Esempio n. 1
0
# move known formation energies to the other side
known_columns = []
dG0_f = zeros((len(all_cids), 1))
for c in xrange(len(all_cids)):
    if (all_cids[c] in [101, 2051]):  # define as 0 (THF and LP)
        known_columns.append(c)
        dG0_f[c, 0] = 0
    elif (all_cids[c] in [
            440, 234, 143, 445, 2972, 1242, 6020, 6021
    ]):  # although GC can calculate it, I'd rather not use that value
        continue
    else:
        try:
            temp = G.estimate_dG0_keggcid(all_cids[c],
                                          pH=7.0,
                                          I=0.25,
                                          T=298.15)
            #temp = G.estimate_dG0_keggcid(all_cids[c], pH=7.0, I=0.0, T=311)
            known_columns.append(c)
            dG0_f[c, 0] = temp
        except Exception:
            continue

unknown_columns = sorted(
    list(set(range(len(all_cids))).difference(known_columns))
)  # find all the indices of columns not in known_columns
unknown_rows = find(isnan(dG0_r))
known_rows = sorted(list(set(range(len(reactions))).difference(
    unknown_rows)))  # find all the indices of rows with measured dG0_r

S_measured = S[known_rows, :]
Esempio n. 2
0
        c = all_cids.index(cid)
        S[r, c] = coeff
        dG0_r[r, 0] = reactions[r][3]

# move known formation energies to the other side
known_columns = []
dG0_f = zeros((len(all_cids), 1))
for c in xrange(len(all_cids)):
    if (all_cids[c] in [101, 2051]): # define as 0 (THF and LP)
        known_columns.append(c)
        dG0_f[c, 0] = 0
    elif (all_cids[c] in [440, 234, 143, 445, 2972, 1242, 6020, 6021]): # although GC can calculate it, I'd rather not use that value
        continue
    else:
        try:
            temp = G.estimate_dG0_keggcid(all_cids[c], pH=7.0, I=0.25, T=298.15)
            #temp = G.estimate_dG0_keggcid(all_cids[c], pH=7.0, I=0.0, T=311)
            known_columns.append(c)
            dG0_f[c, 0] = temp
        except Exception:
            continue

unknown_columns = sorted(list(set(range(len(all_cids))).difference(known_columns))) # find all the indices of columns not in known_columns
unknown_rows = find(isnan(dG0_r))
known_rows = sorted(list(set(range(len(reactions))).difference(unknown_rows))) # find all the indices of rows with measured dG0_r

S_measured = S[known_rows, :]
b = dG0_r[known_rows] - dot(S_measured[:, known_columns], dG0_f[known_columns])
S_red = S_measured[:, unknown_columns]

print "Formation energies from from GC and from linear regression: "