Skip to content

Commit

Permalink
VaspFactory: Allow to customize potcars
Browse files Browse the repository at this point in the history
  • Loading branch information
pmrv committed Jul 22, 2024
1 parent 6cea58a commit 69b5a2e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions pyiron_contrib/jobfactories/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,10 +304,14 @@ class VaspFactory(DftFactory):
def __init__(self):
super().__init__()
self.storage.incar = {}
self.storage.potential = {}
self.storage.nband_nelec_map = None

@property
def incar(self):
"""
Values are set on job.input.incar on job creation.
"""
return self.storage.incar

def enable_nband_hack(self, nelec: Dict[str, int]):
Expand All @@ -320,6 +324,13 @@ def enable_nband_hack(self, nelec: Dict[str, int]):
"""
self.storage.nband_nelec_map = nelec

@property
def potential(self):
"""
Values are set as job.potential.<elem> = <value>
"""
return self.storage.potential

def _get_hamilton(self):
return "Vasp"

Expand All @@ -340,6 +351,11 @@ def _prepare_job(self, job, structure):
job = super()._prepare_job(job, structure)
for k, v in self.incar.items():
job.input.incar[k] = v
for k, v in self.potential.items():
try:
job.potential[k] = v
except AttributeError:
pass # element k does not exist in the current structure
if self.storage.nband_nelec_map is not None:
# ensure we apply the hack only for structures where we know an NBAND estimate for all elements
elems = set(self.storage.nband_nelec_map.keys())
Expand Down

0 comments on commit 69b5a2e

Please sign in to comment.