def find_rotation(self, X1, X2): ca1 = self.topology.coords_adapter(X1) ca2 = self.topology.coords_adapter(X2) if ca1.natoms > 0: raise NotImplementedError dist, mx = findrotation(ca1.posRigid.flatten(), ca2.posRigid.flatten()) X2trans = X2.copy() self.transform.rotate(X2trans, mx) return self.get_dist(X1, X2trans), mx
def find_rotation(self, X1, X2): """find the rotation which minimizes the distance between the structures""" ca1 = self.topology.coords_adapter(X1) ca2 = self.topology.coords_adapter(X2) if ca1.natoms > 0: raise NotImplementedError # align the center of mass coordinates dist, mx = findrotation(ca1.posRigid.ravel(), ca2.posRigid.ravel()) X2trans = X2.copy() self.transform.rotate(X2trans, mx) # compute and return the distance between the rotated coordinates return self.get_dist(X1, X2trans), mx