function sethcp
% sethcp: called by start301 to set up hcpv,hcpl,hcps data for compounds in cnms
% Argument list: none
global StdhkJ StStdh cpv cpl cps nc 
global ns ne TbpK LhslkJ LhlvkJ TmpK
global icpl icpv icps hcpl hcps hcpv 
[nc1,ncv]=size(icpv);
[nc1,ncl]=size(icpl);
[nc1,ncs]=size(icps);
hcpv= [];
hcpl= [];
hcps= [];
nc
for k=1:nc
   icp2=.001*icpv(k,:);
   icp1=.001*icpl(k,:);
   icp0=.001*icps(k,:);
   if StStdh(k)==2
      hcpv=[hcpv;[icp2,StdhkJ(k)-polyval([icp2,0],298.15)]];
      con=enth2(298.15,TbpK(k),icp2)-polyval([icp1,0],TbpK(k));
      hcpl=[hcpl;[icp1,StdhkJ(k)-LhlvkJ(k)+con]];
      con=enth2(298.15,TbpK(k),icp2)+enth2(TbpK(k),TmpK(k),icp1);
      con=con-polyval([icp0,0],TmpK(k));
      hcps=[hcps;[icp0,StdhkJ(k)-LhlvkJ(k)-LhslkJ(k)+con]];
   elseif StStdh(k)==1
      if isnan(icp1(1))|isnan(icp2(1))
         hcpv=[hcpv;zeros(1,ncv+1)*NaN];
         hcps=[hcps;zeros(1,ncs+1)*NaN];
         hcpl=[hcpl;zeros(1,ncl+1)*NaN];
      else
         con=enth2(298.15,TbpK(k),icp1)-polyval([icp2,0],TbpK(k));
         hcpv=[hcpv;[icp2,StdhkJ(k)+LhlvkJ(k)+con]];
         hcpl=[hcpl;[icp1,StdhkJ(k)-polyval([icp1,0],298.15)]];
         con=enth2(298.15,TmpK(k),icp1)-polyval([icp0,0],TmpK(k));
         hcps=[hcps;[icp0,StdhkJ(k)-LhslkJ(k)+con]];
      end
   elseif StStdh(k)==0
      con=enth2(298.15,TmpK(k),icp0)+enth2(TmpK(k),TbpK(k),icp1);
      con=con-polyval([icp2,0],TbpK(k));
      hcpv=[hcpv;[icp2,StdhkJ(k)+LhlvkJ(k)+LhslkJ(k)+con]];
      con=enth2(298.15,TmpK(k),icp0)-polyval([icp1,0],TmpK(k));
      hcpl=[hcpl;[icp1,StdhkJ(k)+LhslkJ(k)+con]];
      hcps=[hcps;[icp0,StdhkJ(k)-polyval([icp0,0],298.15)]];
    elseif isnan(StStdh(k))
      hcpv=[hcpv;[icpv(k,:), NaN]*NaN];
      hcpl=[hcpl;[icpl(k,:), NaN]*NaN];
      hcps=[hcps;[icps(k,:), NaN]*NaN];
    else 
      disp('Wrong value for StStdh')
    end
end
