示例#1
0
    def testCCLibParser(self):

        #Tests to check whether the CCLibParser wrapper around CCLib works fine

        name = 'AAAOFKFEDKWQNN-UHFFFAOYAY'
        InChIaug = 'InChI=1/C9H14O2/c1-6(2)9-5-8(11-10)4-7(9)3/h4-6,8,10H,1-3H3'
        molecule = mol.Molecule().fromInChI(InChIaug)
        inputFileExtension = '.log'
        driver = qm.QMTP('gaussian03', 'pm3')
        directory = os.path.join(os.path.dirname(__file__), 'data', 'QMfiles',
                                 'G03')
        parsingTool = pars.CCLibParser(
            os.path.join(directory, name + inputFileExtension), driver)

        data = parsingTool.parse(molecule)

        self.assertEqual(data.groundStateDegeneracy, 1)
        self.assertEqual(data.cclib_data.natom, 25)
        self.assertEqual(data.cclib_data.molmass, 154.09938)
        self.assertEqual(len(data.cclib_data.atomcoords[-1]),
                         data.cclib_data.natom)
        self.assertEqual(len(data.atomCoords), data.numberOfAtoms)
        self.assertEqual(len(data.cclib_data.rotcons[-1]), 3)
        self.assertEqual(len(data.cclib_data.atomnos), data.cclib_data.natom)

        print 'Z-coord Atom coord of 1st atom: ' + str(
            data.cclib_data.atomcoords[-1][0][2])
示例#2
0
    def testSymmetryJob(self):
        """
        Check whether external call to symmetry tool works fine. 
        """
        name = 'AAAOFKFEDKWQNN-UHFFFAOYAY'
        directory = os.path.join(os.path.dirname(__file__), 'data', 'QMfiles',
                                 'G03')
        InChIaug = 'InChI=1/C9H14O2/c1-6(2)9-5-8(11-10)4-7(9)3/h4-6,8,10H,1-3H3'
        molecule = mol.Molecule().fromInChI(InChIaug)
        molfile = qm.molFile(molecule, name, directory, InChIaug)

        inputFileExtension = '.log'
        driver = qm.QMTP('gaussian03', 'pm3')

        parsingTool = pars.CCLibParser(
            os.path.join(directory, name + inputFileExtension), driver)

        iqmdata = parsingTool.parse(molecule)
        symm_job = job.SymmetryJob(molfile, iqmdata)
        pointGroup = symm_job.calculate()
        self.assertTrue(
            os.path.exists(
                os.path.join(directory, 'AAAOFKFEDKWQNN-UHFFFAOYAY.symm')))

        self.assertEqual(pointGroup.symmetryNumber, 1)
        self.assertTrue(
            pointGroup.chiral
        )  #the chiral flag is set to True for C1 symmetry groups!
        self.assertFalse(pointGroup.linear)
示例#3
0
    def testVerifierDoesNotExist(self):
        molecule = mol.Molecule()
        name = 'UMRZSTCPUPJPOJ-UHFFFAOYSA'
        directory = os.path.join(os.path.dirname(__file__), 'data', 'QMfiles')
        InChIaug = 'InChI=1S/C7H12/c1-2-7-4-3-6(1)5-7/h6-7H,1-5H2'
        molfile = qm.molFile(molecule, name, directory, InChIaug)

        verifier = verif.QMVerifier(molfile)
        verifier.verify()

        self.assertFalse(verifier.succesfulJobExists())
示例#4
0
 def testMOPAC_PM3_Parser(self):
     driver = qm.QMTP('mopac')
     name = 'GRWFGVWFFZKLTI-UHFFFAOYAF'
     InChIaug = 'InChI=1/C10H16/c1-7-4-5-8-6-9(7)10(8,2)3/h4,8-9H,5-6H2,1-3H3'
     molecule = mol.Molecule().fromInChI(InChIaug)
     directory = os.path.join(os.path.dirname(__file__), 'data', 'QMfiles',
                              'MOPAC')
     mf = qm.molFile(molecule, name, directory)
     parser = pars.MOPACPM3Parser(mf, driver)
     result = parser.parse()
     assert isinstance(result, ThermoData)
示例#5
0
    def testVerifierMOPACResultExists(self):
        molecule = mol.Molecule()
        name = 'GRWFGVWFFZKLTI-UHFFFAOYAF'
        directory = os.path.join(os.path.dirname(__file__), 'data', 'QMfiles',
                                 'MOPAC')
        InChIaug = 'InChI=1/C10H16/c1-7-4-5-8-6-9(7)10(8,2)3/h4,8-9H,5-6H2,1-3H3'
        molfile = qm.molFile(molecule, name, directory, InChIaug)

        verifier = verif.QMVerifier(molfile)
        verifier.verify()
        self.assertTrue(verifier.succesfulJobExists())
        self.assertTrue(verifier.mopacResultExists)
        self.assertFalse(verifier.gaussianResultExists)
示例#6
0
    def testMOPACJob(self):
        molecule = mol.Molecule()
        name = 'UMRZSTCPUPJPOJ-UHFFFAOYAR'
        directory = os.path.join(os.path.dirname(__file__), 'data', 'QMfiles',
                                 'MOPAC')
        InChIAug = ''

        molfile = qm.molFile(molecule, name, directory, InChIAug)
        mj = MOPACJob(molfile)
        success = mj.run()

        self.assertTrue(success)

        #remove generated output files
        os.remove(os.path.join(directory, name + '.out'))
        os.remove(os.path.join(directory, name + '.arc'))
示例#7
0
    def testG03InputWriter(self):
        """
        Checks whether the .gjf output file has been written based on the 3D coords file (.mol)
        """
        name = 'WTARULDDTDQWMU-UHFFFAOYAW'
        inchi = 'InChI=1/C10H16/c1-7-4-5-8-6-9(7)10(8,2)3/h8-9H,1,4-6H2,2-3H3'
        directory = os.path.join(os.path.dirname(__file__), 'data', 'QMfiles',
                                 '3DMolfiles')
        target_file = os.path.join(directory, name + '.gjf')
        if os.path.exists(target_file): os.remove(target_file)
        molecule = mol.Molecule().fromInChI(inchi)
        mf = qm.molFile(molecule, name, directory)

        writer = writers.GaussianPM3InputWriter(mf,
                                                attemptNumber=1,
                                                multiplicity=1)
        writer.write()

        time.sleep(3)  #otherwise assertion fails before the file is written!
        self.assertTrue(os.path.exists(target_file))
示例#8
0
 def testPointGroupCalculator(self):
     """
     Tests PointGroupCalculator
     """
     name = 'AAAOFKFEDKWQNN-UHFFFAOYAY'
     InChIaug = 'InChI=1/C9H14O2/c1-6(2)9-5-8(11-10)4-7(9)3/h4-6,8,10H,1-3H3'
     molecule = mol.Molecule().fromInChI(InChIaug)
     inputFileExtension = '.log'
     directory = os.path.join(os.path.dirname(__file__),'data/QMfiles/G03')
     driver = qm.QMTP('gaussian03', 'pm3')
     parsingTool = pars.CCLibParser(os.path.join(directory, name+inputFileExtension), driver)
     
     data = parsingTool.parse(molecule)
     mf = qm.molFile(molecule, name, directory)
     pgc = symm.PointGroupCalculator(mf, data)
     pg = pgc.calculate()
     
     self.assertTrue(isinstance(pg, symm.PointGroup))
     self.assertFalse(pg.linear)
     self.assertTrue(pg.chiral)#the chiral flag is set to True for C1 symmetry groups!
     self.assertEqual(pg.symmetryNumber, 1)