示例#1
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
示例#2
0
class TestAAMindist(unittest.TestCase):
    def setUp(self):
        #GMIN.initialize()
#        self.pot = GMINPotential(GMIN)
        self.nrigid = 10
        self.water = create_water()
        self.topology = RBTopology()
        self.topology.add_sites([deepcopy(self.water) for i in xrange(self.nrigid)])    

#    def test_zeroev(self):
#        x = self.pot.getCoords()
#        zev = self.topology.zeroEV(x)
#        
#        eps = 1e-5
#        for dx in zev:    
#            print "ev test", (self.pot.getEnergy(x) - self.pot.getEnergy(x + eps*dx))/eps  
#        
#        dx = np.random.random(x.shape)
#        dx/=np.linalg.norm(dx)
#        print "ev test", (self.pot.getEnergy(x) - self.pot.getEnergy(x + eps*dx))/eps
        
    def test_distance(self):  
        for i in xrange(100):
            coords1 = np.random.random(6*self.nrigid)*4
            coords2 = np.random.random(6*self.nrigid)*4
            
            coords1[:3*self.nrigid]=0
            coords2[:3*self.nrigid]=0
            
            measure1 = am.MeasureAngleAxisCluster(self.topology)
            measure2 = am.MeasureRigidBodyCluster(self.topology)
            
            #print 
            self.assertAlmostEqual(measure1.get_dist(coords1, coords2),
                                   measure2.get_dist(coords1, coords2))
示例#3
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
示例#4
0
 def setUp(self):
     #GMIN.initialize()
     #        self.pot = GMINPotential(GMIN)
     self.nrigid = 10
     self.water = create_water()
     self.topology = RBTopology()
     self.topology.add_sites(
         [deepcopy(self.water) for i in xrange(self.nrigid)])
示例#5
0
    def setUp(self):
        #GMIN.initialize()
#        self.pot = GMINPotential(GMIN)
        self.nrigid = 10
        self.water = create_water()
        self.topology = RBTopology()
        self.topology.add_sites([deepcopy(self.water) for i in xrange(self.nrigid)])    
示例#6
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
示例#7
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
示例#8
0
class TestAAMindist(unittest.TestCase):
    def setUp(self):
        #GMIN.initialize()
        #        self.pot = GMINPotential(GMIN)
        self.nrigid = 10
        self.water = create_water()
        self.topology = RBTopology()
        self.topology.add_sites(
            [deepcopy(self.water) for i in xrange(self.nrigid)])


#    def test_zeroev(self):
#        x = self.pot.getCoords()
#        zev = self.topology.zeroEV(x)
#
#        eps = 1e-5
#        for dx in zev:
#            print "ev test", (self.pot.getEnergy(x) - self.pot.getEnergy(x + eps*dx))/eps
#
#        dx = np.random.random(x.shape)
#        dx/=np.linalg.norm(dx)
#        print "ev test", (self.pot.getEnergy(x) - self.pot.getEnergy(x + eps*dx))/eps

    def test_distance(self):
        for i in xrange(100):
            coords1 = np.random.random(6 * self.nrigid) * 4
            coords2 = np.random.random(6 * self.nrigid) * 4

            coords1[:3 * self.nrigid] = 0
            coords2[:3 * self.nrigid] = 0

            measure1 = am.MeasureAngleAxisCluster(self.topology)
            measure2 = am.MeasureRigidBodyCluster(self.topology)

            #print
            self.assertAlmostEqual(measure1.get_dist(coords1, coords2),
                                   measure2.get_dist(coords1, coords2))