Skip to content

Commit 1a134b7

Browse files
committed
Refactor some column sorting.
I think the previous might have left the final column in an undetermined state. And this might be quicker (fewer loops) and cleaner Python.
1 parent cba999e commit 1a134b7

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

arkane/statmech.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,14 +1101,10 @@ def project_rotors(conformer, hessian, rotors, linear, is_ts, get_projected_out_
11011101

11021102
# Order p, there will be vectors that are 0.0
11031103
i = 0
1104-
while i < 3 * n_atoms:
1105-
norm = 0.0
1106-
for j in range(3 * n_atoms):
1107-
norm += p[j, i] * p[j, i]
1108-
if norm < 0.5:
1109-
p[:, i:3 * n_atoms + external - 1] = p[:, i + 1:3 * n_atoms + external]
1110-
else:
1111-
i += 1
1104+
is_zero_column = (p*p).sum(axis=0) < 0.5
1105+
# put the columns that are zeros at the end
1106+
temporary = np.hstack((p[:, ~is_zero_column], p[:, is_zero_column]))
1107+
p[:, :] = temporary
11121108

11131109
# T is the transformation vector from cartesian to internal coordinates
11141110
T = np.zeros((n_atoms * 3, 3 * n_atoms - external), float)

0 commit comments

Comments
 (0)