Skip to content

Commit 297f940

Browse files
JamesOBrien2RMeli
andauthored
Apply suggestions from code review
Co-authored-by: Rocco Meli <r.meli@bluemail.ch> Co-authored-by: James <144615809+JamesOBrien2@users.noreply.github.com>
1 parent 29dde39 commit 297f940

5 files changed

Lines changed: 26 additions & 130 deletions

File tree

docs/source/xyzgraph_adapter.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ xyzgraph Adapter
22
================
33

44
``spyrmsd`` can use `xyzgraph <https://github.com/aligfellow/xyzgraph>`_ as an
5-
optional adjacency builder for molecular graph construction.
5+
optional adjacency matrix builder for molecular graph construction.
66

77
Install the optional dependency with:
88

@@ -36,5 +36,5 @@ Example
3636
)
3737
3838
.. note::
39-
The default graph builder remains the built-in ``simple`` path. The
40-
``xyzgraph`` adapter is opt-in.
39+
The default graph builder remains the built-in ``simple`` one,
40+
based on distance and VdW radii. The ``xyzgraph`` adapter is opt-in.

spyrmsd/__main__.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ def build_parser() -> ap.ArgumentParser:
3232
parser.add_argument(
3333
"--graph-builder",
3434
dest="graph_builder",
35-
choices=("xyzgraph",),
36-
default=None,
35+
choices=("simple","xyzgraph"),
36+
default="simple",
3737
help="Use optional adjacency builder (xyzgraph: Molecular Graph Construction from Cartesian Coordinates)",
3838
)
3939
parser.add_argument(
@@ -53,7 +53,7 @@ def build_parser() -> ap.ArgumentParser:
5353
return parser
5454

5555

56-
def main(argv: Optional[Sequence[str]] = None) -> int:
56+
def main() -> int:
5757
parser = build_parser()
5858
args = parser.parse_args(argv)
5959
graph._set_graph_builder("simple")
@@ -117,8 +117,8 @@ def main(argv: Optional[Sequence[str]] = None) -> int:
117117
strip=not args.hydrogens,
118118
)
119119

120-
for value in rmsd_list:
121-
print(f"{value:.5f}")
120+
for rmsd in rmsd_list:
121+
print(f"{rmsd:.5f}")
122122

123123
return 0
124124

spyrmsd/adapters/simple.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Simple built-in adjacency builder.
2+
Simple built-in adjacency matrix builder.
33
"""
44

55
import numpy as np
@@ -11,7 +11,7 @@ def adjacency_matrix_from_atomic_coordinates(
1111
aprops: np.ndarray, coordinates: np.ndarray
1212
) -> np.ndarray:
1313
"""
14-
Compute an adjacency matrix with the built-in distance heuristic.
14+
Compute an adjacency matrix with a distance heuristic.
1515
"""
1616

1717
n = len(aprops)

spyrmsd/constants.py

Lines changed: 14 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -15,126 +15,22 @@
1515

1616
_anum_to_symbol_data = (
1717
"",
18-
"H",
19-
"He",
20-
"Li",
21-
"Be",
22-
"B",
23-
"C",
24-
"N",
25-
"O",
26-
"F",
27-
"Ne",
28-
"Na",
29-
"Mg",
30-
"Al",
31-
"Si",
32-
"P",
33-
"S",
34-
"Cl",
35-
"Ar",
36-
"K",
37-
"Ca",
38-
"Sc",
39-
"Ti",
40-
"V",
41-
"Cr",
42-
"Mn",
43-
"Fe",
44-
"Co",
45-
"Ni",
46-
"Cu",
47-
"Zn",
48-
"Ga",
49-
"Ge",
50-
"As",
51-
"Se",
52-
"Br",
53-
"Kr",
54-
"Rb",
55-
"Sr",
56-
"Y",
57-
"Zr",
58-
"Nb",
59-
"Mo",
60-
"Tc",
61-
"Ru",
62-
"Rh",
63-
"Pd",
64-
"Ag",
65-
"Cd",
66-
"In",
67-
"Sn",
68-
"Sb",
69-
"Te",
70-
"I",
71-
"Xe",
72-
"Cs",
73-
"Ba",
74-
"La",
75-
"Ce",
76-
"Pr",
77-
"Nd",
78-
"Pm",
79-
"Sm",
80-
"Eu",
81-
"Gd",
82-
"Tb",
83-
"Dy",
84-
"Ho",
85-
"Er",
86-
"Tm",
87-
"Yb",
88-
"Lu",
89-
"Hf",
90-
"Ta",
91-
"W",
92-
"Re",
93-
"Os",
94-
"Ir",
95-
"Pt",
96-
"Au",
97-
"Hg",
98-
"Tl",
99-
"Pb",
100-
"Bi",
101-
"Po",
102-
"At",
103-
"Rn",
104-
"Fr",
105-
"Ra",
106-
"Ac",
107-
"Th",
108-
"Pa",
109-
"U",
110-
"Np",
111-
"Pu",
112-
"Am",
113-
"Cm",
114-
"Bk",
115-
"Cf",
116-
"Es",
117-
"Fm",
118-
"Md",
119-
"No",
120-
"Lr",
121-
"Rf",
122-
"Db",
123-
"Sg",
124-
"Bh",
125-
"Hs",
126-
"Mt",
127-
"Ds",
128-
"Rg",
129-
"Cn",
130-
"Nh",
131-
"Fl",
132-
"Mc",
133-
"Lv",
134-
"Ts",
135-
"Og",
18+
"H", "He",
19+
"Li", "Be", "B", "C", "N", "O", "F", "Ne",
20+
"Na", "Mg", "Al", "Si", "P", "S", "Cl", "Ar",
21+
"K", "Ca", "Sc", "Ti", "V", "Cr", "Mn", "Fe", "Co", "Ni", "Cu", "Zn",
22+
"Ga", "Ge", "As", "Se", "Br", "Kr",
23+
"Rb", "Sr", "Y", "Zr", "Nb", "Mo", "Tc", "Ru", "Rh", "Pd", "Ag", "Cd",
24+
"In", "Sn", "Sb", "Te", "I", "Xe",
25+
"Cs", "Ba", "La", "Ce", "Pr", "Nd", "Pm", "Sm", "Eu", "Gd", "Tb", "Dy",
26+
"Ho", "Er", "Tm", "Yb", "Lu", "Hf", "Ta", "W", "Re", "Os", "Ir", "Pt",
27+
"Au", "Hg", "Tl", "Pb", "Bi", "Po", "At", "Rn",
28+
"Fr", "Ra", "Ac", "Th", "Pa", "U", "Np", "Pu", "Am", "Cm", "Bk", "Cf",
29+
"Es", "Fm", "Md", "No", "Lr", "Rf", "Db", "Sg", "Bh", "Hs", "Mt", "Ds",
30+
"Rg", "Cn", "Nh", "Fl", "Mc", "Lv", "Ts", "Og",
13631
)
13732

33+
13834
anum_to_symbol: Dict = {
13935
anum: symbol for anum, symbol in enumerate(_anum_to_symbol_data) if anum > 0
14036
}

spyrmsd/graph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def _validate_graph_builder(graph_builder):
196196
return graph_builder
197197

198198

199-
def _set_graph_builder(graph_builder):
199+
def set_graph_builder(graph_builder):
200200
"""
201201
Set graph builder used for adjacency construction.
202202
"""
@@ -210,7 +210,7 @@ def _set_graph_builder(graph_builder):
210210
_current_graph_builder = graph_builder
211211

212212

213-
def _get_graph_builder():
213+
def get_graph_builder():
214214
"""
215215
Get the current graph builder.
216216
"""

0 commit comments

Comments
 (0)