function Titration2(varargin)
disp('ChemPlugin Example -- pH titration')
% Create ChemPlugin instance
cp = ChemPlugin('Titration2_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);
spec = Report(cp, 'species');

while 1
    time_step = ReportTimeStep(cp);
    if (AdvanceTimeStep(cp, time_step))
        break;
    end
    if (AdvanceChemical(cp))
        break;
    end
    conc = Report(cp, 'concentration aqueous', 'umol/kg');
    for i = 1:size(spec,1)
        if conc(i) >= 10.0
            fprintf('%s = %2.4f umol/kg\n', spec{i}, conc(i));
        end
    end
    fprintf('\n\n');
end

end
