def test_xyz_from_dict(self): """Test correctly assigning xyz from dictionary""" species_dict1 = {'label': 'tst_spc_1', 'xyz': 'C 0.1 0.5 0.0'} species_dict2 = {'label': 'tst_spc_2', 'initial_xyz': 'C 0.2 0.5 0.0'} species_dict3 = {'label': 'tst_spc_3', 'final_xyz': 'C 0.3 0.5 0.0'} species_dict4 = {'label': 'tst_spc_4', 'xyz': ['C 0.4 0.5 0.0', 'C 0.5 0.5 0.0']} spc1 = ARCSpecies(species_dict=species_dict1) spc2 = ARCSpecies(species_dict=species_dict2) spc3 = ARCSpecies(species_dict=species_dict3) spc4 = ARCSpecies(species_dict=species_dict4) self.assertIsNone(spc1.initial_xyz) self.assertIsNone(spc1.final_xyz) self.assertEqual(spc1.conformers, ['C 0.1 0.5 0.0']) self.assertEqual(spc1.conformer_energies, [None]) self.assertEqual(spc2.initial_xyz, 'C 0.2 0.5 0.0') self.assertIsNone(spc2.final_xyz) self.assertEqual(spc2.conformers, []) self.assertEqual(spc2.conformer_energies, []) self.assertIsNone(spc3.initial_xyz) self.assertEqual(spc3.final_xyz, 'C 0.3 0.5 0.0') self.assertEqual(spc3.conformers, []) self.assertEqual(spc3.conformer_energies, []) self.assertIsNone(spc4.initial_xyz) self.assertIsNone(spc4.final_xyz) self.assertEqual(spc4.conformers, ['C 0.4 0.5 0.0', 'C 0.5 0.5 0.0']) self.assertEqual(spc4.conformer_energies, [None, None])
def arc_species_from_rmg_reaction(self): """ A helper function for generating the ARC Species (.r_species and .p_species) from the RMG Reaction object """ if self.rmg_reaction is not None and not len(self.r_species) and not len(self.p_species): self.r_species = [ARCSpecies(label=spc.label, mol=spc.molecule[0]) for spc in self.rmg_reaction.reactants] self.p_species = [ARCSpecies(label=spc.label, mol=spc.molecule[0]) for spc in self.rmg_reaction.products]
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)
def get_rotors_dict(self): """ Determine possible unique rotors in the species to be treated as hindered rotors, taking into account all localized structures. The resulting rotors are saved in {'pivots': [1, 3], 'top': [3, 7], 'scan': [2, 1, 3, 7]} format. """ rotors_dict = {} logging.disable(50) species = ARCSpecies(label=self.label, xyz=self.xyz, charge=self.charge, multiplicity=self.spin_multiplicity) if species is None: return rotors_dict species.determine_rotors() logging.disable(logging.NOTSET) for i in species.rotors_dict: rotors_dict[i + 1] = {} pivots = species.rotors_dict[i]['pivots'] top = species.rotors_dict[i]['top'] scan = species.rotors_dict[i]['scan'] rotors_dict[i + 1]['pivots'] = pivots rotors_dict[i + 1]['top'] = top rotors_dict[i + 1]['scan'] = scan return rotors_dict
def test_get_radius(self): """Test determining the species radius""" spc1 = ARCSpecies(label='r1', smiles='O=C=O') self.assertAlmostEqual(spc1.radius, 2.065000, 5) spc2 = ARCSpecies(label='r1', smiles='CCCCC') self.assertAlmostEqual(spc2.radius, 3.734040, 5) spc3 = ARCSpecies(label='r1', smiles='CCO') self.assertAlmostEqual(spc3.radius, 2.495184, 5)
def setUpClass(cls): """ A method that is run before all unit tests in this class. """ cls.maxDiff = None cls.ch4 = ARCSpecies(label='CH4', smiles='C') cls.nh3 = ARCSpecies(label='NH3', smiles='N') cls.h = ARCSpecies(label='H', smiles='[H]') cls.ch4_bde_1_2_a = ARCSpecies(label='CH4_BDE_1_2_A', smiles='[CH3]') cls.ch4.e0, cls.h.e0, cls.ch4_bde_1_2_a.e0 = 10, 25, 35 cls.ch4.bdes = [(1, 2)]
def test_save_geo(self): """Test saving the geometry files for a species""" spc = ARCSpecies(label='methylamine', smiles='CN', multiplicity=1, charge=0) spc.final_xyz = str_to_xyz( """N -0.74566988 -0.11773792 0.00000000 C 0.70395487 0.03951260 0.00000000 H 1.12173564 -0.45689176 -0.87930074 H 1.06080468 1.07995075 0.00000000 H 1.12173564 -0.45689176 0.87930074 H -1.16115119 0.31478894 0.81506145 H -1.16115119 0.31478894 -0.81506145""") spc.opt_level = 'opt/level' project = 'arc_project_for_testing_delete_after_usage' project_directory = os.path.join(arc_path, 'Projects', project) xyz_path = os.path.join(project_directory, 'output', 'Species', spc.label, 'geometry', 'methylamine.xyz') gjf_path = os.path.join(project_directory, 'output', 'Species', spc.label, 'geometry', 'methylamine.gjf') plotter.save_geo(species=spc, project_directory=project_directory) xyz_data = """7 methylamine optimized at opt/level N -0.74566988 -0.11773792 0.00000000 C 0.70395487 0.03951260 0.00000000 H 1.12173564 -0.45689176 -0.87930074 H 1.06080468 1.07995075 0.00000000 H 1.12173564 -0.45689176 0.87930074 H -1.16115119 0.31478894 0.81506145 H -1.16115119 0.31478894 -0.81506145 """ gjf_data = """# hf/3-21g methylamine optimized at opt/level 0 1 N -0.74566988 -0.11773792 0.00000000 C 0.70395487 0.03951260 0.00000000 H 1.12173564 -0.45689176 -0.87930074 H 1.06080468 1.07995075 0.00000000 H 1.12173564 -0.45689176 0.87930074 H -1.16115119 0.31478894 0.81506145 H -1.16115119 0.31478894 -0.81506145 """ with open(xyz_path, 'r') as f: data = f.read() self.assertEqual(data, xyz_data) with open(gjf_path, 'r') as f: data = f.read() self.assertEqual(data, gjf_data)
def setUpClass(cls): """ A method that is run before all unit tests in this class. """ cls.maxDiff = None # Method 1: RMG Species object (here by SMILES) cls.spc1_rmg = Species(molecule=[Molecule().fromSMILES(str('C=C[O]'))]) # delocalized radical + amine cls.spc1_rmg.label = str('vinoxy') cls.spc1 = ARCSpecies(rmg_species=cls.spc1_rmg) # Method 2: ARCSpecies object by XYZ (also give SMILES for thermo BAC) oh_xyz = str("""O 0.00000000 0.00000000 -0.12002167 H 0.00000000 0.00000000 0.85098324""") cls.spc2 = ARCSpecies(label=str('OH'), xyz=oh_xyz, smiles=str('[OH]'), multiplicity=2, charge=0) # Method 3: ARCSpecies object by SMILES cls.spc3 = ARCSpecies(label=str('methylamine'), smiles=str('CN'), multiplicity=1, charge=0) # Method 4: ARCSpecies object by RMG Molecule object mol4 = Molecule().fromSMILES(str('C=CC')) cls.spc4 = ARCSpecies(label=str('propene'), mol=mol4, multiplicity=1, charge=0) # Method 5: ARCSpecies by AdjacencyList (to generate AdjLists, see https://rmg.mit.edu/molecule_search) n2h4_adj = str("""1 N u0 p1 c0 {2,S} {3,S} {4,S} 2 N u0 p1 c0 {1,S} {5,S} {6,S} 3 H u0 p0 c0 {1,S} 4 H u0 p0 c0 {1,S} 5 H u0 p0 c0 {2,S} 6 H u0 p0 c0 {2,S}""") cls.spc5 = ARCSpecies(label=str('N2H4'), adjlist=n2h4_adj, multiplicity=1, charge=0) n3_xyz = str("""N -1.1997440839 -0.1610052059 0.0274738287 H -1.4016624407 -0.6229695533 -0.8487034080 H -0.0000018759 1.2861082773 0.5926077870 N 0.0000008520 0.5651072858 -0.1124621525 H -1.1294692206 -0.8709078271 0.7537518889 N 1.1997613019 -0.1609980472 0.0274604887 H 1.1294795781 -0.8708998550 0.7537444446 H 1.4015274689 -0.6230592706 -0.8487058662""") cls.spc6 = ARCSpecies(label=str('N3'), xyz=n3_xyz, multiplicity=1, smiles=str('NNN')) xyz1 = os.path.join(arc_path, 'arc', 'testing', 'xyz', 'AIBN.gjf') cls.spc7 = ARCSpecies(label='AIBN', smiles=str('N#CC(C)(C)N=NC(C)(C)C#N'), xyz=xyz1) hso3_xyz = str("""S -0.12383700 0.10918200 -0.21334200 O 0.97332200 -0.98800100 0.31790100 O -1.41608500 -0.43976300 0.14487300 O 0.32370100 1.42850400 0.21585900 H 1.84477700 -0.57224200 0.35517700""") cls.spc8 = ARCSpecies(label=str('HSO3'), xyz=hso3_xyz, multiplicity=2, charge=0, smiles=str('O[S](=O)=O')) nh_s_adj = str("""1 N u0 p2 c0 {2,S} 2 H u0 p0 c0 {1,S}""") nh_s_xyz = str("""N 0.50949998 0.00000000 0.00000000 H -0.50949998 0.00000000 0.00000000""") cls.spc9 = ARCSpecies(label=str('NH2(S)'), adjlist=nh_s_adj, xyz=nh_s_xyz, multiplicity=1, charge=0)
def test_save_conformers_file(self): """test the save_conformers_file function""" project = 'arc_project_for_testing_delete_after_usage' project_directory = os.path.join(arc_path, 'Projects', project) label = 'butanol' spc1 = ARCSpecies(label=label, smiles='CCCCO') spc1.generate_conformers(n_confs=3) self.assertIn(len(spc1.conformers), [2, 3]) plotter.save_conformers_file(project_directory=project_directory, label=spc1.label, xyzs=spc1.conformers, level_of_theory='APFD/def2tzvp', multiplicity=spc1.multiplicity, charge=spc1.charge, is_ts=False, energies=spc1.conformer_energies) conf_file_path = os.path.join(project_directory, 'output', 'Species', label, 'geometry', 'conformers', 'conformers_before_optimization.txt') self.assertTrue(os.path.isfile(conf_file_path))
def test_determine_unique_species_labels(self): """Test the determine_unique_species_labels method""" spc0 = ARCSpecies(label='spc0', smiles='CC', compute_thermo=False) spc1 = ARCSpecies(label='spc1', smiles='CC', compute_thermo=False) spc2 = ARCSpecies(label='spc2', smiles='CC', compute_thermo=False) arc0 = ARC( project='arc_test', job_types=self.job_types1, species=[spc0, spc1, spc2], level_of_theory='ccsd(t)-f12/cc-pvdz-f12//b3lyp/6-311+g(3df,2p)') self.assertEqual(arc0.unique_species_labels, ['spc0', 'spc1', 'spc2']) spc3 = ARCSpecies(label='spc0', smiles='CC', compute_thermo=False) arc0.species.append(spc3) with self.assertRaises(ValueError): arc0.determine_unique_species_labels()
def test_set_vector_length(self): """Test changing a vector's length""" v1 = [1, 0, 0] self.assertEqual(vectors.get_vector_length(v1), 1) v1_transformed = vectors.set_vector_length(v1, 5) self.assertAlmostEqual(vectors.get_vector_length(v1_transformed), 5) v1 = [1, 1, 1] self.assertEqual(vectors.get_vector_length(v1), 3 ** 0.5) v1_transformed = vectors.set_vector_length(v1, 5) self.assertAlmostEqual(vectors.get_vector_length(v1_transformed), 5) label = 'CNCC' pivot = 0 xyz = {'symbols': ('N', 'C', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H'), 'isotopes': (14, 12, 12, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1), 'coords': ((0.7419854952964929, -0.18588322859265055, -0.8060295165375653), (-0.38476668007897186, -0.8774643553523614, -0.1815530887172187), (-1.4977348513273125, 0.05995564693605262, 0.26652181022311233), (1.5633235727172392, 0.5360966415350092, 0.15477859056711452), (-0.04458112063725271, -1.4936027355391557, 0.6589418973690523), (-0.7986335015469359, -1.5715787743431335, -0.9219907626214912), (-2.348455608682208, -0.5210498432021002, 0.6375394558854425), (-1.8523669868240424, 0.6790455638159553, -0.5642494434208211), (-1.170505453235269, 0.7210016856743618, 1.0746899133307615), (2.4283037770451084, 0.9651590522064675, -0.36083882142892065), (1.945994527876002, -0.1322800197070601, 0.9328203647772167), (1.0178974719106297, 1.3595978302624294, 0.6250164549219148), (0.39953935748654607, 0.4610025363062083, -1.5156468543485933))} mol = ARCSpecies(label='CNCC', xyz=xyz).mol v1 = vectors.get_lp_vector(label, mol, xyz, pivot) self.assertAlmostEqual(vectors.get_vector_length(v1), 1) # should return a unit vector v1_transformed = vectors.set_vector_length(v1, 5) self.assertAlmostEqual(vectors.get_vector_length(v1_transformed), 5)
def get_mapped_product_xyz(self): """ Uses the mapping from product onto reactant to create a new ARC Species for the mapped product. For now, only functional for A <=> B reactions. Returns: Tuple[dict, ARCSpecies]: dict: Mapped product atoms in ARC dictionary format. ARCSpecies: ARCSpecies object created from mapped coordinates. """ product = self.p_species[0] mapping = self.atom_map original_xyz_str = xyz_to_str(product.get_xyz()) original_xyz = np.array(original_xyz_str.split('\n')) mapped_xyz = '\n'.join(original_xyz[mapping].tolist()) # create another product with the mapped atoms since ARCSpecies objects preserve this ordering # in RDKit objects and in RMG-Py Molecule objects mapped_product = ARCSpecies( label=product.label, smiles=product.mol.smiles, multiplicity=product.multiplicity, charge=product.charge, xyz=mapped_xyz, ) mapped_xyz = str_to_xyz(mapped_xyz) return mapped_xyz, mapped_product
def test_rmg_species_conversion_into_arc_species(self): """Test the conversion of an RMG species into an ARCSpecies""" self.spc1_rmg.label = None self.spc = ARCSpecies(rmg_species=self.spc1_rmg, label=str('vinoxy')) self.assertEqual(self.spc.label, str('vinoxy')) self.assertEqual(self.spc.multiplicity, 2) self.assertEqual(self.spc.charge, 0)
def test_as_dict(self): """Test the as_dict() method of ARC""" spc1 = ARCSpecies(label='spc1', smiles=str('CC'), generate_thermo=False) arc0 = ARC(project='arc_test', job_types=self.job_types1, initial_trsh='scf=(NDump=30)', arc_species_list=[spc1], level_of_theory='ccsd(t)-f12/cc-pvdz-f12//b3lyp/6-311+g(3df,2p)') restart_dict = arc0.as_dict() expected_dict = {'composite_method': '', 'conformer_level': 'b3lyp/6-31g(d,p) empiricaldispersion=gd3bj', 'ts_guess_level': 'b3lyp/6-31g(d,p) empiricaldispersion=gd3bj', 'opt_level': 'b3lyp/6-311+g(3df,2p)', 'freq_level': 'b3lyp/6-311+g(3df,2p)', 'freq_scale_factor': 0.967, 'initial_trsh': 'scf=(NDump=30)', 'max_job_time': 120, 'model_chemistry': 'ccsd(t)-f12/cc-pvdz-f12//b3lyp/6-311+g(3df,2p)', 'output': {}, 'project': 'arc_test', 'running_jobs': {}, 'reactions': [], 'scan_level': '', 'sp_level': 'ccsd(t)-f12/cc-pvdz-f12', 'job_memory': 14, 'job_types': {'1d_rotors': False, 'conformers': True, 'fine': False, 'freq': True, 'onedmin': False, 'opt': True, 'orbitals': False, 'sp': True}, 't_min': None, 't_max': None, 't_count': None, 'use_bac': True, 'confs_to_dft': 5, 'allow_nonisomorphic_2d': False, 'calc_freq_factor': True, 'ess_settings': {'gaussian': ['local', 'server2'], 'onedmin': ['server1'], 'molpro': ['server2'], 'qchem': ['server1']}, 'species': [{'bond_corrections': {'C-C': 1, 'C-H': 6}, 'arkane_file': None, 'E0': None, 'charge': 0, 'external_symmetry': None, 'optical_isomers': None, 'generate_thermo': False, 'is_ts': False, 'label': 'spc1', 'long_thermo_description': "Bond corrections: {'C-C': 1, 'C-H': 6}\n", 'mol': '1 C u0 p0 c0 {2,S} {3,S} {4,S} {5,S}\n2 C u0 p0 c0 {1,S} {6,S} {7,S} {8,S}\n3 H u0 p0 c0 {1,S}\n4 H u0 p0 c0 {1,S}\n5 H u0 p0 c0 {1,S}\n6 H u0 p0 c0 {2,S}\n7 H u0 p0 c0 {2,S}\n8 H u0 p0 c0 {2,S}\n', 'multiplicity': 1, 'neg_freqs_trshed': [], 'number_of_rotors': 0, 'rotors_dict': {}, 'force_field': 'MMFF94', 't1': None}], } self.assertEqual(restart_dict, expected_dict)
def test_consistent_atom_order(self): """Test that the atom order is preserved whether starting from SMILES or from xyz""" spc1 = ARCSpecies(label='spc1', smiles='CCCO') xyz1 = spc1.get_xyz() for adj, coord in zip(spc1.mol.toAdjacencyList().splitlines(), xyz1.splitlines()): if adj and coord: self.assertEqual(adj.split()[1], coord.split()[0]) xyz2 = """C -0.37147383 -0.54225753 0.07779977 C 0.99011397 0.11006088 -0.10715587 H -0.33990169 -1.22256017 0.93731544 H -0.60100180 -1.16814809 -0.79292035 H 1.26213386 0.70273091 0.77209458 O 1.96607463 -0.90691160 -0.28642183 H 0.99631715 0.75813344 -0.98936747 H -1.27803075 1.09840370 1.16400304 C -1.46891192 0.48768649 0.27579733 H -2.43580767 -0.00829320 0.40610628 H -1.54270451 1.15356356 -0.58992943 H 2.82319256 -0.46240839 -0.40178723""" spc2 = ARCSpecies(label='spc2', xyz=xyz2) for adj, coord in zip(spc2.mol.toAdjacencyList().splitlines(), xyz2.splitlines()): if adj and coord: self.assertEqual(adj.split()[1], coord.split()[0]) n3_xyz = str("""N -1.1997440839 -0.1610052059 0.0274738287 H -1.4016624407 -0.6229695533 -0.8487034080 H -0.0000018759 1.2861082773 0.5926077870 N 0.0000008520 0.5651072858 -0.1124621525 H -1.1294692206 -0.8709078271 0.7537518889 N 1.1997613019 -0.1609980472 0.0274604887 H 1.1294795781 -0.8708998550 0.7537444446 H 1.4015274689 -0.6230592706 -0.8487058662""") spc3 = ARCSpecies(label=str('N3'), xyz=n3_xyz, multiplicity=1, smiles=str('NNN')) self.assertEqual(spc3.mol.atoms[1].symbol, 'H') spc3.generate_conformers() self.assertEqual(len(spc3.conformers), 5) xyz4 = """O -1.48027320 0.36597456 0.41386552 C -0.49770656 -0.40253648 -0.26500019 C 0.86215119 0.24734211 -0.11510338 H -0.77970114 -0.46128090 -1.32025907 H -0.49643724 -1.41548311 0.14879346 H 0.84619526 1.26924854 -0.50799415 H 1.14377239 0.31659216 0.94076336 H 1.62810781 -0.32407050 -0.64676910 H -1.22610851 0.40421362 1.35170355""" spc4 = ARCSpecies(label='CCO', smiles='CCO', xyz=xyz4) # define from xyz for consistent atom order for atom1, atom2 in zip(spc4.mol.atoms, spc4.mol_list[0].atoms): self.assertEqual(atom1.symbol, atom2.symbol)
def test_get_lp_vector(self): """Test the lone pair vector""" xyz1 = converter.str_to_xyz( """O 1.13971727 -0.35763357 -0.91809799 N -0.16022228 -0.63832421 -0.32863338 C -0.42909096 0.49864538 0.54457751 H -1.36471297 0.33135829 1.08632108 H 0.37059419 0.63632068 1.27966893 H -0.53867601 1.41749835 -0.03987146 H 0.03832076 -1.45968957 0.24914206 H 0.94407000 -0.42817536 -1.87310674""") spc1 = ARCSpecies(label='tst1', smiles='CN(O)', xyz=xyz1) vector = vectors.get_lp_vector(label='tst1', mol=spc1.mol, xyz=xyz1, pivot=1) self.assertAlmostEqual(vector[0], -0.7582151013592212, 5) self.assertAlmostEqual(vector[1], -0.14276808320949216, 5) self.assertAlmostEqual(vector[2], -0.6361816835523585, 5) self.assertAlmostEqual((sum([vi**2 for vi in vector]))**0.5, 1) # puts the following dummy atom in xyz1: 'Cl -0.91844 -0.78109 -0.96482' xyz2 = converter.str_to_xyz( """N -0.70735114 0.81971647 0.24999886 C 0.58016992 0.65919122 -0.42405305 C 1.44721132 -0.43727777 0.17945348 C -1.63900905 -0.25796649 -0.04936095 H 1.11974047 1.60931343 -0.33768790 H 0.43764604 0.48458543 -1.49689220 H 1.00255021 -1.42757899 0.04242741 H 2.42947502 -0.44523307 -0.30432399 H 1.60341053 -0.27376799 1.25093890 H -1.81252045 -0.34624671 -1.12667881 H -2.60396918 -0.04100469 0.41960198 H -1.29274859 -1.22036999 0.33877281 H -0.56460509 0.87663914 1.25780346""") spc2 = ARCSpecies(label='tst2', smiles='CNCC', xyz=xyz2) vector = vectors.get_lp_vector(label='tst2', mol=spc2.mol, xyz=xyz2, pivot=0) self.assertAlmostEqual(vector[0], -0.40585301456248446, 5) self.assertAlmostEqual(vector[1], 0.8470158636326891, 5) self.assertAlmostEqual(vector[2], -0.34328917449449764, 5) self.assertAlmostEqual((sum([vi**2 for vi in vector]))**0.5, 1)
def test_from_dict(self): """Test Species.from_dict()""" species_dict = self.spc2.as_dict() spc = ARCSpecies(species_dict=species_dict) self.assertEqual(spc.multiplicity, 2) self.assertEqual(spc.charge, 0) self.assertEqual(spc.label, 'OH') self.assertEqual(spc.mol.toSMILES(), '[OH]') self.assertFalse(spc.is_ts)
def parse_species_in_arc_input(input_path: str) -> dict: """ A function used to get species scope from the ARC input file. """ spc_info = {} try: input_file = read_yaml_file(input_path) except: # Bad input path return spc_info if not 'species' in input_file: # An input file without species information, weird! return spc_info for spc in input_file['species']: label = spc['label'] if 'smiles' in spc: try: spc_info[label] = { 'label': label, 'species': ARCSpecies(label=label, smiles=spc['smiles']), 'smiles': spc['smiles'], 'ts': False } except: pass elif 'xyz' in spc: try: mol = xyz_to_mol(spc['xyz']) except: pass else: smiles = mol.to_smiles() spc_info[label] = { 'label': label, 'species': ARCSpecies(label=label, smiles=smiles), 'smiles': smiles, 'ts': False } if label not in spc_info: # Cannot get smiles or xyz spc_info[label] = {'label': label, 'ts': False} return spc_info
def test_log_bde_report(self): """Test the log_bde_report() function""" path = os.path.join(arc_path, 'arc', 'testing', 'bde_report_test.txt') bde_report = { 'aniline': { (1, 2): 431.43, (5, 8): 465.36, (6, 9): 458.70, (3, 10): 463.16, (4, 11): 463.16, (7, 12): 458.70, (1, 13): 372.31, (1, 14): 372.31, (5, 6): 'N/A' } } xyz = """N 2.28116100 -0.20275000 -0.29653100 C 0.90749600 -0.08067400 -0.11852200 C 0.09862900 -1.21367300 -0.02143500 C 0.30223500 1.17638000 -0.08930600 C -1.87236600 0.16329100 0.13332800 C -1.27400900 -1.08769400 0.10342700 C -1.07133200 1.29144700 0.03586700 H -2.94554700 0.25749800 0.23136900 H -1.88237600 -1.98069300 0.17844600 H 0.55264300 -2.19782900 -0.04842100 H 0.91592000 2.06653500 -0.16951700 H -1.51965000 2.27721000 0.05753400 H 2.68270800 -1.06667200 0.02551200 H 2.82448700 0.59762700 -0.02174900""" aniline = ARCSpecies(label='aniline', xyz=xyz, smiles='c1ccc(cc1)N', bdes=['all_h', (1, 2), (5, 6)]) spc_dict = {'aniline': aniline} plotter.log_bde_report(path, bde_report, spc_dict) with open(path, 'r') as f: content = f.read() expected_content = """ BDE report for aniline: Pivots Atoms BDE (kJ/mol) -------- ----- ------------ (1, 13) N - H 372.31 (1, 14) N - H 372.31 (1, 2) N - C 431.43 (6, 9) C - H 458.70 (7, 12) C - H 458.70 (3, 10) C - H 463.16 (4, 11) C - H 463.16 (5, 8) C - H 465.36 (5, 6) C - C N/A """ self.assertEqual(content, expected_content)
def test_charge_and_multiplicity(self): """Test determination of molecule charge and multiplicity""" spc1 = ARCSpecies(label='spc1', mol=Molecule(SMILES=str('C[CH]C')), generate_thermo=False) spc2 = ARCSpecies(label='spc2', mol=Molecule(SMILES=str('CCC')), generate_thermo=False) spc3 = ARCSpecies(label='spc3', smiles=str('N[NH]'), generate_thermo=False) spc4 = ARCSpecies(label='spc4', smiles=str('NNN'), generate_thermo=False) adj1 = """multiplicity 2 1 O u1 p2 c0 {2,S} 2 H u0 p0 c0 {1,S} """ adj2 = """1 C u0 p0 c0 {2,S} {4,S} {5,S} {6,S} 2 N u0 p1 c0 {1,S} {3,S} {7,S} 3 O u0 p2 c0 {2,S} {8,S} 4 H u0 p0 c0 {1,S} 5 H u0 p0 c0 {1,S} 6 H u0 p0 c0 {1,S} 7 H u0 p0 c0 {2,S} 8 H u0 p0 c0 {3,S} """ spc5 = ARCSpecies(label='spc5', adjlist=str(adj1), generate_thermo=False) spc6 = ARCSpecies(label='spc6', adjlist=str(adj2), generate_thermo=False) xyz1 = """O 0.00000000 0.00000000 -0.10796235 H 0.00000000 0.00000000 0.86318839""" xyz2 = """N -0.74678912 -0.11808620 0.00000000 C 0.70509190 0.01713703 0.00000000 H 1.11547042 -0.48545356 0.87928385 H 1.11547042 -0.48545356 -0.87928385 H 1.07725194 1.05216961 0.00000000 H -1.15564250 0.32084669 0.81500594 H -1.15564250 0.32084669 -0.81500594""" spc7 = ARCSpecies(label='spc7', xyz=xyz1, generate_thermo=False) spc8 = ARCSpecies(label='spc8', xyz=xyz2, generate_thermo=False) self.assertEqual(spc1.charge, 0) self.assertEqual(spc2.charge, 0) self.assertEqual(spc3.charge, 0) self.assertEqual(spc4.charge, 0) self.assertEqual(spc5.charge, 0) self.assertEqual(spc6.charge, 0) self.assertEqual(spc7.charge, 0) self.assertEqual(spc8.charge, 0) self.assertEqual(spc1.multiplicity, 2) self.assertEqual(spc2.multiplicity, 1) self.assertEqual(spc3.multiplicity, 2) self.assertEqual(spc4.multiplicity, 1) self.assertEqual(spc5.multiplicity, 2) self.assertEqual(spc6.multiplicity, 1) self.assertEqual(spc7.multiplicity, 2) self.assertEqual(spc8.multiplicity, 1)
def test_as_dict(self): """Test the as_dict() method of ARC""" self.maxDiff = None ess_settings = {} spc1 = ARCSpecies(label='spc1', smiles=str('CC'), generate_thermo=False) arc0 = ARC(project='arc_test', ess_settings=ess_settings, scan_rotors=False, initial_trsh='scf=(NDump=30)', arc_species_list=[spc1]) restart_dict = arc0.as_dict() expected_dict = {'composite_method': '', 'conformer_level': 'b97-d3/6-311+g(d,p)', 'ts_guess_level': 'b3lyp/6-31+g(d,p)', 'ess_settings': {'ssh': True}, 'fine': True, 'opt_level': 'wb97xd/6-311++g(d,p)', 'freq_level': 'wb97xd/6-311++g(d,p)', 'generate_conformers': True, 'initial_trsh': 'scf=(NDump=30)', 'max_job_time': 120, 'model_chemistry': 'ccsd(t)-f12/cc-pvtz-f12', 'output': {}, 'project': 'arc_test', 'running_jobs': {}, 'reactions': [], 'scan_level': '', 'scan_rotors': False, 'sp_level': 'ccsd(t)-f12/cc-pvtz-f12', 't_min': None, 't_max': None, 't_count': None, 'use_bac': True, 'visualize_orbitals': True, 'allow_nonisomorphic_2d': False, 'species': [{'bond_corrections': {'C-C': 1, 'C-H': 6}, 'arkane_file': None, 'E0': None, 'charge': 0, 'external_symmetry': None, 'optical_isomers': None, 'final_xyz': '', 'generate_thermo': False, 'is_ts': False, 'label': u'spc1', 'long_thermo_description': "Bond corrections: {'C-C': 1, 'C-H': 6}\n", 'mol': '1 C u0 p0 c0 {2,S} {3,S} {4,S} {5,S}\n2 C u0 p0 c0 {1,S} {6,S} {7,S} {8,S}\n3 H u0 p0 c0 {1,S}\n4 H u0 p0 c0 {1,S}\n5 H u0 p0 c0 {1,S}\n6 H u0 p0 c0 {2,S}\n7 H u0 p0 c0 {2,S}\n8 H u0 p0 c0 {2,S}\n', 'multiplicity': 1, 'neg_freqs_trshed': [], 'number_of_rotors': 0, 'rotors_dict': {}, 't1': None}], } self.assertEqual(restart_dict, expected_dict)
def test_add_hydrogen_for_bde(self): """Test the add_hydrogen_for_bde method""" spc0 = ARCSpecies(label='spc0', smiles='CC', compute_thermo=False) arc0 = ARC( project='arc_test', job_types=self.job_types1, species=[spc0], level_of_theory='ccsd(t)-f12/cc-pvdz-f12//b3lyp/6-311+g(3df,2p)') arc0.add_hydrogen_for_bde() self.assertEqual(len(arc0.species), 1) spc1 = ARCSpecies(label='spc1', smiles='CC', compute_thermo=False, bdes=['all_h']) arc1 = ARC( project='arc_test', job_types=self.job_types1, species=[spc1], level_of_theory='ccsd(t)-f12/cc-pvdz-f12//b3lyp/6-311+g(3df,2p)') arc1.add_hydrogen_for_bde() self.assertEqual(len(arc1.species), 2) self.assertIn('H', [spc.label for spc in arc1.species])
def test_unsorted_xyz_mol_from_xyz(self): """Test atom order conservation when xyz isn't sorted with heavy atoms first""" n3h5 = ARCSpecies(label=str('N3H5'), xyz=self.xyz6, smiles=str('NNN')) expected_adjlist = """1 N u0 p1 c0 {2,S} {4,S} {5,S} 2 H u0 p0 c0 {1,S} 3 H u0 p0 c0 {4,S} 4 N u0 p1 c0 {1,S} {3,S} {6,S} 5 H u0 p0 c0 {1,S} 6 N u0 p1 c0 {4,S} {7,S} {8,S} 7 H u0 p0 c0 {6,S} 8 H u0 p0 c0 {6,S} """ self.assertEqual(n3h5.mol.toAdjacencyList(), expected_adjlist) self.assertEqual(n3h5.initial_xyz, self.xyz6)
def test_get_vector_length(self): """Test getting a vector's length""" # unit vector v1 = [1, 0, 0] self.assertEqual(vectors.get_vector_length(v1), 1) # a vector with 0 entries v1 = [0, 0, 0] self.assertEqual(vectors.get_vector_length(v1), 0) # 10D vector v1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] self.assertAlmostEqual(vectors.get_vector_length(v1), 19.6214169) # default: places=7 # 1D vector v1 = [2] self.assertEqual(vectors.get_vector_length(v1), 2) # a vector with small entries v1 = [0.0000001, 0.0000002, 0.0000003] self.assertAlmostEqual(vectors.get_vector_length(v1), 0.000000374165739, places=15) # a vector with large entries v1 = [100, 200, 300] self.assertAlmostEqual(vectors.get_vector_length(v1), 374.165738677394000) # default: places=7 # a real example borrowed from test_set_vector_length label = 'CNCC' pivot = 0 xyz = {'symbols': ('N', 'C', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H', 'H'), 'isotopes': (14, 12, 12, 12, 1, 1, 1, 1, 1, 1, 1, 1, 1), 'coords': ((0.7419854952964929, -0.18588322859265055, -0.8060295165375653), (-0.38476668007897186, -0.8774643553523614, -0.1815530887172187), (-1.4977348513273125, 0.05995564693605262, 0.26652181022311233), (1.5633235727172392, 0.5360966415350092, 0.15477859056711452), (-0.04458112063725271, -1.4936027355391557, 0.6589418973690523), (-0.7986335015469359, -1.5715787743431335, -0.9219907626214912), (-2.348455608682208, -0.5210498432021002, 0.6375394558854425), (-1.8523669868240424, 0.6790455638159553, -0.5642494434208211), (-1.170505453235269, 0.7210016856743618, 1.0746899133307615), (2.4283037770451084, 0.9651590522064675, -0.36083882142892065), (1.945994527876002, -0.1322800197070601, 0.9328203647772167), (1.0178974719106297, 1.3595978302624294, 0.6250164549219148), (0.39953935748654607, 0.4610025363062083, -1.5156468543485933))} mol = ARCSpecies(label='CNCC', xyz=xyz).mol v1 = vectors.get_lp_vector(label, mol, xyz, pivot) # --> Returns a unit vector pointing from the pivotal (nitrogen) atom towards its lone electron pairs orbital. self.assertAlmostEqual(vectors.get_vector_length(v1), 1)
def test_number_of_heavy_atoms_property(self): """Test that the number_of_heavy_atoms property functions correctly""" self.assertEqual(self.spc1.number_of_heavy_atoms, 3) self.assertEqual(self.spc2.number_of_heavy_atoms, 1) self.assertEqual(self.spc3.number_of_heavy_atoms, 2) self.assertEqual(self.spc4.number_of_heavy_atoms, 3) self.assertEqual(self.spc5.number_of_heavy_atoms, 2) self.assertEqual(self.spc6.number_of_heavy_atoms, 3) self.assertEqual(self.spc7.number_of_heavy_atoms, 12) self.assertEqual(self.spc8.number_of_heavy_atoms, 4) self.assertEqual(self.spc9.number_of_heavy_atoms, 1) xyz10 = """N 0.82269400 0.19834500 -0.33588000 C -0.57469800 -0.02442800 0.04618900 H -1.08412400 -0.56416500 -0.75831900 H -0.72300600 -0.58965300 0.98098100 H -1.07482500 0.94314300 0.15455500 H 1.31266200 -0.68161600 -0.46770200 H 1.32129900 0.71837500 0.38017700 """ spc10 = ARCSpecies(label='spc10', xyz=xyz10) self.assertEqual(spc10.number_of_heavy_atoms, 2)
def test_as_dict(self): """Test the as_dict() method of ARC""" spc1 = ARCSpecies( label='spc1', smiles='CC', compute_thermo=False, ) arc0 = ARC( project='arc_test', job_types=self.job_types1, species=[spc1], level_of_theory='ccsd(t)-f12/cc-pvdz-f12//b3lyp/6-311+g(3df,2p)', three_params=False, ) arc0.freq_level.args['keyword']['general'] = 'scf=(NDump=30)' restart_dict = arc0.as_dict() long_thermo_description = restart_dict['species'][0][ 'long_thermo_description'] self.assertIn('Bond corrections:', long_thermo_description) self.assertIn("'C-C': 1", long_thermo_description) self.assertIn("'C-H': 6", long_thermo_description) expected_dict = { 'T_count': 50, 'T_max': None, 'T_min': None, 'allow_nonisomorphic_2d': False, 'arkane_level_of_theory': { 'basis': 'cc-pvdz-f12', 'method': 'ccsd(t)-f12', 'method_type': 'wavefunction', 'software': 'molpro' }, 'calc_freq_factor': True, 'compute_transport': False, 'conformer_level': { 'basis': 'def2svp', 'compatible_ess': ['gaussian', 'terachem'], 'method': 'wb97xd', 'method_type': 'dft', 'software': 'gaussian' }, 'e_confs': 5.0, 'ess_settings': { 'gaussian': ['local', 'server2'], 'molpro': ['server2'], 'onedmin': ['server1'], 'orca': ['local'], 'qchem': ['server1'], 'terachem': ['server1'] }, 'freq_level': { 'basis': '6-311+g(3df,2p)', 'method': 'b3lyp', 'method_type': 'dft', 'software': 'gaussian' }, 'freq_scale_factor': 0.967, 'irc_level': { 'basis': 'def2tzvp', 'compatible_ess': ['gaussian', 'terachem'], 'method': 'wb97xd', 'method_type': 'dft', 'software': 'gaussian' }, 'job_memory': 14, 'job_types': { 'bde': True, 'conformers': True, 'fine': False, 'freq': True, 'irc': True, 'onedmin': False, 'opt': True, 'orbitals': False, 'rotors': False, 'sp': True }, 'kinetics_adapter': 'Arkane', 'max_job_time': 120, 'n_confs': 10, 'opt_level': { 'basis': '6-311+g(3df,2p)', 'method': 'b3lyp', 'method_type': 'dft', 'software': 'gaussian' }, 'output': {}, 'project': 'arc_test', 'reactions': [], 'running_jobs': {}, 'sp_level': { 'basis': 'cc-pvdz-f12', 'method': 'ccsd(t)-f12', 'method_type': 'wavefunction', 'software': 'molpro' }, 'species': [{ 'arkane_file': None, 'bond_corrections': { 'C-C': 1, 'C-H': 6 }, 'charge': 0, 'compute_thermo': False, 'consider_all_diastereomers': True, 'force_field': 'MMFF94s', 'is_ts': False, 'label': 'spc1', 'long_thermo_description': long_thermo_description, 'mol': '1 C u0 p0 c0 {2,S} {3,S} {4,S} {5,S}\n' '2 C u0 p0 c0 {1,S} {6,S} {7,S} {8,S}\n' '3 H u0 p0 c0 {1,S}\n' '4 H u0 p0 c0 {1,S}\n' '5 H u0 p0 c0 {1,S}\n' '6 H u0 p0 c0 {2,S}\n' '7 H u0 p0 c0 {2,S}\n' '8 H u0 p0 c0 {2,S}\n', 'multiplicity': 1, 'number_of_rotors': 0 }], 'thermo_adapter': 'Arkane', 'three_params': False } # import pprint # left intentionally for debugging # print(pprint.pprint(restart_dict)) self.assertEqual(restart_dict, expected_dict)
def get_species_list() -> list: """ Generates the standardized species list. Returns: list: The standardized species list initialized with xyz. """ c2h2_xyz = { 'symbols': ('C', 'C', 'H', 'H'), 'isotopes': (12, 12, 1, 1), 'coords': ((0.0, 0.0, 0.0), (0.0, 0.0, 1.203142), (0.0, -0.0, 2.265747), (-0.0, -0.0, -1.062605)) } ch4_xyz = { 'symbols': ('C', 'H', 'H', 'H', 'H'), 'isotopes': (12, 1, 1, 1, 1), 'coords': ((0.0, 0.0, 0.0), (0.0, 0.0, 1.08744517), (1.02525314, 0.0, -0.36248173), (-0.51262658, 0.88789525, -0.36248173), (-0.51262658, -0.88789525, -0.36248173)) } co2_xyz = { 'symbols': ('C', 'O', 'O'), 'isotopes': (12, 16, 16), 'coords': ((0.0, 0.0, 0.0), (0.0, 0.0, 1.1594846), (0.0, 0.0, -1.1594846)) } co_xyz = { 'symbols': ('O', 'C'), 'isotopes': (16, 12), 'coords': ((0.0, 0.0, 0.0), (0.0, 0.0, 1.12960815)) } f2_xyz = { 'symbols': ('F', 'F'), 'isotopes': (19, 19), 'coords': ((0.0, 0.0, 0.0), (0.0, 0.0, 1.3952041)) } ch2o_xyz = { 'symbols': ('O', 'C', 'H', 'H'), 'isotopes': (16, 12, 1, 1), 'coords': ((0.0, 0.0, 0.674622), (0.0, 0.0, -0.529707), (0.0, 0.935488, -1.109367), (0.0, -0.935488, -1.109367)) } h2o_xyz = { 'symbols': ('O', 'H', 'H'), 'isotopes': (16, 1, 1), 'coords': ((0.0, 0.0, 0.0), (0.0, 0.0, 0.95691441), (0.92636305, 0.0, -0.23986808)) } h2_xyz = { 'symbols': ('H', 'H'), 'isotopes': (1, 1), 'coords': ((0.0, 0.0, 0.0), (0.0, 0.0, 0.74187646)) } hcn_xyz = { 'symbols': ('C', 'N', 'H'), 'isotopes': (12, 14, 1), 'coords': ((0.0, 0.0, -0.500365), (0.0, 0.0, 0.65264), (0.0, 0.0, -1.566291)) } hf_xyz = { 'symbols': ('F', 'H'), 'isotopes': (19, 1), 'coords': ((0.0, 0.0, 0.0), (0.0, 0.0, 0.91538107)) } n2o_xyz = { 'symbols': ('N', 'N', 'O'), 'isotopes': (14, 14, 16), 'coords': ((0.0, 0.0, 0.0), (0.0, 0.0, 1.12056262), (0.0, 0.0, 2.30761092)) } n2_xyz = { 'symbols': ('N', 'N'), 'isotopes': (14, 14), 'coords': ((0.0, 0.0, 0.0), (0.0, 0.0, 1.09710935)) } nh3_xyz = { 'symbols': ('N', 'H', 'H', 'H'), 'isotopes': (14, 1, 1, 1), 'coords': ((0.0, 0.0, 0.11289), (0.0, 0.938024, -0.263409), (0.812353, -0.469012, -0.263409), (-0.812353, -0.469012, -0.263409)) } oh_xyz = { 'symbols': ('O', 'H'), 'isotopes': (16, 1), 'coords': ((0.0, 0.0, 0.0), (0.0, 0.0, 0.967)) } cl2_xyz = { 'symbols': ('Cl', 'Cl'), 'isotopes': (35, 35), 'coords': ((0.0, 0.0, 0.0), (0.0, 0.0, 1.1)) } c2h2 = ARCSpecies(label='C2H2', smiles='C#C', multiplicity=1, charge=0) c2h2.initial_xyz = c2h2_xyz ch4 = ARCSpecies(label='CH4', smiles='C', multiplicity=1, charge=0) ch4.initial_xyz = ch4_xyz co2 = ARCSpecies(label='CO2', smiles='O=C=O', multiplicity=1, charge=0) co2.initial_xyz = co2_xyz co = ARCSpecies(label='CO', smiles='[C-]#[O+]', multiplicity=1, charge=0) co.initial_xyz = co_xyz f2 = ARCSpecies(label='F2', smiles='[F][F]', multiplicity=1, charge=0) f2.initial_xyz = f2_xyz ch2o = ARCSpecies(label='CH2O', smiles='C=O', multiplicity=1, charge=0) ch2o.initial_xyz = ch2o_xyz h2o = ARCSpecies(label='H2O', smiles='O', multiplicity=1, charge=0) h2o.initial_xyz = h2o_xyz h2 = ARCSpecies(label='H2', smiles='[H][H]', multiplicity=1, charge=0) h2.initial_xyz = h2_xyz hcn = ARCSpecies(label='HCN', smiles='C#N', multiplicity=1, charge=0) hcn.initial_xyz = hcn_xyz hf = ARCSpecies(label='HF', smiles='F', multiplicity=1, charge=0) hf.initial_xyz = hf_xyz n2o = ARCSpecies(label='N2O', smiles='[N-]=[N+]=O', multiplicity=1, charge=0) n2o.initial_xyz = n2o_xyz n2 = ARCSpecies(label='N2', smiles='N#N', multiplicity=1, charge=0) n2.initial_xyz = n2_xyz nh3 = ARCSpecies(label='NH3', smiles='N', multiplicity=1, charge=0) nh3.initial_xyz = nh3_xyz oh = ARCSpecies(label='OH', smiles='[OH]', multiplicity=2, charge=0) oh.initial_xyz = oh_xyz cl2 = ARCSpecies(label='Cl2', smiles='[Cl][Cl]', multiplicity=1, charge=0) cl2.initial_xyz = cl2_xyz species_list = [ c2h2, ch4, co2, co, f2, ch2o, h2o, h2, hcn, hf, n2o, n2, nh3, oh, cl2 ] return species_list
def setUpClass(cls): """ A method that is run before all unit tests in this class. """ cls.maxDiff = None cls.xyz1 = """C 0.00000000 0.00000000 0.00000000 H 0.63003260 0.63003260 0.63003260 H -0.63003260 -0.63003260 0.63003260 H -0.63003260 0.63003260 -0.63003260 H 0.63003260 -0.63003260 -0.63003260""" cls.xyz2 = """O 1.17464110 -0.15309781 0.00000000 N 0.06304988 0.35149648 0.00000000 C -1.12708952 -0.11333971 0.00000000 H -1.93800144 0.60171738 0.00000000 H -1.29769464 -1.18742971 0.00000000""" cls.xyz3 = """S 1.02558264 -0.04344404 -0.07343859 O -0.25448248 1.10710477 0.18359696 N -1.30762173 0.15796567 -0.10489290 C -0.49011438 -1.03704380 0.15365747 H -0.64869950 -1.85796321 -0.54773423 H -0.60359153 -1.37304859 1.18613964 H -1.43009127 0.23517346 -1.11797908 """ cls.xyz4 = """S -0.06618943 -0.12360663 -0.07631983 O -0.79539707 0.86755487 1.02675668 O -0.68919931 0.25421823 -1.34830853 N 0.01546439 -1.54297548 0.44580391 C 1.59721519 0.47861334 0.00711000 H 1.94428095 0.40772394 1.03719428 H 2.20318015 -0.14715186 -0.64755729 H 1.59252246 1.51178950 -0.33908352 H -0.87856890 -2.02453514 0.38494433 H -1.34135876 1.49608206 0.53295071""" cls.xyz5 = """O 2.64631000 -0.59546000 0.29327900 O 2.64275300 2.05718500 -0.72942300 C 1.71639100 1.97990400 0.33793200 C -3.48200000 1.50082200 0.03091100 C -3.85550400 -1.05695100 -0.03598300 C 3.23017500 -1.88003900 0.34527100 C -2.91846400 0.11144600 0.02829400 C 0.76935400 0.80820200 0.23396500 C -1.51123800 -0.09830700 0.09199100 C 1.28495500 -0.50051800 0.22531700 C -0.59550400 0.98573400 0.16444900 C -0.94480400 -1.39242500 0.08331900 C 0.42608700 -1.59172200 0.14650400 H 2.24536500 1.93452800 1.29979800 H 1.14735500 2.91082400 0.31665700 H -3.24115200 2.03800800 0.95768700 H -3.08546100 2.10616100 -0.79369800 H -4.56858900 1.48636200 -0.06630800 H -4.89652000 -0.73067200 -0.04282300 H -3.69325500 -1.65970000 -0.93924100 H -3.72742500 -1.73294900 0.81894100 H 3.02442400 -2.44854700 -0.56812500 H 4.30341500 -1.72127600 0.43646000 H 2.87318600 -2.44236600 1.21464900 H -0.97434200 2.00182800 0.16800300 H -1.58581300 -2.26344700 0.02264400 H 0.81122400 -2.60336100 0.13267800 H 3.16280800 1.25020800 -0.70346900 """ cls.xyz6 = """N -1.1997440839 -0.1610052059 0.0274738287 H -1.4016624407 -0.6229695533 -0.8487034080 H -0.0000018759 1.2861082773 0.5926077870 N 0.0000008520 0.5651072858 -0.1124621525 H -1.1294692206 -0.8709078271 0.7537518889 N 1.1997613019 -0.1609980472 0.0274604887 H 1.1294795781 -0.8708998550 0.7537444446 H 1.4015274689 -0.6230592706 -0.8487058662""" nh_s_adj = str("""1 N u0 p2 c0 {2,S} 2 H u0 p0 c0 {1,S}""") nh_s_xyz = str("""N 0.50949998 0.00000000 0.00000000 H -0.50949998 0.00000000 0.00000000""") cls.spc1 = ARCSpecies(label=str('NH2(S)'), adjlist=nh_s_adj, xyz=nh_s_xyz, multiplicity=1, charge=0) spc = Species().fromAdjacencyList(nh_s_adj) cls.spc2 = ARCSpecies(label=str('NH2(S)'), rmg_species=spc, xyz=nh_s_xyz) cls.spc3 = ARCSpecies(label=str('NCN(S)'), smiles=str('[N]=C=[N]'), multiplicity=1, charge=0) cls.spc4 = ARCSpecies(label=str('NCN(T)'), smiles=str('[N]=C=[N]'), multiplicity=3, charge=0)
def setUpClass(cls): """ A method that is run before all unit tests in this class. """ cls.maxDiff = None project = 'processor_test' project_directory = os.path.join(arc_path, 'Projects', project) ch4 = ARCSpecies(label='CH4', smiles='C') nh3 = ARCSpecies(label='NH3', smiles='N') h = ARCSpecies(label='H', smiles='[H]') ch4_BDE_1_2_A = ARCSpecies(label='CH4_BDE_1_2_A', smiles='[CH3]') ch4.e0, h.e0, ch4_BDE_1_2_A.e0 = 10, 25, 35 ch4.bdes = [(1, 2)] species_dict = { 'CH4': ch4, 'NH3': nh3, 'H': h, 'CH4_BDE_1_2_A': ch4_BDE_1_2_A } output_dict = { 'CH4': { 'conformers': '', 'convergence': True, 'errors': '', 'info': '', 'isomorphism': '', 'job_types': { '1d_rotors': True, 'composite': False, 'conformers': True, 'fine_grid': False, 'freq': True, 'lennard_jones': False, 'onedmin': False, 'opt': True, 'orbitals': False, 'bde': True, 'sp': True }, 'paths': { 'composite': '', 'freq': '', 'geo': '', 'sp': '' }, 'restart': '', 'warnings': '' }, 'NH3': { 'conformers': '', 'convergence': True, 'errors': '', 'info': '', 'isomorphism': '', 'job_types': { '1d_rotors': True, 'composite': False, 'conformers': True, 'fine_grid': False, 'freq': True, 'lennard_jones': False, 'onedmin': False, 'opt': True, 'orbitals': False, 'bde': True, 'sp': True }, 'paths': { 'composite': '', 'freq': '', 'geo': '', 'sp': '' }, 'restart': '', 'warnings': '' }, 'H': { 'conformers': '', 'convergence': True, 'errors': '', 'info': '', 'isomorphism': '', 'job_types': { '1d_rotors': True, 'composite': False, 'conformers': True, 'fine_grid': False, 'freq': False, 'lennard_jones': False, 'onedmin': False, 'opt': False, 'orbitals': False, 'bde': True, 'sp': True }, 'paths': { 'composite': '', 'freq': '', 'geo': '', 'sp': '' }, 'restart': '', 'warnings': '' }, 'CH4_BDE_1_2_A': { 'conformers': '', 'convergence': True, 'errors': '', 'info': '', 'isomorphism': '', 'job_types': { '1d_rotors': True, 'composite': False, 'conformers': True, 'fine_grid': False, 'freq': True, 'lennard_jones': False, 'onedmin': False, 'opt': True, 'orbitals': False, 'bde': True, 'sp': True }, 'paths': { 'composite': '', 'freq': '', 'geo': '', 'sp': '' }, 'restart': '', 'warnings': '' }, } cls.processor0 = Processor(project=project, project_directory=project_directory, species_dict=species_dict, rxn_list=list(), output=output_dict, use_bac=True, model_chemistry='b3lyp/6-311+g(3df,2p)', lib_long_desc='', rmgdatabase=None)
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, )