selectedOutputFile TRUE
USER_PUNCH -start10 main$ = "<mainspecies>"20 PUNCH "pH", -LA("H+")30 totel = SYS(main$, n, n$, t$, moles)35 IF (totel <=0) THEN 12036 h2o = TOT("water")40 FOR i = 1 TO n50 IF(MID$(n$(i), 1, 2) = "H(" OR MID$(n$(i), 1, 2) = "O(" OR n$(i) = "O" OR n$(i) = "H") THEN 10060 IF(t$(i) = "equi") THEN 70 ELSE 9070 IF (instr(n$(i),"(g)")=0) THEN PUNCH n$(i)+"(s)", moles(i)/h2o ELSE PUNCH n$(i), moles(i)/h2o80 GOTO 10090 PUNCH n$(i), moles(i)/h2o100 NEXT i120 END
# PhreePlot demo to show how to make a spreadsheet-like file with aq species concn vs pH for Fe.# Accumulated tabular output is sent to the 'out' file.# Also plots the results.# For PhreePlot, see [url]https://www.phreeplot.org[/url].# N.B. This uses a 'custom' calculationType rather than a 'species' type.SPECIATION calculationType custom calculationMethod 1 xmin 2 xmax 12 resolution 101 customxColumn pHPLOT ytitle "species concn (mol/kgw)" lines <aqlist$> minimumYValueForPlotting 1e-5CHEMISTRY####################################################################### SIMULATION 1 - preloop# execute once to generate the tags containing the species for the -heading and 'lines' settingPHASESFix_H+H+ = H+log_k 0.0SOLUTION 1-units mol/kgwpH 1.5Na 0.1Cl 0.13Fe 1e-3SELECTED_OUTPUT 1 -reset falseUSER_PUNCH 1 -headings aqlist$ heading$ # these automatically make character tags10 aqlist$ = ''20 main$ = "Fe"30 IF(STEP_NO = 0) THEN 13040 REM Now concatenate the species names50 REM N.B. the optional sixth parameter (1) means that the species output is in a fixed alphabetic order60 totel = SYS(main$, n, n$, t$, moles, 1)70 FOR i = 1 TO n80 aqlist$ = aqlist$ + " " + n$(i)90 NEXT i100 PUNCH aqlist$110 heading$ = "pH" + aqlist$120 PUNCH heading$130 ENDEQUILIBRIUM_PHASES 1 Fix_H+ -2 NaOH -force_equality true O2(g) -0.67 -force_equality trueEND####################################################################### SIMULATION 2 - last so by default, main loop# loop on this to generate the dataUSE solution 1SELECTED_OUTPUT 1 -reset falseUSER_PUNCH 1 -heading <heading$>10 main$ = "Fe"20 IF(STEP_NO = 0) THEN 9030 PUNCH <x_axis>40 REM Now output the concentrations in alphabetic order50 totel = SYS(main$, n, n$, t$, moles, 1)60 FOR i = 1 TO n70 PUNCH MOL(n$(i)) # remember for mass balance, species may be polynuclear80 NEXT i90 ENDEQUILIBRIUM_PHASES 1 Fix_H+ -<x_axis> NaOH -force_equality true O2(g) -0.67 -force_equality trueEND