Question

I have an ensemble of points in a Cartesian space. I can compute dihedral angles defined by a given sub-ensemble of four points (a,b,c,d) using python with numpy. Below are my functions:

def getDihedral(a,b,c,d):
 v1 = getNormedVector(a, b)
 v2 = getNormedVector(b, c)
 v3 = getNormedVector(c, d)
 v1v2 = numpy.cross(v1,v2)
 v2v3 = numpy.cross(v2,v3)
 return getAngle(v1v2,v2v3)

def getNormedVector(a,b):
 return (b-a)/numpy.linalg.norm(b-a)

def getAngle(a,b):
 return numpy.rad2deg(numpy.arccos(numpy.dot(a/numpy.linalg.norm(a),b.T/numpy.linalg.norm(b))))[0,0]

I want to rotate only one dihedral angles, how can I calculate the new coordinates for a sub-ensembles of points using python with numpy and scipy?

Was it helpful?

Solution

If you can compute the dihedral, I assume you can obtain the axis about which you want to rotate you subset of points. Given that, you can easily do this by rotating all points around this axis by the angle you want in vpython - see this example (go to 'rotating a vector'). Otherwise, you need to program the appropriate equation (spelled out in this thread).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top