Skip to content

Commit

Permalink
getDihedral from multi coordsets
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmkrieger committed Oct 23, 2024
1 parent 89aaa64 commit 66906b2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions prody/measure/measure.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from numpy import ndarray, power, sqrt, array, zeros, arccos, dot
from numpy import sign, tile, concatenate, pi, cross, subtract, var
from numpy import unique, where
from numpy import unique, where, divide, power

from prody.atomic import Atomic, Residue, Atom, extendAtomicData
from prody.kdtree import KDTree
Expand Down Expand Up @@ -207,12 +207,12 @@ def getDihedral(coords1, coords2, coords3, coords4, radian=False):
a3 = coords4 - coords3

v1 = cross(a1, a2)
v1 = v1 / (v1 * v1).sum(-1)**0.5
v1 = divide(v1, power((v1 * v1).sum(-1), 0.5).reshape(-1,1))
v2 = cross(a2, a3)
v2 = v2 / (v2 * v2).sum(-1)**0.5
v2 = divide(v2, power((v2 * v2).sum(-1), 0.5).reshape(-1,1))
porm = sign((v1 * a3).sum(-1))
rad = arccos((v1*v2).sum(-1) / ((v1**2).sum(-1) * (v2**2).sum(-1))**0.5)
if not porm == 0:
if not all(porm == 0):
rad = rad * porm
if radian:
return rad
Expand Down

0 comments on commit 66906b2

Please sign in to comment.