def guessts(coords1, coords2, pot): from pele.optimize import lbfgs_py as quench # from pele.mindist.minpermdist_stochastic import minPermDistStochastic as mindist from pele.transition_states import NEB from pele.systems import LJCluster ret1 = quench(coords1, pot.getEnergyGradient) ret2 = quench(coords2, pot.getEnergyGradient) coords1 = ret1[0] coords2 = ret2[0] natoms = len(coords1)/3 system = LJCluster(natoms) mindist = system.get_mindist() dist, coords1, coords2 = mindist(coords1, coords2) print "dist", dist print "energy coords1", pot.getEnergy(coords1) print "energy coords2", pot.getEnergy(coords2) from pele.transition_states import InterpolatedPath neb = NEB(InterpolatedPath(coords1, coords2, 20), pot) #neb.optimize(quenchParams={"iprint" : 1}) neb.optimize(iprint=-30, nsteps=100) neb.MakeAllMaximaClimbing() #neb.optimize(quenchParams={"iprint": 30, "nsteps":100}) for i in xrange(len(neb.energies)): if(neb.isclimbing[i]): coords = neb.coords[i,:] return pot, coords, neb.coords[0,:], neb.coords[-1,:]
def guesstsATLJ(): from pele.potentials.ATLJ import ATLJ pot = ATLJ(Z = 2.) a = 1.12 #2.**(1./6.) theta = 60./360*np.pi coords1 = np.array([ 0., 0., 0., \ -a, 0., 0., \ -a/2, -a*np.cos(theta), 0. ]) coords2 = np.array([ 0., 0., 0., \ -a, 0., 0., \ a, 0., 0. ]) from pele.optimize import lbfgs_py as quench from pele.transition_states import InterpolatedPath ret1 = quench(coords1, pot.getEnergyGradient) ret2 = quench(coords2, pot.getEnergyGradient) coords1 = ret1[0] coords2 = ret2[0] from pele.transition_states import NEB neb = NEB(InterpolatedPath(coords1, coords2, 30), pot) neb.optimize() neb.MakeAllMaximaClimbing() #neb.optimize() for i in xrange(len(neb.energies)): if(neb.isclimbing[i]): coords = neb.coords[i,:] return pot, coords
break p2[:] = p2n while True: p2n = p2 - n2 if (np.linalg.norm(p2n - p1) > np.linalg.norm(p2 - p1)): break p2[:]=p2n NEBquenchParams = dict() NEBquenchParams["nsteps"]=2000 NEBquenchParams["maxErise"]=1e-1 NEBquenchParams["tol"]=1e-5 NEBquenchParams["iprint"]=1 NEBquenchParams["maxstep"]=.1 neb = NEB(path, pot, k=10., dneb=True, with_springenergy=True, quenchParams=NEBquenchParams) neb.optimize() path = neb.coords print np.linalg.norm(path[1] - path[0]) for x in neb.coords: export_xyz(traj, x) #np.savetxt("energies.txt", neb.energies) import pylab as pl pl.plot(neb.energies) #pl.plot(e1) #pl.plot(e2, "x")
while True: p2n = p2 - n2 if (np.linalg.norm(p2n - p1) > np.linalg.norm(p2 - p1)): break p2[:] = p2n NEBquenchParams = dict() NEBquenchParams["nsteps"] = 2000 NEBquenchParams["maxErise"] = 1e-1 NEBquenchParams["tol"] = 1e-5 NEBquenchParams["iprint"] = 1 NEBquenchParams["maxstep"] = .1 neb = NEB(path, pot, k=10., dneb=True, with_springenergy=True, quenchParams=NEBquenchParams) neb.optimize() path = neb.coords print(np.linalg.norm(path[1] - path[0])) for x in neb.coords: export_xyz(traj, x) #np.savetxt("energies.txt", neb.energies) import pylab as pl pl.plot(neb.energies) #pl.plot(e1)
decp["local_connect_params"]["NEBparams"]["NEBquenchParams"] = NEBquenchParams decp["local_connect_params"]["NEBparams"][ "NEBquenchRoutine"] = NEBquenchRoutine k = 10. nimages = 50 dneb = True #print coords2[-6:],coords1[-6:] path = tip4p.get_path(system, coords1, coords2, nimages) path_energy = [pot.getEnergy(coords) for coords in path] # try the old neb dump_path("interpolate.xyz", system, path) neb = NEB(path, pot, k=k, dneb=dneb, with_springenergy=False) neb.optimize() neb_1 = neb.copy() dump_path("neb1.xyz", system, neb_1.coords) neb.optimize() neb_2 = neb dump_path("neb2.xyz", system, neb_2.coords) # try the new neb aaneb = NEB(path, pot, distance=system.neb_distance, k=k / 20., dneb=dneb, with_springenergy=False) aaneb.optimize()
decp["local_connect_params"]["NEBparams"] = dict() decp["local_connect_params"]["NEBparams"]["NEBquenchParams"] = NEBquenchParams decp["local_connect_params"]["NEBparams"]["NEBquenchRoutine"] = NEBquenchRoutine k = 10. nimages=50 dneb=True #print coords2[-6:],coords1[-6:] path = tip4p.get_path(system, coords1, coords2, nimages) path_energy = [pot.getEnergy(coords) for coords in path] # try the old neb dump_path("interpolate.xyz", system, path) neb = NEB(path, pot, k=k, dneb=dneb, with_springenergy = False) neb.optimize() neb_1 = neb.copy() dump_path("neb1.xyz", system, neb_1.coords) neb.optimize() neb_2 = neb dump_path("neb2.xyz", system, neb_2.coords) # try the new neb aaneb = NEB(path, pot, distance=system.neb_distance, k=k/20., dneb=dneb, with_springenergy = False) aaneb.optimize() aaneb_1 = aaneb.copy() dump_path("aaneb1.xyz", system, aaneb_1.coords) aaneb.optimize() aaneb_2 = aaneb