Skip to content

Commit

Permalink
Merge pull request #4330 from jtkrogel/nx_vasp_dfc
Browse files Browse the repository at this point in the history
Nexus: better handling of pseudopotentials in VASP
  • Loading branch information
ye-luo authored Nov 21, 2022
2 parents ad60dbc + 93ffbe8 commit e13bd41
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
3 changes: 3 additions & 0 deletions nexus/lib/machines.py
Original file line number Diff line number Diff line change
Expand Up @@ -3042,6 +3042,9 @@ def post_process_job(self,job):
def write_job_header(self,job):
c ='#!/bin/bash\n'
c+='#BSUB -P {0}\n'.format(job.account)
if job.queue is not None:
c+='#BSUB -q {0}\n'.format(job.queue)
#end if
c+='#BSUB -J {0}\n'.format(job.name)
c+='#BSUB -o {0}\n'.format(job.outfile)
c+='#BSUB -e {0}\n'.format(job.errfile)
Expand Down
26 changes: 15 additions & 11 deletions nexus/lib/vasp_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -1481,7 +1481,7 @@ def write(self,filepath,prefix='',postfix=''):
#end def write


def incorporate_system(self,system,incorp_kpoints=True,coord='cartesian'):
def incorporate_system(self,system,incorp_kpoints=True,coord='cartesian',set_nelect=True):
structure = system.structure

# assign kpoints
Expand Down Expand Up @@ -1521,8 +1521,10 @@ def incorporate_system(self,system,incorp_kpoints=True,coord='cartesian'):
#end if

# handle charged systems
# warning: spin polarization is handled by the user!
self.incar.nelect = system.particles.count_electrons()
if set_nelect or system.net_charge!=0:
# warning: spin polarization is handled by the user!
self.incar.nelect = system.particles.count_electrons()
#end if

return species
#end def incorporate_system
Expand Down Expand Up @@ -1610,7 +1612,7 @@ def set_potcar(self,pseudos,species=None):
else:
pseudo_map = obj()
for ppname in pseudos:
element = ppname[0:2].strip('.')
element = ppname[0:2].strip('._')
pseudo_map[element] = ppname
#end for
ordered_pseudos = []
Expand Down Expand Up @@ -1745,16 +1747,13 @@ def generate_vasp_input(**kwargs):
pseudos = None,
neb = None,
neb_args = obj(),
coord = 'cartesian'
coord = 'cartesian',
set_nelect = True,
)

def generate_any_vasp_input(**kwargs):
# handle 'system' name collision
system_str = None
if 'title' in kwargs:
system_str = kwargs['title']
del kwargs['title']
#end if
system_str = kwargs.pop('title',None)

# remove keywords associated with kpoints, poscar, and any other formatted files
vf = obj()
Expand Down Expand Up @@ -1792,7 +1791,12 @@ def generate_any_vasp_input(**kwargs):
# incorporate system information
species = None
if vf.system is not None:
species = vi.incorporate_system(vf.system,gen_kpoints,vf.coord)
species = vi.incorporate_system(
system = vf.system,
incorp_kpoints = gen_kpoints,
coord = vf.coord,
set_nelect = vf.set_nelect,
)
#end if

# set potcar
Expand Down

0 comments on commit e13bd41

Please sign in to comment.