Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(
self,
wf_uuid,
parent_structure,
parents,
db_file=DB_FILE,
mc_settings=None,
name="vampire caller",
):
"""Run Vampire Monte Carlo from a HeisenbergModel.
* mc_settings:
mc_box_size (float): MC simulation box size in nm.
equil_timesteps (int): Number of MC equilibration moves.
mc_timesteps (int): Number of MC moves for averaging.
avg (bool): Compute only .
Args:
wf_uuid (int): Unique id for record keeping.
parent_structure (Structure): Magnetic ground state.
parents (FireWorks): Parent FWs.
db_file (str): Path to file containing db credentials.
scan (bool): if True, use the SCAN functional instead of GGA+U,
since the SCAN functional has shown to have improved
performance for magnetic systems in some cases
perform_bader (bool): if True, make sure the "bader" binary is in
your path, will use Bader analysis to calculate
atom-projected magnetic moments
num_orderings_hard_limit (int): will make sure total number of
magnetic orderings does not exceed this number even if there
are extra orderings of equivalent symmetry
c (dict): additional config dict (as used elsewhere in atomate)
Returns: FireWorks Workflow
"""
c_defaults = {"VASP_CMD": VASP_CMD, "DB_FILE": DB_FILE}
additional_fields = {"relax": not self.static}
c = c or {}
for k, v in c_defaults.items():
if k not in c:
c[k] = v
fws = []
analysis_parents = []
# trim total number of orderings (useful in high-throughput context)
# this is somewhat course, better to reduce num_orderings kwarg and/or
# change enumeration strategies
ordered_structures = self.ordered_structures
ordered_structure_origins = self.ordered_structure_origins
def _add_metadata(structure):
c (dict): configurations dict which can include "VASP_CMD", "LOBSTER_CMD", "DB_FILE"
additional_outputs (list): list of additional files to be stored in the
results DB. They will be stored as files in gridfs. Examples are:
"ICOHPLIST.lobster" or "DOSCAR.lobster". Note that the file name
should be given with the full name and the correct capitalization.
Returns: Workflow
"""
c = c or {}
vasp_cmd = c.get("VASP_CMD", VASP_CMD)
lobster_cmd = c.get("LOBSTER_CMD", LOBSTER_CMD)
db_file = c.get("DB_FILE", DB_FILE)
fws = []
staticfw = StaticFW(
structure=structure,
vasp_input_set=LobsterSet(
structure,
user_incar_settings=user_incar_settings,
user_kpoints_settings=user_kpoints_settings,
isym=isym,
),
vasp_cmd=vasp_cmd,
db_file=db_file,
)
fws.append(staticfw)
fws.append(
LobsterFW(
magnetic orderings does not exceed this number even if there
are extra orderings of equivalent symmetry
c Optional[dict]: additional config dict described above
Returns:
wf (Workflow): Heisenberg Model + Vampire Monte Carlo.
TODO:
* Add static SCAN option (only optimization is available)
"""
c = c or {"DB_FILE": DB_FILE}
if "DB_FILE" not in c:
c["DB_FILE"] = DB_FILE
heisenberg_settings = c.get("heisenberg_settings", {})
fws = []
heisenberg_model_fw = HeisenbergModelFW(
wf_uuid=self.uuid,
parent_structure=self.structures[0],
db_file=c["DB_FILE"],
heisenberg_settings=heisenberg_settings,
parents=None,
structures=self.structures,
energies=self.energies,
)
# Vampire Monte Carlo
def wf_scan_opt(structure, c=None):
c = c or {}
vasp_cmd = c.get("VASP_CMD", VASP_CMD)
db_file = c.get("DB_FILE", DB_FILE)
user_incar_settings = c.get("USER_INCAR_SETTINGS", {})
half_kpts = c.get("HALF_KPOINTS_FIRST_RELAX", HALF_KPOINTS_FIRST_RELAX)
ediffg = user_incar_settings.get("EDIFFG", -0.05)
wf = get_wf(
structure,
"optimize_only.yaml",
vis=MVLScanRelaxSet(
structure, user_incar_settings=user_incar_settings),
common_params={
"vasp_cmd": vasp_cmd,
"db_file": db_file
})
wf = use_custodian(
wf,
def __init__(
self,
magnetic_structures,
energies,
default_magmoms=None,
db_file=DB_FILE,
name="Exchange WF",
):
"""Workflow for computing exchange parameters.
This workflow takes a set of magnetic orderings and their energies
from MagneticOrderingsWF and fits to a classical Heisenberg
Hamiltonian to compute exchange parameters. The critical temperature
can then be calculated with Monte Carlo.
Optionally, only the lowest energy FM and AFM configurations can be
used to compute the average exchange interaction, , without any
static calculations.
Args:
magnetic_structures (list): Structure objects with the 'magmom'
site property.
def wf_piezoelectric_constant(structure, c=None):
c = c or {}
vasp_cmd = c.get("VASP_CMD", VASP_CMD)
db_file = c.get("DB_FILE", DB_FILE)
wf = get_wf(structure, "piezoelectric_constant.yaml",
common_params={"vasp_cmd": vasp_cmd, "db_file": db_file})
wf = add_common_powerups(wf, c)
if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
wf = add_wf_metadata(wf, structure)
return wf
user_lobsterin_settings (dict): change lobsterin settings here
user_incar_settings (dict): change incar settings with this dict
user_kpoints_settings (dict): change kpoint settings with this dict
isym (int): isym setting during the VASP calculation, currently lobster can only deal with isym=-1 and isym=0
additional_outputs (list): list of additional files to be stored in the
results DB. They will be stored as files in gridfs. Examples are:
"ICOHPLIST.lobster" or "DOSCAR.lobster". Note that the file name
should be given with the full name and the correct capitalization.
Returns:
"""
c = c or {}
vasp_cmd = c.get("VASP_CMD", VASP_CMD)
lobster_cmd = c.get("LOBSTER_CMD", LOBSTER_CMD)
db_file = c.get("DB_FILE", DB_FILE)
fws = []
# get the relevant potcar files!
inputset = LobsterSet(
structure,
address_basis_file=address_max_basis,
user_incar_settings=user_incar_settings,
user_kpoints_settings=user_kpoints_settings,
isym=isym,
)
# get the basis from dict_max_basis
potcar_symbols = inputset.potcar_symbols
# will get all possible basis functions that have to be tested
if address_max_basis is None and address_min_basis is None:
list_basis_dict = Lobsterin.get_all_possible_basis_functions(
def wf_bandstructure(structure, c=None):
c = c or {}
vasp_cmd = c.get("VASP_CMD", VASP_CMD)
db_file = c.get("DB_FILE", DB_FILE)
wf = get_wf(structure, "bandstructure.yaml", vis=MPRelaxSet(structure, force_gamma=True),
common_params={"vasp_cmd": vasp_cmd, "db_file": db_file})
wf = add_common_powerups(wf, c)
if c.get("SMALLGAP_KPOINT_MULTIPLY", SMALLGAP_KPOINT_MULTIPLY):
wf = add_small_gap_multiply(wf, 0.5, 5, "static")
wf = add_small_gap_multiply(wf, 0.5, 5, "nscf")
if c.get("STABILITY_CHECK", STABILITY_CHECK):
wf = add_stability_check(wf, fw_name_constraint="structure optimization")
if c.get("ADD_WF_METADATA", ADD_WF_METADATA):
wf = add_wf_metadata(wf, structure)
Returns: Workflow
"""
if not structure.is_ordered:
raise ValueError(
"Please obtain an ordered approximation of the input structure."
)
structure = structure.get_primitive_structure(use_site_props=True)
# using a uuid for book-keeping,
# in a similar way to other workflows
uuid = str(uuid4())
c_defaults = {"vasp_cmd": VASP_CMD, "db_file": DB_FILE}
if c:
c.update(c_defaults)
else:
c = c_defaults
wf = get_wf(structure, "magnetic_deformation.yaml", common_params=c, vis=vis)
fw_analysis = Firework(
MagneticDeformationToDb(
db_file=DB_FILE, wf_uuid=uuid, to_db=c.get("to_db", True)
),
name="MagneticDeformationToDb",
)
wf.append_wf(Workflow.from_Firework(fw_analysis), wf.leaf_fw_ids)