function SAkinplotAllMp(Gses,epss,do3,do9,do29,linerange)
% SAkinplotAllMp(Gses,epss,do3,do9,do29,linerange)
%  kinetic trap model prediction for error rate vs speed  
%    3 state, 9 state, and 29 state simplified models
%    (matrix-based calculation)
%
%  for each Gse in Gses, for all eps in eps
%      Gmc = 2Gse-eps
%      r   = k (exp(-Gmc) - exp(2*Gse)) / 2   is the overall growth speed
%      rs  = 2r / a3  * exp(gam3*eps)           for original tiles
%      rs  = 2r / a9  * exp(gam9*eps)           for proofreading tiles
%      rs  = 2r / a29 * exp(gam29*eps)          for proofreading tiles
%
%      a    is the freezing slowdown
%      gam  is the "exponential suddenness factor" (can't explain)

if size(epss,1)==1
  epss=[epss;epss];
end
if size(Gses,1)==1
  Gses=[Gses;Gses];
end

kfh = 10^6;

col = 'rcbgm';
if length(do3)>1
 a3=do3(1); gam3=do3(2); 
 r3 = zeros(size(epss,2),length(Gses)); oe3=r3; 
 for j=1:size(Gses,2)
  for i=1:size(epss,2)
   Gse=Gses(1,j); Gmc = 2*Gse-epss(1,i); 
   r3(i,j) = kfh * (exp(-Gmc) - exp(-2*Gse));
   oe3(i,j) = SAkin3origM(Gmc, Gse, r3(i,j) / a3 * exp(gam3*epss(1,i)), 1, kfh);  
  end
  loglog(r3(:,j)/2,oe3(:,j),[col(mod(j-1,5)+1) '.-']);
  hold on
 end
 if ~isempty(linerange)
  loglog(linerange,.98*sqrt(linerange)/10^2,'k-');
 end
end
if length(do9)>1
 for j=1:size(Gses,2)
  a9=do9(1); gam9=do9(2); 
  r9 = zeros(size(epss,2),length(Gses)); pe9=r9; 
  for i=1:size(epss,2)
   Gse=Gses(2,j); Gmc = 2*Gse-epss(2,i); 
   r9(i,j) = kfh * (exp(-Gmc) - exp(-2*Gse));
   pe9(i,j) = SAkin9proofM(Gmc, Gse, r9(i,j) / a9 * exp(gam9*epss(2,i)), 1, kfh)/2;
   % we divide by two, because SAkin9proofM gives the error rate per block,
   % and we are graphing the error rate per tile.  4 tiles/block, 2 errors/block
  end
  loglog(r9(:,j)/2,pe9(:,j),[col(mod(j-1,5)+1) '.-']);
 end
 if ~isempty(linerange)
  loglog(linerange, 5.5*linerange/10^5,'k-'); 
 end
end
if length(do29)>1
 for j=1:size(Gses,2)
  a29=do29(1); gam29=do29(2); 
  r29 = zeros(size(epss,2),length(Gses)); pe29=r29; 
  for i=1:size(epss,2)
   Gse=Gses(2,j); Gmc = 2*Gse-epss(2,i); 
   r29(i,j) = kfh * (exp(-Gmc) - exp(-2*Gse));
   pe29(i,j) = SAkin29proofM(Gmc, Gse, r29(i,j) / a29 * exp(gam29*epss(2,i)), 1, kfh)/2;
   % we divide by two, because SAkin9proofM gives the error rate per block,
   % and we are graphing the error rate per tile.  4 tiles/block, 2 errors/block
  end
  loglog(r29(:,j)/2,pe29(:,j),[col(mod(j-1,5)+1) '.-']);
 end
 if ~isempty(linerange)
  loglog(linerange, 5.5*linerange/10^5,'k-'); 
 end
end
xlabel('speed (layers/sec)'); ylabel('error rate (mismatches/tile)'); 
title('original & proofreading sierpinski tiles -- kinetic trap predictions');
