Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
molecules (Molecules): list of molecules to calculate
vasp_input_set (DictSet): VaspInputSet for molecules
db_file (string): database file path
vasp_cmd (string): VASP command
name (string): name for workflow
Returns:
workflow consisting of molecule calculations
"""
fws = []
for molecule in molecules:
# molecule in box
m_struct = molecule.get_boxed_structure(10, 10, 10,
offset=np.array([5, 5, 5]))
vis = vasp_input_set or MPSurfaceSet(m_struct)
fws.append(OptimizeFW(structure=molecule, job_type="normal",
vasp_input_set=vis, db_file=db_file,
vasp_cmd=vasp_cmd))
name = name or "molecules workflow"
return Workflow(fws, name=name)
to the slab to be calculated
transmuter (bool): whether or not to use a TransmuterFW based
on slab params, if this option is selected, input slab must
be a Slab object (as opposed to Structure)
vasp_input_set (VaspInputSet): vasp_input_set corresponding to
the slab calculation
parents (Fireworks or list of ints): parent FWs
db_file (string): path to database file
vasp_cmd (string): vasp command
name (string): name of firework
add_slab_metadata (bool): whether to add slab metadata to task doc
Returns:
Firework corresponding to slab calculation
"""
vasp_input_set = vasp_input_set or MPSurfaceSet(slab)
# If a bulk_structure is specified, generate the set of transformations,
# else just create an optimize FW with the slab
if transmuter:
if not isinstance(slab, Slab):
raise ValueError("transmuter mode requires slab to be a Slab object")
# Get transformation from oriented bulk and slab
oriented_bulk = slab.oriented_unit_cell
slab_trans_params = get_slab_trans_params(slab)
trans_struct = SlabTransformation(**slab_trans_params)
slab_from_bulk = trans_struct.apply_transformation(oriented_bulk)
# Ensures supercell construction
supercell_trans = SupercellTransformation.from_scaling_factors(
round(slab.lattice.a / slab_from_bulk.lattice.a),
for q in range(1, 5):
fw = MDFW(structure=interface_structure,
name=f'{label}_{interface_label}-{h_label}_interface_md_prerelax_{q}-{str(tag_id)}',
previous_structure=True, insert_db=True,
start_temp=md_temp, end_temp=md_temp, nsteps=200,
vasp_cmd=">>vasp_cmd<<", db_file=">>db_file<<",
override_default_vasp_params=override_default_vasp_params,
parents=fw_list[-1])
fw_list.append(fw)
user_incar_settings = {'ISTART': 1, 'LVTOT': True, 'LDIPOL': True, 'IDIPOL': 3, 'AMIN': 0.01,
'EDIFF': 0.000001 * interface_structure.num_sites,
'EDIFFG': 0.0001 * interface_structure.num_sites, 'KPAR': 4,
'ICHARG': 0, 'POTIM': 0.5, 'NSW': 200, 'IBRION': 2}
vasp_input_set = MPSurfaceSet(interface_structure, auto_dipole=True,
user_incar_settings=user_incar_settings)
parents = [fw_list[-1]] if md_prerelax else []
interface_opt_fw = OptimizeFW(structure=interface_structure,
name=f'{label}_{interface_label}-{h_label}_interface_optimize-{str(tag_id)}',
previous_structure=True,
parents=parents,
vasp_cmd=">>vasp_cmd<<", db_file=">>db_file<<",
vasp_input_set=vasp_input_set,
handler_group=handler_group, job_type='normal')
override_default_vasp_params = {'user_incar_settings': {'LVTOT': True, "LDIPOL": True, "IDIPOL": 3, 'KPAR': 4,
'AMIN': 0.01}}
interface_static_fw = StaticFW(structure=interface_structure,
name=f'{label}_{interface_label}-{h_label}_interface_static-{str(tag_id)}',
parents=interface_opt_fw,
vasp_cmd=">>vasp_cmd<<", db_file=">>db_file<<",
Returns:
Workflow
"""
fws, parents = [], []
if adsorbates is None:
adsorbates = []
if ads_structures_params is None:
ads_structures_params = {}
# Add bulk opt firework if specified
if include_bulk_opt:
oriented_bulk = slab.oriented_unit_cell
vis = MPSurfaceSet(oriented_bulk, bulk=True)
fws.append(OptimizeFW(structure=oriented_bulk, vasp_input_set=vis,
vasp_cmd=vasp_cmd, db_file=db_file))
parents = fws[-1]
name = slab.composition.reduced_formula
if getattr(slab, "miller_index", None):
name += "_{}".format(slab.miller_index)
# Create slab fw and add it to list of fws
slab_fw = get_slab_fw(slab, include_bulk_opt, db_file=db_file,
vasp_cmd=vasp_cmd, parents=parents,
name="{} slab optimization".format(name))
fws.append(slab_fw)
for adsorbate in adsorbates:
ads_slabs = AdsorbateSiteFinder(slab).generate_adsorption_structures(
adsorbate, **ads_structures_params)
for q in range(1, 5):
fw = MDFW(structure=slab_film,
name=f'{film_label}_{i}-{h_label}_film_slab_md_prerelax_{q}-{str(tag_id)}',
previous_structure=True, insert_db=True,
start_temp=md_temp, end_temp=md_temp, nsteps=200,
vasp_cmd=">>vasp_cmd<<", db_file=">>db_file<<",
override_default_vasp_params=override_default_vasp_params,
parents=fw_list[-1])
fw_list.append(fw)
user_incar_settings = {'ISTART': 1, 'LVTOT': True, 'LDIPOL': True, 'IDIPOL': 3, 'AMIN': 0.01,
'EDIFF': 0.000001 * slab_film.num_sites, 'KPAR': 4,
'EDIFFG': 0.0001 * slab_film.num_sites,
'ICHARG': 0, 'POTIM': 0.5, 'NSW': 200, 'IBRION': 2}
vasp_input_set = MPSurfaceSet(slab_film, auto_dipole=True, user_incar_settings=user_incar_settings)
parents = [fw_list[-1]] if md_prerelax else []
film_slab_opt_fw = OptimizeFW(structure=slab_film,
name=f'{film_label}_{i}-{h_label}_film_slab_optimize-{str(tag_id)}',
previous_structure=True,
parents=parents, vasp_input_set=vasp_input_set,
vasp_cmd=">>vasp_cmd<<", db_file=">>db_file<<",
handler_group=handler_group, job_type='normal')
override_default_vasp_params = {
'user_incar_settings': {'LVTOT': True, "LDIPOL": True, "IDIPOL": 3, 'KPAR': 4,
'AMIN': 0.01}}
film_slab_static_fw = StaticFW(structure=slab_film,
name=f'{film_label}_{i}-{h_label}_film_slab_static-{str(tag_id)}',
parents=film_slab_opt_fw,
vasp_cmd=">>vasp_cmd<<", db_file=">>db_file<<",
override_default_vasp_params=override_default_vasp_params,
def incar(self):
incar = super(MPSurfaceSet, self).incar
# Determine LDAU based on slab chemistry without adsorbates
ldau_elts = {'O', 'F'}
if self.structure.site_properties.get("surface_properties"):
non_adsorbate_elts = {
s.specie.symbol for s in self.structure
if not s.properties['surface_properties'] == 'adsorbate'}
else:
non_adsorbate_elts = {s.specie.symbol for s in self.structure}
ldau = bool(non_adsorbate_elts & ldau_elts)
# Should give better forces for optimization
incar_config = {"EDIFFG": -0.05, "ENAUG": 4000, "IBRION": 1,
"POTIM": 1.0, "LDAU": ldau, "EDIFF": 1e-5, "ISYM": 0}
incar.update(incar_config)
incar.update(self.user_incar_settings)