function Titration6(varargin)
disp('ChemPlugin Example -- pH titration')
% Create ChemPlugin instance
cp = ChemPlugin('Titration3_stdout.txt');
% Configure the instance
Config(cp, 'Ca++ = 1 mmol/kg; Na+ = 1 mmol/kg');
Config(cp, 'Cl- = 3 mmol/kg; HCO3- = 2 mmol/kg; pH = 4');
Config(cp, 'react 3 mmol/kg NaOH; delxi = 0.1');

% Initialize the instance
Initialize(cp);
PlotHeader(cp, 'Titration.gtp', 'char');
PlotBlock(cp);

while 1
    time_step = ReportTimeStep(cp);
    if (AdvanceTimeStep(cp, time_step))
        break;
    end
    if (AdvanceChemical(cp))
        break;
    end
    PlotBlock(cp);
    PlotTrailer(cp);
    fprintf(' Pausing at Xi = %1.2s\n', Report1(cp, 'Xi'));
    % pause; 
    % uncomment above pause to be able to view plot at each step
end

end
