
function [lowBoundRHS] = FBA_EB_accumulationViralHostMetConnect(organism, tStep, iSim)
	% Author: Elsa W. Birch, ewbirch@stanford.edu, Covert Lab - Stanford Bioengineering
	% Date: 4/24/2011
	% Version: associated with production of the figures for Birch et al. 2012
%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
%
% Summary: This function produces elements of the FBA RHS vector allowing accumulation in
%           or use from avalible pools of metabolites shared between host and virus.
% 
%
% Inputs: organism - Organism definition, and simulation, structure
%		  tStep - timestep length, as a 1x1 matrix
%		  iSim - itteration number to denote the current state stored in organism, as a 1x1 integer
%
% Outputs: lowBoundRHS - A nx2 vector with indicies of shared host-viral metabolites in the first column, 
%						 and in the seccond column the lower boud value for uptake of that substrate (less than or equal to zero).
%
%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
%
% Notes: 
%
%
% - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

% calculate ammount that could be drawn from previously accumulated pools
previousPools = organism.simulation.metabolitePools(...
                    organism.model.hostViralMetaboliteConnectionsIdx, iSim - 1);

% This calcualtion is the equivalent of that performed to limit substrate uptake from the
% media, or:
%               [ S ] 
% Sup_max = ----------------
%           [ X ]  * delta_t
%
% Note: because of use of initial/past biomass in this limit and the increase of
% biomass durring timestep (if growth > 0) then more of this metabolite may be drawn than
% is avalible.
%
usePoolBound = previousPools / organism.simulation.biomass(iSim - 1) / tStep ;

% expected format for rhs array of FBA_EB_glpkSove
lowBoundRHS = [organism.model.hostViralMetaboliteConnectionsIdx, - usePoolBound];