diff --git a/emmet-core/emmet/core/vasp/calc_types/enums.py b/emmet-core/emmet/core/vasp/calc_types/enums.py index 5b28246454..020b2abddd 100644 --- a/emmet-core/emmet/core/vasp/calc_types/enums.py +++ b/emmet-core/emmet/core/vasp/calc_types/enums.py @@ -75,6 +75,8 @@ class RunType(ValueEnum): vdW_DF2_U = "vdW-DF2+U" LDA = "LDA" LDA_U = "LDA+U" + G0W0_PBE = "G0W0-PBE" + G0W0_GGA = "G0W0-GGA" @classmethod def _missing_(cls, value): @@ -98,6 +100,7 @@ class TaskType(ValueEnum): Deformation = "Deformation" Optic = "Optic" Molecular_Dynamics = "Molecular Dynamics" + GW_Band_Structure = "GW Band Structure" Unrecognized = "Unrecognized" @@ -954,3 +957,5 @@ class CalcType(ValueEnum): LDA_U_Optic = "LDA+U Optic" LDA_U_Molecular_Dynamics = "LDA+U Molecular Dynamics" LDA_U_Unrecognized = "LDA+U Unrecognized" + G0W0_GGA_Band_Structure = "G0W0-GGA GW Band Structure" + G0W0_PBE_Band_Structure = "G0W0-PBE GW Band Structure" diff --git a/emmet-core/emmet/core/vasp/calc_types/run_types.yaml b/emmet-core/emmet/core/vasp/calc_types/run_types.yaml index 702611d781..f8979ecb01 100644 --- a/emmet-core/emmet/core/vasp/calc_types/run_types.yaml +++ b/emmet-core/emmet/core/vasp/calc_types/run_types.yaml @@ -120,3 +120,12 @@ VDW: LASPH: true LUSE_VDW: true Zab_vdW: -1.8867 +GW: + G0W0-GGA: + ALGO: Gw0 + NELM: 1 + GGA: -- + G0W0-PBE: + ALGO: Gw0 + NELM: 1 + GGA: PE diff --git a/emmet-core/emmet/core/vasp/calc_types/utils.py b/emmet-core/emmet/core/vasp/calc_types/utils.py index 30686dbcec..ae1659ec66 100644 --- a/emmet-core/emmet/core/vasp/calc_types/utils.py +++ b/emmet-core/emmet/core/vasp/calc_types/utils.py @@ -12,7 +12,10 @@ __all__ = ["run_type", "task_type", "calc_type"] -def run_type(parameters: Dict) -> RunType: +def run_type( + parameters: Dict, + inputs: Dict[Literal["incar", "poscar", "kpoints", "potcar"], Dict] = None, +) -> RunType: """ Determine run type from the VASP parameters dict. @@ -20,6 +23,7 @@ def run_type(parameters: Dict) -> RunType: Args: parameters: Dictionary of VASP parameters from vasprun.xml. + inputs: inputs dict with an incar, kpoints, potcar, and poscar dictionaries. Returns: The run type. @@ -29,6 +33,10 @@ def run_type(parameters: Dict) -> RunType: TaskDocument.run_type, copy over LDAU* fields from the incar rather than trust parameters. """ + incar = {} + if inputs is not None: + incar = inputs.get("incar", {}) + is_hubbard = "+U" if parameters.get("LDAU", False) else "" def _variant_equal(v1, v2) -> bool: @@ -38,10 +46,11 @@ def _variant_equal(v1, v2) -> bool: return v1 == v2 # This is to force an order of evaluation - for functional_class in ["HF", "VDW", "METAGGA", "GGA"]: + for functional_class in ["GW", "HF", "VDW", "METAGGA", "GGA"]: for special_type, params in _RUN_TYPE_DATA[functional_class].items(): if all( _variant_equal(parameters.get(param, None), value) + or (param in incar and _variant_equal(incar.get(param, None), value)) for param, value in params.items() ): return RunType(f"{special_type}{is_hubbard}") @@ -116,6 +125,9 @@ def task_type( elif incar.get("IBRION", 1) == 0: calc_type.append("Molecular Dynamics") + elif incar.get("ALGO").upper() == "GW0": + calc_type.append("GW Band Structure") + if len(calc_type) == 0: return TaskType("Unrecognized") @@ -136,6 +148,6 @@ def calc_type( Returns: The calc type. """ - rt = run_type(parameters).value + rt = run_type(parameters, inputs).value tt = task_type(inputs).value return CalcType(f"{rt} {tt}") diff --git a/emmet-core/emmet/core/vasp/calculation.py b/emmet-core/emmet/core/vasp/calculation.py index 9eeb5a7647..1c4c77ce3e 100644 --- a/emmet-core/emmet/core/vasp/calculation.py +++ b/emmet-core/emmet/core/vasp/calculation.py @@ -748,7 +748,10 @@ def from_vasp_files( volumetric_files = [] if volumetric_files is None else volumetric_files vasprun = Vasprun(vasprun_file, **vasprun_kwargs) outcar = Outcar(outcar_file) - contcar = Poscar.from_file(contcar_file) + try: + contcar = Poscar.from_file(contcar_file) + except ValueError: + contcar = Poscar(vasprun.final_structure) completed_at = str(datetime.fromtimestamp(vasprun_file.stat().st_mtime)) output_file_paths = _get_output_file_paths(volumetric_files) @@ -852,7 +855,7 @@ def from_vasp_files( }, bader=bader, ddec6=ddec6, - run_type=run_type(input_doc.parameters), + run_type=run_type(input_doc.parameters, input_doc.model_dump()), task_type=task_type(input_doc.model_dump()), calc_type=calc_type(input_doc.model_dump(), input_doc.parameters), ),