Skip to content

Commit

Permalink
Merge pull request #34 from zadorlab/pbc_attribute
Browse files Browse the repository at this point in the history
Pbc attribute
  • Loading branch information
mjohnson541 authored Mar 22, 2024
2 parents 9d4d0b9 + ec91f83 commit 92e8fdd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pynta/calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ def run_harmonically_forced_xtb_no_pbc(atoms,atom_bond_potentials,site_bond_pote

target = atoms.cell[0][:2] + atoms.cell[1][:2]

og_pbc = atoms.pbc # Need to apply original pbc's on atoms object (depends on QC software)

site_poss = []
site_inds = []
site_mols = []
Expand Down Expand Up @@ -302,7 +304,7 @@ def run_harmonically_forced_xtb_no_pbc(atoms,atom_bond_potentials,site_bond_pote

outadslab = slab + newad

outadslab.pbc = (True,True,False)
outadslab.pbc = og_pbc

return outadslab,Eharm,Fharm

Expand Down
10 changes: 7 additions & 3 deletions pynta/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

class Pynta:
def __init__(self,path,rxns_file,surface_type,metal,label,launchpad_path=None,fworker_path=None,
vacuum=8.0,repeats=(3,3,4),slab_path=None,software="Espresso",socket=False,queue=False,njobs_queue=0,a=None,
vacuum=8.0,repeats=(3,3,4),slab_path=None,software="Espresso", pbc=(True,True,False),socket=False,queue=False,njobs_queue=0,a=None,
software_kwargs={'kpts': (3, 3, 1), 'tprnfor': True, 'occupations': 'smearing',
'smearing': 'marzari-vanderbilt',
'degauss': 0.01, 'ecutwfc': 40, 'nosym': True,
Expand All @@ -49,6 +49,7 @@ def __init__(self,path,rxns_file,surface_type,metal,label,launchpad_path=None,fw
self.slab_path = slab_path
self.vacuum = vacuum
self.a = a
self.pbc = pbc
self.software = software
self.socket = socket
self.repeats = repeats
Expand All @@ -59,6 +60,9 @@ def __init__(self,path,rxns_file,surface_type,metal,label,launchpad_path=None,fw
self.adsorbate_fw_dict = dict()
self.software_kwargs = software_kwargs

if software.lower() == 'vasp':
self.pbc = (True,True,True)

if software_kwargs_gas:
self.software_kwargs_gas = software_kwargs_gas
else:
Expand Down Expand Up @@ -127,7 +131,7 @@ def generate_slab(self,skip_launch=False):
a = self.a
#construct slab with optimial lattice constant
slab = slab_type(self.metal,self.repeats,a,self.vacuum)
slab.pbc = (True, True, False)
slab.pbc = self.pbc
write(os.path.join(self.path,"slab_init.xyz"),slab)
self.slab_path = os.path.join(self.path,"slab.xyz")
if self.software != "XTB":
Expand Down Expand Up @@ -248,7 +252,7 @@ def generate_initial_adsorbate_guesses(self,skip_structs=False):
ads,mol_to_atoms_map = get_adsorbate(mol)
if len(surf_sites) == 0:
if not skip_structs:
ads.pbc = (True,True,False)
ads.pbc = self.pbc
ads.center(vacuum=10)
structures[sm] = [ads]
gratom_to_molecule_atom_maps[sm] = {val:key for key,val in mol_to_atoms_map.items()}
Expand Down

0 comments on commit 92e8fdd

Please sign in to comment.