Exemplo n.º 1
0
class TestQMSettings(unittest.TestCase):
    """
    Contains unit tests for the QMSettings class.
    """
    def setUp(self):
        """
        A function run before each unit test in this class.
        """
        rmg_path = os.path.normpath(os.path.join(get_path(), '..'))

        self.settings1 = QMSettings(
            software='mopac',
            method='pm3',
            fileStore=os.path.join(rmg_path, 'testing', 'qm', 'QMfiles'),
            scratchDirectory=None,
            onlyCyclics=False,
            maxRadicalNumber=0,
        )

        self.settings2 = QMSettings()

    def test_check_all_set(self):
        """
        Test that check_all_set() works correctly.
        """
        try:
            self.settings1.check_all_set()
        except AssertionError:
            self.fail("check_all_set() raised unexpected AssertionError.")

        with self.assertRaises(AssertionError):
            self.settings2.check_all_set()
Exemplo n.º 2
0
class TestQMSettings(unittest.TestCase):
    """
    Contains unit tests for the QMSettings class.
    """
    
    def setUp(self):
        """
        A function run before each unit test in this class.
        """
        RMGpy_path = os.path.normpath(os.path.join(getPath(),'..'))
        
        self.settings1 = QMSettings(software = 'mopac',
                                   method = 'pm3',
                                   fileStore = os.path.join(RMGpy_path, 'testing', 'qm', 'QMfiles'),
                                   scratchDirectory = None,
                                   onlyCyclics = False,
                                   maxRadicalNumber = 0,
                                   )
        
        self.settings2 = QMSettings()

    def testCheckAllSet(self):
        """
        Test that checkAllSet() works correctly.
        """
        try:
            self.settings1.checkAllSet()
        except AssertionError:
            self.fail("checkAllSet() raised unexpected AssertionError.")
        
        with self.assertRaises(AssertionError):
            self.settings2.checkAllSet()
Exemplo n.º 3
0
 def setUp(self):
     """
     A function run before each unit test in this class.
     """
     RMGpy_path = os.path.normpath(os.path.join(getPath(),'..'))
     
     self.settings1 = QMSettings(software = 'mopac',
                                method = 'pm3',
                                fileStore = os.path.join(RMGpy_path, 'testing', 'qm', 'QMfiles'),
                                scratchDirectory = None,
                                onlyCyclics = False,
                                maxRadicalNumber = 0,
                                )
     
     self.settings2 = QMSettings()
Exemplo n.º 4
0
	def setUp(self):
		"""
		A function run before each unit test in this class.
		"""
		RMGpy_path = os.path.normpath(os.path.join(getPath(),'..'))
		
		self.settings1 = QMSettings(software = 'mopac',
								   method = 'pm3',
								   fileStore = os.path.join(RMGpy_path, 'testing', 'qm', 'QMfiles'),
								   scratchDirectory = None,
								   onlyCyclics = False,
								   maxRadicalNumber = 0,
								   )
		
		self.settings2 = QMSettings()
Exemplo n.º 5
0
        atLblsP = dict([(lbl[0], False) for lbl in reaction.labeledAtoms])

        for reactant in reaction.reactants:
            reactant = reactant.molecule[0]
            reactant.clearLabeledAtoms()
            for atom in reactant.atoms:
                for atomLabel in reaction.labeledAtoms:
                    if atom == atomLabel[1]:
                        atom.label = atomLabel[0]
                        atLblsR[atomLabel[0]] = True
        for product in reaction.products:
            product = product.molecule[0]
            product.clearLabeledAtoms()
            for atom in product.atoms:
                for atomLabel in reaction.labeledAtoms:
                    if atom == atomLabel[1]:
                        atom.label = atomLabel[0]
                        atLblsP[atomLabel[0]] = True
        if all(atLblsR.values()) and all(atLblsP.values()):
            gotOne = True
            break

qmSettings = QMSettings(
    software='gaussian',
    method='m062x',
    fileStore=os.getcwd(),
    scratchDirectory='/gss_gpfs_scratch/slakman.b/QMscratch')

qmReac = GaussianTSM062X(reaction, qmSettings, tsDatabase)
qmReac.generateTSGeometryDirectGuess()