function R=rminal(alpha,q,xf,xd)
% Rmin - minimum reflux ratio calculation - conatant alpha
% function R=rmin(alpha,q,xf,xd)
% Binary system min R=L/D
% Arguments:
% alpha  relative vloatility
%   q    quality of the feed: 0 for sat liq., 1 for sat vap.
%  xf    feed mol frac of the 1st comp.
%  xd    mol fraction of the 1st comp. in the distillate.
if q==0
   x1=xf;
   y=bubal(alpha,xf);
else
   if q==1
      y=xf;
      x1=dewal(alpha,xf);
   else
      cs=[alpha,xf,q];
      k=ssec2([1 alpha],'rminfal(c,x)',cs);
      x1=xf/(1+(k-1)*q);
      y=k*x1;
   end
end
s=(xd-y)/(xd-x1);
R=s/(1-s);
