Skip to content

Commit

Permalink
Merge pull request #1196 from pyiron/qha
Browse files Browse the repository at this point in the history
Correctly scale output from phonopy jobs in QuasiHarmonic
  • Loading branch information
pmrv authored Nov 29, 2023
2 parents a66edac + 0a3839d commit 0c5fb13
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions pyiron_atomistics/atomistics/master/quasi.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,23 @@ def collect_output(self):
free_energy_lst, entropy_lst, cv_lst, volume_lst = [], [], [], []
for job_id in self.child_ids:
job = self.project_hdf5.load(job_id)
# the underlying phonopy job might create a supercell; if its
# reference job is interactive this is reflected in its
# job.structure and the output quantities, so we need to rescale
# all the output here; if the structure did not change the
# conversion_factor will simply be 1.
conversion_factor = len(self.structure) / len(job.structure)
thermal_properties = job.get_thermal_properties(
temperatures=np.linspace(
self.input["temperature_start"],
self.input["temperature_end"],
int(self.input["temperature_steps"]),
)
)
free_energy_lst.append(thermal_properties.free_energies)
entropy_lst.append(thermal_properties.entropy)
cv_lst.append(thermal_properties.cv)
volume_lst.append(job.structure.get_volume())
free_energy_lst.append(thermal_properties.free_energies * conversion_factor)
entropy_lst.append(thermal_properties.entropy * conversion_factor)
cv_lst.append(thermal_properties.cv * conversion_factor)
volume_lst.append(job.structure.get_volume() * conversion_factor)

arg_lst = np.argsort(volume_lst)

Expand Down Expand Up @@ -177,10 +183,17 @@ def optimise_volume(self, bulk_eng):
fit_funct=fit, x=v, save_range=0.0, return_ind=True
)

v0_lst.append(v0)
free_eng_lst.append(fit([v0]))
entropy_lst.append(entropy[ind])
cv_lst.append(cv[ind])
if v0 is not None:
v0_lst.append(v0)
free_eng_lst.append(fit(v0))
entropy_lst.append(entropy[ind])
cv_lst.append(cv[ind])
else:
v0_lst.append(np.nan)
free_eng_lst.append(np.nan)
entropy_lst.append(np.nan)
cv_lst.append(np.nan)

return v0_lst, free_eng_lst, entropy_lst, cv_lst

def plot_free_energy_volume_temperature(
Expand Down

0 comments on commit 0c5fb13

Please sign in to comment.