% PKA module

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

function [k_kinetic, N_cT, K_C, W] = kinetic_parameters(M, include_type2_reactions, dims, V)
    % Set the kinetic rate constants.
    % all reactions are reversible. no closed loops.
    % cAMP binds to R subunit one at a time
    
    num_cols = dims.num_cols;
    num_rows = dims.num_rows;

    bigNum = 1e3;
    fastKineticConstant = bigNum;
    smallReverse = fastKineticConstant/(bigNum^2);
    
    % [Ka, Kb, Kd, Kpki]
    Km = [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);
    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));
    
    % volume vector
    W = [ones(num_cols,1); V.V_myo*ones(num_rows,1)];

return 











