Ejemplo n.º 1
0
def findTransitionState_dimer(x0, potential, direction=None, tol=1.0e-6, maxstep=0.1, iprint=-1, **kwargs):
    '''
    Wrapper for DimerSearch to find transition states
    '''    
    search = DimerSearch(x0, potential, direction=direction, **kwargs)
    #search.findNextTS(direction)
    #search.findNextTS(direction)
    #search.findNextTS(direction)
    x, E, rms, tmp = fire(x0, search.getEnergyGradient, tol=tol, maxstep=maxstep, iprint=iprint) 
    #x, E, rms, tmp = quench.mylbfgs(x0, search.getEnergyGradient, tol=tol, maxstep=maxstep, maxErise=1000.)
        
    from collections import namedtuple
    return namedtuple("TransitionStateResults", "coords,energy,eigenval,eigenvec,rms")(x, E, 0.0, search.tau, rms)
Ejemplo n.º 2
0
def _uphill_search(x0, search, push, push_minrms):
    ev = search.tau
    evecs = search.get_eigenvecs(x0)
    #print len(evecs)
    x1 = x0.copy()
    while True:
        x1+=push*ev
        g = search.getOrthogonalGradient(x1, evecs)
        #print np.linalg.norm(g)
        rms = np.linalg.norm(g)/np.sqrt(len(g))
        #print "rms",rms
        if (rms > push_minrms):
        #    print "rms final",rms
            break
    #x1 = x0 + np.random.random(x0.shape)*0.1
    #search.tau_done=[]
    #search.x0 = x1
    #search.findNextTS()
    return fire(x1, search.getEnergyGradient, tol=1e-6)
Ejemplo n.º 3
0
def _uphill_search(x0, search, push, push_minrms):
    ev = search.tau
    evecs = search.get_eigenvecs(x0)
    # print len(evecs)
    x1 = x0.copy()
    while True:
        x1 += push * ev
        g = search.getOrthogonalGradient(x1, evecs)
        # print np.linalg.norm(g)
        rms = old_div(np.linalg.norm(g), np.sqrt(len(g)))
        # print "rms",rms
        if rms > push_minrms:
            # print "rms final",rms
            break
    # x1 = x0 + np.random.random(x0.shape)*0.1
    # search.tau_done=[]
    # search.x0 = x1
    # search.findNextTS()
    return fire(x1, search.getEnergyGradient, tol=1e-6)
Ejemplo n.º 4
0
    print(eo)  # energy
    print(go[0:5])

    print("\n-----------------")
    print("quench\n")

    # lbfgs
    #  ret = quench( coordsVec, pot.getEnergyGradient, iprint=-1 , tol = 1e-3, nsteps=100)
    # core dump!

    # cg
    #    ret = cg( coordsVec, pot.getEnergyGradient)
    # runtime error -- ValueError: The truth value of an array with more than ...

    # fire
    retOpmm = fire(coordsVec, pot, tol=1e-3, nsteps=1000)
    # works but quenched energy is higher!

    print("quenched energy ", retOpmm.energy)
    print("rms gradient", retOpmm.rms)
    print("number of function calls", retOpmm.nfev)

    # -------- GMIN
    print("\n\nCompare with GMIN")
    GMIN.initialize()  # reads coords.inpcrd and coords.prmtop
    pot = gminpot.GMINPotential(GMIN)

    coords = pot.getCoords()
    enerGmin = pot.getEnergy(coords)
    egmin, gminEGrad = pot.getEnergyGradient(coords)
Ejemplo n.º 5
0
    print eo  # energy 
    print go[0:5]    

    print "\n-----------------"    
    print "quench\n"
    
    # lbfgs 
    #  ret = quench( coordsVec, pot.getEnergyGradient, iprint=-1 , tol = 1e-3, nsteps=100) 
    # core dump! 

    # cg  
    #    ret = cg( coordsVec, pot.getEnergyGradient) 
    # runtime error -- ValueError: The truth value of an array with more than ...
    
    # fire   
    retOpmm = fire( coordsVec, pot, tol = 1e-3, nsteps=1000) 
    # works but quenched energy is higher! 
    
    print "quenched energy ", retOpmm.energy
    print "rms gradient", retOpmm.rms
    print "number of function calls", retOpmm.nfev
        
    # -------- GMIN 
    print "\n\nCompare with GMIN"    
    GMIN.initialize()   # reads coords.inpcrd and coords.prmtop 
    pot = gminpot.GMINPotential(GMIN)

    coords = pot.getCoords()
    enerGmin = pot.getEnergy(coords)
    egmin,gminEGrad = pot.getEnergyGradient(coords)