示例#1
0
文件: oxgui.py 项目: js850/PyGMIN
    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 = create_base()
        
        system = RBTopology()
        system.add_sites([deepcopy(water) for i in xrange(nrigid)])
        self.potential = pot
        self.nrigid = nrigid
        
        self.render_scale = 0.15
        self.atom_types = system.get_atomtypes()
        
        self.draw_bonds = []
        for i in xrange(nrigid-1):
            self.draw_bonds.append((2*i, 2*i+1))
            self.draw_bonds.append((2*i, 2*i+2))
    
        return system
示例#2
0
    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
示例#3
0
    def __init__(self):
        BaseSystem.__init__(self)
        neb_params = BaseParameters()
        self.params["neb"]=neb_params
        
        neb_params["nimages"] = 15
        neb_params["k"] = 10.
        neb_params["aadist"] = True
        
        
        defaults.NEBquenchParams["nsteps"] = 200
        defaults.NEBquenchParams["iprint"] = 1
        defaults.NEBquenchParams["maxstep"] = 0.1
        #defaults.NEBquenchParams["maxErise"] = 0.1
        defaults.NEBquenchParams["tol"] = 1e-6
        defaults.NEBquenchRoutine = fire     
        
        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()
        system = RBSystem()
        system.add_sites([deepcopy(water) for i in xrange(nrigid)])
        
        self.aasystem = system
        self.potential = pot
        self.nrigid = nrigid
示例#4
0
文件: oxgui.py 项目: wwwtyro/PyGMIN
 def create_basinhopping(self):
     potential = GMINPotential(GMIN)
     coords = potential.getCoords()
     # genearte a random configuration
     OXDNAReseed().takeStep(coords)
     
     opt = bh.BasinHopping(coords,potential,
                       temperature=0.1, takeStep=self.create_takestep(),
                       outstream = None)
     return opt
示例#5
0
 def getEnergy(self, coords):
     E = GMINPotential.getEnergy(self, coords)
     ca = CoordsAdapter(nrigid=coords.size/6, coords=coords)
     RMX = [rmdrvt(p, True) for p in ca.rotRigid]
     
     xback = np.array([x - 0.4*np.dot(r[0], np.array([1., 0., 0.])) for x, r in zip(ca.posRigid, RMX)])
     xbase = np.array([x + 0.4*np.dot(r[0], np.array([1., 0., 0.])) for x, r in zip(ca.posRigid, RMX)])
     
     Eangle = 0
     v2 = xback[1] - xback[0]
     v2 /= np.linalg.norm(v2)
     for i in xrange(1,ca.nrigid-1):
         v1 = -v2.copy()
         v2 = xback[i+1] - xback[i]
         v2 /= np.linalg.norm(v2)
         
         theta = np.arccos(np.dot(v1,v2))
         Eangle += 0.5*self.k*(theta - self.theta0)**2
         
     # add the torsion angle
     Etorsion = 0
     if self.use_torsion:
         for i in xrange(ca.nrigid-3):
             theta = dihedral_angle(xback[i:i+4])
             Etorsion += U_torsion_back(theta)
     return E + Eangle + Etorsion
示例#6
0
    def getEnergy(self, coords):
        E = GMINPotential.getEnergy(self, coords)
        ca = CoordsAdapter(nrigid=coords.size / 6, coords=coords)
        RMX = [rmdrvt(p, True) for p in ca.rotRigid]

        xback = np.array([
            x - 0.4 * np.dot(r[0], np.array([1., 0., 0.]))
            for x, r in zip(ca.posRigid, RMX)
        ])
        xbase = np.array([
            x + 0.4 * np.dot(r[0], np.array([1., 0., 0.]))
            for x, r in zip(ca.posRigid, RMX)
        ])

        Eangle = 0
        v2 = xback[1] - xback[0]
        v2 /= np.linalg.norm(v2)
        for i in xrange(1, ca.nrigid - 1):
            v1 = -v2.copy()
            v2 = xback[i + 1] - xback[i]
            v2 /= np.linalg.norm(v2)

            theta = np.arccos(np.dot(v1, v2))
            Eangle += 0.5 * self.k * (theta - self.theta0)**2

        # add the torsion angle
        Etorsion = 0
        if self.use_torsion:
            for i in xrange(ca.nrigid - 3):
                theta = dihedral_angle(xback[i:i + 4])
                Etorsion += U_torsion_back(theta)
        return E + Eangle + Etorsion
示例#7
0
    def getEnergyGradient(self, coords):
        #return self.getEnergy(coords), self.NumericalDerivative(coords)
        E, grad = GMINPotential.getEnergyGradient(self, coords)

        ca = CoordsAdapter(nrigid=coords.size / 6, coords=coords)
        RMX = [rmdrvt(p, True) for p in ca.rotRigid]

        xback = [
            x - 0.4 * np.dot(r[0], np.array([1., 0., 0.]))
            for x, r in zip(ca.posRigid, RMX)
        ]
        xbase = [
            x - 0.4 * np.dot(r[0], np.array([1., 0., 0.]))
            for x, r in zip(ca.posRigid, RMX)
        ]

        gback = np.zeros_like(xback)
        Eangle = 0.
        v2 = xback[1] - xback[0]
        absv2 = np.linalg.norm(v2)
        v2 /= absv2
        for i in xrange(1, ca.nrigid - 1):
            v1 = -v2
            absv1 = absv2
            v2 = xback[i + 1] - xback[i]
            absv2 = np.linalg.norm(v2)
            v2 /= absv2

            v1v2 = np.dot(v1, v2)
            theta = np.arccos(v1v2)
            Eangle += 0.5 * self.k * (theta - self.theta0)**2

            acos_prime = 1. / np.sqrt(1. - v1v2**2)
            s = self.k * (theta - self.theta0) * acos_prime
            gback[i - 1] += s * (-v2 / absv1 + v1v2 * v1 / absv1)
            gback[i] += s * (v1 / absv2 + v2 / absv1 - v1v2 * v1 / absv1 -
                             v1v2 * v2 / absv2)
            gback[i + 1] += s * (-v1 / absv2 + v1v2 * v2 / absv2)

        Etorsion = 0
        if self.use_torsion:
            for i in xrange(ca.nrigid - 3):
                r = xback[i:i + 4]
                theta = dihedral_angle(r)
                e_theta, g_theta = U_torsion_back_grad(theta)
                Etorsion += e_theta
                gback[i:i + 4] += g_theta * dihedral_gradient(r)

        cg = CoordsAdapter(nrigid=ca.nrigid, coords=grad)
        cg.posRigid += gback
        for i in xrange(ca.nrigid):
            x = -0.4 * np.array([1., 0., 0.])
            R = RMX[i]
            cg.rotRigid[i][0] += np.dot(gback[i], np.dot(R[1], x))
            cg.rotRigid[i][1] += np.dot(gback[i], np.dot(R[2], x))
            cg.rotRigid[i][2] += np.dot(gback[i], np.dot(R[3], x))
        return E + Eangle + Etorsion, grad
示例#8
0
    def __init__(self, *args, **kwargs):
        AppBasinHopping.__init__(self, *args, **kwargs)
        self.quenchRoutine = mylbfgs
        self.potential = GMINPotential(GMIN)

        self.quenchParameters["tol"] = 1e-4
        self.quenchParameters["M"] = 80
        self.quenchParameters["maxErise"] = 0.1
        self.quenchRoutine = mylbfgs
示例#9
0
    def getEnergyGradient(self, coords):
        #return self.getEnergy(coords), self.NumericalDerivative(coords)
        E, grad = GMINPotential.getEnergyGradient(self, coords)
        
        ca = CoordsAdapter(nrigid=coords.size/6, coords=coords)
        RMX = [rmdrvt(p, True) for p in ca.rotRigid]

        xback = [x - 0.4*np.dot(r[0], np.array([1., 0., 0.])) for x, r in zip(ca.posRigid, RMX)]
        xbase = [x - 0.4*np.dot(r[0], np.array([1., 0., 0.])) for x, r in zip(ca.posRigid, RMX)]
        
        gback = np.zeros_like(xback)
        Eangle = 0.
        v2 = xback[1] - xback[0]
        absv2 = np.linalg.norm(v2)
        v2 /= absv2 
        for i in xrange(1,ca.nrigid-1):
            v1 = -v2
            absv1 = absv2
            v2 = xback[i+1] - xback[i]
            absv2 = np.linalg.norm(v2)
            v2 /= absv2
            
            v1v2 = np.dot(v1,v2)
            theta = np.arccos(v1v2)
            Eangle += 0.5*self.k*(theta - self.theta0)**2
            
            acos_prime = 1. / np.sqrt(1. - v1v2**2);
            s = self.k*(theta -  self.theta0)*acos_prime
            gback[i-1] += s * (- v2 / absv1 +  v1v2 * v1 / absv1 )
            gback[i]   += s * ( v1/absv2 + v2/absv1 
                              - v1v2 * v1 / absv1
                              - v1v2 * v2 / absv2)
            gback[i+1] += s * (- v1 / absv2 +  v1v2 * v2 / absv2 )
        
        Etorsion = 0
        if self.use_torsion:
            for i in xrange(ca.nrigid-3):
                r = xback[i:i+4]
                theta = dihedral_angle(r)
                e_theta, g_theta = U_torsion_back_grad(theta)
                Etorsion += e_theta        
                gback[i:i+4] += g_theta * dihedral_gradient(r)  

        
        cg = CoordsAdapter(nrigid=ca.nrigid, coords=grad)    
        cg.posRigid += gback
        for i in xrange(ca.nrigid):
            x = -0.4*np.array([1., 0., 0.])
            R = RMX[i]
            cg.rotRigid[i][0] += np.dot(gback[i], np.dot(R[1], x))
            cg.rotRigid[i][1] += np.dot(gback[i], np.dot(R[2], x))
            cg.rotRigid[i][2] += np.dot(gback[i], np.dot(R[3], x))
        return E + Eangle + Etorsion, grad
        
示例#10
0
文件: otp.py 项目: yfyh2013/PyGMIN
    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
示例#11
0
文件: otp.py 项目: js850/PyGMIN
 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
示例#12
0
    def check_converged(E, coords):
        if (E < (parameters.TARGET + parameters.EDIFF)):
            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)
示例#13
0
文件: otp.py 项目: yfyh2013/PyGMIN
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 pygmin.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)
示例#14
0
文件: otp.py 项目: js850/PyGMIN
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 pygmin.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)
示例#15
0
文件: path.py 项目: wwwtyro/PyGMIN
def export_xyz(fl, coords):
    ca = CoordsAdapter(nrigid=coords.size/6, coords = coords)
    fl.write("%d\n\n"%(2*ca.nrigid))
    for i in xrange(ca.nrigid):
        a = np.dot(rotations.aa2mx(ca.rotRigid[i]), np.array([1., 0., 0.]))
        x_back = ca.posRigid[i] - 0.4*a # backbone bead
        x_stack = ca.posRigid[i] + 0.4*a
        
        a = np.dot(rotations.aa2mx(ca.rotRigid[i]), np.array([0., 0., 1.]))
        x_tmp = x_back + 0.2*a
        
        fl.write("C %f %f %f\n"%(x_back[0], x_back[1], x_back[2]))
        fl.write("H %f %f %f\n"%(x_stack[0], x_stack[1], x_stack[2]))
        
GMIN.initialize()    
pot = GMINPotential(GMIN)

#fin = open("test.xyz") #path/int.102min.xyz")
fin = open("path/int.2min.xyz")

path_xyz = []

while True:
    if(fin.readline() == ""):
        break
    
    fin.readline()
    coords = np.zeros([26,3])
    for i in xrange(26):
        x = [ float(x) for x in fin.readline().split()[1:]]
        coords[i] = x
示例#16
0
    def check_converged(E, coords):
        if(E<(parameters.TARGET+parameters.EDIFF)):
                  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
示例#17
0
文件: oxgui.py 项目: wwwtyro/PyGMIN
 def Align(self, coords1, coords2):
     from pygmin.mindist import rmsfit,aamindist
     potential = GMINPotential(GMIN)
     
     ca1 = CoordsAdapter(nrigid=coords1.size/6, coords = coords1)
     ca2 = CoordsAdapter(nrigid=coords2.size/6, coords = coords2)
     rot = rmsfit.findrotation_kabsch(ca2.posRigid, ca1.posRigid)
     ca2.posRigid[:] = np.dot(rot,ca2.posRigid.transpose()).transpose()
     for p in ca2.rotRigid:
         p[:] = rotations.mx2aa((np.dot(rot, rotations.aa2mx(p))))
         
     print "before"
     print potential.getEnergy(coords1), potential.getEnergy(coords2)
     print ca2.rotRigid - ca1.rotRigid
     for p1,p2 in zip(ca1.rotRigid, ca2.rotRigid):
         p1[:],p2[:] = aamindist.aadistance(p1, p2)
     print "after"
     print potential.getEnergy(coords1), potential.getEnergy(coords2)
     print ca2.rotRigid - ca1.rotRigid
     path = InterpolatedPath(coords1, coords2, 40)
     print potential.getEnergy(path[0])
     print "Interpolated energies"
     for x in InterpolatedPath(coords1, coords2, 40):
         print potential.getEnergy(x)
     print "done"
     return coords1, coords2
示例#18
0
 def __init__(self, theta0 = 140./180.*np.pi, k = 4., use_torsion=False):
     GMINPotential.__init__(self, GMIN)
     self.theta0 = theta0
     self.k = k
     print "theta0 is", theta0
     self.use_torsion = use_torsion 
示例#19
0
import numpy as np
from pygmin.potentials import GMINPotential
import gmin_ as GMIN
from pygmin.utils import rotations
from pygmin.takestep import buildingblocks
from pygmin.transition_states import NEB
import pylab as pl
from copy import deepcopy, copy
from pygmin.optimize import mylbfgs
from pygmin.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)
示例#20
0
文件: gupta.py 项目: yfyh2013/PyGMIN
 def get_potential(self):
     return GMINPotential(GMIN)
示例#21
0
from pygmin.potentials import GMINPotential
import gmin_ as GMIN
from pygmin.utils import rotations
from pygmin.takestep import buildingblocks
from pygmin.transition_states import NEB
from pygmin import defaults
import pylab as pl
from copy import deepcopy, copy
from pygmin.optimize import mylbfgs, fire
from pygmin.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)
示例#22
0
 def __init__(self, theta0=140. / 180. * np.pi, k=4., use_torsion=False):
     GMINPotential.__init__(self, GMIN)
     self.theta0 = theta0
     self.k = k
     print "theta0 is", theta0
     self.use_torsion = use_torsion