Skip to content

Commit

Permalink
Rename constant Kb to kB
Browse files Browse the repository at this point in the history
  • Loading branch information
jngrad committed Aug 27, 2024
1 parent 2a6c67e commit cbcb099
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pyMBE.py
Original file line number Diff line number Diff line change
Expand Up @@ -2162,7 +2162,7 @@ def get_reduced_units(self):
f"{unit_length.to('nm'):.5g} = {unit_length}",
f"{unit_energy.to('J'):.5g} = {unit_energy}",
f"{unit_charge.to('C'):.5g} = {unit_charge}",
f"Temperature: {(self.kT/self.Kb).to('K'):.5g}"
f"Temperature: {(self.kT/self.kB).to('K'):.5g}"
])
return reduced_units_text

Expand Down Expand Up @@ -2718,9 +2718,9 @@ def set_reduced_units(self, unit_length=None, unit_charge=None, temperature=None
if Kw is None:
Kw = 1e-14
self.N_A=scipy.constants.N_A / self.units.mol
self.Kb=scipy.constants.k * self.units.J / self.units.K
self.kB=scipy.constants.k * self.units.J / self.units.K
self.e=scipy.constants.e * self.units.C
self.kT=temperature*self.Kb
self.kT=temperature*self.kB
self.Kw=Kw*self.units.mol**2 / (self.units.l**2)
self.units.define(f'reduced_energy = {self.kT} ')
self.units.define(f'reduced_length = {unit_length}')
Expand Down
4 changes: 2 additions & 2 deletions testsuite/serialization_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ def test_pint_units(self):
reduced_units = pmb.get_reduced_units()
self.assertEqual(reduced_units, ref_output)
np.testing.assert_allclose(
[pmb.Kb.magnitude, pmb.N_A.magnitude, pmb.e.magnitude],
[pmb.kB.magnitude, pmb.N_A.magnitude, pmb.e.magnitude],
[scipy.constants.k, scipy.constants.N_A, scipy.constants.e],
rtol=1e-8, atol=0.)
self.assertAlmostEqual((pmb.kT / pmb.Kb).magnitude, 298.15, delta=1e-7)
self.assertAlmostEqual((pmb.kT / pmb.kB).magnitude, 298.15, delta=1e-7)
self.assertAlmostEqual((pmb.kT / scipy.constants.k).magnitude, 298.15,
delta=1e-7)

Expand Down

0 comments on commit cbcb099

Please sign in to comment.