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
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))
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
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 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 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 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
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))