isowt.ppi

# simple example of fitting to a Langmuir isotherm using unit weighting
#   plot of fit to Langmuir isotherm - using different weighting for each point (read from the fit data file)
#   see iso.ppi and other \fit files

SPECIATION
  jobTitle                             "Test fitting: variable weighting from the fitdata file"
  calculationType                      fit
  calculationMethod                    1
FIT
  dataFile                             iso.dat                       # fit data file
  dependentVariableColumnObs           Znsorbed                      # from the fit data file
  dependentVariableColumnCalc          sorbZn                        # from selected output
  fitWeightingMethod                   2                             # 2 =  take individual weights from the fit data file
  weightColumn                         wt                            # this column from fit data file used for weights
  fitFiniteDiffStepSize                1.0E-3
  blockRangeColumn                     sim                           # from fit data file
  numberOfFitParameters                2
  fitParameterNames                    log_k  M1
  fitLogParameters                     0 0
  fitAdjustableParameters              1 1
  fitParameterValues                   3.0 1.0
  onepass                              FALSE

PLOT
  plotTitle                            "Zn sorption on Hfo<br>(with variable weighting from the fit data file)"
  xtitle                               "Zn concn (mmol/L)"
  ytitle                               "Zn sorbed (mmol Zn/mol Fe)"
  lineWidth                            0.4
  lines                                calculated
  points                               observed
  lineColor                            red
  labelSize                            0.0
  legendTextSize                       0.0
  pointSize                            4.0
  customXcolumn                        Znconcn
  extraText                            "extratextiso.dat"


CHEMISTRY

PRINT
    -reset false
PHASES
Fix_H+
  H+ = H+
  log_k 0.0

SELECTED_OUTPUT
 -high_precision true
 -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 iso.dat

EQUILIBRIUM_PHASES
  Fix_H+ -<pHobs>  NaOH                                            # <pHobs> from the fit data file
  -force_equality true
END