def test1(self): """align two random configurations""" x0 = _utils.random_configuration(3 * self.natoms) x1 = _utils.random_configuration(3 * self.natoms) # subtract center of mass com = self.measure.get_com(x0) self.policy.translate(x0, -com) com = self.measure.get_com(x1) self.policy.translate(x1, -com) self.basic_test(x0, x1)
def exact_match_test(self, f): x0 = utils.random_configuration(3 * self.natoms) x1 = x0.copy() # apply transformations to x1 f(x1) self.basic_test(x0, x1) self.assertLess(self.measure.get_dist(x0, x1), 1e-3)
def test2(self): """align two configurations that should match exactly """ x0 = _utils.random_configuration(3 * self.natoms) x1 = x0.copy() self.policy.permute(x1, _utils.random_permutation_permlist(self.permlist, self.natoms)) self.basic_test(x0, x1) self.assertLess(np.abs(x0-x1).max(), 1e-3)
def test2(self): """align two configurations that should match exactly """ x0 = _utils.random_configuration(3 * self.natoms) x1 = x0.copy() self.policy.permute( x1, _utils.random_permutation_permlist(self.permlist, self.natoms)) self.basic_test(x0, x1) self.assertLess(np.abs(x0 - x1).max(), 1e-3)
def test2(self): """align two configurations that should match exactly """ x0 = _utils.random_configuration(3 * self.natoms) com = self.measure.get_com(x0) self.policy.translate(x0, -com) x1 = x0.copy() self.policy.rotate(x1, _utils.random_rotation()) self.basic_test(x0, x1) self.assertLess(np.abs(x0 - x1).max(), 1e-3)
def test2(self): """align two configurations that should match exactly """ x0 = _utils.random_configuration(3 * self.natoms) com = self.measure.get_com(x0) self.policy.translate(x0, -com) x1 = x0.copy() self.policy.rotate(x1, _utils.random_rotation()) self.basic_test(x0, x1) self.assertLess(np.abs(x0-x1).max(), 1e-3)
def apply_tests(self, f): """test that that a transofrmation object can reproduce the transformation in f""" x = _utils.random_configuration(self.natoms * 3) tform = TransformCluster3D(nsites=self.natoms) xbkup = x.copy() x2 = x.copy() # do transormation f(tform, x) tform.apply(x2) # x2 and x should be the same self.assertLess(np.abs(x - x2).max(), 1e-3)
def apply_tests(self, f): """test that that a transofrmation object can reproduce the transformation in f""" x = _utils.random_configuration(self.natoms * 3) tform = TransformCluster3D(nsites=self.natoms) xbkup = x.copy() x2 = x.copy() # do transormation f(tform, x) tform.apply(x2) #x2 and x should be the same self.assertLess(np.abs(x - x2).max(), 1e-3)
def test1(self): """align two random configurations""" x0 = utils.random_configuration(3 * self.natoms) x1 = utils.random_configuration(3 * self.natoms) self.basic_test(x0, x1)
def test1(self): x0 = _utils.random_configuration(self.natoms * 3) x1 = _utils.random_configuration(self.natoms * 3) self.basic_test(x0, x1)
def setUp(self): self.natoms = 4 self.x1 = _utils.random_configuration(self.natoms * 3).reshape(-1, 3) self.x2 = _utils.random_configuration(self.natoms * 3).reshape(-1, 3)
def setUp(self): self.natoms = 11 self.tform = TransformCluster3D() self.x = _utils.random_configuration(self.natoms * 3) self.x2 = self.x.copy()