Skip to content

Commit 4f09c1d

Browse files
committed
Refactor constants in constants.py and update read_NRL_tojson.py to use new values for Bohr2Ang, Ryd2eV, and Harte2eV
1 parent f95e9ec commit 4f09c1d

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

dptb/utils/constants.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,17 @@
1313
anglrMId_r = {0:'s',1:'p',2:"d",3:"f",4:"g",5:"h"}
1414

1515
SKBondType = {0:'sigma',1:'pi',2:'delta'}
16-
au2Ang = 0.529177249
17-
Bohr2Ang = 0.529177249
16+
au2Ang = 0.529177210903
17+
Bohr2Ang = 0.529177210903
18+
Harte2eV = 27.211386245988
19+
Ryd2eV = 13.605693122994
20+
21+
dtype_dict = {"float32": torch.float32, "float64": torch.float64}
22+
# k = Boltzmann # k is the Boltzmann constant in old NEGF module
23+
Coulomb = 6.24150974e18 # in the unit of eV*Angstrom
24+
eV2J = 1.6021766208e-19 # in the unit of J
25+
26+
1827
# bond integral index in DFTB sk files. specific.
1928
SKAnglrMHSID = {'dd':np.array([0,1,2]),
2029
'dp':np.array([3,4]), 'pd':np.array([3,4]),
@@ -99,7 +108,3 @@
99108
}
100109

101110

102-
dtype_dict = {"float32": torch.float32, "float64": torch.float64}
103-
# k = Boltzmann # k is the Boltzmann constant in old NEGF module
104-
Coulomb = 6.24150974e18 # in the unit of eV*Angstrom
105-
eV2J = 1.6021766208e-19 # in the unit of J

dptb/utils/read_NRL_tojson.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@
55
import json
66
import logging
77
log = logging.getLogger(__name__)
8+
from dptb.utils.constants import Bohr2Ang, Ryd2eV, Harte2eV
89

9-
bohr2ang = con.value('Bohr radius')*1e10
10-
harte2ev = con.value('Hartree energy in eV')
11-
ryd2ev = con.value('Rydberg constant times hc in eV')
10+
#bohr2ang = con.value('Bohr radius')*1e10
11+
#harte2ev = con.value('Hartree energy in eV')
12+
#ryd2ev = con.value('Rydberg constant times hc in eV')
13+
bohr2ang = Bohr2Ang
14+
ryd2ev = Ryd2eV
15+
harte2ev = Harte2eV
1216

1317
def read_nrl_file(nrl_file):
1418
with open(nrl_file, 'r') as f:

0 commit comments

Comments
 (0)