% PKA module

function [k_kinetic, N_cT, K_C] = kinetic_parameters(M, include_type2_reactions, num_cols)
    % Set the kinetic rate constants.
    % all reactions are reversible. no closed loops.
    % cAMP binds to R subunit one at a time
    
    % CONVERT TO fM 
    bigNum = 1e3;
    fastKineticConstant = bigNum;
    smallReverse = fastKineticConstant/(bigNum^2);
    u_to_f = 1e9;    
    
    % [Ka, Kb, Kd, Kpki]
    Km = u_to_f*[9.14, 1.64, 4.375, 2e-4];    
    N = length(Km);
    kim = zeros(1,N);
    kip = zeros(1,N);
    for i=1:4
        kim(i) = fastKineticConstant; % 1/s
        kip(i) = kim(i) / (Km(i)*u_to_f);
    end
    
    % repeat exct reactions for type I and type II holoenzymes
    % No closed loop, so no detailed balance
    k_kinetic = [
        kip, kip, kim, kim
        ]';

    % CONSTRAINTS
    N_cT = zeros(1,size(M,2)); 
%     % Reaction i: [PKA:PKI] = [C][PKI] at SS   big error. Not isolated reaction
    % repeat for type 1 and 2
    if false
        N_cT(1,num_cols + 2) = 1;
        N_cT(1,num_cols + 6) = 1;
        N_cT(1,num_cols + 8) = -1;
    end
    % Gibbs free energy of L + R binding                            **MED_ERROR**
    if false
        N_cT(3,num_cols + 4) = 1;   % ARC
        N_cT(3,num_cols + 1) = -1;  % cAMP
        N_cT(3,num_cols + 3) = -1;  % RC
        G_0_bind = -45.1872; % kJ/mol
        R = 8.314;
        T = 310;
        K_bind = exp(G_0_bind/(R*T))*10^6;
    end
    
    K_C = ones(1,size(N_cT,1));
return 











