Skip to content

Commit

Permalink
Merge pull request #197 from mattwelborn/add_au_time
Browse files Browse the repository at this point in the history
Units: add atomic unit of time
  • Loading branch information
mattwelborn authored Jan 20, 2020
2 parents 9d02a28 + e6db01d commit 3bd53fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions qcelemental/physical_constants/ureg.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ def build_units_registry(context):
ureg.define("wavenumber = 1 / centimeter")
ureg.define("Angstrom = angstrom")

# Time
ureg.define(f"au_time = {phys_const['atomic unit of time']['value']} * {phys_const['atomic unit of time']['unit']}")

# Masses
ureg.define(
"atomic_mass_unit = {} * kilogram = u = amu = dalton = Da".format(phys_const["atomic mass constant"]["value"])
Expand Down
11 changes: 11 additions & 0 deletions qcelemental/tests/test_units.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,14 @@ def test_quantities_smoke():
Smoke test to ensure Quantities are correctly returned
"""
assert 5 == qcelemental.constants.Quantity("5 kcal").magnitude


def test_speed_of_light():
assert (
pytest.approx(
qcelemental.constants.speed_of_light_in_vacuum
* qcelemental.constants.conversion_factor("m/s", "bohr/au_time"),
1e-8,
)
== qcelemental.constants.c_au
)

0 comments on commit 3bd53fa

Please sign in to comment.