From 06d5443433e031b712e7f1312357cab7ac99dd9d Mon Sep 17 00:00:00 2001 From: AsymmetryChou <181240085@smail.nju.edu.cn> Date: Wed, 28 Aug 2024 12:47:37 +0800 Subject: [PATCH] fix pbc bug to accomdate the removing of pbc in AtomicData_options --- dptb/negf/negf_hamiltonian_init.py | 7 +++++-- .../tests/data/test_negf/test_negf_run/negf_chain_new.json | 3 +-- .../data/test_negf/test_negf_run/negf_graphene_new.json | 3 +-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/dptb/negf/negf_hamiltonian_init.py b/dptb/negf/negf_hamiltonian_init.py index 5c782b6a..756f8770 100644 --- a/dptb/negf/negf_hamiltonian_init.py +++ b/dptb/negf/negf_hamiltonian_init.py @@ -172,11 +172,14 @@ def initialize(self, kpoints, block_tridiagnal=False,useBloch=False,bloch_factor # device_id[0] = n_proj_atom_pre # device_id[1] = n_proj_atom_pre + n_proj_atom_device # self.device_id = device_id - + self.structase.set_pbc(self.pbc_negf) + self.structase.pbc[2] = True alldata = AtomicData.from_ase(self.structase, **self.AtomicData_options) + print('alldata[AtomicDataDict.PBC_KEY]',alldata[AtomicDataDict.PBC_KEY]) alldata[AtomicDataDict.PBC_KEY][2] = True # force pbc in z-axis to get reasonable chemical environment in two ends - + print('alldata[AtomicDataDict.PBC_KEY]',alldata[AtomicDataDict.PBC_KEY]) + alldata = AtomicData.to_AtomicDataDict(alldata.to(self.torch_device)) self.alldata = self.model.idp(alldata) self.alldata[AtomicDataDict.KPOINT_KEY] = \ diff --git a/dptb/tests/data/test_negf/test_negf_run/negf_chain_new.json b/dptb/tests/data/test_negf/test_negf_run/negf_chain_new.json index 0ad717d3..d8140fbd 100644 --- a/dptb/tests/data/test_negf/test_negf_run/negf_chain_new.json +++ b/dptb/tests/data/test_negf/test_negf_run/negf_chain_new.json @@ -52,8 +52,7 @@ "out_current_nscf": true }, "AtomicData_options" :{ - "r_max": 2.0, - "pbc": true + "r_max": 2.0 }, "structure":"./chain.vasp" } \ No newline at end of file diff --git a/dptb/tests/data/test_negf/test_negf_run/negf_graphene_new.json b/dptb/tests/data/test_negf/test_negf_run/negf_graphene_new.json index 5ce5d1c2..269bdba1 100644 --- a/dptb/tests/data/test_negf/test_negf_run/negf_graphene_new.json +++ b/dptb/tests/data/test_negf/test_negf_run/negf_graphene_new.json @@ -55,8 +55,7 @@ "out_lcurrent": false }, "AtomicData_options" :{ - "r_max": 2.0, - "pbc": true + "r_max": 2.0 }, "structure":"./graphene.xyz" } \ No newline at end of file