diff --git a/arc/checks/ts_test.py b/arc/checks/ts_test.py index ac3bc805a4..1428288643 100644 --- a/arc/checks/ts_test.py +++ b/arc/checks/ts_test.py @@ -17,7 +17,6 @@ from arc.level import Level from arc.parser import parse_normal_mode_displacement, parse_xyz_from_file from arc.reaction import ARCReaction -from arc.rmgdb import load_families_only, make_rmg_database_object from arc.species.species import ARCSpecies, TSGuess from arc.utils.wip import work_in_progress @@ -32,8 +31,6 @@ def setUpClass(cls): A method that is run before all unit tests in this class. """ cls.maxDiff = None - cls.rmgdb = make_rmg_database_object() - load_families_only(cls.rmgdb) cls.rms_list_1 = [0.01414213562373095, 0.05, 0.04, 0.5632938842203065, 0.7993122043357026, 0.08944271909999159, 0.10677078252031312, 0.09000000000000001, 0.05, 0.09433981132056604] @@ -185,14 +182,14 @@ def setUpClass(cls): xyz=os.path.join(ts.ARC_PATH, 'arc', 'testing', 'freq', 'TS_nC3H7-iC3H7.out')) cls.rxn_8.ts_label = cls.rxn_8.ts_species.label - cls.rxn_2a.determine_family(rmg_database=cls.rmgdb, save_order=True) - cls.rxn_2b.determine_family(rmg_database=cls.rmgdb, save_order=True) - cls.rxn_3.determine_family(rmg_database=cls.rmgdb, save_order=True) - cls.rxn_4.determine_family(rmg_database=cls.rmgdb, save_order=True) - cls.rxn_5.determine_family(rmg_database=cls.rmgdb, save_order=True) - cls.rxn_6.determine_family(rmg_database=cls.rmgdb, save_order=True) - cls.rxn_7.determine_family(rmg_database=cls.rmgdb, save_order=True) - cls.rxn_8.determine_family(rmg_database=cls.rmgdb, save_order=True) + cls.rxn_2a.determine_family() + cls.rxn_2b.determine_family() + cls.rxn_3.determine_family() + cls.rxn_4.determine_family() + cls.rxn_5.determine_family() + cls.rxn_6.determine_family() + cls.rxn_7.determine_family() + cls.rxn_8.determine_family() cls.ccooj_xyz = {'symbols': ('C', 'C', 'O', 'O', 'H', 'H', 'H', 'H', 'H'), 'isotopes': (12, 12, 16, 16, 1, 1, 1, 1, 1), @@ -380,7 +377,7 @@ def test_check_normal_mode_displacement(self): self.assertFalse(self.rxn_2a.ts_species.ts_checks['NMD']) self.job1.local_path_to_output_file = os.path.join(ts.ARC_PATH, 'arc', 'testing', 'composite', 'TS_intra_H_migration_CBS-QB3.out') - self.rxn_2a.determine_family(rmg_database=self.rmgdb) + self.rxn_2a.determine_family() ts.check_normal_mode_displacement(reaction=self.rxn_2a, job=self.job1) self.assertTrue(self.rxn_2a.ts_species.ts_checks['NMD']) self.rxn_2a.ts_species.populate_ts_checks() diff --git a/arc/common_test.py b/arc/common_test.py index 9ea7888a3a..98a6fa4573 100644 --- a/arc/common_test.py +++ b/arc/common_test.py @@ -21,7 +21,6 @@ import arc.common as common from arc.exceptions import InputError, SettingsError from arc.imports import settings -from arc.rmgdb import make_rmg_database_object, load_families_only from arc.mapping.engine import get_rmg_reactions_from_arc_reaction import arc.species.converter as converter from arc.reaction import ARCReaction @@ -41,8 +40,6 @@ def setUpClass(cls): A method that is run before all unit tests in this class. """ cls.maxDiff = None - cls.rmgdb = make_rmg_database_object() - load_families_only(cls.rmgdb) cls.default_job_types = {'conformers': True, 'opt': True, 'fine': True, @@ -1274,7 +1271,7 @@ def test_check_r_n_p_symbols_between_rmg_and_arc_rxns(self): """Test the _check_r_n_p_symbols_between_rmg_and_arc_rxns() function""" arc_rxn = ARCReaction(r_species=[ARCSpecies(label='CH4', smiles='C'), ARCSpecies(label='OH', smiles='[OH]')], p_species=[ARCSpecies(label='CH3', smiles='[CH3]'), ARCSpecies(label='H2O', smiles='O')]) - rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=arc_rxn, db=self.rmgdb) + rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=arc_rxn) self.assertTrue(common._check_r_n_p_symbols_between_rmg_and_arc_rxns(arc_rxn, rmg_reactions)) def test_almost_equal_coords(self): diff --git a/arc/job/adapters/ts/autotst_test.py b/arc/job/adapters/ts/autotst_test.py index 6d25e9c18e..d100e564c7 100644 --- a/arc/job/adapters/ts/autotst_test.py +++ b/arc/job/adapters/ts/autotst_test.py @@ -15,7 +15,6 @@ from arc.common import ARC_PATH from arc.job.adapters.ts.autotst_ts import AutoTSTAdapter, HAS_AUTOTST from arc.reaction import ARCReaction -from arc.rmgdb import make_rmg_database_object, load_families_only class TestAutoTSTAdapter(unittest.TestCase): @@ -29,8 +28,6 @@ def setUpClass(cls): A method that is run before all unit tests in this class. """ cls.maxDiff = None - cls.rmgdb = make_rmg_database_object() - load_families_only(cls.rmgdb) def test_has_autotst(self): """Test that AutoTST was successfully imported""" @@ -43,7 +40,7 @@ def test_autotst_h_abstraction(self): Species(label='HO2', smiles='O[O]')], products=[Species(label='C3H7', smiles='[CH2]CC'), Species(label='H2O2', smiles='OO')])) - rxn1.determine_family(rmg_database=self.rmgdb) + rxn1.determine_family() self.assertEqual(rxn1.family.label, 'H_Abstraction') atst1 = AutoTSTAdapter(job_type='tsg', reactions=[rxn1], @@ -71,7 +68,7 @@ def test_autotst_h_abstraction(self): Species().from_smiles('[OH]')], products=[Species().from_smiles('CCC[O]'), Species().from_smiles('O')])) - rxn2.determine_family(rmg_database=self.rmgdb) + rxn2.determine_family() self.assertEqual(rxn2.family.label, 'H_Abstraction') atst2 = AutoTSTAdapter(job_type='tsg', reactions=[rxn2], @@ -93,7 +90,7 @@ def test_autotst_h_abstraction(self): Species().from_smiles('[H]')], products=[Species().from_smiles('C=C[O]'), Species().from_smiles('[H][H]')])) - rxn3.determine_family(rmg_database=self.rmgdb) + rxn3.determine_family() self.assertEqual(rxn3.family.label, 'H_Abstraction') atst3 = AutoTSTAdapter(job_type='tsg', reactions=[rxn3], @@ -117,7 +114,7 @@ def test_autotst_intra_h_migration(self): rxn1 = ARCReaction(reactants=['[CH2]CO'], products=['CC[O]'], rmg_reaction=Reaction(reactants=[Species().from_smiles('[CH2]CO')], products=[Species().from_smiles('CC[O]')])) - rxn1.determine_family(rmg_database=self.rmgdb) + rxn1.determine_family() self.assertEqual(rxn1.family.label, 'intra_H_migration') atst1 = AutoTSTAdapter(job_type='tsg', reactions=[rxn1], @@ -157,7 +154,7 @@ def test_autotst_r_addition_multiple_bond(self): rmg_reaction=Reaction(reactants=[Species().from_smiles('C#C'), Species().from_smiles('[OH]')], products=[Species().from_smiles('[CH]=CO')])) - rxn1.determine_family(rmg_database=self.rmgdb) + rxn1.determine_family() self.assertEqual(rxn1.family.label, 'R_Addition_MultipleBond') atst1 = AutoTSTAdapter(job_type='tsg', reactions=[rxn1], diff --git a/arc/job/adapters/ts/gcn_test.py b/arc/job/adapters/ts/gcn_test.py index 47738a8496..8aee473eb3 100644 --- a/arc/job/adapters/ts/gcn_test.py +++ b/arc/job/adapters/ts/gcn_test.py @@ -12,7 +12,6 @@ from arc.common import ARC_PATH import arc.job.adapters.ts.gcn_ts as ts_gcn from arc.reaction import ARCReaction -from arc.rmgdb import load_families_only, make_rmg_database_object from arc.species.converter import str_to_xyz from arc.species.species import ARCSpecies, TSGuess @@ -28,8 +27,6 @@ def setUpClass(cls): A method that is run before all unit tests in this class. """ cls.maxDiff = None - cls.rmgdb = make_rmg_database_object() - load_families_only(cls.rmgdb) cls.output_dir = os.path.join(ARC_PATH, 'arc', 'testing', 'GCN') if not os.path.isdir(cls.output_dir): os.makedirs(cls.output_dir) diff --git a/arc/job/adapters/ts/heuristics_test.py b/arc/job/adapters/ts/heuristics_test.py index 19e1aca401..f8eb2f4b85 100644 --- a/arc/job/adapters/ts/heuristics_test.py +++ b/arc/job/adapters/ts/heuristics_test.py @@ -27,7 +27,6 @@ stretch_zmat_bond, ) from arc.reaction import ARCReaction -from arc.rmgdb import load_families_only, make_rmg_database_object from arc.species.converter import str_to_xyz, zmat_to_xyz from arc.species.species import ARCSpecies from arc.species.zmat import _compare_zmats @@ -44,8 +43,6 @@ def setUpClass(cls): A method that is run before all unit tests in this class. """ cls.maxDiff = None - cls.rmgdb = make_rmg_database_object() - load_families_only(cls.rmgdb) cls.ccooh_xyz = {'symbols': ('C', 'C', 'O', 'O', 'H', 'H', 'H', 'H', 'H', 'H'), 'isotopes': (12, 12, 16, 16, 1, 1, 1, 1, 1, 1), 'coords': ((-1.34047, -0.03188, 0.16703), (0.07658, -0.19298, -0.34334), @@ -241,7 +238,7 @@ def test_heuristics_for_h_abstraction(self): h = ARCSpecies(label='H', smiles='[H]') oh = ARCSpecies(label='OH', smiles='[OH]', xyz=self.oh_xyz) rxn1 = ARCReaction(r_species=[h2, o], p_species=[h, oh]) - rxn1.determine_family(rmg_database=self.rmgdb) + rxn1.determine_family() self.assertEqual(rxn1.family.label, 'H_Abstraction') heuristics_1 = HeuristicsAdapter(job_type='tsg', reactions=[rxn1], @@ -261,7 +258,7 @@ def test_heuristics_for_h_abstraction(self): # H + OH <=> H2 + O rxn2 = ARCReaction(r_species=[h, oh], p_species=[h2, o]) - rxn2.determine_family(rmg_database=self.rmgdb) + rxn2.determine_family() heuristics_2 = HeuristicsAdapter(job_type='tsg', reactions=[rxn2], testing=True, @@ -278,7 +275,7 @@ def test_heuristics_for_h_abstraction(self): # OH + H <=> H2 + O rxn3 = ARCReaction(r_species=[oh, h], p_species=[h2, o]) - rxn3.determine_family(rmg_database=self.rmgdb) + rxn3.determine_family() heuristics_3 = HeuristicsAdapter(job_type='tsg', reactions=[rxn3], testing=True, @@ -300,7 +297,7 @@ def test_heuristics_for_h_abstraction(self): r_species=[ch4, h], p_species=[ch3, h2], rmg_reaction=Reaction(reactants=[Species(smiles='C'), Species(smiles='[H]')], products=[Species(smiles='[CH3]'), Species(smiles='[H][H]')])) - rxn4.determine_family(rmg_database=self.rmgdb) + rxn4.determine_family() self.assertEqual(rxn4.family.label, 'H_Abstraction') self.assertEqual(rxn4.atom_map[0], 0) for index in [1, 2, 3, 4]: @@ -367,7 +364,7 @@ def test_heuristics_for_h_abstraction(self): Species().from_smiles('O[O]')], products=[Species().from_smiles('[CH2]CC'), Species().from_smiles('OO')])) - rxn5.determine_family(rmg_database=self.rmgdb) + rxn5.determine_family() self.assertEqual(rxn5.family.label, 'H_Abstraction') heuristics_5 = HeuristicsAdapter(job_type='tsg', reactions=[rxn5], @@ -425,7 +422,7 @@ def test_heuristics_for_h_abstraction(self): Species().from_smiles('[OH]')], products=[Species().from_smiles('CCC[O]'), Species().from_smiles('O')])) - rxn6.determine_family(rmg_database=self.rmgdb) + rxn6.determine_family() self.assertEqual(rxn6.family.label, 'H_Abstraction') heuristics_6 = HeuristicsAdapter(job_type='tsg', reactions=[rxn6], @@ -464,7 +461,7 @@ def test_heuristics_for_h_abstraction(self): Species().from_smiles('[H]')], products=[Species().from_smiles('C=C[O]'), Species().from_smiles('[H][H]')])) - rxn7.determine_family(rmg_database=self.rmgdb) + rxn7.determine_family() self.assertEqual(rxn7.family.label, 'H_Abstraction') heuristics_7 = HeuristicsAdapter(job_type='tsg', reactions=[rxn7], @@ -498,7 +495,7 @@ def test_heuristics_for_h_abstraction(self): hnco = ARCSpecies(label='HNCO', smiles='N=C=O', xyz=hnco_xyz) nh = ARCSpecies(label='NH', smiles='[NH]', xyz=nh_xyz) rxn8 = ARCReaction(r_species=[nco, nh2], p_species=[hnco, nh]) - rxn8.determine_family(rmg_database=self.rmgdb) + rxn8.determine_family() self.assertEqual(rxn8.family.label, 'H_Abstraction') heuristics_8 = HeuristicsAdapter(job_type='tsg', reactions=[rxn8], @@ -628,8 +625,8 @@ def test_heuristics_for_h_abstraction(self): butenylnebzene_rad2 = ARCSpecies(label='butenylnebzene_rad2', smiles='c1ccccc1[CH]CC=C', xyz=butenylnebzene_rad2_xyz) rxn9 = ARCReaction(r_species=[butenylnebzene, peroxyl], p_species=[peroxide, butenylnebzene_rad1]) rxn10 = ARCReaction(r_species=[butenylnebzene, peroxyl], p_species=[peroxide, butenylnebzene_rad2]) - rxn9.determine_family(rmg_database=self.rmgdb) - rxn10.determine_family(rmg_database=self.rmgdb) + rxn9.determine_family() + rxn10.determine_family() self.assertEqual(rxn9.family.label, 'H_Abstraction') self.assertEqual(rxn10.family.label, 'H_Abstraction') heuristics_9 = HeuristicsAdapter(job_type='tsg', @@ -699,7 +696,7 @@ def test_heuristics_for_h_abstraction(self): c2h5oh = ARCSpecies(label='C2H5OH', smiles='CCO', xyz=c2h5oh_xyz) ch3o = ARCSpecies(label='CH3O', smiles='C[O]', xyz=ch3o_xyz) rxn11 = ARCReaction(r_species=[c2h5o, ch3oh], p_species=[c2h5oh, ch3o]) - rxn11.determine_family(rmg_database=self.rmgdb) + rxn11.determine_family() self.assertEqual(rxn11.family.label, 'H_Abstraction') heuristics_11 = HeuristicsAdapter(job_type='tsg', reactions=[rxn11], @@ -722,7 +719,7 @@ def test_heuristics_for_h_abstraction(self): nh2 = ARCSpecies(label='NH2', smiles='[NH2]', xyz=self.nh2_xyz) h2o = ARCSpecies(label='H2O', smiles='O', xyz=self.h2o_xyz) rxn12 = ARCReaction(r_species=[nh3, oh], p_species=[nh2, h2o]) - rxn12.determine_family(rmg_database=self.rmgdb) + rxn12.determine_family() self.assertEqual(rxn12.family.label, 'H_Abstraction') heuristics_12 = HeuristicsAdapter(job_type='tsg', reactions=[rxn12], @@ -743,7 +740,7 @@ def test_heuristics_for_h_abstraction(self): # Reverse order # NH2 + H2O <=> NH3 + OH rxn13 = ARCReaction(r_species=[nh2, h2o], p_species=[nh3, oh]) - rxn13.determine_family(rmg_database=self.rmgdb) + rxn13.determine_family() self.assertEqual(rxn13.family.label, 'H_Abstraction') heuristics_13 = HeuristicsAdapter(job_type='tsg', reactions=[rxn13], @@ -762,7 +759,7 @@ def test_heuristics_for_h_abstraction(self): # different reactant order order # H2O + NH2 <=> NH3 + OH rxn14 = ARCReaction(r_species=[h2o, nh2], p_species=[nh3, oh]) - rxn14.determine_family(rmg_database=self.rmgdb) + rxn14.determine_family() self.assertEqual(rxn14.family.label, 'H_Abstraction') heuristics_14 = HeuristicsAdapter(job_type='tsg', reactions=[rxn14], @@ -781,7 +778,7 @@ def test_heuristics_for_h_abstraction(self): # different product order order # NH2 + H2O <=> OH + NH3 rxn15 = ARCReaction(r_species=[h2o, nh2], p_species=[nh3, oh]) - rxn15.determine_family(rmg_database=self.rmgdb) + rxn15.determine_family() self.assertEqual(rxn15.family.label, 'H_Abstraction') heuristics_15 = HeuristicsAdapter(job_type='tsg', reactions=[rxn15], @@ -806,7 +803,7 @@ def test_heuristics_for_h_abstraction(self): F -1.17300047 -0.36581404 0.00000000 Cl 1.34997541 -0.22207499 0.00000000""") rxn16 = ARCReaction(r_species=[nfcl, h2o], p_species=[hnfcl, oh]) - rxn16.determine_family(rmg_database=self.rmgdb) + rxn16.determine_family() self.assertEqual(rxn16.family.label, 'H_Abstraction') heuristics_16 = HeuristicsAdapter(job_type='tsg', reactions=[rxn16], @@ -833,7 +830,7 @@ def test_heuristics_for_h_abstraction(self): O 0.0000000 0.0000000 -0.6029240""") n2h3 = ARCSpecies(label='N2H3', smiles='N[NH]') rxn17 = ARCReaction(r_species=[ho2, h2nnt], p_species=[o2, n2h3]) - rxn17.determine_family(rmg_database=self.rmgdb) + rxn17.determine_family() self.assertEqual(rxn17.family.label, 'H_Abstraction') heuristics_16 = HeuristicsAdapter(job_type='tsg', reactions=[rxn17], @@ -853,7 +850,7 @@ def test_heuristics_for_h_abstraction(self): no2 = ARCSpecies(label='NO2', smiles='[O-][N+]=O') nh2oh = ARCSpecies(label='NH2OH', smiles='NO') rxn1 = ARCReaction(r_species=[hono, hnoh], p_species=[no2, nh2oh]) - rxn1.determine_family(rmg_database=self.rmgdb) + rxn1.determine_family() self.assertEqual(rxn1.family.label, 'H_Abstraction') heuristics_1 = HeuristicsAdapter(job_type='tsg', reactions=[rxn1], @@ -872,7 +869,7 @@ def test_heuristics_for_h_abstraction(self): n2h2 = ARCSpecies(label='N2H4', smiles='NN') n2h3 = ARCSpecies(label='N2H3', smiles='[NH]N') rxn1 = ARCReaction(r_species=[h2nn, n2h2], p_species=[n2h3, n2h3]) - rxn1.determine_family(rmg_database=self.rmgdb) + rxn1.determine_family() self.assertEqual(rxn1.family.label, 'H_Abstraction') heuristics_1 = HeuristicsAdapter(job_type='tsg', reactions=[rxn1], @@ -889,7 +886,7 @@ def test_heuristics_for_h_abstraction(self): # Molecules with linear motifs (and many dummy atoms in both R1H and P2H): rxn1 = ARCReaction(r_species=[ARCSpecies(label='CtC[CH]CtC', smiles='C#C[CH]C#C'), ARCSpecies(label='CtCC[C]CtC', smiles='C#CC(C)C#C')], p_species=[ARCSpecies(label='CtCCCtC', smiles='C#CCC#C'), ARCSpecies(label='CtC[C][C]CtC', smiles='C#C[C](C)C#C')]) - rxn1.determine_family(rmg_database=self.rmgdb) + rxn1.determine_family() self.assertEqual(rxn1.family.label, 'H_Abstraction') heuristics_1 = HeuristicsAdapter(job_type='tsg', reactions=[rxn1], @@ -906,7 +903,7 @@ def test_heuristics_for_h_abstraction(self): ch4 = ARCSpecies(label='CH4', smiles='C') chdcdc = ARCSpecies(label='CH=C=C', smiles='[CH]=C=C') rxn1 = ARCReaction(r_species=[ch3, cdcdc], p_species=[ch4, chdcdc]) - rxn1.determine_family(rmg_database=self.rmgdb) + rxn1.determine_family() self.assertEqual(rxn1.family.label, 'H_Abstraction') heuristics_1 = HeuristicsAdapter(job_type='tsg', reactions=[rxn1], @@ -925,7 +922,7 @@ def test_keeping_atom_order_in_ts(self): ARCSpecies(label='CCOOj', smiles='CCO[O]', xyz=self.ccooj_xyz)], p_species=[ARCSpecies(label='C2H5', smiles='C[CH2]', xyz=self.c2h5_xyz), ARCSpecies(label='CCOOH', smiles='CCOO', xyz=self.ccooh_xyz)]) - rxn_1.determine_family(rmg_database=self.rmgdb) + rxn_1.determine_family() self.assertIn(rxn_1.atom_map[0], [0, 1]) self.assertIn(rxn_1.atom_map[1], [0, 1]) for index in [2, 3, 4, 5, 6, 7]: @@ -950,7 +947,7 @@ def test_keeping_atom_order_in_ts(self): ARCSpecies(label='CCOOj', smiles='CCO[O]', xyz=self.ccooj_xyz)], p_species=[ARCSpecies(label='CCOOH', smiles='CCOO', xyz=self.ccooh_xyz), ARCSpecies(label='C2H5', smiles='C[CH2]', xyz=self.c2h5_xyz)]) - rxn_2.determine_family(rmg_database=self.rmgdb) + rxn_2.determine_family() self.assertEqual(rxn_2.family.label, 'H_Abstraction') self.assertEqual(rxn_2.atom_map[:2], [11, 10]) self.assertIn(tuple(rxn_2.atom_map[2:5]), itertools.permutations([9, 16, 15])) @@ -975,7 +972,7 @@ def test_keeping_atom_order_in_ts(self): ARCSpecies(label='C2H6', smiles='CC', xyz=self.c2h6_xyz)], p_species=[ARCSpecies(label='C2H5', smiles='C[CH2]', xyz=self.c2h5_xyz), ARCSpecies(label='CCOOH', smiles='CCOO', xyz=self.ccooh_xyz)]) - rxn_3.determine_family(rmg_database=self.rmgdb) + rxn_3.determine_family() self.assertEqual(rxn_3.atom_map[:4], [7, 8, 9, 10]) self.assertIn(tuple(rxn_3.atom_map[4:7]), itertools.permutations([11, 12, 13])) self.assertIn(tuple(rxn_3.atom_map[7:9]), itertools.permutations([14, 15])) @@ -1000,7 +997,7 @@ def test_keeping_atom_order_in_ts(self): ARCSpecies(label='C2H6', smiles='CC', xyz=self.c2h6_xyz)], p_species=[ARCSpecies(label='CCOOH', smiles='CCOO', xyz=self.ccooh_xyz), ARCSpecies(label='C2H5', smiles='C[CH2]', xyz=self.c2h5_xyz)]) - rxn_4.determine_family(rmg_database=self.rmgdb) + rxn_4.determine_family() self.assertEqual(rxn_4.atom_map[:4], [0, 1, 2, 3]) self.assertIn(tuple(rxn_4.atom_map[4:7]), itertools.permutations([4, 5, 6])) self.assertIn(tuple(rxn_4.atom_map[7:9]), itertools.permutations([7, 8])) @@ -1201,7 +1198,7 @@ def test_react(self): ARCSpecies(label='CCOOj', smiles='CCO[O]', xyz=self.ccooj_xyz)], p_species=[ARCSpecies(label='C2H5', smiles='C[CH2]', xyz=self.c2h5_xyz), ARCSpecies(label='CCOOH', smiles='CCOO', xyz=self.ccooh_xyz)]) - rxn_1.determine_family(rmg_database=self.rmgdb, save_order=True) + rxn_1.determine_family() reactants, products = rxn_1.get_reactants_and_products(arc=True) reactant_mol_combinations = list(itertools.product(*list(reactant.mol_list for reactant in reactants))) product_mol_combinations = list(itertools.product(*list(product.mol_list for product in products))) @@ -1217,7 +1214,7 @@ def test_react(self): rxn_2 = ARCReaction(reactants=['H2N2(T)', 'N2H4'], products=['N2H3', 'N2H3'], r_species=[ARCSpecies(label='H2N2(T)', smiles='[N]N'), ARCSpecies(label='N2H4', smiles='NN')], p_species=[ARCSpecies(label='N2H3', smiles='[NH]N')]) - rxn_2.determine_family(rmg_database=self.rmgdb, save_order=True) + rxn_2.determine_family() self.assertEqual(rxn_2.family.label, 'H_Abstraction') reactants, products = rxn_2.get_reactants_and_products(arc=False) reactant_labels = [atom.label for atom in reactants[0].molecule[0].atoms if atom.label] \ diff --git a/arc/job/adapters/ts/kinbot_test.py b/arc/job/adapters/ts/kinbot_test.py index 5911e48d57..be1dc4e023 100644 --- a/arc/job/adapters/ts/kinbot_test.py +++ b/arc/job/adapters/ts/kinbot_test.py @@ -16,7 +16,6 @@ from arc.common import ARC_PATH from arc.job.adapters.ts.kinbot_ts import KinBotAdapter, HAS_KINBOT from arc.reaction import ARCReaction -from arc.rmgdb import make_rmg_database_object, load_families_only class TestKinBotAdapter(unittest.TestCase): @@ -30,16 +29,15 @@ def setUpClass(cls): A method that is run before all unit tests in this class. """ cls.maxDiff = None - cls.rmgdb = make_rmg_database_object() - load_families_only(cls.rmgdb) - #@pytest.mark.skip(reason="KinBot has been deprecated") + + # @pytest.mark.skip(reason="KinBot support in ARC has been deprecated") def test_intra_h_migration(self): """Test KinBot for intra H migration reactions""" if HAS_KINBOT: rxn1 = ARCReaction(reactants=['CC[O]'], products=['[CH2]CO']) rxn1.rmg_reaction = Reaction(reactants=[Species().from_smiles('CC[O]')], products=[Species().from_smiles('[CH2]CO')]) - rxn1.determine_family(rmg_database=self.rmgdb) + rxn1.determine_family() rxn1.arc_species_from_rmg_reaction() self.assertEqual(rxn1.family.label, 'intra_H_migration') kinbot1 = KinBotAdapter(job_type='tsg', diff --git a/arc/mapping/driver_test.py b/arc/mapping/driver_test.py index e75166328d..d800cea2d3 100644 --- a/arc/mapping/driver_test.py +++ b/arc/mapping/driver_test.py @@ -10,10 +10,8 @@ from rmgpy.reaction import Reaction from rmgpy.species import Species -from rmgpy.data.rmg import RMGDatabase from arc.mapping.driver import * -from arc.rmgdb import load_families_only from arc.reaction import ARCReaction from arc.mapping.engine import check_atom_map from arc.species.species import ARCSpecies @@ -32,8 +30,6 @@ def setUpClass(cls): A method that is run before all unit tests in this class. """ cls.maxDiff = None - cls.rmgdb = RMGDatabase() - load_families_only(cls.rmgdb, 'all') cls.ch4_xyz = {'symbols': ('C', 'H', 'H', 'H', 'H'), 'isotopes': (12, 1, 1, 1, 1), 'coords': ((-5.45906343962835e-10, 4.233517924761169e-10, 2.9505240956083194e-10), (-0.6505520089868748, -0.7742801979689132, -0.4125187934483119), @@ -447,7 +443,7 @@ def test_map_abstractions(self): p_1 = ARCSpecies(label='H2', smiles='[H][H]', xyz=self.h2_xyz) p_2 = ARCSpecies(label='CH3', smiles='[CH3]', xyz=self.ch3_xyz) rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertIn(atom_map[0], [0, 1]) self.assertEqual(atom_map[1], 2) @@ -458,7 +454,7 @@ def test_map_abstractions(self): # H + CH4 <=> CH3 + H2 (different order) rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_2, p_1]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertIn(atom_map[0], [4, 5]) self.assertEqual(atom_map[1], 0) @@ -469,7 +465,7 @@ def test_map_abstractions(self): # CH4 + H <=> H2 + CH3 (different order) rxn = ARCReaction(r_species=[r_2, r_1], p_species=[p_1, p_2]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertEqual(atom_map[0], 2) for index in [1, 2, 3, 4]: @@ -480,7 +476,7 @@ def test_map_abstractions(self): # CH4 + H <=> CH3 + H2 (different order) rxn = ARCReaction(r_species=[r_2, r_1], p_species=[p_2, p_1]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertEqual(atom_map[0], 0) for index in [1, 2, 3, 4]: @@ -513,7 +509,7 @@ def test_map_abstractions(self): p_1 = ARCSpecies(label='H2', smiles='[H][H]', xyz=self.h2_xyz) p_2 = ARCSpecies(label='CH2NH2', smiles='[CH2]N', xyz=ch2nh2_xyz) rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertIn(atom_map[0], [0,1]) self.assertEqual(atom_map[1], 2) @@ -532,7 +528,7 @@ def test_map_abstractions(self): p_1 = ARCSpecies(label='CH3', smiles='[CH3]', xyz=self.ch3_xyz) p_2 = ARCSpecies(label='H2O', smiles='O', xyz=self.h2o_xyz) rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertEqual(atom_map[0], 0) self.assertIn(atom_map[1], [1, 2, 3, 5, 6]) @@ -550,7 +546,7 @@ def test_map_abstractions(self): p_1 = ARCSpecies(label='NH3', smiles='N', xyz=self.nh3_xyz) p_2 = ARCSpecies(label='N2H3', smiles='N[NH]', xyz=self.n2h3_xyz) rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertEqual(atom_map[0], 0) self.assertIn(atom_map[1], [1, 2, 3]) @@ -562,7 +558,7 @@ def test_map_abstractions(self): # NH2 + N2H4 <=> N2H3 + NH3 (reversed product order compared to the above reaction) rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_2, p_1]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertEqual(atom_map[0], 5) self.assertIn(atom_map[1], [6, 7, 8]) @@ -607,7 +603,7 @@ def test_map_abstractions(self): H 1.11374677 1.03794239 0.06905096 H 1.06944350 -0.38306117 1.00698657""") rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertEqual([0,5,3],atom_map[0:3]) self.assertIn(tuple(atom_map[3:6]), list(permutations([1, 2, 4]))) @@ -623,7 +619,7 @@ def test_map_abstractions(self): p_1 = ARCSpecies(label='C3H5O', smiles='C[CH]C=O', xyz=self.c3h5o_xyz) p_2 = ARCSpecies(label='H2O', smiles='O', xyz=self.h2o_xyz) rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertEqual(atom_map[:4], [0, 1, 3, 4]) self.assertIn(atom_map[4], [5,6, 7]) @@ -639,7 +635,7 @@ def test_map_abstractions(self): p_1 = ARCSpecies(label='C4H9O', smiles='[CH2]C(C)CO', xyz=self.c4h9o_xyz) p_2 = ARCSpecies(label='H2O', smiles='O', xyz=self.h2o_xyz) rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertEqual(atom_map[:5], [0, 3, 4, 5, 6]) for index in [5, 6, 7]: @@ -660,7 +656,7 @@ def test_map_abstractions(self): p_1 = ARCSpecies(label='C3H5O', smiles='C[CH]C=O', xyz=self.c3h5o_xyz) p_2 = ARCSpecies(label='C4H10O', smiles='CC(C)CO', xyz=self.c4h10o_xyz) rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertEqual(atom_map[0:4], [0, 1, 3, 4]) self.assertIn(atom_map[4], [5,6, 7]) @@ -692,7 +688,7 @@ def test_map_abstractions(self): p_1 = ARCSpecies(label="CH3", smiles="[CH3]", xyz=self.ch3_xyz_2) p_2 = ARCSpecies(label="HCl", smiles="[H][Cl]", xyz=self.hcl_xyz) rxn = ARCReaction(r_species=[r_2, r_1], p_species=[p_2, p_1]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map = rxn.atom_map self.assertEqual(rxn.family.label.lower(),"cl_abstraction") self.assertEqual(atom_map[:3], [0, 1, 2]) @@ -701,7 +697,7 @@ def test_map_abstractions(self): self.assertTrue(check_atom_map(rxn)) # ClCH3 + H <=> CH3 + HCl different order rxn_2 = ARCReaction(r_species=[r_1, r_2], p_species=[p_2, p_1]) - rxn_2.determine_family(self.rmgdb) + rxn_2.determine_family() atom_map = rxn_2.atom_map self.assertEqual(atom_map[:2], [1, 2]) for index in [2, 3, 4]: @@ -755,7 +751,7 @@ def test_map_abstractions(self): p_2 = ARCSpecies(label='p2', smiles=smiles[3],xyz=p_2_xyz) rxn1 = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - rxn1.determine_family(self.rmgdb) + rxn1.determine_family() atom_map = rxn1.atom_map #expected: [0, 2, 3, 4, 1, 5, [6, 7], [6, 7], [8, 9, 10], [8, 9, 10], [8, 9, 10], 11, 12] self.assertEqual(atom_map[:6], [0,2,3,4,1,5]) @@ -797,7 +793,7 @@ def test_map_abstractions(self): p_2 = ARCSpecies(label='p2', smiles='[CH3]', xyz=p_2_xyz) rxn1 = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - rxn1.determine_family(self.rmgdb) + rxn1.determine_family() atom_map = rxn1.atom_map self.assertEqual(atom_map[:4],[0,2,3,1]) self.assertIn(atom_map[4], [4,5,6]) @@ -834,7 +830,7 @@ def test_map_abstractions(self): p_2 = ARCSpecies(label='p2', smiles='[Br][H]', xyz=p_2_xyz) rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_2, p_1]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map=rxn.atom_map self.assertEqual(atom_map[:5], [1, 2, 3, 4, 0]) self.assertIn(tuple(atom_map[5:]), permutations([5, 6, 7])) @@ -847,7 +843,7 @@ def test_map_abstractions(self): p_2 = ARCSpecies(label='p2', smiles='[H][Br]', xyz=p_2_xyz) rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - rxn.determine_family(self.rmgdb) + rxn.determine_family() atom_map=rxn.atom_map self.assertEqual(atom_map[:5], [7, 0, 1, 2, 6]) self.assertIn(tuple(atom_map[5:]), list(permutations([3, 4, 5]))) @@ -893,7 +889,7 @@ def test_map_abstractions(self): p_2 = ARCSpecies(label='p2', smiles=smiles[3], xyz=p_2_xyz) rxn1 = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - rxn1.determine_family(self.rmgdb) + rxn1.determine_family() atom_map = rxn1.atom_map self.assertEqual(atom_map[:3],[0,2,3]) self.assertIn(atom_map[3:5],[[1,4],[4,1]]) diff --git a/arc/mapping/engine_test.py b/arc/mapping/engine_test.py index eaf6cd2368..e575f59f60 100644 --- a/arc/mapping/engine_test.py +++ b/arc/mapping/engine_test.py @@ -7,15 +7,12 @@ import unittest import numpy as np -from rmgpy.data.rmg import RMGDatabase from random import shuffle import itertools from arc.common import _check_r_n_p_symbols_between_rmg_and_arc_rxns -from arc.species import ARCSpecies from arc.mapping.engine import * from arc.reaction import ARCReaction -from arc.rmgdb import load_families_only, determine_family from arc.species.vectors import calculate_dihedral_angle @@ -35,8 +32,6 @@ def setUpClass(cls): """ A method that is run before all unit tests in this class. """ - cls.db = RMGDatabase() - load_families_only(cls.db, "all") cls.maxDiff = None smiles = ['CC(C)F', '[CH3]', 'C[CH](C)', 'CF'] @@ -93,7 +88,7 @@ def setUpClass(cls): cls.p_2_2 = ARCSpecies(label='p2', smiles=smiles[3],xyz=p_2_1_xyz) cls.rxn_1 = ARCReaction(r_species=[cls.r_1, cls.r_2], p_species=[cls.p_1, cls.p_2]) - cls.rxn_1.determine_family(cls.db) + cls.rxn_1.determine_family() cls.rmg_reactions_rxn_1 = get_rmg_reactions_from_arc_reaction(arc_reaction=cls.rxn_1, backend="ARC") cls.r_label_dict_rxn_1, cls.p_label_dict_rxn_1 = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=cls.rxn_1, rmg_reaction=cls.rmg_reactions_rxn_1[0]) @@ -561,7 +556,7 @@ def test_inc_vals(self): def test_label_species_atoms(self): rxn_1_test = ARCReaction(r_species=[self.r_1, self.r_2], p_species=[self.p_1, self.p_2]) - rxn_1_test.determine_family(self.db) + rxn_1_test.determine_family() assign_labels_to_products(rxn_1_test, self.p_label_dict_rxn_1) reactants, products = copy_species_list_for_mapping(rxn_1_test.r_species), copy_species_list_for_mapping(rxn_1_test.p_species) @@ -584,7 +579,7 @@ def test_label_species_atoms(self): def test_cut_species_based_on_atom_indices(self): """test the cut_species_for_mapping function""" rxn_1_test = ARCReaction(r_species=[self.r_1, self.r_2], p_species=[self.p_1, self.p_2]) - rxn_1_test.determine_family(self.db) + rxn_1_test.determine_family() reactants, products = copy_species_list_for_mapping(rxn_1_test.r_species), copy_species_list_for_mapping(rxn_1_test.p_species) label_species_atoms(reactants), label_species_atoms(products) @@ -625,7 +620,7 @@ def test_cut_species_based_on_atom_indices(self): def test_r_cut_p_cut_isomorphic(self): rxn_1_test = ARCReaction(r_species=[self.r_1, self.r_2], p_species=[self.p_1, self.p_2]) - rxn_1_test.determine_family(self.db) + rxn_1_test.determine_family() reactants, products = copy_species_list_for_mapping(rxn_1_test.r_species), copy_species_list_for_mapping(rxn_1_test.p_species) label_species_atoms(reactants), label_species_atoms(products) @@ -647,7 +642,7 @@ def test_r_cut_p_cut_isomorphic(self): def test_pairing_reactants_and_products_for_mapping(self): smiles = ["[F]", "C[CH]C", "[CH3]"] rxn_1_test = ARCReaction(r_species=[self.r_1, self.r_2], p_species=[self.p_1, self.p_2]) - rxn_1_test.determine_family(self.db) + rxn_1_test.determine_family() reactants, products = copy_species_list_for_mapping(rxn_1_test.r_species), copy_species_list_for_mapping(rxn_1_test.p_species) label_species_atoms(reactants), label_species_atoms(products) @@ -665,7 +660,7 @@ def test_pairing_reactants_and_products_for_mapping(self): def test_map_pairs(self): rxn_1_test = ARCReaction(r_species=[self.r_1, self.r_2], p_species=[self.p_1, self.p_2]) - rxn_1_test.determine_family(self.db) + rxn_1_test.determine_family() rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=rxn_1_test, backend="ARC") r_label_dict, p_label_dict = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=rxn_1_test, rmg_reaction=rmg_reactions[0]) @@ -695,10 +690,10 @@ def test_map_pairs(self): def test_glue_maps(self): rxn_1_test = ARCReaction(r_species=[self.r_1, self.r_2], p_species=[self.p_1, self.p_2]) - rxn_1_test.determine_family(self.db) + rxn_1_test.determine_family() rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=rxn_1_test, backend="ARC") r_label_dict, p_label_dict = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=rxn_1_test, - rmg_reaction=rmg_reactions[0]) + rmg_reaction=rmg_reactions[0]) assign_labels_to_products(rxn_1_test, p_label_dict) reactants, products = copy_species_list_for_mapping(rxn_1_test.r_species), copy_species_list_for_mapping(rxn_1_test.p_species) label_species_atoms(reactants), label_species_atoms(products) @@ -718,8 +713,8 @@ def test_glue_maps(self): def test_get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(self): """Test the get_atom_indices_of_labeled_atoms_in_an_rmg_reaction() function.""" - determine_family(self.arc_reaction_1, db=self.db) - rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=self.arc_reaction_1, db=self.db) + self.arc_reaction_1.determine_family() + rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=self.arc_reaction_1) r_dict, p_dict = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=self.arc_reaction_1, rmg_reaction=rmg_reactions[0]) self.assertEqual(r_dict['*1'], 0) @@ -730,8 +725,8 @@ def test_get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(self): self.assertEqual(p_dict['*3'], 4) self.assertTrue(_check_r_n_p_symbols_between_rmg_and_arc_rxns(self.arc_reaction_1, rmg_reactions)) - determine_family(self.arc_reaction_2, db=self.db) - rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=self.arc_reaction_2, db=self.db) + self.arc_reaction_2.determine_family() + rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=self.arc_reaction_2) r_dict, p_dict = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=self.arc_reaction_2, rmg_reaction=rmg_reactions[0]) self.assertIn(r_dict['*1'], [0, 2]) @@ -742,8 +737,8 @@ def test_get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(self): self.assertEqual(p_dict['*3'], 10) self.assertTrue(_check_r_n_p_symbols_between_rmg_and_arc_rxns(self.arc_reaction_2, rmg_reactions)) - determine_family(self.arc_reaction_4, db=self.db) - rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=self.arc_reaction_4, db=self.db) + self.arc_reaction_4.determine_family() + rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=self.arc_reaction_4) r_dict, p_dict = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=self.arc_reaction_4, rmg_reaction=rmg_reactions[0]) self.assertEqual(r_dict['*1'], 0) @@ -754,7 +749,7 @@ def test_get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(self): self.assertIn(p_dict['*3'], [3, 4, 5]) self.assertTrue(_check_r_n_p_symbols_between_rmg_and_arc_rxns(self.arc_reaction_4, rmg_reactions)) - determine_family(self.rxn_2a, db=self.db) + self.rxn_2a.determine_family() for atom, symbol in zip(self.rxn_2a.r_species[0].mol.atoms, ['C', 'C', 'C', 'H', 'H', 'H', 'H', 'H', 'H', 'H']): self.assertEqual(atom.symbol, symbol) self.assertEqual(self.rxn_2a.r_species[0].mol.atoms[0].radical_electrons, 0) @@ -763,7 +758,7 @@ def test_get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(self): self.assertEqual(self.rxn_2a.p_species[0].mol.atoms[0].radical_electrons, 0) self.assertEqual(self.rxn_2a.p_species[0].mol.atoms[1].radical_electrons, 0) self.assertEqual(self.rxn_2a.p_species[0].mol.atoms[2].radical_electrons, 1) - rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=self.rxn_2a, db=self.db) + rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=self.rxn_2a) r_dict, p_dict = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=self.rxn_2a, rmg_reaction=rmg_reactions[0]) self.assertEqual(r_dict['*1'], 1) @@ -774,10 +769,10 @@ def test_get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(self): self.assertIn(p_dict['*3'], [3, 6]) self.assertTrue(_check_r_n_p_symbols_between_rmg_and_arc_rxns(self.rxn_2a, rmg_reactions)) - determine_family(self.rxn_2b, db=self.db) + self.rxn_2b.determine_family() for atom, symbol in zip(self.rxn_2b.r_species[0].mol.atoms, ['C', 'C', 'H', 'H', 'H', 'H', 'C', 'H', 'H', 'H']): self.assertEqual(atom.symbol, symbol) - rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=self.rxn_2b, db=self.db) + rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=self.rxn_2b) r_dict, p_dict = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=self.rxn_2b, rmg_reaction=rmg_reactions[0]) self.assertEqual(r_dict['*1'], 1) @@ -795,8 +790,8 @@ def test_get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(self): p_2 = ARCSpecies(label='C4H10O', smiles='CC(C)CO') rxn_1 = ARCReaction(reactants=['C3H6O', 'C4H9O'], products=['C3H5O', 'C4H10O'], r_species=[r_1, r_2], p_species=[p_1, p_2]) - determine_family(rxn_1, db=self.db) - rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=rxn_1, db=self.db) + rxn_1.determine_family() + rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=rxn_1) for rmg_reaction in rmg_reactions: r_dict, p_dict = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=rxn_1, rmg_reaction=rmg_reaction) @@ -810,8 +805,8 @@ def test_get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(self): p_1 = ARCSpecies(label='C3H5O', smiles='CC=C[O]') # Use a wrong resonance structure and repeat the above. rxn_2 = ARCReaction(reactants=['C3H6O', 'C4H9O'], products=['C3H5O', 'C4H10O'], r_species=[r_1, r_2], p_species=[p_1, p_2]) - determine_family(rxn_2, db=self.db) - rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=rxn_2, db=self.db) + rxn_2.determine_family() + rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=rxn_2) for rmg_reaction in rmg_reactions: r_dict, p_dict = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=rxn_2, rmg_reaction=rmg_reaction) @@ -829,10 +824,10 @@ def test_get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(self): p_2 = ARCSpecies(label='C4H10O', smiles='CC(C)CO', xyz=self.c4h10o_xyz) rxn_3 = ARCReaction(reactants=['C3H6O', 'C4H9O'], products=['C3H5O', 'C4H10O'], r_species=[r_1, r_2], p_species=[p_1, p_2]) - determine_family(rxn_3, db=self.db) - rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=rxn_3, db=self.db) + rxn_3.determine_family() + rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=rxn_3) r_dict, p_dict = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=rxn_3, - rmg_reaction=rmg_reactions[0]) + rmg_reaction=rmg_reactions[0]) self.assertEqual(r_dict, {'*3': 10, '*1': 1, '*2': 7}) self.assertEqual(p_dict, {'*1': 1, '*3': 9, '*2': 16}) self.assertTrue(_check_r_n_p_symbols_between_rmg_and_arc_rxns(rxn_3, rmg_reactions)) @@ -1387,7 +1382,7 @@ def test_make_bond_changes(self): label_species_atoms([spc1]) label_species_atoms([spc2]) rxn = ARCReaction(r_species = [spc1], p_species=[spc2]) - rxn.determine_family(self.db) + rxn.determine_family() r_label_dict = {'*1': 0, '*2': 1} l = [spc1] make_bond_changes(rxn, l, r_label_dict) @@ -1395,7 +1390,7 @@ def test_make_bond_changes(self): rxn = ARCReaction(r_species = [ARCSpecies(label="N4", smiles = "NNNN")], p_species = [ARCSpecies(label="NH3", smiles = "N"), ARCSpecies(label="NH2NHN_p", smiles = "[N-]=[NH+]N")]) - rxn.determine_family(self.db) + rxn.determine_family() rmg_reactions = get_rmg_reactions_from_arc_reaction(arc_reaction=rxn, backend="arc") r_label_dict, p_label_dict = get_atom_indices_of_labeled_atoms_in_an_rmg_reaction(arc_reaction=rxn, rmg_reaction=rmg_reactions[0]) @@ -1477,7 +1472,7 @@ def test_add_adjacent_hydrogen_atoms_to_map_based_on_a_specific_torsion(self): def test_find_all_bdes(self): """tests the find_all_bdes function""" rxn = ARCReaction(r_species=[self.r_1, self.r_2], p_species=[self.p_1, self.p_2]) - rxn.determine_family(self.db) + rxn.determine_family() bdes = find_all_bdes(rxn, self.r_label_dict_rxn_1, True) self.assertEqual(bdes, [(2, 4)]) diff --git a/arc/rmgdb_test.py b/arc/rmgdb_test.py index 5a29777f33..5d92f37bf5 100644 --- a/arc/rmgdb_test.py +++ b/arc/rmgdb_test.py @@ -13,8 +13,6 @@ from rmgpy.species import Species import arc.rmgdb as rmgdb -from arc.reaction import ARCReaction -from arc.species import ARCSpecies class TestRMGDB(unittest.TestCase): @@ -44,41 +42,6 @@ def test_thermo(self): self.assertAlmostEqual(spc.get_entropy(298), 213.71872, 5) self.assertAlmostEqual(spc.get_heat_capacity(1000), 54.35016, 5) - def test_determine_family(self): - """Test the determine_family() function.""" - rxn = ARCReaction(r_species=[ARCSpecies(label='CH2CH2CH3', smiles='[CH2]CC')], - p_species=[ARCSpecies(label='CH3CHCH3', smiles='C[CH]C')]) - self.assertIsNone(rxn.family) - rmgdb.determine_family(rxn, db=None) - self.assertEqual(rxn.family.label, 'intra_H_migration') - - rxn = ARCReaction(r_species=[ARCSpecies(label='C2H6', smiles='CC'), - ARCSpecies(label='OH', smiles='[OH]')], - p_species=[ARCSpecies(label='water', smiles='O'), - ARCSpecies(label='C2H5', smiles='[CH2]C')]) - self.assertIsNone(rxn.family) - rmgdb.determine_family(rxn, db=self.rmgdb) - self.assertEqual(rxn.family.label, 'H_Abstraction') - - r_1 = ARCSpecies(label='C3H6O', smiles='CCC=O') - r_2 = ARCSpecies(label='C4H9O', smiles='[CH2]C(C)CO') - p_1 = ARCSpecies(label='C3H5O', smiles='CC=C[O]') # This is the "wrong" resonance structure on purpose. - p_2 = ARCSpecies(label='C4H10O', smiles='CC(C)CO') - rxn = ARCReaction(reactants=['C3H6O', 'C4H9O'], products=['C3H5O', 'C4H10O'], - r_species=[r_1, r_2], p_species=[p_1, p_2]) - self.assertIsNone(rxn.family) - rmgdb.determine_family(rxn, db=self.rmgdb) - self.assertEqual(rxn.family.label, 'H_Abstraction') - - r_1 = ARCSpecies(label='C2H6', smiles='CC') - r_2 = ARCSpecies(label='CCOOj', smiles='CCO[O]') - p_1 = ARCSpecies(label='CCOOH', smiles='CCOO') - p_2 = ARCSpecies(label='C2H5', smiles='C[CH2]') - rxn = ARCReaction(r_species=[r_1, r_2], p_species=[p_1, p_2]) - self.assertIsNone(rxn.family) - rmgdb.determine_family(rxn, db=self.rmgdb) - self.assertEqual(rxn.family.label, 'H_Abstraction') - def test_determining_rmg_kinetics(self): """Test the determine_rmg_kinetics() function""" r1 = Species().from_smiles('C') diff --git a/arc/scheduler_test.py b/arc/scheduler_test.py index be6e7a670a..ed7518f6d9 100644 --- a/arc/scheduler_test.py +++ b/arc/scheduler_test.py @@ -9,7 +9,6 @@ import os import shutil -import arc.rmgdb as rmgdb import arc.parser as parser from arc.checks.ts import check_ts from arc.common import ARC_PATH, almost_equal_coords_lists, initialize_job_types, read_yaml_file @@ -69,7 +68,6 @@ def setUpClass(cls): species=[cls.spc1], xyz=xyz1, job_type='scan', torsions=[[3, 1, 2, 6]], rotor_index=0, level=Level(repr={'method': 'b3lyp', 'basis': 'cbsb7'}), project_directory=cls.project_directory, job_num=104) - cls.rmg_database = rmgdb.make_rmg_database_object() cls.job_types1 = {'conformers': True, 'opt': True, 'fine': False,