Supcrt-gwb scripts
From GeoMod
Scripts to convert supcrt output. It's not the simplest procedure so contact me (Dr. Urbano) if there are any questions.
These software are currently supported as shareware, so please contact Dr. Urbano if you find this useful and would like to contribute (suggested $20).
Contents |
Download and install supcrt
Option 1 for Mac OSX 10.4: Download with executables
Download and unzip the script and executable files in Media:supcrt-gwb.zip.
This file contains:
- supcrt and cprons executables.
- the slop98.dat database (and the generated drpons98.dat file)
- UNIX shell scripts (bash) to run things.
- Python scripts to do the database conversions.
Option 2 for Unix: Install from scratch (a Mac OSX 10.4 example)
These instructions are specifically for use on the Mac using the command line in the Terminal application, but should be useful for any other UNIX type environment.
Download supcrt: Media:Supcrt95.zip
- or
- get supcrt from Prediction Central where I found it.
- and get the slop98.dat database from GEOPIG website
Download scripts: Media:supcrt-gwb.zip contains the scripts used in this example.
Unzip:
- Using the Terminal command line unzip with
unzip supcrt95.zip
- This creates a directory "supcrt95" with the fortran files. Go to this directory
cd supcrt95
Copy and unzip the scripts file and move all of the files ending with .s and .py into your supcrt95 directory (note you may need to change the permissions on the scripts to allow you to execute them).
Compile: On the Mac compiling is a bit of a pain. To compile, since I don't have the f77 fortran compiler I used g95 installed using fink (> fink install g95).
- In changing the fortran compiler I also have to change the makefile, so instead I wrote the compile.s script.
./compile.s
(To run supcrt you can just execute ./supcrt but you don't need to do this explicitly for this procedure as I have another script for that.)
supcrt comes with the sprons96.dat database, but we found that not to have some of the species we need. Instead we downloaded the slop98.dat database from the GEOPIG website at ASU. We use cprons program to process the slop98.dat input database and output the dprons98.dat database.
./cprons
You should now be ready to go.
Convert gwb database to supcrt input format
Use the gwb_to_supcrt.py script to convert your Geochemist's Workbench (gwb) database to the right format for supcrt. This script assumes you use a gwb database called "thermo500noC.txt" by default, however you can enter the name of any gwb database you want on the command line.
./gwb_to_supcrt.py thermo250noCnew2.txt
This produces a bunch of files. With our tests supcrt was unable to process more than 50 reactions at a time so the output files are divided up by reaction type (redox, aqueous, mineral and gas) and number of reactions. There are 57 redox reactions in our database so gwb_to_supcrt.py produces 2 output files supcrt_redox0.txt (with 50 reactions) and supcrt_redox1.txt (with 7 reactions). The other reaction types are treated similarly.
NOTE: gwb_to_supcrt.py only extracts reactions from the aqueous, mineral, redox and gases sections of the gwb database because these were all we needed. You would have to modify gwb_to_supcrt.py and reaction.py to enable import of other types of reactions.
Corrections
There are a few idiosyncrasies in program and the database that need to be corrected.
- These corrections are for when using the slop98.dat database
- if you are using the sprons96.dat database that comes with supcrt see sprons96.dat corrections
Error with H2O
The program does not produce the correct format for the H2O(g) reaction in the gases file (supcrt will produce an error). You'll need to manually edit the text file supcrt_gas0.txt and replace the existing reaction with:
H2O(g)
0 0 1 1
-1.000 H2O,g H2O(0)
1.000 H2O H2O
Error with HfO+2
For some reason we can't get supcrt to recognize HfO+2, so we delete it from the redox file supcrt_redox1.txt :
HfO++
0 3 0 1
-1.000 HfO+2 HfO(+2)
-2.000 H+ H(+)
1.000 Hf+4 Hf(+4)
1.000 H2O H2O
and change the number of reactions in the file (line 15) from 7 instead of 6.
6 1
,AQ vs ,aq
Most aqueous reactions in the dprons98.dat database are written with ,aq but for some reason HCN and MgSO4 have uppercased ,AQ. The program fudges.s fixes this in our example but may not in yours.
./fudges.s
Calculate new log_K values with supcrt
'''Note Shortcut''': The gwb_to_supcrt.py file produces
a script (auto_fill.s) that can automate
the rest of the procedure. THIS IS NOT
RECOMMENDED BECAUSE YOU CAN MISS ERRORS.
However th auto_fill.s file does serve as
a template for the rest of the commands.
To use this shortcut use the following two
commands to 1) set execute permission and
2) run the script.
chmod 700 auto_fill.s
./auto_fill.s
All of the files produced by gwb_to_supcrt.py in the section above need to be run through supcrt individually because we were not able to get supcrt to do more than 50 reactions at a time.
To run a file (supcrt_aq0.txt for example) through supcrt use:
./run_supcrt.s supcrt_aq0.txt
This will use our default set of reaction independent parameters (see below) so unless you're happy with our parameters you'll first need to build your own reaction independent file with supcrt. We use the file rip3.txt by default.
For each input file run_supcrt.s will produce an output file with "_o" added to the file name (e.g. supcrt_aq0_o.txt).
We could have written a script to go through all the files at once (see auto_fill.s), but this way we can catch any errors from the supcrt runs.
Modify gwb database
WARNING: this script modifies the values of the gwb database in-place, so you'll want to be sure you have a backup copy somewhere safe. We copy the original database "thermo500noC.txt" to the new name "thermo250noC.txt"
Use the supcrt_to_gwb.py script to substitute in the log_K values calculated by supcrt into the gwb file. Again each individual file must be put through supcrt_to_gwb.py individually in order to catch any errors. You also need to enter the type of specie included in the file (aqueous, redox, mineral or gas). The program will fail if it does not find any specie in the gwb file. For example:
./supcrt_to_gwb.py thermo250noCnew2.txt aqueous supcrt_aq0_o.txt
or
./supcrt_to_gwb.py thermo250noCnew2.txt gas supcrt_gas0_o.txt
or
./supcrt_to_gwb.py thermo250noCnew2.txt mineral supcrt_min0_o.txt
or
./supcrt_to_gwb.py thermo250noCnew2.txt redox supcrt_redox0_o.txt

