-
Notifications
You must be signed in to change notification settings - Fork 33
ComputeAngle
dstoeckel edited this page Mar 16, 2015
·
2 revisions
Use BALL's Angle
-Class:
#include <BALL/STRUCTURE/geometricProperties.h>
#include <BALL/KERNEL/atom.h>
#include <BALL/MATHS/angle.h>
#include <BALL/COMMON/constants.h>
using namespace BALL;
...
Angle angle1 = Angle(-47.,false)
Angle angle2 = Angle(Constants::PI,true);
...
Atom a1, a2, a3, a4;
...
Angle angle3 = calculateTorsionAngle( a1, a2, a3, a4);
std::cout << "degree: " << angle3.toDegree() << std::endl;
std::cout << "radian: " << angle3.toRadian() << std::endl;
...
Vector3 v1, v2;
...
Angle angle4 = v1.getAngle(v2);
Note: Using true as second parameter in the constructor regards the given value as radian, false as degree. Since BALL's internal setting is radianly, we strongly invite you to use radian as well :-)
For the computation of backbone torsional angles BALL offers convenience functions:
Residue* residue = ...
Angle phi = residue->getTorsionPhi();
Angle psi = residue->getTorsionPsi();
from BALL import *
import math
angle1 = Angle(Constant.PI, True)
angle2 = Angle(math.pi, False)
a1 = Atom()
a2 = Atom()
a3 = Atom()
a4 = Atom()
...
angle3 = calculateTorsionAngle( a1, a2, a3, a4)
print "degree: ", angle3.toDegree()
print "radian: ", angle3.toRadian()
v1 = Vector3(1, 0, 0)
v2 = Vector3(0, 0, 1)
angle4 = v1.getAngle(v2)
print angle4.toRadian(), angle4.toDegree()