Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: hackingmaterials/atomate
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: MichaelWolloch/atomate
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
Able to merge. These branches can be automatically merged.

Commits on Sep 22, 2021

  1. Added copying of the vdW kernel for OptimizeWF, StaticFW, and Transmu…

    …terFW in the same way as already done for ScanOptimizeFW.
    MichaelWolloch committed Sep 22, 2021
    Copy the full SHA
    48cb818 View commit details
  2. Copy the full SHA
    10d9478 View commit details
  3. Merge pull request #1 from MichaelWolloch/add_copy_options_to_StaticFW

    added support to copy more files from the previous calculation in
    MichaelWolloch authored Sep 22, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f167553 View commit details
  4. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    b238e75 View commit details
  5. Merge pull request #2 from MichaelWolloch/add_vdW_kernel_copy

    Added copying of the vdW kernel for
    MichaelWolloch authored Sep 22, 2021

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    5e94c41 View commit details
  6. Copy the full SHA
    30a7c48 View commit details
  7. Copy the full SHA
    dc6a561 View commit details

Commits on Jul 21, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    cd32beb View commit details
  2. Copy the full SHA
    d7e426a View commit details

Commits on Dec 19, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    391c454 View commit details
  2. Copy the full SHA
    b502b00 View commit details
  3. merged some stuff

    MichaelWolloch committed Dec 19, 2022
    Copy the full SHA
    b96e37f View commit details

Commits on Dec 20, 2022

  1. Copy the full SHA
    623bff7 View commit details

Commits on Dec 21, 2022

  1. Copy the full SHA
    d5c9cda View commit details
  2. fixed typo

    MichaelWolloch committed Dec 21, 2022
    Copy the full SHA
    c05d30a View commit details

Commits on Jun 23, 2023

  1. fixed merge conflicts

    MichaelWolloch committed Jun 23, 2023
    Copy the full SHA
    043caa7 View commit details

Commits on Aug 10, 2023

  1. Copy the full SHA
    6645a0a View commit details

Commits on Sep 12, 2023

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    2cffc78 View commit details

Commits on Sep 25, 2023

  1. Copy the full SHA
    85eba45 View commit details

Commits on Sep 26, 2023

  1. Copy the full SHA
    e6748dc View commit details
  2. bugfix

    MichaelWolloch committed Sep 26, 2023
    Copy the full SHA
    6a770ee View commit details

Commits on Sep 29, 2023

  1. Copy the full SHA
    5e5d428 View commit details
  2. cleaning up a bit

    MichaelWolloch committed Sep 29, 2023
    Copy the full SHA
    4afb084 View commit details
  3. Copy the full SHA
    ed53617 View commit details
Showing with 160 additions and 28 deletions.
  1. +33 −15 atomate/vasp/drones.py
  2. +127 −13 atomate/vasp/fireworks/core.py
48 changes: 33 additions & 15 deletions atomate/vasp/drones.py
Original file line number Diff line number Diff line change
@@ -512,18 +512,32 @@ def process_vasprun(self, dir_name, taskname, filename):
d["output"]["transition"] = bs_gap["transition"]

except Exception:
logger.warning("Error in parsing bandstructure")
if vrun.incar["IBRION"] == 1:
logger.warning("Vasp doesn't properly output efermi for IBRION == 1")
if self.bandstructure_mode is True:
logger.error(traceback.format_exc())
logger.error(
"Error in "
+ os.path.abspath(dir_name)
+ ".\n"
+ traceback.format_exc()
if vrun.incar.get("ML_LMLFF", False):
logger.warning(
"VASP doesn't properly output band structure data for machine learned force fields\n"
"<output.bandgap>, <output.vbm>, <output.cbm>, <output.is_gap_direct>, <output.is_metal>, and <output.direct_gap> will be set to None"
)
raise
d["output"]["bandgap"] = None
d["output"]["vbm"] = None
d["output"]["cbm"] = None
d["output"]["is_gap_direct"] = None
d["output"]["is_metal"] = None
d["output"]["direct_gap"] = None
else:
logger.warning("Error in parsing bandstructure.")
if vrun.incar["IBRION"] == 1:
logger.warning(
"Vasp doesn't properly output efermi for IBRION == 1"
)
if self.bandstructure_mode is True:
logger.error(traceback.format_exc())
logger.error(
"Error in "
+ os.path.abspath(dir_name)
+ ".\n"
+ traceback.format_exc()
)
raise

# Should roughly agree with information from .get_band_structure() above, subject to tolerances
# If there is disagreement, it may be related to VASP incorrectly assigning the Fermi level
@@ -536,7 +550,14 @@ def process_vasprun(self, dir_name, taskname, filename):
"is_gap_direct": band_props[3],
}
except Exception:
logger.warning("Error in parsing eigenvalue band properties")
if vrun.incar.get("ML_LMLFF", False):
logger.warning(
"VASP doesn't properly output eigenvalue band properties for machine learned force fields\n"
"<output.eigenvalue_band_properties> will be set to None"
)
d["output"]["eigenvalue_band_properties"] = None
else:
logger.warning("Error in parsing eigenvalue band properties.")

# store run name and location ,e.g. relax1, relax2, etc.
d["task"] = {"type": taskname, "name": taskname}
@@ -598,7 +619,6 @@ def process_vasprun(self, dir_name, taskname, filename):
return d

def process_bandstructure(self, vrun):

vasprun_file = vrun.filename
# Band structure parsing logic
if str(self.bandstructure_mode).lower() == "auto":
@@ -689,7 +709,6 @@ def set_analysis(d, max_force_threshold=0.5, volume_change_threshold=0.2):
max_force = None
calc = d["calcs_reversed"][0]
if d["state"] == "successful":

# calculate max forces
if "forces" in calc["output"]["ionic_steps"][-1]:
forces = np.array(calc["output"]["ionic_steps"][-1]["forces"])
@@ -701,7 +720,6 @@ def set_analysis(d, max_force_threshold=0.5, volume_change_threshold=0.2):
max_force = max(np.linalg.norm(forces, axis=1))

if calc["input"]["parameters"].get("NSW", 0) > 0:

drift = calc["output"]["outcar"].get("drift", [[0, 0, 0]])
max_drift = max(np.linalg.norm(d) for d in drift)
ediffg = calc["input"]["parameters"].get("EDIFFG", None)
140 changes: 127 additions & 13 deletions atomate/vasp/fireworks/core.py
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@
import warnings
from typing import Any

from fireworks import Firework
from fireworks import Firework, FileTransferTask
from pymatgen.core import Structure
from pymatgen.io.vasp.sets import (
MITMDSet,
@@ -67,6 +67,10 @@ def __init__(
auto_npar=">>auto_npar<<",
half_kpts_first_relax=HALF_KPOINTS_FIRST_RELAX,
parents=None,
vdw_kernel_dir=VDW_KERNEL_DIR,
prev_calc_loc=False,
prev_calc_dir=None,
additional_files_from_prev_calc=[],
**kwargs,
):
"""
@@ -87,6 +91,14 @@ def __init__(
auto_npar (bool or str): whether to set auto_npar. defaults to env_chk: ">>auto_npar<<"
half_kpts_first_relax (bool): whether to use half the kpoints for the first relaxation
parents ([Firework]): Parents of this particular Firework.
vdw_kernel_dir (str): Place were the vdw kernel can be found and copied from.
prev_calc_loc (bool or str): If true (default), copies outputs from previous calc. If
a str value, retrieves a previous calculation output by name. If False/None, will create
new static calculation using the provided structure.
prev_calc_dir (str): Path to a previous calculation to copy from
additional_files_from_prev_calc (list o str): Copy additional files other than
POSCAR, POTCAR, KPOINTS, INCAR, vasprun.xml, like WAVECAR or CHGCAR.
**kwargs: Other kwargs that are passed to Firework.__init__.
"""
override_default_vasp_params = override_default_vasp_params or {}
@@ -103,7 +115,33 @@ def __init__(
)

t = []
# copy files from a previous calculation. Useful e.g. for adding LDIPOL or other flags that
# profit from pre-relaxed orbitals. Note that we write the VASP files
# later, so actually the INCAR, POSCAR, POTCAR, KPOINTS can be overwritten!
if prev_calc_dir:
t.append(
CopyVaspOutputs(
calc_dir=prev_calc_dir,
contcar_to_poscar=True,
additional_files=additional_files_from_prev_calc,
)
)
elif parents:
if prev_calc_loc:
t.append(
CopyVaspOutputs(
calc_loc=prev_calc_loc,
contcar_to_poscar=True,
additional_files=additional_files_from_prev_calc,
)
)
t.append(WriteVaspFromIOSet(structure=structure, vasp_input_set=vasp_input_set))
if vasp_input_set.vdw is not None:
# Copy the pre-compiled VdW kernel for VASP
t.append(
CopyFiles(files_to_copy=["vdw_kernel.bindat"], from_dir=vdw_kernel_dir)
)

t.append(
RunVaspCustodian(
vasp_cmd=vasp_cmd,
@@ -115,6 +153,8 @@ def __init__(
)
t.append(PassCalcLocs(name=name))
t.append(VaspToDb(db_file=db_file, additional_fields={"task_label": name}))
# Delete the VdW kernel
t.append(DeleteFiles(files=["vdw_kernel.bindat"]))
super().__init__(
t,
parents=parents,
@@ -254,16 +294,25 @@ def __init__(
WriteVaspFromIOSet(structure=structure, vasp_input_set=vasp_input_set)
)
# Update the INCAR for the PBESol GGA preconditioning step
metagga_type = vasp_input_set.incar.get("METAGGA",
vasp_input_set_params.get("METAGGA", "R2scan"))
pre_opt_settings = {"_set": {"GGA": "Ps", "EDIFFG": -0.05},
"_unset": {"METAGGA": metagga_type}}
metagga_type = vasp_input_set.incar.get(
"METAGGA", vasp_input_set_params.get("METAGGA", "R2scan")
)
pre_opt_settings = {
"_set": {"GGA": "Ps", "EDIFFG": -0.05},
"_unset": {"METAGGA": metagga_type},
}

# Disable vdW for the precondition step
if vasp_input_set_params.get("vdw"):
pre_opt_settings.update({"_unset": {"LUSE_VDW": True,
"BPARAM": 11.95,
"METAGGA": metagga_type}})
pre_opt_settings.update(
{
"_unset": {
"LUSE_VDW": True,
"BPARAM": 11.95,
"METAGGA": metagga_type,
}
}
)

t.append(ModifyIncar(incar_dictmod=pre_opt_settings))

@@ -306,6 +355,8 @@ def __init__(
vasptodb_kwargs=None,
parents=None,
spec_structure_key=None,
vdw_kernel_dir=VDW_KERNEL_DIR,
additional_files_from_prev_calc=[],
**kwargs,
):
"""
@@ -327,6 +378,8 @@ def __init__(
db_file (str): Path to file specifying db credentials.
parents (Firework): Parents of this particular Firework. FW or list of FWS.
vasptodb_kwargs (dict): kwargs to pass to VaspToDb
additional_files_from_prev_calc (list o str): Copy additional files other than
POSCAR, POTCAR, KPOINTS, INCAR, vasprun.xml, like WAVECAR or CHGCAR.
**kwargs: Other kwargs that are passed to Firework.__init__.
"""
t = []
@@ -337,7 +390,11 @@ def __init__(
vasptodb_kwargs["additional_fields"] = {}
vasptodb_kwargs["additional_fields"]["task_label"] = name

formula = structure.composition.reduced_formula if structure is not None else "unknown"
formula = (
structure.composition.reduced_formula
if structure is not None
else "unknown"
)
fw_name = f"{formula}-{name}"

if spec_structure_key is not None:
@@ -352,27 +409,60 @@ def __init__(
)
)
elif prev_calc_dir:
t.append(CopyVaspOutputs(calc_dir=prev_calc_dir, contcar_to_poscar=True))
t.append(
CopyVaspOutputs(
calc_dir=prev_calc_dir,
contcar_to_poscar=True,
additional_files=additional_files_from_prev_calc,
)
)
t.append(WriteVaspStaticFromPrev(other_params=vasp_input_set_params))
if vasp_input_set_params.get("vdw"):
# Copy the pre-compiled VdW kernel for VASP
t.append(
CopyFiles(
files_to_copy=["vdw_kernel.bindat"], from_dir=vdw_kernel_dir
)
)
elif parents:
if prev_calc_loc:
t.append(
CopyVaspOutputs(calc_loc=prev_calc_loc, contcar_to_poscar=True)
CopyVaspOutputs(
calc_loc=prev_calc_loc,
contcar_to_poscar=True,
additional_files=additional_files_from_prev_calc,
)
)
t.append(WriteVaspStaticFromPrev(other_params=vasp_input_set_params))
if vasp_input_set_params.get("vdw"):
# Copy the pre-compiled VdW kernel for VASP
t.append(
CopyFiles(
files_to_copy=["vdw_kernel.bindat"], from_dir=vdw_kernel_dir
)
)
elif structure is not None:
vasp_input_set = vasp_input_set or MPStaticSet(
structure, **vasp_input_set_params
)
t.append(
WriteVaspFromIOSet(structure=structure, vasp_input_set=vasp_input_set)
)
if vasp_input_set.vdw:
# Copy the pre-compiled VdW kernel for VASP
t.append(
CopyFiles(
files_to_copy=["vdw_kernel.bindat"], from_dir=vdw_kernel_dir
)
)
else:
raise ValueError("Must specify structure or previous calculation")

t.append(RunVaspCustodian(vasp_cmd=vasp_cmd, auto_npar=">>auto_npar<<"))
t.append(PassCalcLocs(name=name))
t.append(VaspToDb(db_file=db_file, **vasptodb_kwargs))
# Delete the VdW kernel
t.append(DeleteFiles(files=["vdw_kernel.bindat"]))
super().__init__(t, parents=parents, name=fw_name, **kwargs)


@@ -846,6 +936,7 @@ def __init__(
db_file=DB_FILE,
parents=None,
override_default_vasp_params=None,
vdw_kernel_dir=VDW_KERNEL_DIR,
**kwargs,
):
"""
@@ -914,7 +1005,11 @@ def __init__(
)
else:
raise ValueError("Must specify structure or previous calculation")

if vasp_input_set.vdw is not None:
# Copy the pre-compiled VdW kernel for VASP
t.append(
CopyFiles(files_to_copy=["vdw_kernel.bindat"], from_dir=vdw_kernel_dir)
)
t.append(RunVaspCustodian(vasp_cmd=vasp_cmd))
t.append(PassCalcLocs(name=name))
t.append(
@@ -929,6 +1024,8 @@ def __init__(
},
)
)
# Delete the VdW kernel
t.append(DeleteFiles(files=["vdw_kernel.bindat"]))

super().__init__(t, parents=parents, name=fw_name, **kwargs)

@@ -948,6 +1045,8 @@ def __init__(
db_file=DB_FILE,
parents=None,
copy_vasp_outputs=True,
additional_files_from_prev_calc=["CHGCAR"],
vasptodb_kwargs={},
**kwargs,
):
"""
@@ -986,7 +1085,21 @@ def __init__(
if copy_vasp_outputs:
t.append(
CopyVaspOutputs(
calc_loc=True, additional_files=["CHGCAR"], contcar_to_poscar=True
calc_loc=True,
additional_files=additional_files_from_prev_calc,
contcar_to_poscar=True,
)
)

if "ML_ABN" in additional_files_from_prev_calc:
t.append(
FileTransferTask(
{
"files": [
{"src": "./ML_ABN", "dest": "./ML_AB"},
],
"mode": "move",
}
)
)

@@ -1005,6 +1118,7 @@ def __init__(
db_file=db_file,
additional_fields={"task_label": name},
defuse_unsuccessful=False,
**vasptodb_kwargs,
)
)
super().__init__(