Skip to content

Commit

Permalink
added store_onsite_density_matrices option issue atomate2 #671 (#925)
Browse files Browse the repository at this point in the history
* added store_onsite_density_matrices: bool = False option to calculation.py

* fix empty lines

* Update emmet-core/emmet/core/vasp/calculation.py

Co-authored-by: Alex Ganose <[email protected]>

* Update emmet-core/emmet/core/vasp/calculation.py

Co-authored-by: Alex Ganose <[email protected]>

---------

Co-authored-by: Jason Munro <[email protected]>
Co-authored-by: Alex Ganose <[email protected]>
  • Loading branch information
3 people authored Feb 15, 2024
1 parent 2fa80de commit e9689db
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions emmet-core/emmet/core/vasp/calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ def from_vasp_outputs(
locpot: Optional[Locpot] = None,
elph_poscars: Optional[List[Path]] = None,
store_trajectory: StoreTrajectoryOption = StoreTrajectoryOption.NO,
store_onsite_density_matrices: bool = False,
) -> "CalculationOutput":
"""
Create a VASP output document from VASP outputs.
Expand All @@ -452,7 +453,8 @@ def from_vasp_outputs(
Different value tune the amount of data from the ionic_steps
stored in the Trajectory.
If not NO, the `ionic_steps` field is left as None.
store_onsite_density_matrices
Whether to store the onsite density matrices from the OUTCAR.
Returns
-------
The VASP calculation output document.
Expand Down Expand Up @@ -510,7 +512,8 @@ def from_vasp_outputs(
if outcar and contcar:
outcar_dict = outcar.as_dict()
outcar_dict.pop("run_stats")

if not store_onsite_density_matrices and outcar.has_onsite_density_matrices:
outcar_dict.pop("onsite_density_matrices")
# use structure from CONTCAR as it is written to
# greater precision than in the vasprun
# but still need to copy the charge over
Expand Down Expand Up @@ -547,7 +550,6 @@ def from_vasp_outputs(
temp = str(elph_poscar.name).replace("POSCAR.T=", "").replace(".gz", "")
elph_structures["temperatures"].append(temp)
elph_structures["structures"].append(Structure.from_file(elph_poscar))

return cls(
structure=structure,
energy=vasprun.final_energy,
Expand Down Expand Up @@ -631,6 +633,7 @@ def from_vasp_files(
strip_dos_projections: bool = False,
store_volumetric_data: Optional[Tuple[str]] = None,
store_trajectory: StoreTrajectoryOption = StoreTrajectoryOption.NO,
store_onsite_density_matrices: bool = False,
vasprun_kwargs: Optional[Dict] = None,
) -> Tuple["Calculation", Dict[VaspObject, Dict]]:
"""
Expand Down Expand Up @@ -705,6 +708,8 @@ def from_vasp_files(
- NO: Trajectory is not Stored.
If not NO, :obj:'.CalculationOutput.ionic_steps' is set to None
to reduce duplicating information.
store_onsite_density_matrices
Whether to store the onsite density matrices from the OUTCAR.
vasprun_kwargs
Additional keyword arguments that will be passed to the Vasprun init.
Expand Down Expand Up @@ -771,6 +776,7 @@ def from_vasp_files(
locpot=locpot,
elph_poscars=elph_poscars,
store_trajectory=store_trajectory,
store_onsite_density_matrices=store_onsite_density_matrices,
)
if store_trajectory != StoreTrajectoryOption.NO:
exclude_from_trajectory = ["structure"]
Expand Down

0 comments on commit e9689db

Please sign in to comment.