Skip to content

Commit

Permalink
Merge pull request #22 from avcopan/main
Browse files Browse the repository at this point in the history
Bug fix: Build coordinate system w/o s-axis
  • Loading branch information
sgoodlett authored Nov 29, 2023
2 parents ebfd7d1 + 8cd8848 commit d56e630
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions molsym/symtext/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,13 @@ def rotate_mol_to_symels(mol, paxis, saxis):
return mol, rmat, rmat_inv
z = paxis
if np.isclose(np.linalg.norm(saxis), 0.0, atol=global_tol):
trial_vec = np.array([1.0,0.0,0.0])
if np.isclose(np.dot(trial_vec, z), 1.0, atol=global_tol):
trial_vec = np.array([0.0,1.0,0.0])
x = normalize(np.cross(trial_vec, z))
# Find a trial vector that works
x = None
for trial_vec in np.eye(3):
x = np.cross(trial_vec, z)
if not np.isclose(np.linalg.norm(x), 0, atol=global_tol):
x = normalize(x)
break
y = normalize(np.cross(z, x))
else:
x = saxis
Expand Down

0 comments on commit d56e630

Please sign in to comment.