Exemplo n.º 1
0
    def test_bath_gas(self):
        """Test correctly assigning the bath_gas attribute"""
        self.assertIsNone(self.job1.bath_gas)

        job2 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz='C 0.0 0.0 0.0',
                   job_type='onedmin',
                   level_of_theory='b3lyp/6-31+g(d)',
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(arc_path, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100)
        self.assertEqual(job2.bath_gas, 'N2')

        job2 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz='C 0.0 0.0 0.0',
                   job_type='onedmin',
                   level_of_theory='b3lyp/6-31+g(d)',
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(arc_path, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100,
                   bath_gas='Ar')
        self.assertEqual(job2.bath_gas, 'Ar')
Exemplo n.º 2
0
 def setUpClass(cls):
     """
     A method that is run before all unit tests in this class.
     """
     cls.maxDiff = None
     cls.ess_settings = {'gaussian': ['server1'], 'molpro': ['server2', 'server1'], 'qchem': ['server1']}
     cls.project_directory = os.path.join(arc_path, 'Projects', 'arc_project_for_testing_delete_after_usage3')
     cls.spc1 = ARCSpecies(label=str('methylamine'), smiles=str('CN'))
     cls.spc2 = ARCSpecies(label=str('C2H6'), smiles=str('CC'))
     cls.job1 = Job(project='project_test', ess_settings=cls.ess_settings, species_name='methylamine',
                    xyz='C 0.0 0.0 0.0', job_type='conformer', conformer=0, level_of_theory='b97-d3/6-311+g(d,p)',
                    multiplicity=1, project_directory=cls.project_directory, job_num=101)
     cls.job2 = Job(project='project_test', ess_settings=cls.ess_settings, species_name='methylamine',
                    xyz='C 0.0 0.0 0.0', job_type='conformer', conformer=1, level_of_theory='b97-d3/6-311+g(d,p)',
                    multiplicity=1, project_directory=cls.project_directory, job_num=102)
     cls.job3 = Job(project='project_test', ess_settings=cls.ess_settings, species_name='C2H6', xyz='C 0.0 0.0 0.0',
                    job_type='freq', level_of_theory='wb97x-d3/6-311+g(d,p)', multiplicity=1,
                    project_directory=cls.project_directory, software='qchem', job_num=103)
     cls.rmgdb = rmgdb.make_rmg_database_object()
     cls.job_types1 = {'conformers': True,
                       'opt': True,
                       'fine_grid': False,
                       'freq': True,
                       'sp': True,
                       '1d_rotors': False,
                       'orbitals': False,
                       'lennard_jones': False,
                       }
     cls.sched1 = Scheduler(project='project_test', ess_settings=cls.ess_settings, species_list=[cls.spc1, cls.spc2],
                            composite_method='', conformer_level=default_levels_of_theory['conformer'],
                            opt_level=default_levels_of_theory['opt'], freq_level=default_levels_of_theory['freq'],
                            sp_level=default_levels_of_theory['sp'], scan_level=default_levels_of_theory['scan'],
                            ts_guess_level=default_levels_of_theory['ts_guesses'], rmgdatabase=cls.rmgdb,
                            project_directory=cls.project_directory, testing=True, job_types=cls.job_types1,
                            orbitals_level=default_levels_of_theory['orbitals'], adaptive_levels=None)
Exemplo n.º 3
0
 def setUpClass(cls):
     """
     A method that is run before all unit tests in this class.
     """
     cls.maxDiff = None
     cls.ess_settings = {
         'gaussian': ['server1', 'server2'],
         'molpro': ['server2'],
         'qchem': ['server1'],
         'onedmin': ['server1']
     }
     cls.job1 = Job(project='project_test',
                    ess_settings=cls.ess_settings,
                    species_name='tst_spc',
                    xyz='C 0.0 0.0 0.0',
                    job_type='opt',
                    level_of_theory='b3lyp/6-31+g(d)',
                    multiplicity=1,
                    testing=True,
                    project_directory=os.path.join(arc_path, 'Projects',
                                                   'project_test'),
                    fine=True,
                    job_num=100)
     cls.job1.initial_time = datetime.datetime(2019, 3, 15, 19, 53, 7, 0)
     cls.job1.final_time = datetime.datetime(2019, 3, 15, 19, 53, 8, 0)
     cls.job1.determine_run_time()
Exemplo n.º 4
0
 def test_from_dict(self):
     """Test Job.from_dict()"""
     job_dict = self.job1.as_dict()
     job = Job(**job_dict)
     self.assertEqual(job.multiplicity, 1)
     self.assertEqual(job.charge, 0)
     self.assertEqual(job.species_name, 'tst_spc')
     self.assertEqual(job.server, 'server1')
     self.assertEqual(job.level.as_dict(), {'method': 'b3lyp', 'basis': '6-31+g(d)',
                                            'method_type': 'dft', 'software': 'gaussian'})
     self.assertEqual(job.job_type, 'scan')
     self.assertEqual(job.project_directory.split('/')[-1], 'project_test')
     self.assertFalse(job.is_ts)
Exemplo n.º 5
0
    def test_bath_gas(self):
        """Test correctly assigning the bath_gas attribute"""
        self.assertIsNone(self.job1.bath_gas)

        job2 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz=self.xyz_c,
                   job_type='onedmin',
                   level={
                       'method': 'b3lyp',
                       'basis': '6-31+g(d)'
                   },
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(ARC_PATH, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100)
        self.assertEqual(job2.bath_gas, 'N2')

        job2 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz=self.xyz_c,
                   job_type='onedmin',
                   level={
                       'method': 'b3lyp',
                       'basis': '6-31+g(d)'
                   },
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(ARC_PATH, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100,
                   bath_gas='Ar')
        self.assertEqual(job2.bath_gas, 'Ar')
Exemplo n.º 6
0
 def setUpClass(cls):
     """
     A method that is run before all unit tests in this class.
     """
     cls.maxDiff = None
     cls.ess_settings = {
         'gaussian': ['server1', 'server2'],
         'molpro': ['server2'],
         'qchem': ['server1'],
         'onedmin': ['server1'],
         'orca': ['server1'],
         'terachem': ['server1']
     }
     cls.xyz_c = {
         'symbols': ('C', ),
         'isotopes': (12, ),
         'coords': ((0.0, 0.0, 0.0), )
     }
     cls.job1 = Job(
         project='arc_project_for_testing_delete_after_usage3',
         ess_settings=cls.ess_settings,
         species_name='tst_spc',
         xyz=cls.xyz_c,
         job_type='opt',
         level=Level(repr={
             'method': 'b3lyp',
             'basis': '6-31+g(d)'
         }),
         multiplicity=1,
         fine=True,
         job_num=100,
         testing=True,
         project_directory=os.path.join(arc_path, 'Projects',
                                        'project_test'),
         initial_time=datetime.datetime(2019, 3, 15, 19, 53, 7, 0),
         final_time='2019-3-15 19:53:08',
     )
     cls.job1.determine_run_time()
Exemplo n.º 7
0
    def test_automatic_ess_assignment(self):
        """Test that the Job module correctly assigns a software for specific methods and basis sets"""
        job0 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz='C 0.0 0.0 0.0',
                   job_type='opt',
                   level_of_theory='b3lyp/6-311++G(d,p)',
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(arc_path, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100)
        self.assertEqual(job0.software, 'gaussian')

        job0 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz='C 0.0 0.0 0.0',
                   job_type='opt',
                   level_of_theory='ccsd(t)/avtz',
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(arc_path, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100)
        self.assertEqual(job0.software, 'molpro')

        job0 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz='C 0.0 0.0 0.0',
                   job_type='opt',
                   level_of_theory='wb97xd/6-311++g(d,p)',
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(arc_path, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100)
        self.assertEqual(job0.software, 'gaussian')

        job0 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz='C 0.0 0.0 0.0',
                   job_type='opt',
                   level_of_theory='wb97x-d3/6-311++g(d,p)',
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(arc_path, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100)
        self.assertEqual(job0.software, 'qchem')

        job0 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz='C 0.0 0.0 0.0',
                   job_type='opt',
                   level_of_theory='b97/6-311++g(d,p)',
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(arc_path, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100)
        self.assertEqual(job0.software, 'gaussian')

        job0 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz='C 0.0 0.0 0.0',
                   job_type='opt',
                   level_of_theory='m062x/6-311++g(d,p)',
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(arc_path, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100)
        self.assertEqual(job0.software, 'gaussian')

        job0 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz='C 0.0 0.0 0.0',
                   job_type='opt',
                   level_of_theory='m06-2x/6-311++g(d,p)',
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(arc_path, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100)
        self.assertEqual(job0.software, 'qchem')

        job0 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz='C 0.0 0.0 0.0',
                   job_type='scan',
                   level_of_theory='m062x/6-311++g(d,p)',
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(arc_path, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100)
        self.assertEqual(job0.software, 'gaussian')

        job0 = Job(project='project_test',
                   ess_settings=self.ess_settings,
                   species_name='tst_spc',
                   xyz='C 0.0 0.0 0.0',
                   job_type='scan',
                   level_of_theory='m06-2x/6-311++g(d,p)',
                   multiplicity=1,
                   testing=True,
                   project_directory=os.path.join(arc_path, 'Projects',
                                                  'project_test'),
                   fine=True,
                   job_num=100)
        self.assertEqual(job0.software, 'qchem')

        self.assertEqual(job0.memory, 15000)
        self.assertEqual(job0.max_job_time, 120)
Exemplo n.º 8
0
 def test_format_max_job_time(self):
     """Test that the maximum job time can be formatted properly, including days, minutes, and seconds"""
     test_job = Job.__new__(Job)
     test_job.max_job_time = 59.888
     self.assertEqual(test_job.format_max_job_time('days'), '2-11:53:16')
     self.assertEqual(test_job.format_max_job_time('hours'), '59:53:16')
Exemplo n.º 9
0
    def test_automatic_ess_assignment(self):
        """Test that the Job module correctly assigns a software for specific methods and basis sets"""
        job0 = Job(project='project_test', ess_settings=self.ess_settings, species_name='tst_spc', xyz=self.xyz_c,
                   job_type='opt', level={'method': 'b3lyp', 'basis': '6-311++G(d,p)'},
                   multiplicity=1, testing=True,
                   project_directory=os.path.join(arc_path, 'Projects', 'project_test'), fine=True, job_num=100)
        self.assertEqual(job0.software, 'gaussian')

        job0 = Job(project='project_test', ess_settings=self.ess_settings, species_name='tst_spc', xyz=self.xyz_c,
                   job_type='opt', level={'method': 'ccsd(t)', 'basis': 'avtz'},
                   multiplicity=1, testing=True,
                   project_directory=os.path.join(arc_path, 'Projects', 'project_test'), fine=True, job_num=100)
        self.assertEqual(job0.software, 'molpro')

        job0 = Job(project='project_test', ess_settings=self.ess_settings, species_name='tst_spc', xyz=self.xyz_c,
                   job_type='opt', level={'method': 'wb97xd2', 'basis': '6-311++g(d,p)'},
                   multiplicity=1, testing=True,
                   project_directory=os.path.join(arc_path, 'Projects', 'project_test'), fine=True, job_num=100)
        self.assertEqual(job0.software, 'terachem')

        job0 = Job(project='project_test', ess_settings=self.ess_settings, species_name='tst_spc', xyz=self.xyz_c,
                   job_type='opt', level={'method': 'wb97x-d3', 'basis': '6-311++g(d,p)'},
                   multiplicity=1, testing=True,
                   project_directory=os.path.join(arc_path, 'Projects', 'project_test'), fine=True, job_num=100)
        self.assertEqual(job0.software, 'qchem')

        job0 = Job(project='project_test', ess_settings=self.ess_settings, species_name='tst_spc', xyz=self.xyz_c,
                   job_type='opt', level={'method': 'b97', 'basis': '6-311++g(d,p)'},
                   multiplicity=1, testing=True,
                   project_directory=os.path.join(arc_path, 'Projects', 'project_test'), fine=True, job_num=100)
        self.assertEqual(job0.software, 'gaussian')

        job0 = Job(project='project_test', ess_settings=self.ess_settings, species_name='tst_spc', xyz=self.xyz_c,
                   job_type='opt', level={'method': 'm062x', 'basis': '6-311++g(d,p)'},
                   multiplicity=1, testing=True,
                   project_directory=os.path.join(arc_path, 'Projects', 'project_test'), fine=True, job_num=100)
        self.assertEqual(job0.software, 'gaussian')

        job0 = Job(project='project_test', ess_settings=self.ess_settings, species_name='tst_spc', xyz=self.xyz_c,
                   job_type='opt', level={'method': 'm06-2x', 'basis': '6-311++g(d,p)'},
                   multiplicity=1, testing=True,
                   project_directory=os.path.join(arc_path, 'Projects', 'project_test'), fine=True, job_num=100)
        self.assertEqual(job0.software, 'qchem')

        job0 = Job(project='project_test', ess_settings=self.ess_settings, species_name='tst_spc', xyz=self.xyz_c,
                   job_type='scan', level={'method': 'm062x', 'basis': '6-311++g(d,p)'},
                   multiplicity=1, testing=True,
                   project_directory=os.path.join(arc_path, 'Projects', 'project_test'), fine=True, job_num=100)
        self.assertEqual(job0.software, 'gaussian')

        job0 = Job(project='project_test', ess_settings=self.ess_settings, species_name='tst_spc', xyz=self.xyz_c,
                   job_type='scan', level={'method': 'm06-2x', 'basis': '6-311++g(d,p)'},
                   multiplicity=1, testing=True,
                   project_directory=os.path.join(arc_path, 'Projects', 'project_test'), fine=True, job_num=100)
        self.assertEqual(job0.software, 'qchem')
        job0 = Job(project='project_test', ess_settings=self.ess_settings, species_name='tst_spc', xyz=self.xyz_c,
                   job_type='sp', level={'method': 'dlpno-ccsd(t)', 'basis': 'aug-cc-pvtz',
                                         'auxiliary_basis': 'aug-cc-pvtz/c'}, multiplicity=1,
                   testing=True, project_directory=os.path.join(arc_path, 'Projects', 'project_test'), fine=True,
                   job_num=100)
        self.assertEqual(job0.software, 'orca')

        self.assertEqual(job0.total_job_memory_gb, 14)
        self.assertEqual(job0.max_job_time, 120)
Exemplo n.º 10
0
    def setUpClass(cls):
        """
        A method that is run before all unit tests in this class.
        """
        cls.maxDiff = None
        cls.ess_settings = {
            'gaussian': ['server1'],
            'molpro': ['server2', 'server1'],
            'qchem': ['server1']
        }
        cls.project_directory = os.path.join(
            arc_path, 'Projects',
            'arc_project_for_testing_delete_after_usage3')
        cls.spc1 = ARCSpecies(label='methylamine', smiles='CN')
        cls.spc2 = ARCSpecies(label='C2H6', smiles='CC')
        xyz1 = """C       1.11424367   -0.01231165   -0.11493630
C      -0.07257945   -0.17830906   -0.16010022
O      -1.38500471   -0.36381519   -0.20928090
H       2.16904830    0.12689206   -0.07152274
H      -1.82570782    0.42754384   -0.56130718"""
        cls.spc3 = ARCSpecies(label='CtripCO', smiles='C#CO', xyz=xyz1)
        xyz2 = {
            'symbols': ('C', ),
            'isotopes': (12, ),
            'coords': ((0.0, 0.0, 0.0), )
        }
        cls.job1 = Job(project='project_test',
                       ess_settings=cls.ess_settings,
                       species_name='methylamine',
                       xyz=xyz2,
                       job_type='conformer',
                       conformer=0,
                       level={
                           'method': 'b97-d3',
                           'basis': '6-311+g(d,p)'
                       },
                       multiplicity=1,
                       project_directory=cls.project_directory,
                       job_num=101)
        cls.job2 = Job(project='project_test',
                       ess_settings=cls.ess_settings,
                       species_name='methylamine',
                       xyz=xyz2,
                       job_type='conformer',
                       conformer=1,
                       level={
                           'method': 'b97-d3',
                           'basis': '6-311+g(d,p)'
                       },
                       multiplicity=1,
                       project_directory=cls.project_directory,
                       job_num=102)
        cls.job3 = Job(project='project_test',
                       ess_settings=cls.ess_settings,
                       species_name='C2H6',
                       xyz=xyz2,
                       job_type='freq',
                       level={
                           'method': 'wb97x-d3',
                           'basis': '6-311+g(d,p)'
                       },
                       multiplicity=1,
                       project_directory=cls.project_directory,
                       software='qchem',
                       job_num=103)
        cls.rmg_database = rmgdb.make_rmg_database_object()
        cls.job_types1 = {
            'conformers': True,
            'opt': True,
            'fine_grid': False,
            'freq': True,
            'sp': True,
            'rotors': False,
            'orbitals': False,
            'lennard_jones': False,
        }
        cls.sched1 = Scheduler(
            project='project_test',
            ess_settings=cls.ess_settings,
            species_list=[cls.spc1, cls.spc2, cls.spc3],
            composite_method=None,
            conformer_level=Level(repr=default_levels_of_theory['conformer']),
            opt_level=Level(repr=default_levels_of_theory['opt']),
            freq_level=Level(repr=default_levels_of_theory['freq']),
            sp_level=Level(repr=default_levels_of_theory['sp']),
            scan_level=Level(repr=default_levels_of_theory['scan']),
            ts_guess_level=Level(repr=default_levels_of_theory['ts_guesses']),
            rmg_database=cls.rmg_database,
            project_directory=cls.project_directory,
            testing=True,
            job_types=cls.job_types1,
            orbitals_level=default_levels_of_theory['orbitals'],
            adaptive_levels=None,
        )