def test_coord_shift(self): benzene = Geometry(TestGeometry.benzene) mol = Geometry(TestGeometry.benzene) # shift all atoms vector = np.array([0, 3.2, -1.0]) for a in benzene.atoms: a.coords += vector mol.coord_shift([0, 3.2, -1.0]) self.assertTrue(np.linalg.norm(benzene.coords() - mol.coords()) == 0) # shift some atoms vector = np.array([0, -3.2, 1.0]) for a in benzene.atoms[0:5]: a.coords += vector mol.coord_shift([0, -3.2, 1.0], [str(i) for i in range(1, 6)]) self.assertTrue(np.linalg.norm(benzene.coords() - mol.coords()) == 0)
if args.reverse: x_factor *= -1 dX += x_factor * G_AAron_file.other['frequency'].data[combo].vector if args.animate is not None: #animate by setting up 3 geometries: -, 0, and + #then create a Pathway to interpolate between these #if roundtrip, - -> 0 -> + -> 0 -> - #if not roundtrip, - -> 0 -> + w = width(args.animate[0]) fmt = "%0" + "%i" % w + "i" Gf = G.copy() Gf.update_geometry(G.coords() + dX) Gr = G.copy() Gr.update_geometry(G.coords() - dX) #make a scales(t) function so we can see the animation progress in the XYZ file comment if args.roundtrip: S = Pathway([Gf, G, Gr, G, Gf]) ev = [ Pathway.get_splines_vector([-x, 0, x, 0, -x]) for x in scale[i] ] m = Pathway.get_splines_mat(5) else: S = Pathway([Gf, G, Gr]) ev = [Pathway.get_splines_vector([-x, 0, x]) for x in scale[i]] m = Pathway.get_splines_mat(3)