def test_1(self): import StringIO mol1 = read.readxyz(StringIO.StringIO(test_in_1)) mol2 = read.readxyz(StringIO.StringIO(test_in_2)) self.assertAlmostEqual(_rmsd.rmsd(mol1, mol2), 1.001, 3) self.assertAlmostEqual(_rmsd.rmsd(mol1.coords.take([0], axis=0), mol2.coords.take([0], axis=0)), 0.0)
def rmsd(mol1, mol2, atoms1=None, atoms2=None, mirror=False, loop_step=None): coords1, coords2 = rmsd_common(mol1, mol2, atoms1, atoms2) coords2s = [coords2] if mirror: coords2s.append(-coords2) if loop_step is not None: for t in coords2s[:]: for i in range(loop_step, len(coords2), loop_step): idx = tuple(range(i, len(coords2)) + range(i)) coords2s.append(t.take(idx, axis=0)) return min([_rmsd.rmsd(coords1, x) for x in coords2s])