PhreeqcUsers Discussion Forum

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 

  • Forum Home
  • Login
  • Register

  • PhreeqcUsers Discussion Forum »
  • USER_PUNCH/USER_GRAPH »
  • SELECTED_OUTPUT »
  • How to Export Equivalents for Each Species?
« previous next »
  • Print
Pages: [1]   Go Down

Author Topic: How to Export Equivalents for Each Species?  (Read 612 times)

swhit

  • Frequent Contributor
  • Posts: 13
How to Export Equivalents for Each Species?
« on: June 15, 2020, 06:16:44 PM »
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
Logged

dlparkhurst

  • Top Contributor
  • Posts: 2485
Re: How to Export Equivalents for Each Species?
« Reply #1 on: June 15, 2020, 11:59:06 PM »
Here is an example for USER_PRINT; you can adapt it for USER_PUNCH. I admit it is obscure.

Code: [Select]
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
Logged

swhit

  • Frequent Contributor
  • Posts: 13
Re: How to Export Equivalents for Each Species?
« Reply #2 on: July 08, 2020, 06:20:31 PM »
Belated thanks!  This worked well for my intended purpose.
Logged

  • Print
Pages: [1]   Go Up
« previous next »
  • PhreeqcUsers Discussion Forum »
  • USER_PUNCH/USER_GRAPH »
  • SELECTED_OUTPUT »
  • How to Export Equivalents for Each Species?
 

  • SMF 2.0.17 | SMF © 2019, Simple Machines | Terms and Policies
  • XHTML
  • RSS
  • WAP2