Ejemplo n.º 1
0
 def testAngleAxisToQuaternion(self):
     q = Quaternion()
     q.identity()
     angle = 1.57
     axis = Axis3(x = -0.340, y = -0.940, z = 0.000)
     q.set_angle_axis(angle, axis)
     self.assertEquals(str(q), "Quaternion: 0.7074 + -0.2404i + -0.6647j + 0.0000k")
Ejemplo n.º 2
0
 def twist(self, angles):
     ''' apply the torsion angles.
         alway do twist before transform anything
     '''
     if len(angles)!=len(self.torsions):
         raise Exception('bad torsion parameter size')
     for angle,torsion in zip(angles,self.torsions):
         quat=Quaternion()
         quat.set_angle_axis(angle,torsion.axis)
         torParam=quat.getRot()
         for atom in [x for x in self.atoms if x.no in torsion.torList]:
             #print torsion.torList
             atom.coords = atom.coords - torsion.base
             atom.coords.transform(torParam,torsion.base)