def setup_aatopology(self): GMIN.initialize() pot = GMINPotential(GMIN) coords = pot.getCoords() nrigid = old_div(coords.size, 6) print("I have %d water molecules in the system"%nrigid) print("The initial energy is", pot.getEnergy(coords)) water = create_base() system = RBTopology() system.add_sites([deepcopy(water) for i in range(nrigid)]) self.potential = pot self.nrigid = nrigid self.render_scale = 0.15 self.atom_types = system.get_atomtypes() self.draw_bonds = [] for i in range(nrigid-1): self.draw_bonds.append((2*i, 2*i+1)) self.draw_bonds.append((2*i, 2*i+2)) return system
def setup_aatopology(self): GMIN.initialize() pot = GMINPotential(GMIN) coords = pot.getCoords() nrigid = coords.size / 6 print "I have %d water molecules in the system"%nrigid print "The initial energy is", pot.getEnergy(coords) water = tip4p.water() system = RBTopology() system.add_sites([deepcopy(water) for i in xrange(nrigid)]) self.potential = pot self.nrigid = nrigid self.render_scale = 0.3 self.atom_types = system.get_atomtypes() self.draw_bonds = [] for i in xrange(nrigid): self.draw_bonds.append((3*i, 3*i+1)) self.draw_bonds.append((3*i, 3*i+2)) return system
def setup_aatopology(self): GMIN.initialize() pot = GMINPotential(GMIN) coords = pot.getCoords() nrigid = coords.size / 6 print "I have %d PAP molecules in the system" % nrigid print "The initial energy is", pot.getEnergy(coords) water = create_pap() system = RBTopology() system.add_sites([deepcopy(water) for i in xrange(nrigid)]) self.potential = pot self.nrigid = nrigid self.render_scale = 0.1 self.atom_types = system.get_atomtypes() self.draw_bonds = [] for i in xrange(nrigid): self.draw_bonds.append((3 * i, 3 * i + 1)) self.draw_bonds.append((3 * i, 3 * i + 2)) return system
fl = open("stat.dat", "a") print("#found minimum") t1 = time.clock() timespent = t1 - t0 fl.write("#quenches, functioncalls, time\n") fl.write("%d %d %f\n" % (opt.stepnum, potential.ncalls, timespent)) fl.close() exit() # initialize GMIN GMIN.initialize() # create a potential which calls GMIN potential = GMINPotential(GMIN) # get the initial coorinates coords = potential.getCoords() coords = np.random.random(coords.shape) # create takestep routine # we combine a normal step taking group = takestep.BlockMoves() step1 = takestep.AdaptiveStepsize(OXDNATakestep(displace=parameters.displace, rotate=0.), frequency=50) step2 = takestep.AdaptiveStepsize(OXDNATakestep(displace=0., rotate=parameters.rotate), frequency=50) group.addBlock(100, step1) group.addBlock(100, step2) # with a generate random configuration
from pele.potentials import GMINPotential import gmin_ as GMIN from pele.utils import rotations from pele.takestep import buildingblocks from pele.transition_states import NEB import pylab as pl from copy import deepcopy, copy from pele.optimize import mylbfgs from pele.angleaxis import RigidFragment, RBSystem import tip4p from tip4p import dump_path # initialize GMIN and potential GMIN.initialize() pot = GMINPotential(GMIN) coords = pot.getCoords() nrigid = old_div(coords.size, 6) print("I have %d water molecules in the system" % nrigid) water = tip4p.water() #water.S = np.identity(3, dtype="float64") #water.S*=10. # define the whole water system system = RBSystem() system.add_sites([deepcopy(water) for i in range(nrigid)]) # this is an easy access wrapper for coordinates array ca = system.coords_adapter(coords)
fl = open("stat.dat", "a") print "#found minimum" t1= time.clock() timespent= t1 - t0 fl.write("#quenches, functioncalls, time\n") fl.write("%d %d %f\n"%(opt.stepnum , potential.ncalls , timespent)) fl.close() exit() # initialize GMIN GMIN.initialize() # create a potential which calls GMIN potential = GMINPotential(GMIN) # get the initial coorinates coords=potential.getCoords() coords=np.random.random(coords.shape) # create takestep routine # we combine a normal step taking group = takestep.BlockMoves() step1 = takestep.AdaptiveStepsize(OXDNATakestep(displace=parameters.displace, rotate=0.), frequency=50) step2 = takestep.AdaptiveStepsize(OXDNATakestep(displace=0., rotate=parameters.rotate), frequency=50) group.addBlock(100, step1) group.addBlock(100, step2) # with a generate random configuration genrandom = OXDNAReseed() # in a reseeding takestep procedure reseed = takestep.Reseeding(group, genrandom, maxnoimprove=parameters.reseed)
class OTPSystem(RBSystem): def __init__(self, nmol, boxl=None): # super(OTPSystem, self) self.nmol = nmol if boxl is None: self.periodic = False self.boxl = 1e100 else: self.periodic = True self.boxl = boxl super(OTPSystem, self).__init__() self.setup_params(self.params) def get_rigid_fragment(self): return RigidFragment() def make_otp(self): otp = self.get_rigid_fragment() otp.add_atom("O", np.array([0.0, -2./3 * np.sin( 7.*pi/24.), 0.0]), 1.) otp.add_atom("O", np.array([cos( 7.*pi/24.), 1./3. * sin( 7.* pi/24.), 0.0]), 1.) otp.add_atom("O", np.array([-cos( 7.* pi/24.), 1./3. * sin( 7.*pi/24), 0.0]), 1.) otp.finalize_setup() return otp def setup_params(self, params): params.gui["basinhopping_nsteps"] = 1000 nebparams = params.double_ended_connect.local_connect_params.NEBparams nebparams.max_images = 50 nebparams.image_density = 5 nebparams.iter_density = 10. nebparams.k = 5. nebparams.reinterpolate = 50 nebparams.NEBquenchParams["iprint"] = 10 tssearch = params.double_ended_connect.local_connect_params.tsSearchParams tssearch.nsteps_tangent1 = 10 tssearch.nsteps_tangent2 = 30 tssearch.lowestEigenvectorQuenchParams["nsteps"] = 50 tssearch.iprint=1 tssearch.nfail_max = 100 def get_random_coordinates(self): coords = np.zeros([self.nmol*2, 3]) coords[:self.nmol,:] = np.random.uniform(-1,1,[self.nmol,3]) * (self.nmol*3)**(-1./3) * 1.5 from pele.utils.rotations import random_aa for i in range(self.nmol, self.nmol*2): coords[i,:] = random_aa() return coords.flatten() def write_coords_data(self): coords = self.get_random_coordinates() coords = coords.reshape(-1,3) with open("coords", "w") as fout: for xyz in coords: fout.write( "%f %f %f\n" % tuple(xyz) ) data = "LWOTP 2.614\n" if self.periodic: data += "periodic %f %f %f\n" % (self.boxl, self.boxl, self.boxl) with open("data", "w") as fout: fout.write(data) def setup_aatopology(self): self.write_coords_data() GMIN.initialize() self.pot = GMINPotential(GMIN) coords = self.pot.getCoords() self.nrigid = coords.size/6 assert(self.nrigid == self.nmol) #self.nrigid = self.nmol otp = self.make_otp() topology = RBTopology() topology.add_sites([deepcopy(otp) for i in xrange(self.nrigid)]) self.render_scale = 0.2 self.atom_types = topology.get_atomtypes() self.draw_bonds = [] for i in xrange(self.nrigid): self.draw_bonds.append((3*i, 3*i+1)) self.draw_bonds.append((3*i, 3*i+2)) self.params.double_ended_connect.local_connect_params.tsSearchParams.iprint = 10 return topology def get_potential(self): #return OTPPotential(self.aasystem) return self.pot def __call__(self): return self def load_coords_pymol(self, coordslist, oname, index=1): import pymol super(OTPSystem, self).load_coords_pymol(coordslist, oname, index=index) pymol.cmd.set("sphere_scale", value=0.2, selection=oname)
from pele.potentials import GMINPotential import gmin_ as GMIN from pele.utils import rotations from pele.takestep import buildingblocks from pele.transition_states import NEB import pylab as pl from copy import deepcopy, copy from pele.optimize import mylbfgs from pele.angleaxis import RigidFragment, RBSystem import tip4p from tip4p import dump_path # initialize GMIN and potential GMIN.initialize() pot = GMINPotential(GMIN) coords = pot.getCoords() nrigid = coords.size / 6 print "I have %d water molecules in the system"%nrigid water = tip4p.water() #water.S = np.identity(3, dtype="float64") #water.S*=10. # define the whole water system system = RBSystem() system.add_sites([deepcopy(water) for i in xrange(nrigid)]) # this is an easy access wrapper for coordinates array ca = system.coords_adapter(coords)