Example #1
0
 def _N2oneH(self, atom, known, unknown):
     r = atom.position()
     r1 = known[0].position()
     others = filter(lambda a: a.symbol != 'H', known[0].bondedTo())
     r2 = others[0].position()
     try:
         plane = Objects3D.Plane(r, r1, r2)
     except ZeroDivisionError:
         # We get here when all three points are colinear.
         # Add a small random displacement as a fix.
         from MMTK.Random import randomPointInSphere
         plane = Objects3D.Plane(r, r1, r2 + randomPointInSphere(0.001))
     axis = (r - r1).normal()
     cone = Objects3D.Cone(r, axis, 0.5 * self._hch_angle)
     sphere = Objects3D.Sphere(r, self._nh_bond)
     circle = sphere.intersectWith(cone)
     points = circle.intersectWith(plane)
     unknown[0].setPosition(points[0])
Example #2
0
 def _N2oneH(self, atom, known, unknown):
     r = atom.position()
     r1 = known[0].position()
     others = filter(lambda a: a.symbol != 'H', known[0].bondedTo())
     r2 = others[0].position()
     try:
         plane = Objects3D.Plane(r, r1, r2)
     except ZeroDivisionError:
         # We get here when all three points are colinear.
         # Add a small random displacement as a fix.
         from MMTK.Random import randomPointInSphere
         plane = Objects3D.Plane(r, r1, r2 + randomPointInSphere(0.001))
     axis = (r-r1).normal()
     cone = Objects3D.Cone(r, axis, 0.5*self._hch_angle)
     sphere = Objects3D.Sphere(r, self._nh_bond)
     circle = sphere.intersectWith(cone)
     points = circle.intersectWith(plane)
     unknown[0].setPosition(points[0])