Skip to content

Commit f023556

Browse files
committed
dropped periodictable dependency
1 parent ee9090f commit f023556

File tree

5 files changed

+226
-30
lines changed

5 files changed

+226
-30
lines changed

pixi.lock

Lines changed: 1 addition & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

prism_pruner/graph_manipulations.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
import numpy as np
66
from networkx import Graph, all_simple_paths, from_numpy_array, set_node_attributes
7-
from periodictable import elements
87
from scipy.spatial.distance import cdist
98

109
from prism_pruner.algebra import dihedral
10+
from prism_pruner.periodic_table import RADII_TABLE
1111
from prism_pruner.typing import Array1D_bool, Array1D_str, Array2D_float
1212

1313

1414
@lru_cache()
1515
def d_min_bond(a1: str, a2: str, factor: float = 1.2) -> float:
1616
"""Return the bond distance between two atoms."""
17-
return factor * (elements.symbol(a1).covalent_radius + elements.symbol(a2).covalent_radius) # type: ignore [no-any-return]
17+
return factor * (RADII_TABLE[a1] + RADII_TABLE[a2])
1818

1919

2020
def graphize(

prism_pruner/periodic_table.py

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
"""Atomic Masses and Covalent Radii."""
2+
3+
MASSES_TABLE = {
4+
"H": 1.00800,
5+
"He": 4.00260,
6+
"Li": 6.94000,
7+
"Be": 9.01218,
8+
"B": 10.81000,
9+
"C": 12.01100,
10+
"N": 14.00700,
11+
"O": 15.99900,
12+
"F": 18.99840,
13+
"Ne": 20.17970,
14+
"Na": 22.98977,
15+
"Mg": 24.30500,
16+
"Al": 26.98154,
17+
"Si": 28.08500,
18+
"P": 30.97376,
19+
"S": 32.06000,
20+
"Cl": 35.45000,
21+
"Ar": 39.95000,
22+
"K": 39.09830,
23+
"Ca": 40.07800,
24+
"Sc": 44.95591,
25+
"Ti": 47.86700,
26+
"V": 50.94150,
27+
"Cr": 51.99610,
28+
"Mn": 54.93804,
29+
"Fe": 55.84500,
30+
"Co": 58.93319,
31+
"Ni": 58.69340,
32+
"Cu": 63.54600,
33+
"Zn": 65.38000,
34+
"Ga": 69.72300,
35+
"Ge": 72.63000,
36+
"As": 74.92159,
37+
"Se": 78.97100,
38+
"Br": 79.90400,
39+
"Kr": 83.79800,
40+
"Rb": 85.46780,
41+
"Sr": 87.62000,
42+
"Y": 88.90584,
43+
"Zr": 91.22400,
44+
"Nb": 92.90637,
45+
"Mo": 95.95000,
46+
"Tc": 98.00000,
47+
"Ru": 101.07000,
48+
"Rh": 102.90549,
49+
"Pd": 106.42000,
50+
"Ag": 107.86820,
51+
"Cd": 112.41400,
52+
"In": 114.81800,
53+
"Sn": 118.71000,
54+
"Sb": 121.76000,
55+
"Te": 127.60000,
56+
"I": 126.90447,
57+
"Xe": 131.29300,
58+
"Cs": 132.90545,
59+
"Ba": 137.32700,
60+
"La": 138.90547,
61+
"Ce": 140.11600,
62+
"Pr": 140.90766,
63+
"Nd": 144.24200,
64+
"Pm": 145.00000,
65+
"Sm": 150.36000,
66+
"Eu": 151.96400,
67+
"Gd": 157.25000,
68+
"Tb": 158.92535,
69+
"Dy": 162.50000,
70+
"Ho": 164.93033,
71+
"Er": 167.25900,
72+
"Tm": 168.93422,
73+
"Yb": 173.04500,
74+
"Lu": 174.96680,
75+
"Hf": 178.48600,
76+
"Ta": 180.94788,
77+
"W": 183.84000,
78+
"Re": 186.20700,
79+
"Os": 190.23000,
80+
"Ir": 192.21700,
81+
"Pt": 195.08400,
82+
"Au": 196.96657,
83+
"Hg": 200.59200,
84+
"Tl": 204.38000,
85+
"Pb": 207.20000,
86+
"Bi": 208.98040,
87+
"Po": 209.00000,
88+
"At": 210.00000,
89+
"Rn": 222.00000,
90+
"Fr": 223.00000,
91+
"Ra": 226.00000,
92+
"Ac": 227.00000,
93+
"Th": 232.03770,
94+
"Pa": 231.03588,
95+
"U": 238.02891,
96+
"Np": 237.00000,
97+
"Pu": 244.00000,
98+
"Am": 243.00000,
99+
"Cm": 247.00000,
100+
"Bk": 247.00000,
101+
"Cf": 251.00000,
102+
"Es": 252.00000,
103+
"Fm": 257.00000,
104+
"Md": 258.00000,
105+
"No": 259.00000,
106+
"Lr": 262.00000,
107+
"Rf": 261.00000,
108+
"Db": 262.00000,
109+
"Sg": 266.00000,
110+
"Bh": 264.00000,
111+
"Hs": 277.00000,
112+
"Mt": 268.00000,
113+
"Ds": 281.00000,
114+
"Rg": 272.00000,
115+
"Cn": 285.00000,
116+
"Nh": 286.00000,
117+
"Fl": 289.00000,
118+
"Mc": 289.00000,
119+
"Lv": 293.00000,
120+
"Ts": 294.00000,
121+
"Og": 294.00000,
122+
}
123+
124+
RADII_TABLE = {
125+
"H": 0.31,
126+
"He": 0.28,
127+
"Li": 1.28,
128+
"Be": 0.96,
129+
"B": 0.84,
130+
"C": 0.76,
131+
"N": 0.71,
132+
"O": 0.66,
133+
"F": 0.57,
134+
"Ne": 0.58,
135+
"Na": 1.66,
136+
"Mg": 1.41,
137+
"Al": 1.21,
138+
"Si": 1.11,
139+
"P": 1.07,
140+
"S": 1.05,
141+
"Cl": 1.02,
142+
"Ar": 1.06,
143+
"K": 2.03,
144+
"Ca": 1.76,
145+
"Sc": 1.70,
146+
"Ti": 1.60,
147+
"V": 1.53,
148+
"Cr": 1.39,
149+
"Mn": 1.39,
150+
"Fe": 1.32,
151+
"Co": 1.26,
152+
"Ni": 1.24,
153+
"Cu": 1.32,
154+
"Zn": 1.22,
155+
"Ga": 1.22,
156+
"Ge": 1.20,
157+
"As": 1.19,
158+
"Se": 1.20,
159+
"Br": 1.20,
160+
"Kr": 1.16,
161+
"Rb": 2.20,
162+
"Sr": 1.95,
163+
"Y": 1.90,
164+
"Zr": 1.75,
165+
"Nb": 1.64,
166+
"Mo": 1.54,
167+
"Tc": 1.47,
168+
"Ru": 1.46,
169+
"Rh": 1.42,
170+
"Pd": 1.39,
171+
"Ag": 1.45,
172+
"Cd": 1.44,
173+
"In": 1.42,
174+
"Sn": 1.39,
175+
"Sb": 1.39,
176+
"Te": 1.38,
177+
"I": 1.39,
178+
"Xe": 1.40,
179+
"Cs": 2.44,
180+
"Ba": 2.15,
181+
"La": 2.07,
182+
"Ce": 2.04,
183+
"Pr": 2.03,
184+
"Nd": 2.01,
185+
"Pm": 1.99,
186+
"Sm": 1.98,
187+
"Eu": 1.98,
188+
"Gd": 1.96,
189+
"Tb": 1.94,
190+
"Dy": 1.92,
191+
"Ho": 1.92,
192+
"Er": 1.89,
193+
"Tm": 1.90,
194+
"Yb": 1.87,
195+
"Lu": 1.87,
196+
"Hf": 1.75,
197+
"Ta": 1.70,
198+
"W": 1.62,
199+
"Re": 1.51,
200+
"Os": 1.44,
201+
"Ir": 1.41,
202+
"Pt": 1.36,
203+
"Au": 1.36,
204+
"Hg": 1.32,
205+
"Tl": 1.45,
206+
"Pb": 1.46,
207+
"Bi": 1.48,
208+
"Po": 1.40,
209+
"At": 1.50,
210+
"Rn": 1.50,
211+
"Fr": 2.60,
212+
"Ra": 2.21,
213+
"Ac": 2.15,
214+
"Th": 2.06,
215+
"Pa": 2.00,
216+
"U": 1.96,
217+
"Np": 1.90,
218+
"Pu": 1.87,
219+
"Am": 1.80,
220+
"Cm": 1.69,
221+
}

prism_pruner/pruner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
import numpy as np
88
from networkx import Graph, connected_components
9-
from periodictable import elements
109
from scipy.spatial.distance import cdist
1110

1211
from prism_pruner.algebra import get_inertia_moments
1312
from prism_pruner.graph_manipulations import graphize
13+
from prism_pruner.periodic_table import MASSES_TABLE
1414
from prism_pruner.rmsd import rmsd_and_max
1515
from prism_pruner.torsion_module import (
1616
get_angles,
@@ -647,7 +647,7 @@ def prune_by_moment_of_inertia(
647647
max_dE=max_dE,
648648
debugfunction=debugfunction,
649649
max_dev=max_deviation,
650-
masses=np.array([elements.symbol(a).mass for a in atoms]),
650+
masses=np.array([MASSES_TABLE[a] for a in atoms]),
651651
)
652652

653653
return _run(prunerconfig)

pyproject.toml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ requires-python = ">=3.12"
1010
dependencies = [
1111
"networkx>=3.0",
1212
"numpy>=2.0",
13-
"periodictable",
1413
"scipy>=1.10",
1514
"tqdm>=4"
1615
]
@@ -104,10 +103,6 @@ ignore_missing_imports = true
104103
module = "networkx.*"
105104
ignore_missing_imports = true
106105

107-
[[tool.mypy.overrides]]
108-
module = "periodictable.*"
109-
ignore_missing_imports = true
110-
111106
[tool.pytest.ini_options]
112107
testpaths = ["tests", "prism_pruner"]
113108
addopts = "--doctest-modules"

0 commit comments

Comments
 (0)