Skip to content

Commit

Permalink
fix pbc bug to accomdate the removing of pbc in AtomicData_options
Browse files Browse the repository at this point in the history
  • Loading branch information
AsymmetryChou committed Aug 28, 2024
1 parent 482e7e1 commit 06d5443
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
7 changes: 5 additions & 2 deletions dptb/negf/negf_hamiltonian_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -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] = \
Expand Down
3 changes: 1 addition & 2 deletions dptb/tests/data/test_negf/test_negf_run/negf_chain_new.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@
"out_current_nscf": true
},
"AtomicData_options" :{
"r_max": 2.0,
"pbc": true
"r_max": 2.0
},
"structure":"./chain.vasp"
}
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@
"out_lcurrent": false
},
"AtomicData_options" :{
"r_max": 2.0,
"pbc": true
"r_max": 2.0
},
"structure":"./graphene.xyz"
}

0 comments on commit 06d5443

Please sign in to comment.