|
2 | 2 |
|
3 | 3 | from abc import ABC |
4 | 4 |
|
5 | | -from scipy import constants # noqa: TID253 |
| 5 | +# scipy physical constant version 2018 |
| 6 | +physical_constants = { |
| 7 | + "Avogadro constant": 6.02214076e23, # mol^-1 |
| 8 | + "elementary charge": 1.602176634e-19, # C |
| 9 | + "atomic unit of length": 5.29177210903e-11, # m |
| 10 | + "atomic unit of energy": 4.3597447222071e-18, # J |
| 11 | + "Rydberg constant": 10973731.568160, # m^-1 |
| 12 | + "Planck constant": 6.62607015e-34, # J·s |
| 13 | + "speed of light in vacuum": 299792458, # m·s^-1 |
| 14 | +} |
| 15 | + |
| 16 | + |
| 17 | +def scipy_constant_value(key: str) -> float: |
| 18 | + return physical_constants[key] |
| 19 | + |
6 | 20 |
|
7 | | -AVOGADRO = constants.Avogadro # Avagadro constant |
8 | | -ELE_CHG = constants.elementary_charge # Elementary Charge, in C |
9 | | -BOHR = constants.value("atomic unit of length") # Bohr, in m |
10 | | -HARTREE = constants.value("atomic unit of energy") # Hartree, in Jole |
11 | | -RYDBERG = constants.Rydberg * constants.h * constants.c # Rydberg, in Jole |
| 21 | +AVOGADRO = scipy_constant_value("Avogadro constant") # Avagadro constant |
| 22 | +ELE_CHG = scipy_constant_value("elementary charge") # Elementary Charge, in C |
| 23 | +BOHR = scipy_constant_value("atomic unit of length") # Bohr, in m |
| 24 | +HARTREE = scipy_constant_value("atomic unit of energy") # Hartree, in Jole |
| 25 | +RYDBERG = ( |
| 26 | + scipy_constant_value("Rydberg constant") |
| 27 | + * scipy_constant_value("Planck constant") |
| 28 | + * scipy_constant_value("speed of light in vacuum") |
| 29 | +) # Rydberg, in Jole |
12 | 30 |
|
13 | 31 | # energy conversions |
14 | 32 | econvs = { |
|
0 commit comments