Ejemplo n.º 1
0
def guesstsATLJ():
    from pygmin.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 pygmin.optimize import lbfgs_py as quench
    from pygmin.transition_states import InterpolatedPath
    ret1 = quench(coords1, pot.getEnergyGradient)
    ret2 = quench(coords2, pot.getEnergyGradient)
    coords1 = ret1[0]
    coords2 = ret2[0]
    from pygmin.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
Ejemplo n.º 2
0
def guessts(coords1, coords2, pot):
    from pygmin.optimize import lbfgs_py as quench
#    from pygmin.mindist.minpermdist_stochastic import minPermDistStochastic as mindist
    from pygmin.transition_states import NEB
    from pygmin.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 pygmin.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,:]
Ejemplo n.º 3
0
def guessts(coords1, coords2, pot):
    from pygmin.optimize import lbfgs_py as quench
    #    from pygmin.mindist.minpermdist_stochastic import minPermDistStochastic as mindist
    from pygmin.transition_states import NEB
    from pygmin.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 pygmin.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, :]
Ejemplo n.º 4
0
def guesstsATLJ():
    from pygmin.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 pygmin.optimize import lbfgs_py as quench
    from pygmin.transition_states import InterpolatedPath
    ret1 = quench(coords1, pot.getEnergyGradient)
    ret2 = quench(coords2, pot.getEnergyGradient)
    coords1 = ret1[0]
    coords2 = ret2[0]
    from pygmin.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
Ejemplo n.º 5
0
                    break
                p2[:]=p2n
                
            while True:
                p2n = p2-n2
                if(np.linalg.norm(p2n - p1) > np.linalg.norm(p2 - p1)):
                    break
                p2[:]=p2n  
            
    defaults.NEBquenchParams["nsteps"]=2000
    defaults.NEBquenchParams["maxErise"]=1e-1
    defaults.NEBquenchParams["tol"]=1e-5
    defaults.NEBquenchParams["iprint"]=1
    defaults.NEBquenchParams["maxstep"]=.1
    neb = NEB(path, pot, k=10., dneb=True, with_springenergy=True)
    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")
pl.show()
Ejemplo n.º 6
0
defaults.NEBquenchParams["maxErise"] = 0.1
defaults.NEBquenchParams["tol"] = 1e-6
defaults.NEBquenchRoutine = mylbfgs
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
dump_path("aaneb2.xyz", system, aaneb_2.coords)
Ejemplo n.º 7
0
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()
Ejemplo n.º 8
0
                    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")
pl.show()