Skip to content

Commit

Permalink
Merge pull request #254 from pyiron/thermal_expansion_bug_fix
Browse files Browse the repository at this point in the history
Fix bug in thermal expansion
  • Loading branch information
jan-janssen authored Apr 25, 2024
2 parents a5e63bf + 12cc6c3 commit 93a5274
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 12 deletions.
3 changes: 3 additions & 0 deletions atomistics/workflows/quasiharmonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ def get_thermal_properties(
volume_lst = np.array(get_volume_lst(structure_dict=structure_dict)) / np.prod(
repeat_vector
)
eng_internal_dict = {
key: value / np.prod(repeat_vector) for key, value in eng_internal_dict.items()
}
if quantum_mechanical:
tp_collect_dict = _get_thermal_properties_quantum_mechanical(
phonopy_dict=phonopy_dict,
Expand Down
12 changes: 6 additions & 6 deletions tests/test_quasiharmonic_lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,16 @@ def test_calc_phonons(self):
self.assertTrue(tp_collect_dict["free_energy"][-1] > -2.7)
self.assertTrue(tp_collect_dict["entropy"][0] < 0.1)
self.assertTrue(tp_collect_dict["entropy"][0] > 0.0)
self.assertTrue(tp_collect_dict["entropy"][-1] < 270)
self.assertTrue(tp_collect_dict["entropy"][-1] > 269)
self.assertTrue(tp_collect_dict["entropy"][-1] < 273)
self.assertTrue(tp_collect_dict["entropy"][-1] > 272)
self.assertTrue(tp_collect_dict["heat_capacity"][0] < 0.1)
self.assertTrue(tp_collect_dict["heat_capacity"][0] > 0.0)
self.assertTrue(tp_collect_dict["heat_capacity"][-1] < 100)
self.assertTrue(tp_collect_dict["heat_capacity"][-1] > 99)
self.assertTrue(tp_collect_dict["volumes"][-1] < 66.6)
self.assertTrue(tp_collect_dict["volumes"][-1] > 66.5)
self.assertTrue(tp_collect_dict["volumes"][0] < 66.5)
self.assertTrue(tp_collect_dict["volumes"][0] > 66.4)
self.assertTrue(tp_collect_dict["volumes"][-1] < 68.6)
self.assertTrue(tp_collect_dict["volumes"][-1] > 68.5)
self.assertTrue(tp_collect_dict["volumes"][0] < 66.8)
self.assertTrue(tp_collect_dict["volumes"][0] > 66.7)
thermal_properties_dict = workflow.get_thermal_properties(
temperatures=[100, 1000],
output_keys=["temperatures", "volumes"],
Expand Down
12 changes: 6 additions & 6 deletions tests/test_quasiharmonic_lammps_functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ def test_calc_phonons(self):
self.assertTrue(tp_collect_dict["free_energy"][-1] > -2.7)
self.assertTrue(tp_collect_dict["entropy"][0] < 0.1)
self.assertTrue(tp_collect_dict["entropy"][0] > 0.0)
self.assertTrue(tp_collect_dict["entropy"][-1] < 270)
self.assertTrue(tp_collect_dict["entropy"][-1] > 269)
self.assertTrue(tp_collect_dict["entropy"][-1] < 273)
self.assertTrue(tp_collect_dict["entropy"][-1] > 272)
self.assertTrue(tp_collect_dict["heat_capacity"][0] < 0.1)
self.assertTrue(tp_collect_dict["heat_capacity"][0] > 0.0)
self.assertTrue(tp_collect_dict["heat_capacity"][-1] < 100)
self.assertTrue(tp_collect_dict["heat_capacity"][-1] > 99)
self.assertTrue(tp_collect_dict["volumes"][-1] < 66.6)
self.assertTrue(tp_collect_dict["volumes"][-1] > 66.5)
self.assertTrue(tp_collect_dict["volumes"][0] < 66.5)
self.assertTrue(tp_collect_dict["volumes"][0] > 66.4)
self.assertTrue(tp_collect_dict["volumes"][-1] < 68.6)
self.assertTrue(tp_collect_dict["volumes"][-1] > 68.5)
self.assertTrue(tp_collect_dict["volumes"][0] < 66.8)
self.assertTrue(tp_collect_dict["volumes"][0] > 66.7)
thermal_properties_dict = get_thermal_properties(
eng_internal_dict=eng_internal_dict,
phonopy_dict=phonopy_dict,
Expand Down

0 comments on commit 93a5274

Please sign in to comment.