Skip to content

Commit

Permalink
Tests: Removed RMGDatabase from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alongd committed Jul 3, 2024
1 parent c1d21d2 commit e96cb3d
Show file tree
Hide file tree
Showing 10 changed files with 92 additions and 157 deletions.
21 changes: 9 additions & 12 deletions arc/checks/ts_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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]
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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()
Expand Down
5 changes: 1 addition & 4 deletions arc/common_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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):
Expand Down
13 changes: 5 additions & 8 deletions arc/job/adapters/ts/autotst_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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"""
Expand All @@ -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],
Expand Down Expand Up @@ -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],
Expand All @@ -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],
Expand All @@ -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],
Expand Down Expand Up @@ -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],
Expand Down
3 changes: 0 additions & 3 deletions arc/job/adapters/ts/gcn_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand Down
Loading

0 comments on commit e96cb3d

Please sign in to comment.