Conceptual Models > Database selection and modification

Defining log_K values

(1/1)

**Sol-Chan Han**:

Hi Phreeqc users!

I would like to modify the phreeqc database.

I am currently working on using Phreeqc with external code.

For my purpose, I would like to use an equation for defining log_K value of SURFACE_SPECIES, as follows.

Hfo_sOH + H+ = Hfo_sOH2+

-log_k 8.29 - 1

However, it seems like Phreeqc cannot understand 8.29 -1 = 7.29.

And Phreeqc just use 8.29 instead of 7.29.

Is there any way to use equation for defining log_K value?

Thank you in advance for your help.

**dlparkhurst**:

Assuming you don't want to just set the log_K to 7.29, there are a couple of options.

(1) There is an undocumented option -add_constant. A constant is added to the log K, which is either the log K as defined with -log_k or -analytical_expression. An analytical expression defines log K as a function of temperature. The analytical expression is used in preference to -log_k if both -log_k and -analytical_expression are defined. Here is an example:

--- Code: ---SOLUTION_SPECIES

Hfo_sOH + H+ = Hfo_sOH2+

-log_k 8.29

-add_constant -1

END

SOLUTION 1

Na 1

Cl 1 charge

SURFACE 1

Hfo_sOH 1 600 1

USER_PRINT

10 PRINT "Log10K(Hfo_sOH2+): ", LK_SPECIES("Hfo_sOH2+")

END

--- End code ---

(2) There is another more complicated, but more flexible option to add a "named expression", -add_logk, in SURFACE_SPECIES. This option is documented in the manual. You can define a NAMED_EXPRESSION that is a function of temperature, and then add it (multiplied by a coefficient) to the log K that is defined by -log_k or -analytical_expression in SURFACE_SPECIES.

**Sol-Chan Han**:

Hi sir Parkhurst

Thank you for the reply.

I have tried option (1).

It seems that the option (1) works for solution_species but does not work for surface_species.

Am I correct?

Unfortunately, the option (2) might not be fit for my purpose becasue I would not use analytical expression.

But thank you for your comment.

**dlparkhurst**:

Sorry, my mistake. I should have had SURFACE_SPECIES, rather than SOLUTION_SPECIES, but add_constant is available for both types of input. Here is the corrected script with log K for Hfo_sOH2+ calculated in a couple different ways:

--- Code: ---SURFACE_SPECIES

Hfo_sOH + H+ = Hfo_sOH2+

-log_k 8.29

-add_constant -1

END

SOLUTION 1

Na 1

Cl 1 charge

END

USE solution 1

SURFACE 1

Hfo_sOH 1 600 1

USER_PRINT

100 PRINT "Log10K(Hfo_sOH2+): ", LK_SPECIES("Hfo_sOH2+")

110 F_KJ_V_EQ = 96.4935

120 R_KJ_DEG_MOL = 0.00831470

130 REM equation 15 of PHREEQC version 2, 1999 manual

140 lk = LA("Hfo_sOH2+") - LA("H+") - LA("Hfo_sOH") \

+ LOG10(EXP[1*F_KJ_V_EQ*EDL("psi","Hfo")/(R_KJ_DEG_MOL*TK)])

150 PRINT "Alternatively: ", lk

END

--- End code ---

Note that the equation for NAMED_EXPRESSION includes a constant, so -add_logk would work as an alternative to -add_constant.

**Sol-Chan Han**:

Thank you, parkhurst!

Navigation

[0] Message Index

Go to full version