Numerical kernel solver of the GEM-Selektor v.3 package for geochemical modelling. Just extended with an alternative Activity C++ API as the basis for a new Python API (based on Pybind11) on top of it, see xGEMS repository.
Main version use ThermoFun - a code for calculating the standard state thermodynamic properties of substances and reactions at a given temperature and pressure.
The code Implements the improved GEM IPM-3 algorithm with excellent mass balance precision and fast convergence to Gibbs energy minimum even in very complex non-ideal chemical systems with two-sided metastability constraints (learn more on GEMS3K web page).
The code is written in C/C++. Using compiler directives, the GEMS3K code can be compiled as a standalone program e.g. 'gemcalc'; as a static or dynamic library for coupling with the mass transport simulator or another code; or as part of the GEM-Selektor v3 code together with GUI and databases.
Input: The standalone GEMS3K code needs to be initialized by reading a set of GEMS3K I/O files (since v.3.8.1, also a set of JSON documents) that can be exported from GEM-Selektor code for any chemical system (SysEq record) or from any GEM2MT task.
GEMS3K is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
GEMS3K is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with GEMS3K code. If not, see http://www.gnu.org/licenses/.
GEMS3K can be easily installed using Conda package manager. If you have Conda installed, first add the conda-forge channel by executing
#!bash
conda config --add channels conda-forge
install GEMS3K by executing the following command:
#!bash
conda install gems3k
Conda can be installed from Miniconda.
In your home directory, make a folder named e.g. ~/gitGEMS3 with a subfolder gitGEMS3/standalone.
Change into ~/gitGEMS3/standalone and clone this repository from https://bitbucket.org/gems4/gems3k.git using git, a preinstalled free git client SourceTree or SmartGit (the best way on Windows).
Alternatively on Mac OS X or linux or Windows10, open a terminal and type in the command line (do not forget a period) to download the actual "trunk" branch:
git clone https://bitbucket.org/gems4/gems3k.git .
To switch to another branch (e.g. devEJDB), use a git client or open a terminal, cd to ~/gitGEMS3/standalone, and type in the command line
git checkout -b branches/devEJDB --track origin/branches/devEJDB
git pull origin branches/devEJDB
To switch back to trunk, type
git checkout trunk
~/standalone$
(if not using Conda environment)#!bash
sudo ./install-dependencies.sh
~/standalone$
:conda devenv
conda activate GEMS3K
Build GEMS3K library and examples The most common way to build GEMS3K on Linux or MacOS is using cmake (https://cmake.org/). Please, make sure that you have cmake installed in your system.
To build GEMS3K and install it in your home directory or in the system directory (as in the example below), a typical sequence of commands can be executed in the terminal:
cd ~/gitGEMS3/standalone
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local
make
sudo make install
The same will be done by executing the install.sh script instead (check that this file has executable status, if not, run a command "chmod +x ./install.sh"):
cd ~/gitGEMS3/standalone
sudo ./install.sh
Building and installing without ThermoFun library
cd ~/gitGEMS3/standalone
sudo ./install-dependencies.sh NO_THERMOFUN
sudo ./install_no_thermofun.sh
Since version 3.7.0, the GEMS3K "ipm.dat" files exported by earlier versions of GEM-Selektor may need a small modification: the "
Introducing the
Examples of the beginning of "ipm.dat" file valid since v.3.7.0:
# GEMS3K v.3.8.1 c.0aa600e
# Comments can be marked with # $ ; as the first character in the line
# IPM text input file for the internal GEM IPM-3 kernel data
# (should be read after the DCH file and before DBR files)