|
3 | 3 | import unittest
|
4 | 4 |
|
5 | 5 | import numpy as np
|
| 6 | +from numpy.testing import assert_allclose |
6 | 7 |
|
7 | 8 | from pymatgen.analysis.eos import EOS
|
8 | 9 | from pymatgen.analysis.quasiharmonic import QuasiharmonicDebyeApprox
|
@@ -107,34 +108,33 @@ def setUp(self):
|
107 | 108 | def test_bulk_modulus(self):
|
108 | 109 | eos = EOS(self.eos)
|
109 | 110 | eos_fit = eos.fit(self.volumes, self.energies)
|
110 |
| - print(f"{eos_fit.b0_GPa=!s}") |
111 | 111 | bulk_modulus = float(str(eos_fit.b0_GPa).split()[0])
|
112 | 112 | bulk_modulus_ans = float(str(self.qhda.bulk_modulus).split()[0])
|
113 |
| - np.testing.assert_allclose(bulk_modulus, bulk_modulus_ans, atol=1e-3) |
| 113 | + assert_allclose(bulk_modulus, bulk_modulus_ans, atol=1e-3) |
114 | 114 |
|
115 | 115 | def test_optimum_volume(self):
|
116 | 116 | opt_vol = self.qhda.optimum_volumes[0]
|
117 |
| - np.testing.assert_allclose(opt_vol, self.opt_vol, atol=1e-3) |
| 117 | + assert_allclose(opt_vol, self.opt_vol, atol=1e-3) |
118 | 118 |
|
119 | 119 | def test_debye_temperature(self):
|
120 | 120 | theta = self.qhda.debye_temperature(self.opt_vol)
|
121 |
| - np.testing.assert_allclose(theta, 2559.675227, atol=1e-3) |
| 121 | + assert_allclose(theta, 2559.675227, atol=1e-3) |
122 | 122 |
|
123 | 123 | def test_gruneisen_parameter(self):
|
124 | 124 | gamma = self.qhda.gruneisen_parameter(self.T, self.opt_vol)
|
125 |
| - np.testing.assert_allclose(gamma, 1.670486, atol=1e-3) |
| 125 | + assert_allclose(gamma, 1.670486, atol=1e-3) |
126 | 126 |
|
127 | 127 | def test_thermal_conductivity(self):
|
128 | 128 | kappa = self.qhda.thermal_conductivity(self.T, self.opt_vol)
|
129 |
| - np.testing.assert_allclose(kappa, 131.736242, atol=1e-1) |
| 129 | + assert_allclose(kappa, 131.736242, atol=1e-1) |
130 | 130 |
|
131 | 131 | def test_vibrational_internal_energy(self):
|
132 | 132 | u = self.qhda.vibrational_internal_energy(self.T, self.opt_vol)
|
133 |
| - np.testing.assert_allclose(u, 0.50102, atol=1e-3) |
| 133 | + assert_allclose(u, 0.50102, atol=1e-3) |
134 | 134 |
|
135 | 135 | def test_vibrational_free_energy(self):
|
136 | 136 | A = self.qhda.vibrational_free_energy(self.T, self.opt_vol)
|
137 |
| - np.testing.assert_allclose(A, 0.494687, atol=1e-3) |
| 137 | + assert_allclose(A, 0.494687, atol=1e-3) |
138 | 138 |
|
139 | 139 |
|
140 | 140 | class TestAnharmonicQuasiharmociDebyeApprox(unittest.TestCase):
|
@@ -185,24 +185,24 @@ def setUp(self):
|
185 | 185 |
|
186 | 186 | def test_optimum_volume(self):
|
187 | 187 | opt_vol = self.qhda.optimum_volumes[0]
|
188 |
| - np.testing.assert_allclose(opt_vol, self.opt_vol, atol=1e-3) |
| 188 | + assert_allclose(opt_vol, self.opt_vol, atol=1e-3) |
189 | 189 |
|
190 | 190 | def test_debye_temperature(self):
|
191 | 191 | theta = self.qhda.debye_temperature(self.opt_vol)
|
192 | 192 | np.testing.assert_approx_equal(theta, 601.239096, 4)
|
193 | 193 |
|
194 | 194 | def test_gruneisen_parameter(self):
|
195 | 195 | gamma = self.qhda.gruneisen_parameter(0, self.qhda.ev_eos_fit.v0)
|
196 |
| - np.testing.assert_allclose(gamma, 2.188302, atol=1e-3) |
| 196 | + assert_allclose(gamma, 2.188302, atol=1e-3) |
197 | 197 |
|
198 | 198 | def test_thermal_conductivity(self):
|
199 | 199 | kappa = self.qhda.thermal_conductivity(self.T, self.opt_vol)
|
200 |
| - np.testing.assert_allclose(kappa, 21.810997, atol=1e-1) |
| 200 | + assert_allclose(kappa, 21.810997, atol=1e-1) |
201 | 201 |
|
202 | 202 | def test_vibrational_internal_energy(self):
|
203 | 203 | u = self.qhda.vibrational_internal_energy(self.T, self.opt_vol)
|
204 |
| - np.testing.assert_allclose(u, 0.13845, atol=1e-3) |
| 204 | + assert_allclose(u, 0.13845, atol=1e-3) |
205 | 205 |
|
206 | 206 | def test_vibrational_free_energy(self):
|
207 | 207 | A = self.qhda.vibrational_free_energy(self.T, self.opt_vol)
|
208 |
| - np.testing.assert_allclose(A, -0.014620, atol=1e-3) |
| 208 | + assert_allclose(A, -0.014620, atol=1e-3) |
0 commit comments