From 2c234353557e881983179c8150fff733ff3ee673 Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Mon, 11 Dec 2023 13:19:10 -0800 Subject: [PATCH] Default `create_thermal_displacements` to `False` in VASP and forcefield `PhononMaker` (#647) * default create_thermal_displacements to False in vasp and force field PhononMaker * fix vasp/flows/test_phonons.py --- src/atomate2/common/schemas/phonons.py | 2 +- src/atomate2/forcefields/flows/phonons.py | 2 +- src/atomate2/vasp/flows/phonons.py | 2 +- src/atomate2/vasp/jobs/elastic.py | 2 +- tests/forcefields/flows/test_phonon.py | 2 +- tests/vasp/flows/test_phonons.py | 24 +++++++++++------------ 6 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/atomate2/common/schemas/phonons.py b/src/atomate2/common/schemas/phonons.py index 53b4a52dae..4023067487 100644 --- a/src/atomate2/common/schemas/phonons.py +++ b/src/atomate2/common/schemas/phonons.py @@ -339,7 +339,7 @@ def from_forces_born( # get phonon density of states filename_dos_yaml = "phonon_dos.yaml" - kpoint_density_dos = kwargs.get("kpoint_density_dos", 7000) + kpoint_density_dos = kwargs.get("kpoint_density_dos", 7_000) kpoint = Kpoints.automatic_density( structure=get_pmg_structure(phonon.primitive), kppa=kpoint_density_dos, diff --git a/src/atomate2/forcefields/flows/phonons.py b/src/atomate2/forcefields/flows/phonons.py index 2a5de9aec4..e84f2088c5 100644 --- a/src/atomate2/forcefields/flows/phonons.py +++ b/src/atomate2/forcefields/flows/phonons.py @@ -140,7 +140,7 @@ class PhononMaker(Maker): phonon_displacement_maker: BaseVaspMaker | ForceFieldStaticMaker = field( default_factory=CHGNetStaticMaker ) - create_thermal_displacements: bool = True + create_thermal_displacements: bool = False generate_frequencies_eigenvectors_kwargs: dict = field(default_factory=dict) kpath_scheme: str = "seekpath" code: str = "vasp" diff --git a/src/atomate2/vasp/flows/phonons.py b/src/atomate2/vasp/flows/phonons.py index 5bb9091368..2f41a65933 100644 --- a/src/atomate2/vasp/flows/phonons.py +++ b/src/atomate2/vasp/flows/phonons.py @@ -144,7 +144,7 @@ class PhononMaker(Maker): phonon_displacement_maker: BaseVaspMaker = field( default_factory=PhononDisplacementMaker ) - create_thermal_displacements: bool = True + create_thermal_displacements: bool = False generate_frequencies_eigenvectors_kwargs: dict = field(default_factory=dict) kpath_scheme: str = "seekpath" code: str = "vasp" diff --git a/src/atomate2/vasp/jobs/elastic.py b/src/atomate2/vasp/jobs/elastic.py index a83041d5c4..7888ab305f 100644 --- a/src/atomate2/vasp/jobs/elastic.py +++ b/src/atomate2/vasp/jobs/elastic.py @@ -51,7 +51,7 @@ class ElasticRelaxMaker(BaseVaspMaker): name: str = "elastic relax" input_set_generator: VaspInputGenerator = field( default_factory=lambda: StaticSetGenerator( - user_kpoints_settings={"grid_density": 7000}, + user_kpoints_settings={"grid_density": 7_000}, user_incar_settings={ "IBRION": 2, "ISIF": 2, diff --git a/tests/forcefields/flows/test_phonon.py b/tests/forcefields/flows/test_phonon.py index 7a37dffbec..b91eacbe10 100644 --- a/tests/forcefields/flows/test_phonon.py +++ b/tests/forcefields/flows/test_phonon.py @@ -83,7 +83,7 @@ def test_phonon_wf(clean_dir): ) assert ( responses[job.jobs[-1].uuid][1].output.phonopy_settings.kpoint_density_dos - == 7000 + == 7_000 ) assert_allclose( responses[job.jobs[-1].uuid][1].output.entropies, diff --git a/tests/vasp/flows/test_phonons.py b/tests/vasp/flows/test_phonons.py index 2ee728e214..b57c3e7cfb 100644 --- a/tests/vasp/flows/test_phonons.py +++ b/tests/vasp/flows/test_phonons.py @@ -100,7 +100,7 @@ def test_phonon_wf_only_displacements3(mock_vasp, clean_dir): ) assert ( responses[job.jobs[-1].uuid][1].output.phonopy_settings.kpoint_density_dos - == 7000 + == 7_000 ) assert_allclose( responses[job.jobs[-1].uuid][1].output.entropies, @@ -263,7 +263,7 @@ def test_phonon_wf_only_displacements_no_structural_transformation( ) assert ( responses[job.jobs[-1].uuid][1].output.phonopy_settings.kpoint_density_dos - == 7000 + == 7_000 ) assert_allclose( responses[job.jobs[-1].uuid][1].output.entropies, @@ -326,6 +326,7 @@ def test_phonon_wf_only_displacements_kpath(mock_vasp, clean_dir, kpath_scheme): use_symmetrized_structure="primitive", kpath_scheme=kpath_scheme, generate_frequencies_eigenvectors_kwargs={"tstep": 100}, + create_thermal_displacements=True, ).make(structure) # run the flow or job and ensure that it finished running successfully @@ -387,7 +388,7 @@ def test_phonon_wf_only_displacements_kpath(mock_vasp, clean_dir, kpath_scheme): ) assert ( responses[job.jobs[-1].uuid][1].output.phonopy_settings.kpoint_density_dos - == 7000 + == 7_000 ) @@ -427,6 +428,7 @@ def test_phonon_wf_only_displacements_add_inputs_raises(mock_vasp, clean_dir): born_maker=None, use_symmetrized_structure="primitive", generate_frequencies_eigenvectors_kwargs={"tstep": 100}, + create_thermal_displacements=True, ).make( structure=structure, total_dft_energy_per_formula_unit=total_dft_energy_per_formula_unit, @@ -471,6 +473,7 @@ def test_phonon_wf_only_displacements_add_inputs(mock_vasp, clean_dir): born_maker=None, use_symmetrized_structure="primitive", generate_frequencies_eigenvectors_kwargs={"tstep": 100}, + create_thermal_displacements=True, ).make( structure=structure, total_dft_energy_per_formula_unit=total_dft_energy_per_formula_unit, @@ -542,7 +545,7 @@ def test_phonon_wf_only_displacements_add_inputs(mock_vasp, clean_dir): ) assert ( responses[job.jobs[-1].uuid][1].output.phonopy_settings.kpoint_density_dos - == 7000 + == 7_000 ) @@ -641,7 +644,7 @@ def test_phonon_wf_only_displacements_optional_settings(mock_vasp, clean_dir): ) assert ( responses[job.jobs[-1].uuid][1].output.phonopy_settings.kpoint_density_dos - == 7000 + == 7_000 ) @@ -678,6 +681,7 @@ def test_phonon_wf_all_steps(mock_vasp, clean_dir): min_length=3.0, use_symmetrized_structure=None, generate_frequencies_eigenvectors_kwargs={"tstep": 100}, + create_thermal_displacements=True, ).make(structure) # run the flow or job and ensure that it finished running successfully @@ -688,13 +692,7 @@ def test_phonon_wf_all_steps(mock_vasp, clean_dir): assert_allclose( responses[job.jobs[-1].uuid][1].output.free_energies, - [ - 5853.74150399, - 5692.29089555, - 4798.67784919, - 3122.48296003, - 782.17345333, - ], + [5853.74150399, 5692.29089555, 4798.67784919, 3122.48296003, 782.17345333], ) assert isinstance( @@ -748,7 +746,7 @@ def test_phonon_wf_all_steps(mock_vasp, clean_dir): ) assert ( responses[job.jobs[-1].uuid][1].output.phonopy_settings.kpoint_density_dos - == 7000 + == 7_000 )