Skip to content

Commit dbe767e

Browse files
Merge branch 'devel' into pre-commit-ci-update-config
2 parents 5835c6d + 18ba98d commit dbe767e

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
## Installation
1010

11-
DP-GEN only supports Python 3.7 and above. You can [setup a conda/pip environment](https://docs.deepmodeling.com/faq/conda.html), and then use one of the following methods to install DP-GEN:
11+
dpdata only supports Python 3.7 and above. You can [setup a conda/pip environment](https://docs.deepmodeling.com/faq/conda.html), and then use one of the following methods to install dpdata:
1212

1313
- Install via pip: `pip install dpdata`
1414
- Install via conda: `conda install -c conda-forge dpdata`

dpdata/unit.py

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,31 @@
22

33
from abc import ABC
44

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+
620

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
1230

1331
# energy conversions
1432
econvs = {

0 commit comments

Comments
 (0)