/
periodictable.py
237 lines (230 loc) · 5.47 KB
/
periodictable.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
from typing import Union
import torch
import numpy as np
from dqc.utils.datastruct import ZType
periodic_table_atomz = {
"H": 1,
"He": 2,
"Li": 3,
"Be": 4,
"B": 5,
"C": 6,
"N": 7,
"O": 8,
"F": 9,
"Ne": 10,
"Na": 11,
"Mg": 12,
"Al": 13,
"Si": 14,
"P": 15,
"S": 16,
"Cl": 17,
"Ar": 18,
"K": 19,
"Ca": 20,
"Sc": 21,
"Ti": 22,
"V": 23,
"Cr": 24,
"Mn": 25,
"Fe": 26,
"Co": 27,
"Ni": 28,
"Cu": 29,
"Zn": 30,
"Ga": 31,
"Ge": 32,
"As": 33,
"Se": 34,
"Br": 35,
"Kr": 36,
"Rb": 37,
"Sr": 38,
"Y": 39,
"Zr": 40,
"Nb": 41,
"Mo": 42,
"Tc": 43,
"Ru": 44,
"Rh": 45,
"Pd": 46,
"Ag": 47,
"Cd": 48,
"In": 49,
"Sn": 50,
"Sb": 51,
"Te": 52,
"I": 53,
"Xe": 54,
}
atom_masses = { # isotope-averaged atom masses in a.m.u.
# from https://www.angelo.edu/faculty/kboudrea/periodic/structure_mass.htm
1: 1.00797,
2: 4.00260,
3: 6.941,
4: 9.01218,
5: 10.81,
6: 12.011,
7: 14.0067,
8: 15.9994,
9: 18.998403,
10: 20.179,
11: 22.98977,
12: 24.305,
13: 26.98154,
14: 28.0855,
15: 30.97376,
16: 32.06,
17: 35.453,
18: 39.948,
19: 39.0983,
20: 40.08,
21: 44.9559,
22: 47.90,
23: 50.9415,
24: 51.996,
25: 54.9380,
26: 55.847,
27: 58.9332,
28: 58.70,
29: 63.546,
30: 65.38,
31: 69.72,
32: 72.59,
33: 74.9216,
34: 78.96,
35: 79.904,
36: 83.80,
37: 85.4678,
38: 87.62,
39: 88.9059,
40: 91.22,
41: 92.9064,
42: 95.94,
43: 98.,
44: 101.07,
45: 102.9055,
46: 106.4,
47: 107.868,
48: 112.41,
49: 114.82,
50: 118.69,
51: 121.75,
53: 126.9045,
52: 127.60,
54: 131.30,
}
# JCP 41, 3199 (1964); DOI:10.1063/1.1725697
# taken from PySCF:
# https://github.com/pyscf/pyscf/blob/45582e915e91890722fcae2bc30fb04867d5c95f/pyscf/data/radii.py#L23
# I don't know why H has 0.35 while in the reference it is 0.
# They are in angstrom, so we need to convert it to Bohr
atom_bragg_radii = list(np.array([
2.00, # Ghost atom
0.35, 1.40, # 1s
1.45, 1.05, 0.85, 0.70, 0.65, 0.60, 0.50, 1.50, # 2s2p
1.80, 1.50, 1.25, 1.10, 1.00, 1.00, 1.00, 1.80, # 3s3p
2.20, 1.80, # 4s
1.60, 1.40, 1.35, 1.40, 1.40, 1.40, 1.35, 1.35, 1.35, 1.35, # 3d
1.30, 1.25, 1.15, 1.15, 1.15, 1.90, # 4p
2.35, 2.00, # 5s
1.80, 1.55, 1.45, 1.45, 1.35, 1.30, 1.35, 1.40, 1.60, 1.55, # 4d
1.55, 1.45, 1.45, 1.40, 1.40, 2.10, # 5p
2.60, 2.15, # 6s
1.95, 1.85, 1.85, 1.85, 1.85, 1.85, 1.85, # La, Ce-Eu
1.80, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75, # Gd, Tb-Lu
1.55, 1.45, 1.35, 1.35, 1.30, 1.35, 1.35, 1.35, 1.50, # 5d
1.90, 1.80, 1.60, 1.90, 1.45, 2.10, # 6p
1.80, 2.15, # 7s
1.95, 1.80, 1.80, 1.75, 1.75, 1.75, 1.75,
1.75, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75,
1.75, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75,
1.75, 1.75, 1.75, 1.75, 1.75, 1.75,
1.75, 1.75,
1.75, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75, 1.75]) / 0.52917721092)
atom_expected_radii = [1.0, # Ghost atom
1.0, # 1
0.927272, # 2
3.873661, # 3
2.849396, # 4
2.204757, # 5
1.714495, # 6
1.409631, # 7
1.232198, # 8
1.084786, # 9
0.965273, # 10
4.208762, # 11
3.252938, # 12
3.433889, # 13
2.752216, # 14
2.322712, # 15
2.060717, # 16
1.842024, # 17
1.662954, # 18
5.243652, # 19
4.218469, # 20
3.959716, # 21
3.778855, # 22
3.626288, # 23
3.675012, # 24
3.381917, # 25
3.258487, # 26
3.153572, # 27
3.059109, # 28
3.330979, # 29
2.897648, # 30
3.424103, # 31
2.866859, # 32
2.512233, # 33
2.299617, # 34
2.111601, # 35
1.951590, # 36
5.631401, # 37
4.632850, # 38
4.299870, # 39
4.091705, # 40
3.985219, # 41
3.841740, # 42
3.684647, # 43
3.735235, # 44
3.702057, # 45
1.533028, # 46
3.655961, # 47
3.237216, # 48
3.777242, # 49
3.248093, # 50
2.901067, # 51
2.691328, # 52
2.501704, # 53
2.337950] # 54
def get_atomz(elmt: Union[str, ZType]) -> ZType:
# returns the atomic number from the given element
if isinstance(elmt, str):
return periodic_table_atomz[elmt]
elif isinstance(elmt, torch.Tensor):
assert elmt.numel() == 1
return elmt
else: # float or int
return elmt
def get_atom_mass(atomz: int) -> float:
# returns the atomic mass in atomic unit
return atom_masses[atomz] * 1822.888486209
def get_period(atz: int) -> int:
# get the period of the given atom z
if atz <= 2:
return 1
elif atz <= 10:
return 2
elif atz <= 18:
return 3
elif atz <= 36:
return 4
elif atz <= 54:
return 5
elif atz <= 86:
return 6
elif atz <= 118:
return 7
else:
raise RuntimeError("Unimplemented atomz: %d" % atz)