From a066ba58a823faf1e824b21a56fdb9c860a3e591 Mon Sep 17 00:00:00 2001 From: Jiongzhi ZHENG Date: Mon, 1 Jul 2024 12:06:35 -0400 Subject: [PATCH] change function name to solve the conflict with hiphive function --- src/atomate2/common/jobs/phonons.py | 4 ++-- src/atomate2/common/schemas/phonons.py | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/atomate2/common/jobs/phonons.py b/src/atomate2/common/jobs/phonons.py index 837b08087a..7500636d9f 100644 --- a/src/atomate2/common/jobs/phonons.py +++ b/src/atomate2/common/jobs/phonons.py @@ -18,7 +18,7 @@ CubicSupercellTransformation, ) -from atomate2.common.schemas.phonons import ForceConstants, PhononBSDOSDoc, get_factor +from atomate2.common.schemas.phonons import Forceconstants, PhononBSDOSDoc, get_factor if TYPE_CHECKING: from pathlib import Path @@ -248,7 +248,7 @@ def generate_phonon_displacements( @job( output_schema=PhononBSDOSDoc, - data=[PhononDos, PhononBandStructureSymmLine, ForceConstants], + data=[PhononDos, PhononBandStructureSymmLine, Forceconstants], ) def generate_frequencies_eigenvectors( structure: Structure, diff --git a/src/atomate2/common/schemas/phonons.py b/src/atomate2/common/schemas/phonons.py index 63397adaf3..ae02c386d8 100644 --- a/src/atomate2/common/schemas/phonons.py +++ b/src/atomate2/common/schemas/phonons.py @@ -117,7 +117,7 @@ class PhononUUIDs(BaseModel): born_run_uuid: Optional[str] = Field(None, description="born run uuid") -class ForceConstants(MSONable): +class Forceconstants(MSONable): """A force constants class.""" def __init__(self, force_constants: list[list[Matrix3D]]) -> None: @@ -198,7 +198,7 @@ class PhononBSDOSDoc(StructureMetadata, extra="allow"): # type: ignore[call-arg ) # needed, e.g. to compute Grueneisen parameter etc - force_constants: Optional[ForceConstants] = Field( + force_constants: Optional[Forceconstants] = Field( None, description="Force constants between every pair of atoms in the structure" ) @@ -554,8 +554,10 @@ def from_forces_born( new_plotter = PhononBSPlotter(bs=bs_symm_line) - new_plotter.save_plot("phonon_band_structure.eps",img_format=kwargs.get("img_format", "eps"),units=kwargs.get("units", "THz"),) - + new_plotter.save_plot( + filename=kwargs.get("filename_bs", "phonon_band_structure.pdf"), + units=kwargs.get("units", "THz"), + ) imaginary_modes_hiphive = bs_symm_line.has_imaginary_freq( tol=kwargs.get("tol_imaginary_modes", 1e-5) ) @@ -619,10 +621,9 @@ def from_forces_born( new_plotter = PhononBSPlotter(bs=bs_symm_line) new_plotter.save_plot( - "phonon_band_structure.eps", - img_format=kwargs.get("img_format", "eps"), - units=kwargs.get("units", "THz"), - ) + filename=kwargs.get("filename_bs", "phonon_band_structure.pdf"), + units=kwargs.get("units", "THz"), + ) else: pass