def testBadInput(self): """Asserts raise of ValueError for missing atom type input.""" with self.assertRaises(ValueError) as e: param.GetVdwParam('AA') self.assertEqual(str(e.exception), 'No vdw param found for atom type: AA')
def testEmptyInput(self): """Asserts raise of ValueError for empty string input.""" with self.assertRaises(ValueError) as e: param.GetVdwParam('') self.assertEqual(str(e.exception), 'No vdw param found for atom type: ')
def GetGeom(mol): """Read in molecular geometry data from molecule xyzq file. Parse 2-d array of strings from xyzq file into atomic data. First line contains (int) number of atoms. Second line is ignored comment. Each line after (3 to [n+2]) contains atom type, (float) 3 xyz cartesian coordinates [Angstrom], and (float) charge [e]. Args: mol (mmlib.molecule.Molecule): molecule with an associated xyzq input file. """ infile_array = _GetFileStringArray(mol.infile) mol.n_atoms = int(infile_array[0][0]) for i in range(mol.n_atoms): at_type = infile_array[i+2][0] at_coords = numpy.array( list(map(float, infile_array[i+2][1:1+const.NUMDIM]))) at_charge = float(infile_array[i+2][4]) at_element = GetElement(at_type) at_mass = param.GetAtMass(at_element) at_ro, at_eps = param.GetVdwParam(at_type) atom = molecule.Atom(at_type, at_coords, at_charge, at_ro, at_eps, at_mass) atom.SetCovRad(param.GetCovRad(at_element)) mol.atoms.append(atom) mol.mass += at_mass
def __init__(self, type_, coords, charge, ro=None, eps=None): self.SetType(type_) self.SetCoords(coords) self.SetCharge(charge) if ro == None or eps == None: ro, eps = param.GetVdwParam(self.type_) self.SetRo(ro) self.SetEps(eps) self.SetElement(param.GetElement(type_)) self.SetMass(param.GetMass(self.element)) self.SetCovRad(param.GetCovRad(self.element)) self.SetVels(numpy.zeros(const.NUMDIM)) self.SetAccs(numpy.zeros(const.NUMDIM)) self.SetPVels(numpy.zeros(const.NUMDIM)) self.SetPAccs(numpy.zeros(const.NUMDIM))
def testAromaticCarbon(self): """Asserts correct parameters for carbon atom type.""" self.assertEqual(param.GetVdwParam('CA'), (1.9080, 0.0860))
def testDummyInput(self): """Asserts zero parameters for dummy atom type.""" self.assertEqual(param.GetVdwParam('X'), (0.0000, 0.00000))
def testWaterOxygen(self): """Asserts correct parameters for water oxygen atom type.""" self.assertEqual(param.GetVdwParam('OW'), (1.7683, 0.1520))