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)
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)
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())
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())
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)
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)
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)
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'))
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'))
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))
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))
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)
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)
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)