def createBasinHopping(self): GMIN.initialize() pot = gminpot.GMINPotental(GMIN) coords = pot.getCoords() step = displace.RandomDisplacement() opt = bh.BasinHopping(coords, pot, takeStep=step, temperature=0.4, storage=self.storage) return opt
def __init__(self, prmtopFname, inpcrdFname ): # prmtopFname, inpcrdFname ): # reads coords.inpcrd , coords.prmtop , min.in and data # - fnames hard coded (todo) super(GMINAmberPotential, self).__init__(GMIN) # self.potentialLocal = gminpot.GMINPotential(GMIN) GMIN.initialize() self.prmtop = AmberPrmtopFile( prmtopFname ) self.inpcrd = AmberInpcrdFile( inpcrdFname ) # number of atoms self.natoms = self.prmtop.topology._numAtoms self.localCoords = self.inpcrd.positions/angstrom
def __init__(self, prmtopFname, inpcrdFname): # prmtopFname, inpcrdFname ): # reads coords.inpcrd , coords.prmtop , min.in and data # - fnames hard coded (todo) super(GMINAmberPotential, self).__init__(GMIN) # self.potentialLocal = gminpot.GMINPotential(GMIN) GMIN.initialize() self.prmtop = AmberPrmtopFile(prmtopFname) self.inpcrd = AmberInpcrdFile(inpcrdFname) # number of atoms self.natoms = self.prmtop.topology._numAtoms self.localCoords = self.inpcrd.positions / angstrom
# 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) retGmin = fire(coords, pot, tol=1e-3, nsteps=1000) print(" -- pre-quench --") print("E gmin : ", egmin) print(" openmm: ", eo / 4.184) print("grad gmin : ", gminEGrad[0:3]) print(" openmm: ", go[0:3] / 41.84)
# 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) retGmin = fire( coords, pot, tol = 1e-3, nsteps=1000) print " -- pre-quench --" print "E gmin : ", egmin print " openmm: ", eo/4.184 print "grad gmin : ", gminEGrad[0:3] print " openmm: ", go[0:3]/41.84
import ambgmin_ as GMIN import pele.potentials.gminpotential as gminpot import numpy as np import pele.basinhopping as bh from pele.optimize import _quench as quench from pele.takestep import displace # export PYTHONPATH=/home/ss2029/svn/GMIN/bin:$PWD/../.. GMIN.initialize() pot = gminpot.GMINPotental(GMIN) coords = pot.getCoords() step = displace.RandomDisplacement(stepsize=0.7) opt = bh.BasinHopping(coords, pot, takeStep=step, quenchRoutine=quench.lbfgs_py) opt.quenchParameters['tol'] = 1e-4 opt.run(3) # some visualization try: import pele.utils.pymolwrapper as pym pym.start() pym.draw_spheres(opt.coords, "A", 1) except: print "Could not draw using pymol, skipping this step" from pele.utils.xyz import write_xyz write_xyz(open("final.xyz", "w"), opt.coords)
import ambgmin_ as GMIN import pygmin.potentials.gminpotential as gminpot import numpy as np import pygmin.basinhopping as bh from pygmin.optimize import _quench as quench from pygmin.takestep import displace # export PYTHONPATH=/home/ss2029/svn/GMIN/bin:$PWD/../.. GMIN.initialize() pot = gminpot.GMINPotental(GMIN) coords = pot.getCoords() step = displace.RandomDisplacement(stepsize=0.7) opt = bh.BasinHopping(coords, pot, takeStep=step, quenchRoutine=quench.lbfgs_py) opt.quenchParameters['tol'] = 1e-4 opt.run(3) # some visualization try: import pygmin.utils.pymolwrapper as pym pym.start() pym.draw_spheres(opt.coords, "A", 1) except: print "Could not draw using pymol, skipping this step" import pygmin.printing.print_atoms_xyz as pr
def __init__(self): self.storage = savenlowest.SaveN(10) GMIN.initialize()