diff --git a/burnman/calibrants/Fei_2007.py b/burnman/calibrants/Fei_2007.py index 51572839..56e77bbb 100644 --- a/burnman/calibrants/Fei_2007.py +++ b/burnman/calibrants/Fei_2007.py @@ -33,22 +33,14 @@ def _pressure_Fei_Pt(volume, temperature, params): Pth0 = thermal_model._thermal_pressure(params["T_0"], volume, params) Pth = thermal_model._thermal_pressure(temperature, volume, params) - # Electronic pressure - Pel = ( - 1.1916e-15 * temperature**4.0 - - 1.4551e-11 * temperature**3.0 - + 1.6209e-07 * temperature**2.0 - + 1.8269e-4 * temperature - - 0.069 - ) * 1.0e09 - # Total pressure - P = P0 + Pth - Pth0 + Pel + P = P0 + Pth - Pth0 return P + Z = 4.0 _params_Fei_Pt = { - "V_0": 9.0904e-06, + "V_0": molar_volume_from_unit_cell_volume(60.38, Z), "K_0": 277.0e9, "Kprime_0": 5.08, "Debye_0": 230.0, @@ -57,7 +49,7 @@ def _pressure_Fei_Pt(volume, temperature, params): "n": 1.0, "T_0": 300.0, "P_0": 0.0, - "Z": 4.0, + "Z": Z, } Calibrant.__init__(self, _pressure_Fei_Pt, "pressure", _params_Fei_Pt) @@ -86,17 +78,18 @@ def _pressure_Fei_Au(volume, temperature, params): return P + Z = 4.0 _params_Fei_Au = { - "V_0": molar_volume_from_unit_cell_volume(67.850, 4.0), + "V_0": molar_volume_from_unit_cell_volume(67.850, Z), "K_0": 167.0e9, - "Kprime_0": 6.00, + "Kprime_0": 6.0, "Debye_0": 170.0, "grueneisen_0": 2.97, "q_0": 0.6, "n": 1.0, "T_0": 300.0, "P_0": 0.0, - "Z": 4.0, + "Z": Z, } Calibrant.__init__(self, _pressure_Fei_Au, "pressure", _params_Fei_Au) diff --git a/burnman/calibrants/Holmes_1989.py b/burnman/calibrants/Holmes_1989.py index 7480e6aa..b0efb85f 100644 --- a/burnman/calibrants/Holmes_1989.py +++ b/burnman/calibrants/Holmes_1989.py @@ -32,12 +32,14 @@ def _pressure(volume, temperature, params): return P_300 + params["alpha_T"] * params["beta_T"] * (temperature - 300.0) + Z = 4.0 _params = { - "V_0": molar_volume_from_unit_cell_volume(60.38, 4.0), + "V_0": molar_volume_from_unit_cell_volume(60.38, Z), "beta_T": 798.31e9 / 3.0, "eta": 7.2119, "beta_prime_T": (7.2119 / 1.5) + 1.0, "alpha_T": 2.61e-5, + "Z": Z, } Calibrant.__init__(self, _pressure, "pressure", _params) diff --git a/misc/benchmarks/calibrant_benchmarks.py b/misc/benchmarks/calibrant_benchmarks.py new file mode 100644 index 00000000..7ecb40d6 --- /dev/null +++ b/misc/benchmarks/calibrant_benchmarks.py @@ -0,0 +1,67 @@ +from __future__ import absolute_import + +import numpy as np +import matplotlib.pyplot as plt +import matplotlib.image as mpimg +from burnman import calibrants +from burnman.tools.unitcell import molar_volume_from_unit_cell_volume + + +def make_VPT_figure(calibrant, temperatures, figure, figure_extent, plot_extent): + name = str(calibrant).split(" ")[0][1:] + print(f"Checking {name}...") + + fig = plt.figure(figsize=(6, 4)) + fig.suptitle(f"{name}") + + ax = [fig.add_subplot(1, 1, 1)] + + fig1 = mpimg.imread(figure) + ax[0].imshow(fig1, extent=figure_extent, aspect="auto") + + pressures = np.linspace(plot_extent[0] * 1.0e9, plot_extent[1] * 1.0e9, 101) + volumes = np.empty_like(pressures) + for T in temperatures: + for i, P in enumerate(pressures): + volumes[i] = calibrant.volume(P, T) / molar_volume_from_unit_cell_volume( + 1.0, calibrant.params["Z"] + ) + + plt.plot(pressures / 1.0e9, volumes) + + ax[0].set_xlim(plot_extent[0], plot_extent[1]) + ax[0].set_ylim(plot_extent[2], plot_extent[3]) + plt.show() + + +def check_figures(): + make_VPT_figure( + calibrants.Fei_2007.Au(), + [300.0, 1473.0, 2173.0], + "figures/Fei_2007_Au.png", + [0, 139.5, 50, 68], + [0, 139.5, 50, 68], + ) + + make_VPT_figure( + calibrants.Fei_2007.Pt(), + [300.0, 1473.0, 1873.0], + "figures/Fei_2007_Pt.png", + [-2, 125, 46.98, 61.02], + [0, 125, 47, 61], + ) + + V_0 = calibrants.Holmes_1989.Pt().params[ + "V_0" + ] / molar_volume_from_unit_cell_volume(1.0, 4) + make_VPT_figure( + calibrants.Holmes_1989.Pt(), + [300.0], + "figures/Holmes_1989_Pt.png", + [0, 600, 0.6 * V_0, 1.1 * V_0], + [0, 600, 0.6 * V_0, 1.1 * V_0], + ) + + +if __name__ == "__main__": + check_figures() diff --git a/misc/benchmarks/figures/Fei_2007_Au.png b/misc/benchmarks/figures/Fei_2007_Au.png new file mode 100644 index 00000000..5bad1efe Binary files /dev/null and b/misc/benchmarks/figures/Fei_2007_Au.png differ diff --git a/misc/benchmarks/figures/Fei_2007_Pt.png b/misc/benchmarks/figures/Fei_2007_Pt.png new file mode 100644 index 00000000..c61e3a2c Binary files /dev/null and b/misc/benchmarks/figures/Fei_2007_Pt.png differ diff --git a/misc/benchmarks/figures/Holmes_1989_Pt.png b/misc/benchmarks/figures/Holmes_1989_Pt.png new file mode 100644 index 00000000..59150805 Binary files /dev/null and b/misc/benchmarks/figures/Holmes_1989_Pt.png differ diff --git a/misc/ref/calibrant_benchmarks.py.out b/misc/ref/calibrant_benchmarks.py.out new file mode 100644 index 00000000..7cffaede --- /dev/null +++ b/misc/ref/calibrant_benchmarks.py.out @@ -0,0 +1,3 @@ +Checking burnman.calibrants.Fei_2007.Au... +Checking burnman.calibrants.Fei_2007.Pt... +Checking burnman.calibrants.Holmes_1989.Pt...