function [s,rmin,rmax,ixmin,ixmax] = parse_head(seg,resid)
%
%  This function identifies the segments and residue sequences
%  associated with each segment
%
   n = 1;
   j = 1;
   while (1), 
      s(n) = seg(j);
      ixmin(n) = j;
      rmin(n) = resid(j);
      while (strcmp(s(n),seg(j))),
         rmax(n) = resid(j); 
         ixmax(n) = j;
         j = j + 1;
         if (j > length(seg)); return ; end
      end
      n = n + 1;
   end
return      
