% B1AR module 

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

% 6 sep 21: removcing signalling rewactions (separate module, LRGbinding)

function [k_kinetic, N_cT, K_C, W] = kinetic_parameters(M, include_type2_reactions, dims, V)
    % Set the kinetic rate constants.
    % original model had reactions that omitted enzymes as substrates e.g. BARK
    % convert unit from 1/s to 1/uM.s by dividing by conc of enzyme
    % all reactions were irreversible, made reversible by letting kr ~= 0
    
    num_cols = dims.num_cols;
    num_rows = dims.num_rows;

    % concentration of BARK = 0.6uM (crude approx from litsearch, for GRK)
    bigNum = 1e6;
    fastKineticConstant = bigNum;
    smallReverse = fastKineticConstant/(bigNum^2);
    cBARK = 0.6;                %uM
    cPKACI = 0.0587898478276673;        %uM
    
    Kl = 0.285; % uM
    Kr = 0.062; % uM
    Kc = 33; % uM
    
    kB11p = 1.1e-3 / cBARK;     % 1/uM.s
    kB11m = 2.2e-3;             % 1/s
    kB12p = fastKineticConstant;%1/s
    kB12m = smallReverse;       % 1/uM.s
    kB21p = kB11p;              % 1/uM.s
    kB21m = kB11m;              % 1/s
    kB22p = fastKineticConstant;%1/s
    kB22m = smallReverse;       % 1/uM.s
    kP1p = 2.2e-3/ cPKACI;      % 1/uM.s 
    kP1m = smallReverse;        % 1/s
    kP2p = fastKineticConstant; % 1/s
    kP2m = 3.6e-3;              % 1/uM.s 
    
    % detailed balance for kP2p
    kP2p = kP2m*kP1m/kP1p;
    
    k_kinetic = [
        kB11p, kB12p, kB21p, kB22p, kP1p, kP2p,...
        kB11m, kB12m, kB21m, kB22m, kP1m, kP2m
        ]';
    nid = [7,8];

    % CONSTRAINTS
    N_cT = zeros(1,size(M,2)); 
    % substrate B1ARp is in eqlm with product B1ARtot
    N_cT(1,num_cols + nid(1)) = 1;
    N_cT(1,num_cols + nid(2)) = -1;

    K_C = ones(1,size(N_cT,1));

    % volume vector
    W = [ones(num_cols,1); V.V_myo*ones(num_rows,1)];

return 