From 03c1f5ed4d00232e53d85caa5cb4944ecdc89f60 Mon Sep 17 00:00:00 2001 From: kfir4444 Date: Wed, 27 Sep 2023 13:31:26 +0300 Subject: [PATCH 1/3] Changed the default of load_families_only --- arc/rmgdb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arc/rmgdb.py b/arc/rmgdb.py index 291696086e..d938a43adc 100644 --- a/arc/rmgdb.py +++ b/arc/rmgdb.py @@ -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. From e6ef29dbe96fb3b77324a7bbfc35047120e87205 Mon Sep 17 00:00:00 2001 From: kfir4444 Date: Wed, 27 Sep 2023 14:26:31 +0300 Subject: [PATCH 2/3] Added a function for creating a clean rmg database object Made more for scripting and testing. --- arc/rmgdb.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/arc/rmgdb.py b/arc/rmgdb.py index d938a43adc..bb6e9dc6a3 100644 --- a/arc/rmgdb.py +++ b/arc/rmgdb.py @@ -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() From d91c4c1e60c9fdd97a924fc9149da6149eef5af3 Mon Sep 17 00:00:00 2001 From: kfir4444 Date: Thu, 28 Sep 2023 09:08:36 +0300 Subject: [PATCH 3/3] Test: clean_rmg_database_object --- arc/rmgdb_test.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arc/rmgdb_test.py b/arc/rmgdb_test.py index 3f5934eacd..5a29777f33 100644 --- a/arc/rmgdb_test.py +++ b/arc/rmgdb_test.py @@ -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))