isolog1.ppi

# simple example of fitting to a Langmuir isotherm using unit weighting
#   plot of calcd vs obsd
#   see iso.ppi

SPECIATION
  jobTitle                             "Fit with no data transformations"
  calculationType                      fit
  calculationMethod                    1
FIT
  dataFile                             isolog.dat 
  logVariableIn                        0 0 0 0  0 0 0                # this controls the transformation of data variables as they comes in from the fit data file
  dependentVariableColumnObs           Znsorbed
  dependentVariableColumnCalc          sorbZn
  logDepVariable                       0                             # this controls the transformation of the dependent variable after it comes out of selected output
  fitWeightingMethod                   0                             #   0 = no transformation
  fitFiniteDiffStepSize                1.0E-3
  blockRangeColumn                     sim
  numberOfFitParameters                2
  fitParameterNames                    log_k  M1
  fitLogParameters                     0 0
  fitAdjustableParameters              1 1
  fitParameterValues                   3.0 1.0
  onepass                              FALSE                         # each data point is calculated in a separate pass of PHREEQC

PLOT
  plotTitle                            "Zn sorption on Hfo<br>(input lin data & fit lin)"
  xtitle                               "Zn sorbed (fitted) (mmol Zn/mol Fe)"
  ytitle                               "Zn sorbed (obsd) (mmol Zn/mol Fe)"
  points                               observed                      # y = observed (points)
  pointSize                            4.0
  legendTextSize                       0.0
  customXcolumn                        calculated                    # x = calculated
  extrasymbolslines                    extrasymbolslines1-1line.dat  # provides the blue 1:1 line


CHEMISTRY

PHASES
Fix_H+
  H+ = H+
  log_k 0.0
SELECTED_OUTPUT
 -high_precision true
 -reset false
PRINT
    -reset false

SURFACE_MASTER_SPECIES
  Surf Surf
SURFACE_SPECIES
  Surf = Surf
  log_k  0.0

  Surf + Zn+2 = SurfZn+2
  log_K <log_k>
SURFACE
    Surf <M1>
    -equil 1
    -no_edl

USER_PUNCH
# fit Langmuir isotherm
-headings  sorbZn pH mmolZn step_no
10 sorbedZn=SURF("Zn","Surf")
20 if sorbedZn>0 THEN punch sorbedZn, -la("H+"), tot("Zn")*1e3, step_no

SOLUTION 1
    -pH <pHobs>
    -units mmol/L
    Na   1000
    N(5) 1000
    Zn   <Znconcn>                                                   # <Znconcn> from isolog.dat
EQUILIBRIUM_PHASES
  Fix_H+ -<pHobs>  NaOH
END