def LoadAllEstimators(): db_public = SqliteDatabase('../data/public_data.sqlite') db_gibbs = SqliteDatabase('../res/gibbs.sqlite') if not db_gibbs.DoesTableExist('prc_pseudoisomers'): nist_regression = NistRegression(db_gibbs) nist_regression.Train() tables = { 'alberty': (db_public, 'alberty_pseudoisomers', 'Alberty'), 'PRC': (db_gibbs, 'prc_pseudoisomers', 'our method (PRC)') } estimators = {} for key, (db, table_name, thermo_name) in tables.iteritems(): if db.DoesTableExist(table_name): estimators[key] = PsuedoisomerTableThermodynamics.FromDatabase( db, table_name, name=thermo_name) else: logging.warning('The table %s does not exist in %s' % (table_name, str(db))) estimators['hatzi_gc'] = Hatzi(use_pKa=False) #estimators['hatzi_gc_pka'] = Hatzi(use_pKa=True) if db.DoesTableExist('bgc_pseudoisomers'): estimators['BGC'] = GroupContribution(db=db_gibbs, transformed=True) estimators['BGC'].init() estimators['BGC'].name = 'our method (BGC)' if db.DoesTableExist('pgc_pseudoisomers'): estimators['PGC'] = GroupContribution(db=db_gibbs, transformed=False) estimators['PGC'].init() estimators['PGC'].name = 'our method (PGC)' estimators['UGC'] = UnifiedGroupContribution(db=db_gibbs) estimators['UGC'].init() estimators['UGC'].name = 'our method (UGC)' estimators['C1'] = ReactionThermodynamics.FromCsv( '../data/thermodynamics/c1_reaction_thermodynamics.csv', estimators['alberty']) if 'PGC' in estimators: estimators['merged'] = BinaryThermodynamics(estimators['alberty'], estimators['PGC']) estimators['merged_C1'] = BinaryThermodynamics(estimators['C1'], estimators['PGC']) for thermo in estimators.values(): thermo.load_bounds('../data/thermodynamics/concentration_bounds.csv') return estimators
def LoadAllEstimators(): db_public = SqliteDatabase('../data/public_data.sqlite') db_gibbs = SqliteDatabase('../res/gibbs.sqlite') if not db_gibbs.DoesTableExist('prc_pseudoisomers'): nist_regression = NistRegression(db_gibbs) nist_regression.Train() tables = {'alberty': (db_public, 'alberty_pseudoisomers', 'Alberty'), 'PRC': (db_gibbs, 'prc_pseudoisomers', 'our method (PRC)')} estimators = {} for key, (db, table_name, thermo_name) in tables.iteritems(): if db.DoesTableExist(table_name): estimators[key] = PsuedoisomerTableThermodynamics.FromDatabase( db, table_name, name=thermo_name) else: logging.warning('The table %s does not exist in %s' % (table_name, str(db))) estimators['hatzi_gc'] = Hatzi(use_pKa=False) #estimators['hatzi_gc_pka'] = Hatzi(use_pKa=True) if db.DoesTableExist('bgc_pseudoisomers'): estimators['BGC'] = GroupContribution(db=db_gibbs, transformed=True) estimators['BGC'].init() estimators['BGC'].name = 'our method (BGC)' if db.DoesTableExist('pgc_pseudoisomers'): estimators['PGC'] = GroupContribution(db=db_gibbs, transformed=False) estimators['PGC'].init() estimators['PGC'].name = 'our method (PGC)' estimators['UGC'] = UnifiedGroupContribution(db=db_gibbs) estimators['UGC'].init() estimators['UGC'].name = 'our method (UGC)' estimators['C1'] = ReactionThermodynamics.FromCsv( '../data/thermodynamics/c1_reaction_thermodynamics.csv', estimators['alberty']) if 'PGC' in estimators: estimators['merged'] = BinaryThermodynamics(estimators['alberty'], estimators['PGC']) estimators['merged_C1'] = BinaryThermodynamics(estimators['C1'], estimators['PGC']) for thermo in estimators.values(): thermo.load_bounds('../data/thermodynamics/concentration_bounds.csv') return estimators
dG0_r_prime[0, j] = np.nan return dG0_r_prime if __name__ == "__main__": from pygibbs.groups import GroupContribution db_public = SqliteDatabase('../data/public_data.sqlite') db_gibbs = SqliteDatabase('../res/gibbs.sqlite') alberty = PsuedoisomerTableThermodynamics.FromDatabase(\ db_public, 'alberty_pseudoisomers', name='alberty') pgc = GroupContribution(db=db_gibbs, transformed=False) pgc.init() pgc.name = "PGC" merged = BinaryThermodynamics(alberty, pgc) S = np.matrix([[-1, 1, 0, 0, 0, 0, 0, 0, 0], [ 0, -1, -1, 1, 0, 0, -1, 1, 1], [ 0, 0, 0, -1, 1, 1, 0, 0, 0], [ 0, -1, -1, 0, 1, 1, -1, 1, 1]]).T cids = [311, 158, 10, 566, 24, 36, 2, 8, 9] print alberty.GetTransformedFormationEnergies(cids) print alberty.GetTransfromedReactionEnergies(S, cids) print pgc.GetTransfromedReactionEnergies(S, cids) dG0_r_primes = merged.GetTransfromedReactionEnergies(S, cids) print dG0_r_primes