3d-dart/server/system/NAfunctionLib.py
def calc_torsion_angle(a1, a2, a3, a4):
    	
	"""Calculates the torsion angle between the four argument atoms."""
    	
	if a1 == None or a2 == None or a3 == None or a4 == None:
        	return None

	a12 = a2.position - a1.position
	a23 = a3.position - a2.position
	a34 = a4.position - a3.position

	n12 = cross(a12, a23)
	n34 = cross(a23, a34)

	n12 = n12 / length(n12)
	n34 = n34 / length(n34)

	cross_n12_n34  = cross(n12, n34)
	direction      = cross_n12_n34 * a23
	scalar_product = numpy.dot(n12, n34)

	if scalar_product > 1.0:
            	scalar_product = 1.0
	if scalar_product < -1.0:
        	scalar_product = -1.0

	angle = math.acos(scalar_product)
	
	return angle
Calculates the torsion angle between the four argument atoms.
Calculates the torsion angle between the four argument atoms.
Calculates the torsion angle between the four argument atoms .
def calc_torsion_angle(a1, a2, a3, a4):
	if a1 == None or a2 == None or a3 == None or a4 == None:
        	return None
	a12 = a2.position - a1.position
	a23 = a3.position - a2.position
	a34 = a4.position - a3.position
	n12 = cross(a12, a23)
	n34 = cross(a23, a34)
	n12 = n12 / length(n12)
	n34 = n34 / length(n34)
	cross_n12_n34  = cross(n12, n34)
	direction      = cross_n12_n34 * a23
	scalar_product = numpy.dot(n12, n34)
	if scalar_product > 1.0:
            	scalar_product = 1.0
	if scalar_product < -1.0:
        	scalar_product = -1.0
	angle = math.acos(scalar_product)
	return angle
def calc_torsion_angle ( a1 , a2 , a3 , a4 ) : if a1 == None or a2 == None or a3 == None or a4 == None : return None a12 = a2 . position - a1 . position a23 = a3 . position - a2 . position a34 = a4 . position - a3 . position n12 = cross ( a12 , a23 ) n34 = cross ( a23 , a34 ) n12 = n12 / length ( n12 ) n34 = n34 / length ( n34 ) cross_n12_n34 = cross ( n12 , n34 ) direction = cross_n12_n34 * a23 scalar_product = numpy . dot ( n12 , n34 ) if scalar_product > 1.0 : scalar_product = 1.0 if scalar_product < - 1.0 : scalar_product = - 1.0 angle = math . acos ( scalar_product ) return angle
Calculates the torsion angle between the four argument atoms.
Calculates the torsion angle between the four argument atoms .
"""Calculates the torsion angle between the four argument atoms."""
a1
a2
a3
a4