def minor_pair(universe, i, bp, seg1="SYSTEM", seg2="SYSTEM"): """Minor-Groove basepair distance for residue *i* with residue *bp*. The distance of the nitrogen and oxygen atoms in a Minor-groove hydrogen bond is computed. :Arguments: *universe* :class:`~MDAnalysis.core.AtomGroup.Universe` containing the trajectory *seg1* segment id for first base *i* resid of the first base *seg2* segment id for second base *bp* resid of the second base NOTE: if failure occurs be sure to check the segment identification .. versionadded:: 0.7.6 """ if universe.selectAtoms(" resid %s " % (i,)).resnames()[0] in ["DC", "DT", "U", "C", "T", "CYT", "THY", "URA"]: a1, a2 = "O2", "C2" if universe.selectAtoms(" resid %s " % (i,)).resnames()[0] in ["DG", "DA", "A", "G", "ADE", "GUA"]: a1, a2 = "C2", "O2" c2o2_dist = universe.selectAtoms( " (segid %s and resid %s and name %s) or (segid %s and resid %s and name %s) " % (seg1, i, a1, seg2, bp, a2)) c2o2 = norm(c2o2_dist[0].pos - c2o2_dist[1].pos) return c2o2
def calc_eucl_distance(self, a1, a2): """Calculate the Euclidean distance between two atoms. """ return norm(a2.pos - a1.pos)
def testNormRandom(self): for x in numpy.random.uniform(0, pi, 20): r = numpy.random.uniform(0, 1000) v = r * numpy.array([cos(x), sin(x), 0]) assert_almost_equal(util.norm(v), r, 6)
def testNormNullVector(self): assert_equal(util.norm(self.null), 0.0)
def testNorm(self): assert_equal(util.norm(self.e3), 1) assert_equal(util.norm(self.a), numpy.linalg.norm(self.a))
def _calc_angle(self,xyz): a = xyz[0, :] - xyz[1, :] b = xyz[2, :] - xyz[1, :] return np.rad2deg(np.arccos(np.dot(a, b) / (mdutil.norm(a) * mdutil.norm(b))))
def _calc_bond(self,xyz): return mdutil.norm(xyz[0, :] - xyz[1, :])