Skip to content

Commit

Permalink
Checkpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
charnley committed Jan 2, 2025
1 parent 55c3463 commit 714e793
Show file tree
Hide file tree
Showing 5 changed files with 997 additions and 137 deletions.
34 changes: 8 additions & 26 deletions notebooks/coord_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
from numpy import ndarray


def rotation_matrix(sigma: float) -> ndarray:
def get_rotation_matrix(degrees: float) -> ndarray:
"""https://en.wikipedia.org/wiki/Rotation_matrix"""

radians = sigma * np.pi / 180.0
radians = degrees * np.pi / 180.0

r11 = np.cos(radians)
r12 = -np.sin(radians)
Expand All @@ -21,27 +21,9 @@ def degree2radiant(degrees):
return degrees * np.pi / 180.0


# def find_best_inertia(
# atoms_a,
# coord_a,
# atoms_b,
# coord_b,
# reorder_method=rmsdlib.hungarian,
# rotation_method=rmsdlib.kabsch,
# ):
# """Expect coord are centered"""

# inertia_a = rmsdlib.get_inertia_tensor(atoms_a, coord_a)
# eigval_a, eigvec_a = np.linalg.eig(inertia_a)
# inertia_b = rmsdlib.get_inertia_tensor(atoms_b, coord_b)
# eigval_b, eigvec_b = np.linalg.eig(inertia_b)

# # Align by eignval

# # Enumerate permutation
# U = rmsdlib.kabsch(eigvec_a, eigvec_b)

# # U1 = rotation_matrix_vectors(p_axis, q_axis)
# # U2 = rotation_matrix_vectors(p_axis, -q_axis)

# return
def rotate_coord(angle, coord, axis=[0, 1]):
U = get_rotation_matrix(angle)
_xy = np.dot(coord[:, axis], U)
_coord = np.array(coord, copy=True)
_coord[:, :2] = _xy
return _coord
Loading

0 comments on commit 714e793

Please sign in to comment.