defaults.NEBquenchParams["maxErise"] = 0.1 defaults.NEBquenchParams["maxstep"] = 0.001 defaults.NEBquenchRoutine = lbfgs_py #defaults.NEBquenchParams["M"] = 1 k = 100. nimages = 20 dneb=True #set up the potential pot = LJ() #import the starting and ending points and quench them, coords1 = np.genfromtxt("coords.A").flatten() coords2 = np.genfromtxt("coords.B").flatten() dist, coords1, coords2 = minPermDistStochastic(coords1, coords2, niter=100, verbose=False) print "The distance is:", dist neb = NEB(InterpolatedPath(coords1, coords2, nimages), pot, k=k, dneb=dneb) neb.optimize() energies1 = copy(neb.energies) distances1 = [] for i in xrange(1,len(neb.energies)): x1 = neb.coords[i-1] x2 = neb.coords[i] distances1.append(np.linalg.norm(x2-x1)) neb.optimize() energies2 = copy(neb.energies) distances2 = []
""" an example for finding the minimum distance and best alignment between two lennard jones clusters """ import numpy as np from pygmin.potentials.lj import LJ from pygmin.optimize import lbfgs_py from pygmin.mindist import minPermDistStochastic pot = LJ() natoms = 40 #get two random quenched structures to compare coords1 = np.random.rand(natoms*3)*natoms**(1./3)*1.5 coords2 = np.random.rand(natoms*3)*natoms**(1./3)*1.5 ret1 = lbfgs_py(coords1, pot.getEnergyGradient) ret2 = lbfgs_py(coords2, pot.getEnergyGradient) coords1 = ret1[0] coords2 = ret2[0] #all the atoms are permutable permlist = [range(natoms)] dist, newcoords1, newcoords2 = minPermDistStochastic(coords1, coords2, niter=100, permlist=permlist, verbose=False) print "" print "dist =", dist