1- """Schemas for qha documents."""
1+ """Schemas for QHA documents."""
22
33import logging
44from typing import Union
1515
1616
1717class PhononQHADoc (StructureMetadata , extra = "allow" ): # type: ignore[call-arg]
18- """Collection of all data produced by the qha workflow."""
18+ """Collection of all data produced by the QHA workflow."""
1919
2020 structure : Structure | None = Field (
2121 None , description = "Structure of Materials Project."
@@ -62,7 +62,7 @@ class PhononQHADoc(StructureMetadata, extra="allow"): # type: ignore[call-arg]
6262 description = "Gruneisen parameters at temperatures.Shape: (temperatures,)" ,
6363 )
6464 pressure : float | None = Field (
65- None , description = "Pressure in GPA at which Gibb's energy was computed"
65+ None , description = "Pressure in GPa at which the Gibbs energy was computed. "
6666 )
6767 t_max : float | None = Field (
6868 None ,
@@ -106,7 +106,7 @@ def from_phonon_runs(
106106 eos_type : str = "vinet" ,
107107 ** kwargs ,
108108 ) -> Self :
109- """Generate qha results.
109+ """Generate QHA results.
110110
111111 Parameters
112112 ----------
@@ -149,35 +149,28 @@ def from_phonon_runs(
149149
150150 # create some plots here
151151 # add kwargs to change the names and file types
152+ fig_ext = kwargs .get ("plot_type" , "pdf" )
152153 qha .plot_helmholtz_volume ().savefig (
153- f"{ kwargs .get ('helmholtz_volume_filename' , 'helmholtz_volume' )} "
154- f".{ kwargs .get ('plot_type' , 'pdf' )} "
154+ f"{ kwargs .get ('helmholtz_volume_filename' , 'helmholtz_volume' )} .{ fig_ext } "
155155 )
156156 qha .plot_volume_temperature ().savefig (
157- f"{ kwargs .get ('volume_temperature_plot' , 'volume_temperature' )} "
158- f".{ kwargs .get ('plot_type' , 'pdf' )} "
157+ f"{ kwargs .get ('volume_temperature_plot' , 'volume_temperature' )} .{ fig_ext } "
159158 )
160159 qha .plot_thermal_expansion ().savefig (
161- f"{ kwargs .get ('thermal_expansion_plot' , 'thermal_expansion' )} "
162- f".{ kwargs .get ('plot_type' , 'pdf' )} "
160+ f"{ kwargs .get ('thermal_expansion_plot' , 'thermal_expansion' )} .{ fig_ext } "
163161 )
164162 qha .plot_gibbs_temperature ().savefig (
165- f"{ kwargs .get ('gibbs_temperature_plot' , 'gibbs_temperature' )} "
166- f".{ kwargs .get ('plot_type' , 'pdf' )} "
163+ f"{ kwargs .get ('gibbs_temperature_plot' , 'gibbs_temperature' )} .{ fig_ext } "
167164 )
168165 qha .plot_bulk_modulus_temperature ().savefig (
169- f"{ kwargs .get ('bulk_modulus_plot' , 'bulk_modulus_temperature' )} "
170- f".{ kwargs .get ('plot_type' , 'pdf' )} "
166+ f"{ kwargs .get ('bulk_modulus_plot' , 'bulk_modulus_temperature' )} .{ fig_ext } "
171167 )
172168 qha .plot_heat_capacity_P_numerical ().savefig (
173- f"{ kwargs .get ('heat_capacity_plot' , 'heat_capacity_P_numerical' )} "
174- f".{ kwargs .get ('plot_type' , 'pdf' )} "
169+ f"{ kwargs .get ('heat_capacity_plot' , 'heat_capacity_P_numerical' )} .{ fig_ext } "
175170 )
176171 # qha.plot_heat_capacity_P_polyfit().savefig("heat_capacity_P_polyfit.eps")
177- qha .plot_gruneisen_temperature ().savefig (
178- f"{ kwargs .get ('gruneisen_temperature_plot' , 'gruneisen_temperature' )} "
179- f".{ kwargs .get ('plot_type' , 'pdf' )} "
180- )
172+ ge_temp_plot = kwargs .get ("gruneisen_temperature_plot" , "gruneisen_temperature" )
173+ qha .plot_gruneisen_temperature ().savefig (f"{ ge_temp_plot } .{ fig_ext } " )
181174
182175 qha .write_helmholtz_volume (
183176 filename = kwargs .get ("helmholtz_volume_datafile" , "helmholtz_volume.dat" )
@@ -197,21 +190,16 @@ def from_phonon_runs(
197190 qha .write_gibbs_temperature (
198191 filename = kwargs .get ("gibbs_temperature_datafile" , "gibbs_temperature.dat" )
199192 )
200- qha .write_gruneisen_temperature (
201- filename = kwargs .get (
202- "gruneisen_temperature_datafile" , "gruneisen_temperature.dat"
203- )
193+ ge_temp_file = kwargs .get (
194+ "gruneisen_temperature_datafile" , "gruneisen_temperature.dat"
204195 )
196+ qha .write_gruneisen_temperature (filename = ge_temp_file )
205197 qha .write_heat_capacity_P_numerical (
206198 filename = kwargs .get (
207199 "heat_capacity_datafile" , "heat_capacity_P_numerical.dat"
208200 )
209201 )
210- qha .write_gruneisen_temperature (
211- filename = kwargs .get (
212- "gruneisen_temperature_datafile" , "gruneisen_temperature.dat"
213- )
214- )
202+ qha .write_gruneisen_temperature (filename = ge_temp_file )
215203
216204 # write files as well - might be easier for plotting
217205
0 commit comments