Jump to content
Geochemist's Workbench Support Forum

Custom Rate Laws


Recommended Posts


I am interested in writing some custom rate laws into a script for dissolution of some minerals. I have an idea as to how to do this but I think I am possibly missing something critical. Below is a rate law for anorthite dissolution that is one of the simpler expressions I am interested in incorporating into a React model. It has the form:


Rate = k+[((aH+3n/aAl3+n)Keq)/(1+Keq(aH+3n/aAl3+n))]


where n = 1/3, Keq is a known constant, and k+ is the forward rate constant. "a" represents activities and the parameters with n in them are exponents on the various hydrogen ion and aluminum ion activities. I have attached a file with a better representation of the expression. Also, I have not included the surface area of the (1-Q/K) terms because those are obvious to me as to their implementation. Any suggestions you have would be greatly appreciated.


Best wishes,

Karen J.


Anorthite Rate Law.pdf

Link to comment
Share on other sites

Hi Karen,


I moved your post to the front page of the forum. It was posted in the archive of old posts.


The Custom Rate Laws chapter (section 5 in the GWB Reaction Modeling Guide) should be helpful. I think you probably want to use a rate law script, which you'll write in a simplified form of the BASIC language. You can find a description of the syntax in Table 5.3. In your scripts, you can access certain parameters (pH, temperature, rate_con) and helper functions (activity(), fugacity(), etc.) that are listed in Tables 5.1 and 5.2 in the guide, respectively. You can also define new variables within your script (n, for example).


Assuming you define the rate constant using the GUI, your .bas script file might look something like this:


n = 1/3

Keq = ...


top = ((activity("H+")^(3*n))/(activity("Al+++")^n))*Keq

bottom = ...

rate = rate_con * top / bottom



In this case, n and Keq are variables that you define, activity() is a helper function from 5.2, and rate_con is a parameter, listed in 5.1, that accesses what you entered in the rate constant field of the GUI.


Please keep in mind the GWB's convention of writing reactions as destruction reactions (i.e., a mineral dissolves or a complex breaks down). A positive rate indicates dissolution, while a negative rate indicates precipitation. I hope this helps.



Brian Farrell

Aqueous Solutions

Link to comment
Share on other sites

You can write out the entire basic rate law script in parentheses within your React script or you can save them as separate script files (.bas) that you refer to in your React script. In my opinion, the latter method is easier, especially if you have rate laws for several different kinetic minerals.


You would write a rate law script, like the one above, in a text editor like Notepad. Instead of saving as a txt file, though, just change the extension to .bas (AlbiteRate.bas, for example). I mentioned using the GUI to define certain parameters, like the rate constant, for use by your rate law. You can alternatively use a simple keyword to define those parameters in your React script (.rea) at the same time that you set up your rate law. For example,


kinetic Quartz rate_law = QuartzRate.bas rate_constant = 10^-16

kinetic Albite rate_law = AlbiteRate.bas rate_constant = 10^-15


If you had instead included your own variable "MyRateConstant" in your rate law script, then you wouldn't need to specify the rate constant within your React script:


kinetic Quartz rate_law = QuartzRate.bas


Hope this helps,


Link to comment
Share on other sites

  • 3 weeks later...
  • 2 weeks later...

Hi Brian,

Great! I will pop by the GWB booth and say hi.


Quick question, does the BASIC language that GWB employs for such custom rate laws use log for log base 10? When I used to use BASIC decades ago, LOG was for the natural log. I have rate law expression that is given as:


log Rate = 0.03*pH2 - 0.073*pH - 10 that I need to "code" for one of the minerals in my hypothetical basalt. Based on what you wrote above, I will need to convert "log R = ..." to "R = ..." using activity("H+") for the pH terms. In my olden days of BASIC programming to code for log base 10, I would have to use "2.303*LOG(argument).



Link to comment
Share on other sites

Hi Karen,


When writing a script in the BASIC language (to define a custom rate law or to specify medium heterogeneity, for example) LOG refers to the natural logarithm, whereas LOG10 refers to the common (base 10) logarithm. See Table 5.3 in the GWB Reaction Modeling Guide.


If you've ever used the calculator built into the Command pane of any GWB app, though, you would use ln (or LN) for the natural log and log (or LOG) for the common log. See section B.4, Calculator, in the GWB Reference Manual for more info.


See you next week,


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...