Jump to content
Geochemist's Workbench Support Forum

dan saalfeld

Admin
  • Content count

    13
  • Joined

  • Last visited

Community Reputation

0 Neutral

About dan saalfeld

  • Rank
    Admin

Profile Information

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. dan saalfeld

    Script in Chemplugin

    Hi Johan, 1) The surface data one happens to work because \P \C \G and \F are not special escape sequences in Python. However in the thermo database path you have a \t which is a special escape sequence that represents a "tab" character. Here is one list of special escape sequences https://docs.python.org/2.0/ref/strings.html . However it is usually easiest if you are using backslashes to just always escape them if you want a literal backslash character in the string - that way you don't need to remember which letters are special. Also some versions of Python will throw an error if you use an invalid escape sequence. You may also use forward slashes when specifying thermo and surface data paths (linux style paths) for ChemPlugin e.g. 'data = "C:/Program Files/Gwb/Gtdata/thermo_wateq4f.tdat" verify' 2) There are a couple different issues I see in the script, but still mostly Python string related. For your rate law instead of having 'rate = (expression) RETURN rate' you can instead just have it return the expression directly without setting that temporary variable. e.g. 'RETURN (expression)'. Alternatively you could also add newline "\n" before the RETURN rate part since that should be on a separate line. a) return value directly: "kinetic Calcite .1 volume% rate_law = script 'RETURN (1.49e-02*EXP(-29000/(8.3144598*TK))*activity(\'H+\')^0.75 + 1.00e-02*EXP(-34800/(8.3144598*TK))*activity(\'H2CO3\')^0.75 + 2.20e-07*EXP(-52200/(8.3144598*TK))*activity(\'H2O\')^0.75) * surface * (1 - QoverK) RETURN rate' pre-exp = ??? act_eng = ??? surface = 200", b) properly separate the lines of script with newline \n: "kinetic Calcite .1 volume% rate_law = script 'rate = (1.49e-02*EXP(-29000/(8.3144598*TK))*activity(\'H+\')^0.75 + 1.00e-02*EXP(-34800/(8.3144598*TK))*activity(\'H2CO3\')^0.75 + 2.20e-07*EXP(-52200/(8.3144598*TK))*activity(\'H2O\')^0.75) * surface * (1 - QoverK) \nRETURN rate' pre-exp = ??? act_eng = ??? surface = 200", To get a better feel for Python strings I would recommend opening an interactive Python session and just try things out interactively with the print command. Here are the dataset examples: >>> print('surface_data = "C:\Program Files\ChemPlugin\Gtdata\FeOH.sdat"') surface_data = "C:\Program Files\ChemPlugin\Gtdata\FeOH.sdat" >>> print('data = "C:\Program Files\Gwb\Gtdata\thermo_wateq4f.tdat" verify') data = "C:\Program Files\Gwb\Gtdata hermo_wateq4f.tdat" verify >>> print('data = "C:\\Program Files\\Gwb\\Gtdata\\thermo_wateq4f.tdat" verify') data = "C:\Program Files\Gwb\Gtdata\thermo_wateq4f.tdat" verify One last thing that may also help with Python strings that contain nested single and double quotes is that instead of using one single or double quote to mark string start/end Python also allows you to use three single or double quotes to start and end a string which allows you to then use the same type of quote inside the string without escaping it. >>> print("""can now freely use unescaped double quotes like these " " inside the string""") can now freely use unescaped double quotes like these " " inside the string >>> print('''can now freely use unescaped single quotes like these ' ' inside the string''') can now freely use unescaped single quotes like these ' ' inside the string Hope this helps, Dan
  2. Hi Tao, It looks like the DLL was built correctly, but it is a 32-bit DLL. As such it will only work with the 32-bit version of GWB. I am guessing you are running the 64-bit version of GWB and that is why it is unable to load it. To get it to work please either install the 32-bit version of GWB or build the DLL as a 64-bit DLL. If you are using a recent version of Microsoft Visual Studio to build the DLL you should be able to just change the platform dropdown from "x86" to "x64" to change the DLL to a 64-bit build. Instead of : You want : Hope this helps, Dan
  3. Hi Helge, When species contain brackets in the name you will need to put quotes around the name. It is preferred to name species with parenthesis instead of brackets to avoid having to add these quotes. Both single and double quotes will work. Since your string is already inside single quotes, adding double quotes around the name would be easiest: myGWB.results('concentration aqueous "Ca3[Nd(OH)6]+++"', 'molal') Hope this helps, Dan
  4. dan saalfeld

    Problem with Python Plugin

    Hi Helge, It looks like you need to add the GWB install folder to your PATH environment variable so that Python can find the GWB libraries. If working from the Windows command pane you can set the PATH as follows: set PATH=C:\Program Files\GWB;%PATH% If you have GWB installed somewhere else you will need to adjust the command to match. Please note that that will only set the PATH for that command pane window. To permanently set PATH you can hit the Windows key + s to bring up Windows search or just click the Windows button and start typing in "environment". You should then get an option for changing account environment variables. You can then add or update the PATH variable for your user account. Hope this helps, Dan
  5. dan saalfeld

    GWB activation problem in Win10

    Hi Cycas, That seems very unusual. Do you have GWB installed on a local hard drive or a networked drive? If you could take a screenshot of the GWB Activation Utility and send it to support@gwb.com that may help us diagnose the issue. Thank you.
  6. dan saalfeld

    GWBplugin with Perl

    Hi Maurice, OK, just tested with ActivePerl 5.16.3 and ActivePerl 5.18.1 and it does indeed crash. Will have to look into that more. Thanks for letting us know. In the meantime it does still work correctly with ActivePerl 5.14.2. Unfortunately ActiveState no longer seems to have that available to download (at least not as the free community edition). But if you already have or can find that version of ActivePerl it should work. -Dan
  7. dan saalfeld

    GWBplugin with Perl

    Hi Maurice, It sounds like you are trying to use the 64-bit version of GWBplugin with Perl. Unfortunately as far as we know Perl only has that Win32-API package for loading 32-bit DLLs so you will need to use the 32-bit version of GWBplugin with it. You can just run the GWB installer again and select the 32-bit version to install. Hope this helps, -Dan
  8. dan saalfeld

    Reading a script from tcl

    Hello, The easiest way around your current issue is to stop script processing before reading a file and resuming it afterwards. So your given example would be changed to the following: script start go pickup reactants minerals save minerals.rea #do some other stuff #recall the minerals you saved earlier script end read minerals.rea script start #do more stuff This seems like a bug and will be looked into, but the extra script end/script start around read commands should bypass it for now. As for the tcl read command it has been renamed within GWB to fread so that both are usable. Similarly flush has been renamed to fflush and time has been renamed to dtime. Hope this helps, Dan Saalfeld
  9. dan saalfeld

    Pipe

    Hi Skyboarder, I'm not sure without more information, but it sounds like you probably need to use the c_str() function on the time_step variable. "time begin = 0 seconds, end = " + time_step.c_str() + " seconds" If that doesn't work, please provide more information about what type of variable time_step is. Hope this helps. ~Dan Saalfeld
×