Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
structure=structure,
parents=staticfw,
calculation_type=calculation_type,
delete_wavecar=delete_all_wavecars,
delete_wavecar_previous_fw=delete_all_wavecars,
lobster_cmd=lobster_cmd,
db_file=db_file,
lobsterin_key_dict=user_lobsterin_settings,
user_supplied_basis=user_supplied_basis,
handler_group="default",
validator_group="strict",
additional_outputs=additional_outputs,
)
)
workflow = Workflow(fws, name="LobsterWorkflow")
return workflow
fws = []
# Get neb fireworks.
for n in range(neb_round):
fw = NEBFW(spec=spec, neb_label=str(n + 1), from_images=True,
user_incar_settings=user_incar_settings[n + 2],
user_kpoints_settings=user_kpoints_settings[n + 2],
additional_cust_args=additional_cust_args[n + 2])
fws.append(fw)
# Build fireworks link
links_dict = {}
if neb_round >= 2:
for i in range(neb_round - 1):
links_dict[fws[i]] = [fws[i + 1]]
workflow = Workflow(fws, name=wf_name, links_dict=links_dict)
return workflow
def from_Firework(cls, fw, name=None, metadata=None):
"""
Return Workflow from the given Firework.
Args:
fw (Firework)
name (str): New workflow's name. if not provided, the firework name is used
metadata (dict): New workflow's metadata.
Returns:
Workflow
"""
name = name if name else fw.name
return Workflow([fw], None, name=name, metadata=metadata, created_on=fw.created_on,
updated_on=fw.updated_on)
spec['_queueadapter'] = QA_VASP
fws.append(Firework([VaspWriterTask(), get_custodian_task(spec)], spec, name=get_slug(f + '--' + spec['task_type']), fw_id=100+raman_count))
priority = fw_spec['_priority']
spec = {'task_type': 'VASP db insertion', '_priority': priority, "_pass_job_info": True, '_allow_fizzled_parents': True, '_queueadapter': QA_DB}
fws.append(Firework([VaspToDBTask()], spec, name=get_slug(f + '--' + spec['task_type']), fw_id=100+raman_count+1))
connections[100+raman_count] = [100+raman_count+1]
connections[100+raman_count+1] = -1
raman_count += 2
passed_vars = [eigvals, eigvecs, norms]
spec= {'task_type': 'Setup Raman Verification Task', '_priority': priority, "_pass_job_info": True, '_allow_fizzled_parents': False, '_queueadapter': QA_CONTROL}
spec['passed_vars'] = []
fws.append(Firework([SetupRamanVerificationTask()], spec, name=get_slug(f + '--' + spec['task_type']), fw_id=-1))
wf.append(Workflow(fws, connections))
return FWAction(additions=wf, stored_data={'passed_vars': passed_vars}, mod_spec=[{'_push': {'passed_vars': passed_vars}}])
spec['_trackers'] = trackers
#Turn off dupefinder for supercell structure
del spec['_dupefinder']
fws.append(Firework([VaspWriterTask(), get_custodian_task(spec)],
spec, name=get_slug(f + '--' + fw_spec['task_type']), fw_id=-999+i*10))
priority = fw_spec['_priority']*3
spec = {'task_type': 'VASP db insertion', '_priority': priority,
'_allow_fizzled_parents': True, '_queueadapter': QA_DB,
'clean_task_doc':True,
}
fws.append(Firework([VaspToDBTask()], spec, name=get_slug(f + '--' + spec['task_type']), fw_id=-998+i*10))
connections[-999+i*10] = [-998+i*10]
return Workflow(fws, connections)
kpoints = Kpoints.from_dict(relax["input"]["kpoints"])
kpoints.write_file(os.path.join(cwd, folder, "KPOINTS"))
poscar.to("POSCAR", os.path.join(cwd, folder, "POSCAR"))
tasks = [RunCustodianTask(cwd=cwd, folder=folder, debug=debug,
custodian_params=cust_params),
InsertTask(cwd=cwd, folder=folder, debug=debug,
db_credentials=db_credentials,
task_id=task)]
fw = Firework(tasks, name=folder)
fw_ids.append(fw.fw_id)
fws.append(fw)
wf = Workflow(fws, name='Workfunction Calculations')
launchpad = LaunchPad.from_file(os.path.join(os.environ["HOME"],
launchpad_dir,
"my_launchpad.yaml"))
launchpad.add_wf(wf)
user_incar_settings=user_incar_settings,
terminations=self.terminations,
custodian_params=cust_params,
vaspdbinsert_parameters=
self.vaspdbinsert_params,
potcar_functional=potcar_functional,
k_product=k_product,
miller_index=miller_index,
min_slab_size=self.ssize,
min_vacuum_size=self.vsize,
ucell=self.unit_cells_dict[key][0]))
fw = Firework(tasks, name=folderbulk)
fws.append(fw)
wf = Workflow(fws, name='Surface Calculations')
launchpad.add_wf(wf)
lpdb.rerun_fw(child_fw_id)
print 'AddEStructureTask v2', child_fw_id , 'marked for rerun for', fw_id
elif child_fw['state'] == 'COMPLETED':
print 'AddEStructureTask v2 already successfully run for', fw_id
sec_child_fw_id = wf['links'][str(child_fw_id)][0]
sec_child_fw = lpdb.fireworks.find_one({'fw_id': sec_child_fw_id}, {'spec.task_type':1, 'state':1})
if sec_child_fw['state'] == 'FIZZLED':
lpdb.rerun_fw(sec_child_fw_id)
print 'FIZZLED -> marked for rerun:', sec_child_fw_id, sec_child_fw['spec']['task_type']
else:
print 'AddEStructureTask v2 added but neither DEFUSED, FIZZLED, or COMPLETED for', fw_id
return
f = lpdb.get_wf_summary_dict(fw_id)['name'].replace(' ', '_')
name = get_slug(f + '--' + spec['task_type'])
fw = Firework([AddEStructureTask()], spec, name=name)
lpdb.append_wf(Workflow([fw]), [parent_fw_id])
print name, 'added for', fw_id
except ValueError:
raise ValueError('could not append controller task to wf', wf['name'])
spec["_pass_job_info"] = True
spec['_allow_fizzled_parents'] = False
spec['_queueadapter'] = QA_VASP
fws.append(Firework([VaspWriterTask(), get_custodian_task(spec)], spec, name=get_slug(f + '--' + spec['task_type']), fw_id=11))
priority = fw_spec['_priority']*3
spec = {'task_type': 'VASP db insertion', '_priority': priority, "_pass_job_info": True, '_allow_fizzled_parents': True, '_queueadapter': QA_DB, 'dielectrics':"force_relaxed_structure"}
fws.append(Firework([VaspToDBTask()], spec, name=get_slug(f + '--' + spec['task_type']), fw_id=12))
connections[11] = [12]
spec = {'task_type': 'Setup Raman Task', '_priority': priority, "_pass_job_info": True, '_allow_fizzled_parents': False, '_queueadapter': QA_CONTROL}
spec['passed_vars'] = []
fws.append(Firework([SetupRamanTask()], spec, name=get_slug(f + '--' + spec['task_type']), fw_id=13))
connections[12] = [13]
wf.append(Workflow(fws, connections))
return FWAction(additions=wf)
parents = orig_parent_links[int(fid)]
except KeyError:
parents = []
# remove the firework from their parent links and re-link their parents to the children.
for p in parents:
wf_dict["links"][str(p)].remove(fid)
# adopt the children
for c in children:
# adopt only if the child doesn't have any other parents.
if len(orig_parent_links[int(c)]) == 1:
wf_dict["links"][str(p)].append(c)
# update the list of fireworks.
wf_dict["fws"] = [f for f in fws if f["fw_id"] not in fw_ids]
new_wf = Workflow.from_dict(wf_dict)
self.fw_states = new_wf.fw_states
self.id_fw = new_wf.id_fw
self.links = new_wf.links