# cGS module, translated from Yang et al 2005

# Return kinetic parameters, constraints, and vector of volumes in each
# compartment (pL) (1 if gating variable, or in element corresponding to
# kappa)

# Based on Pan 2018 cardiac AP

import numpy as np

def kinetic_parameters(M, include_type2_reactions, dims, V):

    num_cols = dims['num_cols']
    num_rows = dims['num_rows']

    fkc = 1e6
    smr = 1e-3

    E0 = 0.05  # [=] mM    #GUESS for sum of sGC forms

    # DIMENSIONALISE appropriate rates by multiplying by E0, the quantity used to nondimensionalise the model
    k1p = 2e6*E0 # [=] 1/mM.s
    k1m = 100 # [=] 1/s
    k2p = 0.1 # [=] 1/s
    k2m = smr # [=] 1/s
    k3p = 0.003e6*E0 # [=] 1/mM.s
    k3m = smr
    k4p = 0.011 # [=] 1/s
    k4m = smr
    k_dno_p = 0.01 # [=] 1/s
    k_dno_m = smr

    # Calculate bond graph constants from kinetic parameters
    # Note: units of kappa are fmol/s, units of K are fmol^-1
    kf = [k1p,
          k2p,
          k3p,
          k4p,
          k_dno_p,
          ]

    kr = [
        k1m,
        k2m,
        k3m,
        k4m,
        k_dno_m,
    ]

    k_kinetic = kf + kr

    # CONSTRAINTS
    N_cT = []
    K_C = []

    # volume vector
    # W = list(np.append([1] * num_cols, [V['V_myo']] * num_rows))
    W = [1] * num_cols + [V['V_myo']]*num_rows

    return (k_kinetic, N_cT, K_C, W)













