Skip to content

Commit

Permalink
Changed the default of load_families_only (#704)
Browse files Browse the repository at this point in the history
This solved issues #703 and circumventing issue #702 by loading all
reaction families by default.
  • Loading branch information
MichalKesl authored Sep 28, 2023
2 parents 753d74a + d91c4c1 commit 82d915d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
19 changes: 18 additions & 1 deletion arc/rmgdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def make_rmg_database_object() -> RMGDatabase:


def load_families_only(rmgdb: RMGDatabase,
kinetics_families: Union[str, list] = 'default'):
kinetics_families: Union[str, list] = 'all'):
"""
A helper function for loading kinetic families from RMG's database.
Expand Down Expand Up @@ -380,3 +380,20 @@ def get_family(rmgdb: RMGDatabase,
family.save_order = True
return family
return None


def clean_rmg_database_object(db: RMGDatabase) -> RMGDatabase:
"""
clears the global RMG database object.
Args:
db (RMGDatabase): the database object
Returns:
RMGDatabase: the database object
"""
global rmg_database_instance
del rmg_database_instance
rmg_database_instance = None

return make_rmg_database_object()
7 changes: 7 additions & 0 deletions arc/rmgdb_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,13 @@ def test_get_family(self):
self.assertEqual(family_4.label, 'intra_H_migration') # returns the correct capitalization
self.assertTrue(family_4.save_order)

def test_clean_rmg_database_object(self):
"""Test the clean_rmg_database_object() function"""
self.rmgdb = rmgdb.clean_rmg_database_object(self.rmgdb)
self.assertIsNone(self.rmgdb.thermo)
self.assertIsNone(self.rmgdb.transport)
self.assertIsNone(self.rmgdb.kinetics)
rmgdb.load_rmg_database(rmgdb=self.rmgdb)

if __name__ == '__main__':
unittest.main(testRunner=unittest.TextTestRunner(verbosity=2))

0 comments on commit 82d915d

Please sign in to comment.