コード例 #1
0
ファイル: tip4p_system.py プロジェクト: Mahdisadjadi/pele
    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
コード例 #2
0
ファイル: oxgui.py プロジェクト: spraharsh/pele
    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
コード例 #3
0
ファイル: oxdnaanglepot.py プロジェクト: js850/pele
    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.0, 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.0, 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
コード例 #4
0
    def getEnergy(self, coords):
        E = GMINPotential.getEnergy(self, coords)
        ca = CoordsAdapter(nrigid=old_div(coords.size, 6), coords=coords)
        RMX = [rotMatDeriv(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 range(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 range(ca.nrigid - 3):
                theta = dihedral_angle(xback[i:i + 4])
                Etorsion += U_torsion_back(theta)
        return E + Eangle + Etorsion
コード例 #5
0
    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
コード例 #6
0
ファイル: tip4p_aaneb.py プロジェクト: spraharsh/pele
# 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)

#buildingblocks.rotate(3.0, ca.rotRigid[-1:])
#ret = mylbfgs(coords, pot.getEnergyGradient, iprint=0)
#coords2 = ret[0]
#np.savetxt("coords1_2.txt", coords1)
#np.savetxt("coords2_2.txt", coords2)

coords1 = np.loadtxt("coords1.txt")
coords2 = np.loadtxt("coords2.txt")
print(pot.getEnergy(coords1), pot.getEnergy(coords2))

NEBquenchParams = dict()
NEBquenchParams["nsteps"] = 200
NEBquenchParams["iprint"] = 1
NEBquenchParams["maxstep"] = 0.1
NEBquenchParams["maxErise"] = 0.1
NEBquenchParams["tol"] = 1e-6
NEBquenchRoutine = mylbfgs
decp = dict()
decp["local_connect_params"] = dict()
decp["local_connect_params"]["NEBparams"] = dict()
decp["local_connect_params"]["NEBparams"]["NEBquenchParams"] = NEBquenchParams
decp["local_connect_params"]["NEBparams"][
    "NEBquenchRoutine"] = NEBquenchRoutine
コード例 #7
0
ファイル: tip4p_aaneb.py プロジェクト: Mahdisadjadi/pele
# 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)

#buildingblocks.rotate(3.0, ca.rotRigid[-1:])
#ret = mylbfgs(coords, pot.getEnergyGradient, iprint=0)
#coords2 = ret[0]
#np.savetxt("coords1_2.txt", coords1)
#np.savetxt("coords2_2.txt", coords2)

coords1 = np.loadtxt("coords1.txt")
coords2 = np.loadtxt("coords2.txt")
print pot.getEnergy(coords1), pot.getEnergy(coords2)

NEBquenchParams = dict()
NEBquenchParams["nsteps"] = 200
NEBquenchParams["iprint"] = 1
NEBquenchParams["maxstep"] = 0.1
NEBquenchParams["maxErise"] = 0.1
NEBquenchParams["tol"] = 1e-6
NEBquenchRoutine = mylbfgs
decp = dict()
decp["local_connect_params"] = dict()
decp["local_connect_params"]["NEBparams"] = dict()
decp["local_connect_params"]["NEBparams"]["NEBquenchParams"] = NEBquenchParams
decp["local_connect_params"]["NEBparams"]["NEBquenchRoutine"] = NEBquenchRoutine

k = 10.