def _dihedralTerm(self, n, phase, V): mod_file = self.mod_template % \ (V/(Units.kcal/Units.mol), phase/Units.deg, n) ff = Amber99ForceField(mod_files=[StringIO(mod_file)]) self.universe.setForceField(ff) param = self.universe.energyEvaluatorParameters() i1, i2, i3, i4, n_test, phase_test, V_test = \ param['cosine_dihedral_term'][0] self.assertEqual(n_test, n) # The accuracy is no better than five digits because the # parameters pass through a text representation. self.assertAlmostEqual(phase_test, phase, 5) self.assertAlmostEqual(V_test, V, 5) two_pi = 2. * N.pi m = self.universe[0] for angle in N.arange(0., two_pi, 0.1): m.C4.setPosition(Vector(N.cos(angle), N.sin(angle), 1.)) e = self.universe.energyTerms()['cosine dihedral angle'] da = self.universe.dihedral(m.C1, m.C2, m.C3, m.C4) e_ref = V * (1. + N.cos(n * angle - phase)) self.assertAlmostEqual(angle % two_pi, da % two_pi, 14) self.assertAlmostEqual(e, e_ref, 5) self._gradientTest() self._forceConstantTest()
def setUp(self): self.universe = MMTK.InfiniteUniverse(Amber99ForceField()) self.universe.peptide = Protein('bala1') self.subspace = RigidMotionSubspace(self.universe, self.universe.peptide.residues())
def setUp(self): self.universe = MMTK.InfiniteUniverse(Amber99ForceField()) self.universe.water = MMTK.Molecule('water')
velocities += dv configuration += delta_t*velocities universe.setConfiguration(configuration) energy, gradients = evaluator(gradients) dv = -0.5*delta_t*gradients*inv_masses velocities += dv universe.setVelocities(velocities) time += delta_t snapshot(data={'time': time, 'potential_energy': energy}) if equilibration_temperature is not None \ and step % equilibration_frequency == 0: universe.scaleVelocitiesToTemperature(equilibration_temperature) # Define system universe = InfiniteUniverse(Amber99ForceField()) universe.protein = Protein('bala1') # Create trajectory and snapshot generator trajectory = Trajectory(universe, "md_trajectory.nc", "w", "Generated by a Python integrator") snapshot = SnapshotGenerator(universe, actions = [TrajectoryOutput(trajectory, ["all"], 0, None, 1)]) # Initialize velocities universe.initializeVelocitiesToTemperature(50.*Units.K) # Heat and equilibrate for temperature in [50., 100., 200., 300.]: doVelocityVerletSteps(delta_t = 1.*Units.fs, nsteps = 500, equilibration_temperature = temperature*Units.K,
elem = bsubstr(line, 32, 2) if elem[1] == ' ': elem = elem[0] name.append(elem + str(atmi)) factory.addAtom('main', name[atmi - 1], elem) factory.setPosition('main',name[atmi-1],Vector\ (x*Units.Ang, y*Units.Ang, z*Units.Ang)) if linecnt >= (5 + natm): if line[0] == 'M': break factory.addBond('main',\ name[int(bsubstr(line,1,3))-1], name[int(bsubstr(line,4,3))-1]) fpo1.close() newmol = factory.retrieveMolecule('main') universe = InfiniteUniverse(Amber99ForceField(mod_files=['frcmod.ff99SB'])) universe.addObject(newmol) universe.configuration() # ------------------------------------------- #anchor(universe) # BUG pseudo01.sdf when first atom has only one bond #universe.writeXML(file('out.xml', 'w')); #universe.writeToFile('out.pdb'); convertor = bConvertor(universe) convertor.cart2all_internals() #convertor.print_internals() #print '\n++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n'
def setUp(self): self.universe = MMTK.InfiniteUniverse(Amber99ForceField()) self.universe.water1 = MMTK.Molecule('water', position=MMTK.Vector(0., 0., 0.)) self.universe.water2 = MMTK.Molecule('water', position=MMTK.Vector(0.5, 0., 0.))
def setUp(self): self.universe = MMTK.InfiniteUniverse(Amber99ForceField()) self.universe.peptide = Protein('bala1')