Skip to content

Commit

Permalink
enable custodian arg modification by user
Browse files Browse the repository at this point in the history
  • Loading branch information
HanmeiTang committed Mar 17, 2017
1 parent 33ae84c commit 60300b8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 15 deletions.
3 changes: 2 additions & 1 deletion atomate/vasp/firetasks/run_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ def run_task(self, fw_spec):
elif job_type == "neb":
jobs = [VaspNEBJob(vasp_cmd, output_file="neb_vasp.out", stderr_file="neb_std_err.txt",
suffix="", final=False, auto_npar=self.get("auto_npar", False),
half_kpts=True, auto_gamma=True, auto_continue=False,
half_kpts=self.get("half_kpts", True), auto_continue=False,
auto_gamma=self.get("auto_gamma", True),
gamma_vasp_cmd=gamma_vasp_cmd)]
else:
raise ValueError("Unsupported job type: {}".format(job_type))
Expand Down
3 changes: 1 addition & 2 deletions atomate/vasp/fireworks/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,6 @@ class NEBFW(Firework):
Task 4) Update structure to spec
"""

# TODO: These tags are not used.... maybe in spec
def __init__(self, spec, neb_label, from_images=True, user_incar_settings=None,
sort_tol=None, dimages=None, interp_method="IDPP",
vasp_cmd=">>vasp_cmd<<", gamma_vasp_cmd=">>gamma_vasp_cmd<<",
Expand Down Expand Up @@ -484,7 +483,7 @@ def __init__(self, spec, neb_label, from_images=True, user_incar_settings=None,
# Task 2: Run NEB using Custodian
run_neb_task = RunVaspCustodian(vasp_cmd=vasp_cmd, gamma_vasp_cmd=gamma_vasp_cmd,
handler_group="no_handler",
gzip_output=False, # must be false, # TODO: fix custodian
gzip_output=False, # must be false
job_type="neb", **cust_args)

# Task 3, 4: Transfer and PassCalLocs
Expand Down
3 changes: 2 additions & 1 deletion atomate/vasp/workflows/base/library/neb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ common_params:
np_tag: "-n"
ppn: 24
path_sites: [0, 1]
db_file: ">>db_file<<"
db_file: ">>db_file<<"
cust_args: null
20 changes: 12 additions & 8 deletions atomate/vasp/workflows/base/neb.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def _get_incar(mode, user_incar_settings=None):


def get_wf_neb_from_structure(structure, path_sites, user_incar_settings,
is_optimized=True, wf_name=None, spec=None):
is_optimized=True, wf_name=None, spec=None, cust_args=None):
"""
Get a CI-NEB workflow from given perfect structures.
Workflow: (Init relax) -- Endpoints relax -- NEB_1 -- NEB_2 - ... - NEB_r
Expand All @@ -165,6 +165,7 @@ def get_wf_neb_from_structure(structure, path_sites, user_incar_settings,
initial relaxation before generating endpoints.
wf_name (str): some appropriate name for the workflow.
spec (dict): user setting spec settings to overwrite spec_orig.
cust_args (dict): Other kwargs that are passed to RunVaspCustodian.
Returns:
Workflow
Expand All @@ -178,6 +179,7 @@ def get_wf_neb_from_structure(structure, path_sites, user_incar_settings,
uis_ep = _get_incar(mode, user_incar_settings)[1]
uis_neb = _get_incar(mode, user_incar_settings)[2]
neb_round = len(uis_neb)
cust_args = cust_args or {}

# Get relaxation fireworks.
if is_optimized: # Start from endpoints
Expand All @@ -196,14 +198,14 @@ def get_wf_neb_from_structure(structure, path_sites, user_incar_settings,
for n in range(neb_round):
fw = NEBFW(spec=spec, neb_label=str(n + 1), from_images=False,
user_incar_settings=uis_neb[n], vasp_cmd=vasp_cmd,
gamma_vasp_cmd=gamma_vasp_cmd, cust_args={})
gamma_vasp_cmd=gamma_vasp_cmd, cust_args=cust_args)
neb_fws.append(fw)

# Get relax fireworks
rlx_fws = [NEBRelaxationFW(spec=spec, label=i, vasp_input_set=None,
user_incar_settings=uis_ep, vasp_cmd=vasp_cmd,
gamma_vasp_cmd=gamma_vasp_cmd,
cust_args={}) for i in ["ep0", "ep1"]]
cust_args=cust_args) for i in ["ep0", "ep1"]]

links = {rlx_fws[0]: [neb_fws[0]],
rlx_fws[1]: [neb_fws[0]]}
Expand All @@ -218,7 +220,7 @@ def get_wf_neb_from_structure(structure, path_sites, user_incar_settings,
for n in range(neb_round):
fw = NEBFW(spec=spec, neb_label=str(n + 1), from_images=False,
user_incar_settings=uis_neb[n], vasp_cmd=vasp_cmd,
gamma_vasp_cmd=gamma_vasp_cmd, cust_args={})
gamma_vasp_cmd=gamma_vasp_cmd, cust_args=cust_args)
neb_fws.append(fw)

rlx_fws = [NEBRelaxationFW(spec=spec, label=label, vasp_input_set=None,
Expand All @@ -238,8 +240,8 @@ def get_wf_neb_from_structure(structure, path_sites, user_incar_settings,
return workflow


def get_wf_neb_from_endpoints(user_incar_settings, parent, endpoints=None,
is_optimized=True, wf_name=None, additional_spec=None):
def get_wf_neb_from_endpoints(user_incar_settings, parent, endpoints=None, is_optimized=True,
wf_name=None, additional_spec=None, cust_args=None):
"""
Get a CI-NEB workflow from given endpoints.
Workflow: (Endpoints relax -- ) NEB_1 -- NEB_2 - ... - NEB_r
Expand All @@ -254,10 +256,12 @@ def get_wf_neb_from_endpoints(user_incar_settings, parent, endpoints=None,
run endpoints relaxation before NEB.
wf_name (str): some appropriate name for the workflow.
additional_spec (dict): user setting spec settings to overwrite spec_orig.
cust_args (dict): Other kwargs that are passed to RunVaspCustodian.
Returns:
Workflow
"""
cust_args = cust_args or {}
if endpoints is not None:
for e in endpoints:
assert isinstance(e, Structure)
Expand All @@ -281,7 +285,7 @@ def get_wf_neb_from_endpoints(user_incar_settings, parent, endpoints=None,
for n in range(neb_round):
fw = NEBFW(spec=spec, neb_label=str(n + 1), from_images=False,
user_incar_settings=uis_neb[n], vasp_cmd=vasp_cmd,
gamma_vasp_cmd=gamma_vasp_cmd, cust_args={})
gamma_vasp_cmd=gamma_vasp_cmd, cust_args=cust_args)
neb_fws.append(fw)

workflow = Workflow(neb_fws, name=wf_name)
Expand All @@ -291,7 +295,7 @@ def get_wf_neb_from_endpoints(user_incar_settings, parent, endpoints=None,
ep_fws = [NEBRelaxationFW(spec=spec, label=i, vasp_input_set=None,
user_incar_settings=uis_ep, vasp_cmd=vasp_cmd,
gamma_vasp_cmd=gamma_vasp_cmd,
cust_args={}) for i in ["ep0", "ep1"]]
cust_args=cust_args) for i in ["ep0", "ep1"]]
# Create Firework links.
fws = ep_fws + neb_fws
links = {ep_fws[0]: [neb_fws[0]], ep_fws[1]: [neb_fws[0]]}
Expand Down
8 changes: 5 additions & 3 deletions atomate/vasp/workflows/presets/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ def get_incar(mode):
is_optimized = c.get("is_optimized", False) # default
wf_name = spec.get("wf_name") # default
path_sites = spec.get("path_sites", []) # default
cust_args = spec.get("cust_args", {})

# Default
if "fireworks" not in c:
Expand Down Expand Up @@ -448,13 +449,14 @@ def get_incar(mode):
if mode in [1, 2]:
wf = get_wf_neb_from_structure(structure=structures[0], path_sites=path_sites,
is_optimized=is_optimized, wf_name=wf_name,
spec=spec, user_incar_settings=user_incar_settings)
spec=spec, user_incar_settings=user_incar_settings,
cust_args=cust_args)
elif mode in [3, 4]:
wf = get_wf_neb_from_endpoints(parent=structures[0], endpoints=structures,
is_optimized=is_optimized, wf_name=wf_name,
additional_spec=spec,
additional_spec=spec, cust_args=cust_args,
user_incar_settings=user_incar_settings)
else: # mode == 5
wf = get_wf_neb_from_images(parent, user_incar_settings, images=structures,
wf_name=wf_name, spec=spec)
wf_name=wf_name, spec=spec, cust_args=cust_args)
return wf

0 comments on commit 60300b8

Please sign in to comment.