Exemple #1
0
 def test_1(self):
     """
     Test post functionality of /tools/chemkin/
     """
     
     chemFile = os.path.join(rmgpy.getPath(),'tools','data','diffmodels','chem1.inp')
     dictFile = os.path.join(rmgpy.getPath(),'tools','data','diffmodels','species_dictionary1.txt')
     
     with open(chemFile) as cf, open(dictFile) as df:
         response = self.client.post('/tools/chemkin/', {'ChemkinFile': cf, 'DictionaryFile': df})
     
     self.assertEqual(response.status_code, 200)
     
     folder = os.path.join(settings.MEDIA_ROOT,'rmg','tools','chemkin')
     
     # Check if inputs were correctly uploaded
     chemInput = os.path.join(folder,'chemkin','chem.inp')
     dictInput = os.path.join(folder,'RMG_Dictionary.txt')
     
     self.assertTrue(os.path.isfile(chemInput),'Chemkin file was not uploaded')
     self.assertTrue(os.path.isfile(dictInput),'Dictionary file was not uploaded')
     
     # Check if outputs were correctly generated
     htmlOutput = os.path.join(folder,'output.html')
     
     self.assertTrue(os.path.isfile(htmlOutput),'HTML Output was not generated')
     
     # Clean up
     shutil.rmtree(folder)
Exemple #2
0
 def test_1(self):
     """
     Test basic functionality of /tools/compare/
     """
     
     chemFile1 = os.path.join(rmgpy.getPath(),'tools','data','diffmodels','chem1.inp')
     dictFile1 = os.path.join(rmgpy.getPath(),'tools','data','diffmodels','species_dictionary1.txt')
     chemFile2 = os.path.join(rmgpy.getPath(),'tools','data','diffmodels','chem2.inp')
     dictFile2 = os.path.join(rmgpy.getPath(),'tools','data','diffmodels','species_dictionary2.txt')
     
     with open(chemFile1) as cf1, open(dictFile1) as df1, open(chemFile2) as cf2, open(dictFile2) as df2:
         response = self.client.post('/tools/compare/', {'ChemkinFile1': cf1, 'DictionaryFile1': df1, 'ChemkinFile2': cf2, 'DictionaryFile2': df2})
     
     self.assertEqual(response.status_code, 200)
     
     folder = os.path.join(settings.MEDIA_ROOT,'rmg','tools','compare')
     
     # Check if inputs were correctly uploaded
     chemInput1 = os.path.join(folder,'chem1.inp')
     dictInput1 = os.path.join(folder,'RMG_Dictionary1.txt')
     chemInput2 = os.path.join(folder,'chem2.inp')
     dictInput2 = os.path.join(folder,'RMG_Dictionary2.txt')
     
     self.assertTrue(os.path.isfile(chemInput1),'Chemkin file 1 was not uploaded')
     self.assertTrue(os.path.isfile(dictInput1),'Dictionary file 1 was not uploaded')
     self.assertTrue(os.path.isfile(chemInput2),'Chemkin file was 2 not uploaded')
     self.assertTrue(os.path.isfile(dictInput2),'Dictionary file 2 was not uploaded')
     
     # Check if outputs were correctly generated
     htmlOutput = os.path.join(folder,'diff.html')
     
     self.assertTrue(os.path.isfile(htmlOutput),'HTML Output was not generated')
     
     shutil.rmtree(folder)
Exemple #3
0
 def test_1(self):
     """
     Test basic functionality of /tools/flux/
     """
     
     inputFile = os.path.join(rmgpy.getPath(),'tools','data','flux','input.py')
     chemFile = os.path.join(rmgpy.getPath(),'tools','data','flux','chemkin','chem.inp')
     dictFile = os.path.join(rmgpy.getPath(),'tools','data','flux','chemkin','species_dictionary.txt')
     
     with open(inputFile) as nf, open(chemFile) as cf, open(dictFile) as df:
         response = self.client.post('/tools/flux/', {'InputFile': nf, 'ChemkinFile': cf, 'DictionaryFile': df, 
                                                      'MaxNodes': 50, 'MaxEdges': 50, 'TimeStep': 1.25, 
                                                      'ConcentrationTolerance': 1e-6, 'SpeciesRateTolerance': 1e-6})
     
     self.assertEqual(response.status_code, 200)
     
     folder = os.path.join(settings.MEDIA_ROOT,'rmg','tools','flux')
     
     # Check if inputs were correctly uploaded
     pyInput = os.path.join(folder,'input.py')
     chemInput = os.path.join(folder,'chem.inp')
     dictInput = os.path.join(folder,'species_dictionary.txt')
     
     self.assertTrue(os.path.isfile(pyInput),'RMG input file was not uploaded')
     self.assertTrue(os.path.isfile(chemInput),'Chemkin file was not uploaded')
     self.assertTrue(os.path.isfile(dictInput),'Dictionary file was not uploaded')
     
     # Check if outputs were correctly generated
     videoOutput = os.path.join(folder,'1','flux_diagram.avi')
     species = os.path.join(folder,'species')
     
     self.assertTrue(os.path.isfile(videoOutput),'Video output was not generated')
     self.assertTrue(os.path.isdir(species),'Species directory was not generated')
     
     shutil.rmtree(folder)
    def test_3(self):
        """
        Test basic functionality of /tools/merge_models/
        """

        chemFile1 = os.path.join(rmgpy.getPath(), 'tools', 'data',
                                 'diffmodels', 'chem1.inp')
        dictFile1 = os.path.join(rmgpy.getPath(), 'tools', 'data',
                                 'diffmodels', 'species_dictionary1.txt')
        chemFile2 = os.path.join(rmgpy.getPath(), 'tools', 'data',
                                 'diffmodels', 'chem2.inp')
        dictFile2 = os.path.join(rmgpy.getPath(), 'tools', 'data',
                                 'diffmodels', 'species_dictionary2.txt')

        with open(chemFile1) as cf1, open(dictFile1) as df1, open(
                chemFile2) as cf2, open(dictFile2) as df2:
            response = self.client.post(
                '/tools/merge_models/', {
                    'ChemkinFile1': cf1,
                    'DictionaryFile1': df1,
                    'ChemkinFile2': cf2,
                    'DictionaryFile2': df2
                })

        self.assertEqual(response.status_code, 200)

        folder = os.path.join(settings.MEDIA_ROOT, 'rmg', 'tools', 'compare')

        # Check if inputs were correctly uploaded
        chemInput1 = os.path.join(folder, 'chem1.inp')
        dictInput1 = os.path.join(folder, 'RMG_Dictionary1.txt')
        chemInput2 = os.path.join(folder, 'chem2.inp')
        dictInput2 = os.path.join(folder, 'RMG_Dictionary2.txt')

        self.assertTrue(os.path.isfile(chemInput1),
                        'Chemkin file 1 was not uploaded')
        self.assertTrue(os.path.isfile(dictInput1),
                        'Dictionary file 1 was not uploaded')
        self.assertTrue(os.path.isfile(chemInput2),
                        'Chemkin file was 2 not uploaded')
        self.assertTrue(os.path.isfile(dictInput2),
                        'Dictionary file 2 was not uploaded')

        # Check if outputs were correctly generated
        chemOutput = os.path.join(folder, 'chem.inp')
        dictOutput = os.path.join(folder, 'species_dictionary.txt')
        logOutput = os.path.join(folder, 'merging_log.txt')

        self.assertTrue(os.path.isfile(chemOutput),
                        'CHEMKIN file was not generated')
        self.assertTrue(os.path.isfile(dictOutput),
                        'Species dictionary was not generated')
        self.assertTrue(os.path.isfile(logOutput),
                        'Merging log file was not generated')

        shutil.rmtree(folder)
    def test_1(self):
        """
        Test basic functionality of /tools/flux/
        """

        inputFile = os.path.join(rmgpy.getPath(), 'tools', 'data', 'flux',
                                 'input_simple.py')
        chemFile = os.path.join(rmgpy.getPath(), 'tools', 'data', 'flux',
                                'chemkin', 'chem.inp')
        dictFile = os.path.join(rmgpy.getPath(), 'tools', 'data', 'flux',
                                'chemkin', 'species_dictionary.txt')

        with open(inputFile) as nf, open(chemFile) as cf, open(dictFile) as df:
            response = self.client.post(
                '/tools/flux/', {
                    'InputFile': nf,
                    'ChemkinFile': cf,
                    'DictionaryFile': df,
                    'MaxNodes': 50,
                    'MaxEdges': 50,
                    'TimeStep': 1.25,
                    'ConcentrationTolerance': 1e-6,
                    'SpeciesRateTolerance': 1e-6
                })

        self.assertEqual(response.status_code, 200)

        folder = os.path.join(settings.MEDIA_ROOT, 'rmg', 'tools', 'flux')

        # Check if inputs were correctly uploaded
        pyInput = os.path.join(folder, 'input.py')
        chemInput = os.path.join(folder, 'chem.inp')
        dictInput = os.path.join(folder, 'species_dictionary.txt')

        self.assertTrue(os.path.isfile(pyInput),
                        'RMG input file was not uploaded')
        self.assertTrue(os.path.isfile(chemInput),
                        'Chemkin file was not uploaded')
        self.assertTrue(os.path.isfile(dictInput),
                        'Dictionary file was not uploaded')

        # Check if outputs were correctly generated
        videoOutput = os.path.join(folder, '1', 'flux_diagram.avi')
        species = os.path.join(folder, 'species')

        self.assertTrue(os.path.isfile(videoOutput),
                        'Video output was not generated')
        self.assertTrue(os.path.isdir(species),
                        'Species directory was not generated')

        shutil.rmtree(folder)
Exemple #6
0
 def getGitCommit(self):
     import subprocess
     from rmgpy import getPath
     try:
         return subprocess.check_output(['git', 'log',
                                         '--format=%H%n%cd', '-1'],
                                         cwd=getPath()).splitlines()
     except:
         return '', ''
Exemple #7
0
    def createOutput(self):
        """
        Generate output html file from the path containing chemkin and dictionary files.
        """

        import subprocess
        import rmgpy

        command = ("python", os.path.join(rmgpy.getPath(), "..", "generateReactions.py"), self.input)
        subprocess.check_call(command, cwd=self.path)
Exemple #8
0
    def createOutput(self):
        """
        Generate output html file from the path containing chemkin and dictionary files.
        """

        import subprocess
        import rmgpy
        command = (
            'python',
            os.path.join(rmgpy.getPath(), '..', 'generateReactions.py'),
            self.input,
        )
        subprocess.check_call(command, cwd=self.path)
Exemple #9
0
 def createOutput(self):
     """
     Generate output html file from the path containing chemkin and dictionary files.
     """
     
     
     import subprocess
     import rmgpy
     command = ('python',
         os.path.realpath(os.path.join(rmgpy.getPath(), '..', 'scripts', 'generateReactions.py')),
         self.input,
     )
     subprocess.check_call(command, cwd=self.path)
Exemple #10
0
	def setUp(self):
		"""
		A function run before each unit test in this class.
		"""
		RMGpy_path = os.path.normpath(os.path.join(getPath(),'..'))
		
		fileStore = os.path.join(RMGpy_path, 'testing', 'qm', 'QMfiles')
		
		self.mop1 = QMCalculator(software = 'mopac',
								method = 'pm3',
								fileStore = fileStore
								)
				
		self.mop2 = QMCalculator(software = 'mopac',
								method = 'pm6',
								)
		
		self.mop3 = QMCalculator(software = 'mopac',
								method = 'pm7',
								fileStore = fileStore
								)
		
		self.mop4 = QMCalculator(software = 'mopac',
								method = 'pm8',
								fileStore = fileStore
								)
		
		self.gauss1 = QMCalculator(software = 'gaussian',
								  method = 'pm3',
								  )	
		
		self.gauss2 = QMCalculator(software = 'gaussian',
								  method = 'pm6',
								  fileStore = fileStore
								  )
		
		self.gauss3 = QMCalculator(software = 'gaussian',
								  method = 'pm7',
								  fileStore = fileStore
								  )
		
		self.molpro1 = QMCalculator(software = 'molpro',
								   method = 'mp2',
								   fileStore = fileStore
								   )
		
		self.qmmol1 = QMCalculator(fileStore=fileStore)
		self.qmmol1.RMG_bin_path = os.path.join(RMGpy_path, 'testing', 'qm', 'bin')
		
		self.qmmol2 = QMCalculator(fileStore=fileStore)
		self.qmmol2.RMG_bin_path = os.path.join(RMGpy_path, 'testing', 'hexadiene', 'input.py')
Exemple #11
0
    def test_1(self):
        """
        Test post functionality of /tools/chemkin/
        """

        chemFile = os.path.join(rmgpy.getPath(), 'tools', 'data', 'diffmodels',
                                'chem1.inp')
        dictFile = os.path.join(rmgpy.getPath(), 'tools', 'data', 'diffmodels',
                                'species_dictionary1.txt')

        with open(chemFile) as cf, open(dictFile) as df:
            response = self.client.post('/tools/chemkin/', {
                'ChemkinFile': cf,
                'DictionaryFile': df
            })

        self.assertEqual(response.status_code, 200)

        folder = os.path.join(settings.MEDIA_ROOT, 'rmg', 'tools', 'chemkin')

        # Check if inputs were correctly uploaded
        chemInput = os.path.join(folder, 'chemkin', 'chem.inp')
        dictInput = os.path.join(folder, 'RMG_Dictionary.txt')

        self.assertTrue(os.path.isfile(chemInput),
                        'Chemkin file was not uploaded')
        self.assertTrue(os.path.isfile(dictInput),
                        'Dictionary file was not uploaded')

        # Check if outputs were correctly generated
        htmlOutput = os.path.join(folder, 'output.html')

        self.assertTrue(os.path.isfile(htmlOutput),
                        'HTML Output was not generated')

        # Clean up
        shutil.rmtree(folder)
Exemple #12
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()
 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()
Exemple #14
0
    def setUp(self):
        """
        A function run before each unit test in this class.
        """
        RMGpy_path = os.path.normpath(os.path.join(getPath(),'..'))
        
        qm = QMCalculator(software = 'gaussian',
                          method = 'pm6',
                          fileStore = os.path.join(RMGpy_path, 'testing', 'qm', 'QMfiles'),
                          scratchDirectory = os.path.join(RMGpy_path, 'testing', 'qm', 'QMscratch'),
                          )

        if not os.path.exists(qm.settings.fileStore):
            os.makedirs(qm.settings.fileStore)

        self.qmmol1 = GaussianMolPM6(mol1, qm.settings)
Exemple #15
0
    def setUp(self):
        """
        A function run before each unit test in this class.
        """
        RMGpy_path = os.path.normpath(os.path.join(getPath(),'..'))
        
        qm = QMCalculator(software = 'gaussian',
                          method = 'pm6',
                          fileStore = os.path.join(RMGpy_path, 'testing', 'qm', 'QMfiles'),
                          scratchDirectory = os.path.join(RMGpy_path, 'testing', 'qm', 'QMscratch'),
                          )

        if not os.path.exists(qm.settings.fileStore):
            os.makedirs(qm.settings.fileStore)

        self.qmmol1 = GaussianMolPM6(mol1, qm.settings)
Exemple #16
0
    def test_1(self):
        """
        Test basic functionality of /tools/populate_reactions/
        """

        from rmgpy.chemkin import loadChemkinFile
        from rmgpy.rmg.model import ReactionModel

        inputFile = os.path.join(rmgpy.getPath(), 'tools', 'data', 'generate',
                                 'input.py')

        with open(inputFile) as fp:
            response = self.client.post('/tools/populate_reactions/',
                                        {'InputFile': fp})

        self.assertEqual(response.status_code, 200)

        folder = os.path.join(settings.MEDIA_ROOT, 'rmg', 'tools',
                              'populateReactions')

        # Check if inputs were correctly uploaded
        pyInput = os.path.join(folder, 'input.txt')

        self.assertTrue(os.path.isfile(pyInput),
                        'RMG input file was not uploaded')

        # Check if outputs were correctly generated
        htmlOutput = os.path.join(folder, 'output.html')
        chemOutput = os.path.join(folder, 'chemkin', 'chem.inp')
        dictOutput = os.path.join(folder, 'chemkin', 'species_dictionary.txt')

        self.assertTrue(os.path.isfile(htmlOutput),
                        'HTML Output was not generated')
        self.assertTrue(os.path.isfile(chemOutput),
                        'CHEMKIN file was not generated')
        self.assertTrue(os.path.isfile(dictOutput),
                        'Species dictionary was not generated')

        # Check that the output is not empty
        model = ReactionModel()
        model.species, model.reactions = loadChemkinFile(
            chemOutput, dictOutput)

        self.assertTrue(model.species, 'No species were generated')
        self.assertTrue(model.reactions, 'No reactions were generated')

        shutil.rmtree(folder)
    def setUp(self):
        """
        A function run before each unit test in this class.
        """
        RMGpy_path = os.path.normpath(os.path.join(getPath(), '..'))

        qm = QMCalculator(software='mopac',
                          method='pm7',
                          fileStore=os.path.join(RMGpy_path, 'testing', 'qm', 'QMfiles'),
                          scratchDirectory=os.path.join(RMGpy_path, 'testing', 'qm', 'QMscratch'),
                          )

        if not os.path.exists(qm.settings.fileStore):
            os.makedirs(qm.settings.fileStore)

        mol1 = Molecule().fromSMILES('C1=CC=C2C=CC=CC2=C1')
        self.qmmol1 = MopacMolPM7(mol1, qm.settings)
Exemple #18
0
    def setUp(self):
        """
		A function run before each unit test in this class.
		"""
        RMGpy_path = os.path.normpath(os.path.join(getPath(), ".."))

        qm = QMCalculator(
            software="mopac",
            method="pm3",
            fileStore=os.path.join(RMGpy_path, "testing", "qm", "QMfiles"),
            scratchDirectory=os.path.join(RMGpy_path, "testing", "qm", "QMscratch"),
        )

        if not os.path.exists(qm.settings.fileStore):
            os.makedirs(qm.settings.fileStore)

        self.qmmol1 = MopacMolPM3(mol1, qm.settings)
Exemple #19
0
    def setUp(self):
        """
        A function run before each unit test in this class.
        """
        RMGpy_path = os.path.normpath(os.path.join(getPath(), '..'))

        qm = QMCalculator(software='mopac',
                          method='pm7',
                          fileStore=os.path.join(RMGpy_path, 'testing', 'qm', 'QMfiles'),
                          scratchDirectory=os.path.join(RMGpy_path, 'testing', 'qm', 'QMscratch'),
                          )

        if not os.path.exists(qm.settings.fileStore):
            os.makedirs(qm.settings.fileStore)

        mol1 = Molecule().fromSMILES('C1=CC=C2C=CC=CC2=C1')
        self.qmmol1 = MopacMolPM7(mol1, qm.settings)
Exemple #20
0
    def setUp(self):
        """
        A function run before each unit test in this class.
        """
        rmg_path = os.path.normpath(os.path.join(getPath(), '..'))
        self.fileStore = os.path.join(rmg_path, 'testing', 'qm', 'QMfiles')

        self.mop1 = QMCalculator(software='mopac',
                                 method='pm3',
                                 fileStore=self.fileStore)

        self.mop2 = QMCalculator(
            software='mopac',
            method='pm6',
        )

        self.mop3 = QMCalculator(software='mopac',
                                 method='pm7',
                                 fileStore=self.fileStore)

        self.mop4 = QMCalculator(software='mopac',
                                 method='pm8',
                                 fileStore=self.fileStore)

        self.gauss1 = QMCalculator(
            software='gaussian',
            method='pm3',
        )

        self.gauss2 = QMCalculator(software='gaussian',
                                   method='pm6',
                                   fileStore=self.fileStore)

        self.gauss3 = QMCalculator(software='gaussian',
                                   method='pm7',
                                   fileStore=self.fileStore)

        self.molpro1 = QMCalculator(software='molpro',
                                    method='mp2',
                                    fileStore=self.fileStore)

        self.qmmol1 = QMCalculator(fileStore=self.fileStore)

        self.qmmol2 = QMCalculator(fileStore=self.fileStore)
Exemple #21
0
 def test_1(self):
     """
     Test basic functionality of /tools/populate_reactions/
     """
     
     from rmgpy.chemkin import loadChemkinFile
     from rmgpy.rmg.model import ReactionModel
     
     inputFile = os.path.join(rmgpy.getPath(),'tools','data','generate','input.py')
     
     with open(inputFile) as fp:
         response = self.client.post('/tools/populate_reactions/', {'InputFile': fp})
     
     self.assertEqual(response.status_code, 200)
     
     folder = os.path.join(settings.MEDIA_ROOT,'rmg','tools','populateReactions')
     
     # Check if inputs were correctly uploaded
     pyInput = os.path.join(folder,'input.txt')
     
     self.assertTrue(os.path.isfile(pyInput),'RMG input file was not uploaded')
     
     # Check if outputs were correctly generated
     htmlOutput = os.path.join(folder,'output.html')
     chemOutput = os.path.join(folder,'chemkin','chem.inp')
     dictOutput = os.path.join(folder,'chemkin','species_dictionary.txt')
     
     self.assertTrue(os.path.isfile(htmlOutput),'HTML Output was not generated')
     self.assertTrue(os.path.isfile(chemOutput),'CHEMKIN file was not generated')
     self.assertTrue(os.path.isfile(dictOutput),'Species dictionary was not generated')
     
     # Check that the output is not empty
     model = ReactionModel()
     model.species, model.reactions = loadChemkinFile(chemOutput, dictOutput)
     
     self.assertTrue(model.species,'No species were generated')
     self.assertTrue(model.reactions, 'No reactions were generated')
     
     shutil.rmtree(folder)
Exemple #22
0
	def setUp(self):
		"""
		A function run before each unit test in this class.
		"""
		RMGpy_path = os.path.normpath(os.path.join(getPath(),'..'))
		
		fileStore = os.path.join(RMGpy_path, 'testing', 'qm', 'QMfiles')
		if not os.path.exists(fileStore):
			os.makedirs(fileStore)
		
		self.mop1 = QMCalculator(fileStore=fileStore)
		self.mop1.settings.software = 'mopac'
		self.mop1.settings.method = 'pm3'
		self.mop1.settings.onlyCyclics = False
		self.mop1.settings.maxRadicalNumber = 0
				
		self.mop2 = QMCalculator()
		self.mop2.settings.software = 'mopac'
		self.mop2.settings.method = 'pm6'
		self.mop2.settings.onlyCyclics = False
		self.mop2.settings.maxRadicalNumber = 0

		
		self.mop3 = QMCalculator(fileStore=fileStore)
		self.mop3.settings.software = 'mopac'
		self.mop3.settings.method = 'pm7'
		self.mop3.settings.onlyCyclics = False
		self.mop3.settings.maxRadicalNumber = 0
		
		self.mop4 = QMCalculator(fileStore=fileStore)
		self.mop4.settings.software = 'mopac'
		self.mop4.settings.method = 'pm8'
		self.mop4.settings.onlyCyclics = False
		self.mop4.settings.maxRadicalNumber = 0
		
		self.gauss1 = QMCalculator()
		self.gauss1.settings.software = 'gaussian'
		self.gauss1.settings.method = 'pm3'
		self.gauss1.settings.onlyCyclics = False
		self.gauss1.settings.maxRadicalNumber = 0	
		
		self.gauss2 = QMCalculator(fileStore=fileStore)
		self.gauss2.settings.software = 'gaussian'
		self.gauss2.settings.method = 'pm6'
		self.gauss2.settings.onlyCyclics = False
		self.gauss2.settings.maxRadicalNumber = 0
		
		self.gauss3 = QMCalculator(fileStore=fileStore)
		self.gauss3.settings.software = 'gaussian'
		self.gauss3.settings.method = 'pm7'
		self.gauss3.settings.onlyCyclics = False
		self.gauss3.settings.maxRadicalNumber = 0
		
		self.molpro1 = QMCalculator(fileStore=fileStore)
		self.molpro1.settings.software = 'molpro'
		self.molpro1.settings.method = 'mp2'
		self.molpro1.settings.onlyCyclics = False
		self.molpro1.settings.maxRadicalNumber = 0
		
		self.qmmol1 = QMCalculator(fileStore=fileStore)
		self.qmmol1.RMG_bin_path = os.path.join(RMGpy_path, 'testing', 'qm', 'bin')
		
		self.qmmol2 = QMCalculator(fileStore=fileStore)
		self.qmmol2.RMG_bin_path = os.path.join(RMGpy_path, 'testing', 'hexadiene', 'input.py')
Exemple #23
0
	def setUp(self):
		"""
		A function run before each unit test in this class.
		"""
		RMGpy_path = os.path.normpath(os.path.join(getPath(),'..'))
		
		fileStore = os.path.join(RMGpy_path, 'testing', 'qm', 'QMfiles')
		if not os.path.exists(fileStore):
			os.makedirs(fileStore)
		
		self.mop1 = QMCalculator(fileStore=fileStore)
		self.mop1.settings.software = 'mopac'
		self.mop1.settings.method = 'pm3'
		self.mop1.settings.onlyCyclics = False
		self.mop1.settings.maxRadicalNumber = 0
				
		self.mop2 = QMCalculator()
		self.mop2.settings.software = 'mopac'
		self.mop2.settings.method = 'pm6'
		self.mop2.settings.onlyCyclics = False
		self.mop2.settings.maxRadicalNumber = 0

		
		self.mop3 = QMCalculator(fileStore=fileStore)
		self.mop3.settings.software = 'mopac'
		self.mop3.settings.method = 'pm7'
		self.mop3.settings.onlyCyclics = False
		self.mop3.settings.maxRadicalNumber = 0
		
		self.mop4 = QMCalculator(fileStore=fileStore)
		self.mop4.settings.software = 'mopac'
		self.mop4.settings.method = 'pm8'
		self.mop4.settings.onlyCyclics = False
		self.mop4.settings.maxRadicalNumber = 0
		
		self.gauss1 = QMCalculator()
		self.gauss1.settings.software = 'gaussian'
		self.gauss1.settings.method = 'pm3'
		self.gauss1.settings.onlyCyclics = False
		self.gauss1.settings.maxRadicalNumber = 0	
		
		self.gauss2 = QMCalculator(fileStore=fileStore)
		self.gauss2.settings.software = 'gaussian'
		self.gauss2.settings.method = 'pm6'
		self.gauss2.settings.onlyCyclics = False
		self.gauss2.settings.maxRadicalNumber = 0
		
		self.gauss3 = QMCalculator(fileStore=fileStore)
		self.gauss3.settings.software = 'gaussian'
		self.gauss3.settings.method = 'pm7'
		self.gauss3.settings.onlyCyclics = False
		self.gauss3.settings.maxRadicalNumber = 0
		
		self.molpro1 = QMCalculator(fileStore=fileStore)
		self.molpro1.settings.software = 'molpro'
		self.molpro1.settings.method = 'mp2'
		self.molpro1.settings.onlyCyclics = False
		self.molpro1.settings.maxRadicalNumber = 0
		
		self.qmmol1 = QMCalculator(fileStore=fileStore)
		self.qmmol1.RMG_bin_path = os.path.join(RMGpy_path, 'testing', 'qm', 'bin')
		
		self.qmmol2 = QMCalculator(fileStore=fileStore)
		self.qmmol2.RMG_bin_path = os.path.join(RMGpy_path, 'testing', 'hexadiene', 'input.py')
Exemple #24
0
from rmgpy.qm.main import QMCalculator
from rmgpy.molecule import Molecule
from rmgpy.qm.mopac import MopacMolPM3, MopacMolPM6, MopacMolPM7


mopacEnv = os.getenv('MOPAC_DIR', default="/opt/mopac")
if os.path.exists(os.path.join(mopacEnv , 'MOPAC2012.exe')):
	executablePath = os.path.join(mopacEnv , 'MOPAC2012.exe')
elif os.path.exists(os.path.join(mopacEnv , 'MOPAC2009.exe')):
	executablePath = os.path.join(mopacEnv , 'MOPAC2009.exe')
else:
	executablePath = os.path.join(mopacEnv , '(MOPAC 2009 or 2012)')
	
qm = QMCalculator()
qm.settings.software = 'mopac'
RMGpy_path = os.path.normpath(os.path.join(getPath(),'..'))
qm.settings.fileStore = os.path.join(RMGpy_path, 'testing', 'qm', 'QMfiles')
qm.settings.scratchDirectory = None
qm.settings.onlyCyclics = False
qm.settings.maxRadicalNumber = 0

mol1 = Molecule().fromSMILES('C1=CC=C2C=CC=CC2=C1')

class TestMopacMolPM3(unittest.TestCase):
	"""
	Contains unit tests for the Geometry class.
	"""
	
	@unittest.skipIf(os.path.exists(executablePath)==False, "MOPAC not found. Try resetting your environment variables if you want to use it.")
	def setUp(self):
		"""
Exemple #25
0
#   DEALINGS IN THE SOFTWARE.
#
################################################################################

import os
import unittest
import shutil 
from nose.plugins.attrib import attr
from main import RMG
from rmgpy import settings
from rmgpy.data.rmg import RMGDatabase
from rmgpy import getPath
from rmgpy.rmg.model import CoreEdgeReactionModel
###################################################

originalPath = getPath()
@attr('functional')
class TestMain(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        """A function that is run ONCE before all unit tests in this class."""
        cls.testDir = os.path.join(originalPath, 'rmg', 'test_data', 'mainTest')
        cls.outputDir = 'output'
        cls.databaseDirectory = settings['database.directory']

        cls.seedThermo = os.path.join(cls.databaseDirectory, 'thermo', 'libraries', 'testSeed.py')
        cls.seedKinetics = os.path.join(cls.databaseDirectory, 'kinetics', 'libraries', 'testSeed')
        cls.seedThermoEdge = os.path.join(cls.databaseDirectory, 'thermo', 'libraries', 'testSeed_edge.py')
        cls.seedKineticsEdge = os.path.join(cls.databaseDirectory, 'kinetics', 'libraries', 'testSeed_edge')
Exemple #26
0
#   DEALINGS IN THE SOFTWARE.
#
################################################################################

import os
import unittest
import shutil 

from main import RMG
from rmgpy import settings
from rmgpy.data.rmg import RMGDatabase
from rmgpy import getPath
from rmgpy.rmg.model import CoreEdgeReactionModel
###################################################

originalPath = getPath()

class TestMain(unittest.TestCase):

    @classmethod
    def setUpClass(cls):
        """A function that is run ONCE before all unit tests in this class."""
        cls.testDir = os.path.join(originalPath, 'rmg', 'test_data', 'mainTest')
        cls.outputDir = 'output'
        cls.databaseDirectory = settings['database.directory']

        cls.seedThermo = os.path.join(cls.databaseDirectory, 'thermo', 'libraries', 'testSeed.py')
        cls.seedKinetics = os.path.join(cls.databaseDirectory, 'kinetics', 'libraries', 'testSeed')
        cls.seedThermoEdge = os.path.join(cls.databaseDirectory, 'thermo', 'libraries', 'testSeed_edge.py')
        cls.seedKineticsEdge = os.path.join(cls.databaseDirectory, 'kinetics', 'libraries', 'testSeed_edge')
Exemple #27
0
from rmgpy.qm.main import QMCalculator
from rmgpy.molecule import Molecule
from rmgpy.qm.gaussian import GaussianMolPM3, GaussianMolPM6

gaussEnv = os.getenv('GAUSS_EXEDIR') or os.getenv('g09root') or os.getenv(
    'g03root') or ""
if os.path.exists(os.path.join(gaussEnv, 'g09')):
    executablePath = os.path.join(gaussEnv, 'g09')
elif os.path.exists(os.path.join(gaussEnv, 'g03')):
    executablePath = os.path.join(gaussEnv, 'g03')
else:
    executablePath = os.path.join(gaussEnv, '(g03 or g09)')

qm = QMCalculator()
qm.settings.software = 'gaussian'
RMGpy_path = os.path.normpath(os.path.join(getPath(), '..'))
qm.settings.fileStore = os.path.join(RMGpy_path, 'testing', 'qm', 'QMfiles')
qm.settings.scratchDirectory = None
qm.settings.onlyCyclics = False
qm.settings.maxRadicalNumber = 0

mol1 = Molecule().fromSMILES('C1=CC=C2C=CC=CC2=C1')


class TestGaussianMolPM3(unittest.TestCase):
    """
	Contains unit tests for the Geometry class.
	"""
    @unittest.skipIf(
        os.path.exists(executablePath) == False,
        "Gaussian not found. Try resetting your environment variables if you want to use it."