def coupling(self): """ Ion-ion coupling parameter to determine if quantum/coupling effects are important. This compares Coulomb potential energy to thermal kinetic energy. """ return coupling_parameter(self.T_e, self.n_e, (self.particle, self.particle), self.Z)
def test_zmean(self): """ Test value obtained when arbitrary z_mean is passed """ methodVal = coupling_parameter(self.T, self.n_e, self.particles, z_mean=self.z_mean, V=np.nan * u.m / u.s, method="classical") testTrue = np.isclose(self.True_zmean, methodVal, rtol=1e-1, atol=0.0) errStr = (f"Coupling parameter should be {self.True_zmean} and " f"not {methodVal}.") assert testTrue, errStr
def test_known1(self): """ Test for known value. """ methodVal = coupling_parameter(self.T, self.n_e, self.particles, z_mean=np.nan * u.dimensionless_unscaled, V=np.nan * u.m / u.s, method="classical") testTrue = np.isclose(self.True1, methodVal, rtol=1e-1, atol=0.0) errStr = (f"Coupling parameter should be {self.True1} and " f"not {methodVal}.") assert testTrue, errStr
def test_quantum(self): """ Testing quantum method for coupling parameter. """ methodVal = coupling_parameter(self.T, self.n_e, self.particles, method="quantum") testTrue = np.isclose(self.True_quantum, methodVal, rtol=1e-1, atol=0.0) errStr = (f"Coupling parameter should be {self.True_quantum} and " f"not {methodVal}.") assert testTrue, errStr
def coupling(self): """ Ion-ion coupling parameter to determine if quantum/coupling effects are important. This compares Coulomb potential energy to thermal kinetic energy. """ couple = coupling_parameter(self.T_e, self.n_e, (self.particle, self.particle), self.Z) if couple < 0.01: warnings.warn(f"Coupling parameter is {couple}, you might have strong coupling effects", CouplingWarning) return couple
def test_fail1(self): """ Tests if test_known1() would fail if we slightly adjusted the value comparison by some quantity close to numerical error. """ fail1 = self.True1 * (1 + 1e-15) methodVal = coupling_parameter(self.T, self.n_e, self.particles, z_mean=np.nan * u.dimensionless_unscaled, V=np.nan * u.m / u.s, method="classical") testTrue = not np.isclose(methodVal, fail1, rtol=1e-16, atol=0.0) errStr = (f"Coupling parameter value test gives {methodVal} and " f"should not be equal to {fail1}.") assert testTrue, errStr
def test_symmetry(self): result = coupling_parameter(self.T, self.n_e, self.particles) resultRev = coupling_parameter(self.T, self.n_e, self.particles[::-1]) assert result == resultRev