function Rtot = B_model_numeric(params, constants )
%------------------- LineshapeKin Simulation -----------------------------
% Function for numeric solving of equilibrium thermodynamic equations
%
% 5/12/09
% Evgenii Kovrigin
% Medical College of Wisconsin
%
% B model was developed in 
% /Users/kovrigin/Documents/Workspace/Data/Data.XV/EKM16.Analysis_of_multistep_kinetic_mechanisms/Equilibria/B_model/B_model_derivation.mn


%--- this is what I need for K-matrix
Leq=params(1);


%-- these are constants named as used in the equation below
K_A_1_a=constants( 1);
K_A_1_b=constants( 2);
K_A_2_a=constants( 3);
Ltot       =constants( 4);



%-- equation 4.8


Rtot = - (Leq - Ltot)/(K_A_1_a*Leq + K_A_1_b*Leq + 2*K_A_1_a*K_A_2_a*Leq^2) - (K_A_1_a*Leq*(Leq - Ltot))/(K_A_1_a*Leq + K_A_1_b*Leq + 2*K_A_1_a*K_A_2_a*Leq^2) - (K_A_1_b*Leq*(Leq - Ltot))/(K_A_1_a*Leq + K_A_1_b*Leq + 2*K_A_1_a*K_A_2_a*Leq^2) - (K_A_1_a*K_A_2_a*Leq^2*(Leq - Ltot))/(K_A_1_a*Leq + K_A_1_b*Leq + 2*K_A_1_a*K_A_2_a*Leq^2);






