def smooth_path(self, images, **kwargs): """return a smoothed path between two configurations. used for movies See Also -------- pele.landscape.smooth_path """ from pele.landscape import smooth_path try: interpolator = self.params.double_ended_connect.local_connect_params.NEBparams.interpolator except (KeyError, AttributeError): interpolator = None return smooth_path(images, self.get_mindist(), interpolator=interpolator)
def test1(self): natoms = 13 m1 = np.random.uniform(-1, 1, natoms * 3) ts = np.random.uniform(-1, 1, natoms * 3) m2 = np.random.uniform(-1, 1, natoms * 3) path = [m1, ts, m2] density = 5. spath = smooth_path(path, crap_mindist, density=density) d1 = crap_mindist(m1, ts)[0] d2 = crap_mindist(ts, m2)[0] dmax = max(d1, d2) for x1, x2 in zip(spath[:-1], spath[1:]): d = crap_mindist(x1, x2)[0] self.assertGreater(d, 0) self.assertLess(d, dmax) self.assertGreaterEqual(len(spath), 2 * density)
def test1(self): natoms = 13 m1 = np.random.uniform(-1,1,natoms*3) ts = np.random.uniform(-1,1,natoms*3) m2 = np.random.uniform(-1,1,natoms*3) path = [m1, ts, m2] density = 5. spath = smooth_path(path, crap_mindist, density=density) d1 = crap_mindist(m1,ts)[0] d2 = crap_mindist(ts,m2)[0] dmax = max(d1, d2) for x1, x2 in izip(spath[:-1], spath[1:]): d = crap_mindist(x1, x2)[0] self.assertGreater(d, 0) self.assertLess(d, dmax) self.assertGreaterEqual(len(spath), 2*density)
def smooth_path(self, path, **kwargs): mindist = self.get_mindist() return smooth_path(path, mindist, **kwargs)
def smooth_path(self, images, **kwargs): mindist = self.get_mindist() path = smooth_path(images, mindist, interpolator=interpolate_spins) return path
def smooth_path(self, path, **kwargs): mindist = self.get_mindist() return smooth_path(path, mindist, interpolator=self.aasystem.interpolate, **kwargs)
nts = nmin - 1 print "the path has %d minima and %d transition states" % (nmin, nts) eofs = "path.EofS" print "saving energies to", eofs with open(eofs, "w") as fout: for i in range(len(S)): fout.write("%f %f\n" % (S[i], energies[i])) xyzfile = "path.xyz" print "saving path in xyz format to", xyzfile with open(xyzfile, "w") as fout: for m in mints: write_xyz(fout, m.coords, title=str(m.energy)) xyzfile = "path.smooth.xyz" print "saving smoothed path in xyz format to", xyzfile clist = [m.coords for m in mints] smoothed = smooth_path(clist, mindist) with open(xyzfile, "w") as fout: for coords in smoothed: write_xyz(fout, coords) if False: try: import matplotlib.pyplot as plt plt.plot(S, energies) plt.show() except ImportError: print "problem plotting with pyplot, skipping"
nts = nmin - 1 print("the path has %d minima and %d transition states" % (nmin, nts)) eofs = "path.EofS" print("saving energies to", eofs) with open(eofs, "w") as fout: for i in range(len(S)): fout.write("%f %f\n" % (S[i], energies[i])) xyzfile = "path.xyz" print("saving path in xyz format to", xyzfile) with open(xyzfile, "w") as fout: for m in mints: write_xyz(fout, m.coords, title=str(m.energy)) xyzfile = "path.smooth.xyz" print("saving smoothed path in xyz format to", xyzfile) clist = [m.coords for m in mints] smoothed = smooth_path(clist, mindist) with open(xyzfile, "w") as fout: for coords in smoothed: write_xyz(fout, coords) if False: try: import matplotlib.pyplot as plt plt.plot(S, energies) plt.show() except ImportError: print("problem plotting with pyplot, skipping")