Esempio n. 1
0
def test_superposition():
    n = 4
    crds1 = [v3.random_vector() for i in range(n)]
    random_m = v3.random_rotation()
    crds2 = [v3.transform(random_m, c) for c in crds1]
    rms, m = rmsd.calc_rmsd_rot(crds1, crds2)
    for crd1, crd2 in zip(crds1, crds2):
        assert v3.is_similar_vector(v3.transform(m, crd1), crd2)
Esempio n. 2
0
def test_superposition():
  n = 4
  crds1 = [v3.random_vector() for i in range(n)]
  random_m = v3.random_rotation()
  crds2 = [v3.transform(random_m, c) for c in crds1]
  rms, m = rmsd.calc_rmsd_rot(crds1, crds2)
  for crd1, crd2 in zip(crds1, crds2):
    assert v3.is_similar_vector(v3.transform(m, crd1), crd2)
Esempio n. 3
0
def test_rmsd():
    n = 4
    crds1 = [v3.random_vector() for i in range(n)]
    random_m = v3.random_rotation()
    crds2 = [v3.transform(random_m, c) for c in crds1]
    rms, m = rmsd.calc_rmsd_rot(crds1, crds2)
    assert v3.is_similar_mag(0, rms)
    # test the two algorithms separately
    rms, m = rmsd.pyqcprot_rmsd_rot(crds1, crds2)
    assert v3.is_similar_mag(0, rms)
    if rmsd.is_numpy:
        rms, m = rmsd.numpy_svd_rmsd_rot(crds1, crds2)
        assert v3.is_similar_mag(0, rms)
Esempio n. 4
0
def test_rmsd():
  n = 4
  crds1 = [v3.random_vector() for i in range(n)]
  random_m = v3.random_rotation()
  crds2 = [v3.transform(random_m, c) for c in crds1]
  rms, m = rmsd.calc_rmsd_rot(crds1, crds2)
  assert v3.is_similar_mag(0, rms)
  # test the two algorithms separately
  rms, m = rmsd.pyqcprot_rmsd_rot(crds1, crds2)
  assert v3.is_similar_mag(0, rms)
  if rmsd.is_numpy:
    rms, m = rmsd.numpy_svd_rmsd_rot(crds1, crds2)
    assert v3.is_similar_mag(0, rms)
 def _rmsd_rot_res(self, res1, res2):
     """
     RMSD of arbitrary residue lists, may be out of order or a subset
     of total.
     """
     assert_eq(len(res1), len(res2))
     coords1 = [r.position for r in res1]
     coords2 = [r.position for r in res2]
     center1, coords1 = center_vlist(coords1)
     center2, coords2 = center_vlist(coords2)
     score, rot_matrix = rmsd.calc_rmsd_rot(coords1, coords2)
     return StructuralAlignSolution(
         self, score=score, rot_matrix=rot_matrix, center1=center1, center2=center2, res1=res1, res2=res2
     )