USER_PUNCH/USER_GRAPH > SELECTED_OUTPUT

How to Export Equivalents for Each Species?

(1/1)

swhit:
Hi,

I would like to export the total equivalents for each species in the Sum of Species table.

I found this code in the PhreeqPy google group, which works for my intended purpose, aside from not including charge.

Is there a basic function to get charge for each of the species?  I have looked high and low and can't find anything..

SELECTED_OUTPUT
-file ..........
-reset false
-solution false

USER_PUNCH
10 t = SYS("aq", count, name$, type$, moles$)
20 FOR i = 1 TO count
30 PUNCH name$(i)
40 PUNCH LA(name$(i))
50 PUNCH LM(name$(i))
60 NEXT i

END

dlparkhurst:
Here is an example for USER_PRINT; you can adapt it for USER_PUNCH. I admit it is obscure.


--- Code: ---SOLUTION
pH  7 charge
Na 1
C  1
USER_PRINT
10 t = SYS("aq", count , name$ , type$ , moles )
20 PRINT PAD("Species",10), PAD(" eq/kg water",12)
30 FOR i = 1 TO count
40   s$ = SPECIES_FORMULA$(name$(i), count_e, elt$, coef)
50   z = 0
60   FOR j = 1 TO count_e
70      IF (elt$(j) = "charge") THEN z = coef(j)
80   NEXT j
90   PRINT PAD(name$(i), 10), STR_E$(MOL(name$(i))*z, 12, 2)
100 NEXT i
END

--- End code ---

swhit:
Belated thanks!  This worked well for my intended purpose.

Navigation

[0] Message Index

Go to full version