From 5e907df8302f336682506bb64476cdaaa2fcb845 Mon Sep 17 00:00:00 2001 From: alongd Date: Thu, 21 Mar 2019 14:05:31 -0400 Subject: [PATCH] Initialize the global RMGDatabase object upon calling it even (and especially) if it already exists. This solves cases when using RMG's API where the database doesn't get appropriately updated. --- rmgpy/data/rmg.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/rmgpy/data/rmg.py b/rmgpy/data/rmg.py index 8594e926da..174dd0032a 100644 --- a/rmgpy/data/rmg.py +++ b/rmgpy/data/rmg.py @@ -50,7 +50,8 @@ ################################################################################ -class RMGDatabase: + +class RMGDatabase(object): """ The primary class for working with the RMG database. """ @@ -62,15 +63,12 @@ def __init__(self): self.kinetics = None self.statmech = None self.solvation = None - + # Store the newly created database in the module. global database -# assert database is None, "Should only make one instance of RMGDatabase because it's stored as a module-level variable." - if database is None: - database = self - else: - logging.warning("Should only make one instance of RMGDatabase because it's stored as a module-level variable!") - logging.warning("Unexpected behaviour may result!") + if database is not None: + logging.warning('An instance of RMGDatabase already exists. Re-initializing it.') + database = self def load(self, path,