Exemplo n.º 1
0
 def testBadIndex4(self):
     """Asserts error raise for non-positive-integer atomic index 4 input."""
     with self.assertRaises(ValueError) as e:
         fileio.GetTorsionFromPrm(
             ['TORSION', '10', '11', '12', 'i', '1.0', '0.0', '1', '1'])
     self.assertEqual(str(e.exception),
                      'Torsion atom4 index must be positive integer: i')
Exemplo n.º 2
0
 def testBadTorsionPaths(self):
     """Asserts error raise for non-positive-integer torsion path number."""
     with self.assertRaises(ValueError) as e:
         fileio.GetTorsionFromPrm(
             ['TORSION', '5', '4', '3', '1', '2.5', '30.0', '3', '-2'])
     self.assertEqual(str(e.exception),
                      'Torsion path number must be positive integer: -2')
Exemplo n.º 3
0
 def testEmptyArray(self):
     """Asserts error raise for empty array is input."""
     with self.assertRaises(IndexError) as e:
         fileio.GetTorsionFromPrm([])
     self.assertEqual(
         str(e.exception),
         'Insufficient columns to parse prm file row into Torsion object: ')
Exemplo n.º 4
0
 def testBadTorsionFrequency(self):
     """Asserts error raise for non-postive-integer torsion frequency."""
     with self.assertRaises(ValueError) as e:
         fileio.GetTorsionFromPrm(
             ['TORSION', '1', '2', '3', '4', '1.0', '0.0', '0', '3'])
     self.assertEqual(
         str(e.exception),
         'Torsion barrier frequency must be positive integer: 0')
Exemplo n.º 5
0
 def testBadTorsionOffsetAngle(self):
     """Asserts error raise for non-numeric or out-of-bounds offset angle."""
     with self.assertRaises(ValueError) as e:
         fileio.GetTorsionFromPrm(
             ['TORSION', '9999', '2', '34', '6', '0.1', '180.1', '1', '3'])
     self.assertEqual(
         str(e.exception),
         'Torsion offset angle must be between -180.0 and 180.0: 180.1')
Exemplo n.º 6
0
 def testBadTorsionBarrier(self):
     """Asserts error raise for non-positive numeric torsion half-barrier."""
     with self.assertRaises(ValueError) as e:
         fileio.GetTorsionFromPrm([
             'TORSION', '100', '101', '102', '103', '-1.0', '1.0', '2', '6'
         ])
     self.assertEqual(
         str(e.exception),
         'Torsion half-barrier must be positive numeric value: -1.0')
Exemplo n.º 7
0
 def testShortArray(self):
     """Asserts error raise for not enough fields in input."""
     with self.assertRaises(IndexError) as e:
         fileio.GetTorsionFromPrm(
             ['TORSION', '1', '2', '3', '4', '1.0', '0.0', '1'])
     self.assertEqual(
         str(e.exception),
         ('Insufficient columns to parse prm file row into Torsion object: '
          'TORSION 1 2 3 4 1.0 0.0 1'))
Exemplo n.º 8
0
 def testArbitrary(self):
     """Asserts correct Torsion object for arbitrary input parameters."""
     param = ['ANGLE', '62', '64', '67', '51', '10.0', '90.0', '3', '9']
     test.assertObjectEqual(
         self, fileio.GetTorsionFromPrm(param),
         molecule.Torsion(61, 63, 66, 50, 10.0, 90.0, 3, 9))
Exemplo n.º 9
0
 def testSmallestValues(self):
     """Asserts correct Torsion object for smallest allowed values."""
     param = ['TORSION', '1', '2', '3', '4', '0.000001', '-180.0', '1', '1']
     test.assertObjectEqual(
         self, fileio.GetTorsionFromPrm(param),
         molecule.Torsion(0, 1, 2, 3, 0.000001, -180.0, 1, 1))