Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/atomate2/common/schemas/phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,11 @@ def from_forces_born(
)

# compute vibrational part of free energies per formula unit
temperature_range = np.arange(
kwargs.get("tmin", 0), kwargs.get("tmax", 500), kwargs.get("tstep", 10)
)
# the grid includes tmax and defaults to 0-1000 K, as in phonopy
tmin = kwargs.get("tmin", 0)
tmax = kwargs.get("tmax", 1000)
tstep = kwargs.get("tstep", 10)
temperature_range = np.arange(tmin, tmax + tstep / 2, tstep)

free_energies = [
dos.helmholtz_free_energy(
Expand Down
2 changes: 1 addition & 1 deletion tests/torchsim/flows/test_phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def test_torchsim_phonon_maker_integration(
phonon_displacement_maker=static_maker,
create_thermal_displacements=False,
store_force_constants=False,
generate_frequencies_eigenvectors_kwargs={"tstep": 100},
generate_frequencies_eigenvectors_kwargs={"tstep": 100, "tmax": 400},
socket=socket,
)

Expand Down
40 changes: 40 additions & 0 deletions tests/vasp/flows/test_phonons.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,46 @@ def test_phonon_wf_vasp_only_displacements3(


# structure will be kept in the format that was transferred
@pytest.mark.parametrize(
("kwargs", "expected_temperatures"),
[
({}, np.arange(0, 1001, 10)), # default grid is 0-1000 K, as in phonopy
({"tmax": 500, "tstep": 100}, [0, 100, 200, 300, 400, 500]), # tmax included
],
)
def test_phonon_wf_vasp_temperature_grid(
mock_vasp, clean_dir, si_structure: Structure, kwargs, expected_temperatures
):
ref_paths = {
"phonon static 1/1": "Si_phonons_2/phonon_static_1_1",
"static": "Si_phonons_2/static",
}
mock_vasp(
ref_paths,
{
"phonon static 1/1": {"incar_settings": ["NSW", "ISMEAR"]},
"static": {"incar_settings": ["NSW", "ISMEAR"]},
},
)

job = PhononMaker(
min_length=3.0,
bulk_relax_maker=None,
born_maker=None,
use_symmetrized_structure="conventional",
create_thermal_displacements=False,
store_force_constants=False,
prefer_90_degrees=False,
generate_frequencies_eigenvectors_kwargs=kwargs,
).make(si_structure)
responses = run_locally(job, create_folders=True, ensure_success=True)

ph_doc = responses[job.jobs[-1].uuid][1].output
assert_allclose(ph_doc.temperatures, expected_temperatures)
assert len(ph_doc.free_energies) == len(expected_temperatures)
assert len(ph_doc.heat_capacities) == len(expected_temperatures)


def test_phonon_wf_vasp_only_displacements_no_structural_transformation(
mock_vasp, clean_dir, si_structure: Structure
):
Expand Down
Loading