Skip to content

Commit

Permalink
Default create_thermal_displacements to False in VASP and forcefi…
Browse files Browse the repository at this point in the history
…eld `PhononMaker` (#647)

* default create_thermal_displacements to False in vasp and force field PhononMaker

* fix vasp/flows/test_phonons.py
  • Loading branch information
janosh committed Dec 11, 2023
1 parent bfd4a25 commit 2c23435
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/atomate2/common/schemas/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/forcefields/flows/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/vasp/flows/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion src/atomate2/vasp/jobs/elastic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion tests/forcefields/flows/test_phonon.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
24 changes: 11 additions & 13 deletions tests/vasp/flows/test_phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
)


Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
)


Expand Down Expand Up @@ -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
)


Expand Down Expand Up @@ -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
Expand All @@ -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(
Expand Down Expand Up @@ -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
)


Expand Down

0 comments on commit 2c23435

Please sign in to comment.