Skip to main content

GEMSFIT: a generic fitting tool for geochemical activity models


GEMSFIT, a parallelized open-source tool for fitting thermodynamic activity models has been developed. It is the first open-source implementation of a generic geochemical-thermodynamic fitting tool coupled to a chemical equilibrium solver which uses the direct Gibbs energy minimization (GEM) approach. This enables speciation-based fitting of complex solution systems such as solid solutions and mixed solvents. The extendable framework of GEMSFIT provides a generic interface for fitting geochemical activity models at varying system compositions, temperatures and pressures. GEMSFIT provides the most common tools for statistical analysis which allow thorough evaluation of the fitted parameters. The program can receive input of measured data from a PostgreSQL database server or exported spreadsheets. The fitting tool allows for bound, linear, and nonlinear (in)equality-constrained minimization of weighted squared residuals of highly nonlinear systems over a wide temperature and pressure interval only limited by user-supplied thermodynamic data. Results from parameter regression as well as from statistical analysis can be visualized and directly printed to various graphical formats. Efficient use of the code is facilitated by a graphical user interface which assists in setting up GEMSFIT input files. The usage and resulting output of GEMSFIT is demonstrated by results from parameter regression of the extended universal quasichemical aqueous activity model for geothermal brines.

This is a preview of subscription content, access via your institution.


  1. 1.

    Adams, B., Bohnhoff, W., Dalbey, K., Eddy, J., Eldred, M., Gay, D., Haskell, K., Hough, P., Swiler, L.: DAKOTA, a multilevel parallel object-oriented framework for design optimization, parameter estimation, uncertainty quantification, and sensitivity analysis: version 5.0 user’s manual. Sandia Technical Report SAND2010-2183 (2009)

  2. 2.

    Anderson, G.M., Crerar, D.A.: Thermodynamics in Geochemistry—The Equilibrium Model. Oxford University Press, New York (1993)

    Google Scholar 

  3. 3

    Andre, L., Rabemanana, V., Vuataz, F.D.: Influence of water-rock interactions on fracture permeability of the deep reservoir at Soultz-sous-Forets, France. Geothermics 35, 507–531 (2006)

    Article  Google Scholar 

  4. 4.

    Barnes, H.L.: Geochemistry of Hydrothermal Ore Deposits, 3rd edn. Wiley, New York (1997)

    Google Scholar 

  5. 5

    Bruno, J., Bosbach, D., Kulik, D., Navrotsky, A.: Chemical thermodynamics of solid solutions of interest in radioactive waste management: a state-of-the art report. In: Chemical Thermodynamics Series, vol. 10. OECD, Paris (2007)

  6. 6.

    Dai, Z., Samper, J., Ritzi Jr. R.: Identifying geochemical processes by inverse modeling of multicomponent reactive transport in the Aquia aquifer. Geosphere 2, 210–219 (2006)

    Article  Google Scholar 

  7. 7.

    D’Agostino, R., Belanger, A.: A suggestion for using powerful and informative tests of normality. Amer. Statistician 44, 316–321 (1990)

    Google Scholar 

  8. 8.

    Garcia, A.V., Thomsen, K., Stenby, E.H.: Prediction of mineral scale formation in geothermal and oilfield operations using the extended UNIQUAC model: part I. Sulfate scaling minerals. Geothermics 34, 61–97 (2005)

    Article  Google Scholar 

  9. 9.

    Garcia, A.V., Thomsen, K., Stenby, E.H.: Prediction of mineral scale formation in geothermal and oilfield operations using the Extended UNIQUAC model: part II. Carbonate-scaling minerals. Geothermics 35, 239–284 (2006)

    Article  Google Scholar 

  10. 10.

    Glasstone, S.: Thermodynamics for Chemists, 3rd edn. D. Van Nostrand Company, New York (1947)

    Google Scholar 

  11. 11.

    Harned, H., Owen, B.: The physical chemistry of electrolytic solutions. ACS Monograph Series, No. 137, 3rd edn. Reinhold Pub. Corp., New York (1963)

    Google Scholar 

  12. 12.

    Helgeson, H.C., Kirkham, D.H.: Theoretical prediction of thermodynamic behaviour of aqueous electrolytes at high pressures and temperatures. II. Debye-Huckel parameters for activity-coefficients and relative partial molal properties. Am. J. Sci. 274, 1199–1261 (1974)

    Article  Google Scholar 

  13. 13.

    Helgeson, H.C., Kirkham, D.H., Flowers, G.C.: Theoretical prediction of the thermodynamic behavior of aqueous electrolytes at high-pressures and temperatures. III. Equation of state for aqueous species at infinite dilution. Am. J. Sci. 276, 97–240 (1976)

    Article  Google Scholar 

  14. 14.

    Hill, M., Tiedeman, C.: Effective Groundwater Model Calibration: With Analysis of Data, Sensitivities, Predictions, and Uncertainty. Wiley-Interscience, Hoboken (2007)

    Book  Google Scholar 

  15. 15.

    Hingerl, F.F., Wagner, T., Kulik, D.A., Thomsen, K., Driesner, T.: A new aqueous activity model for geothermal brines from 25 to 300 °C. Chem. Geol. (in press) (2014)

  16. 16.

    Johnson, S.: The NLopt nonlinear-optimization package (2011).

  17. 17.

    Johnson, J.W., Oelkers, E.H., Helgeson, H.C.: SUPCRT92: a software package for calculating the standard molal thermodynamic properties of minerals, gases, aqueous species, and reactions from 1 to 5000 bar and 0 to 1000 °C. Comput. Geosci. 18, 899–947 (1992)

    Article  Google Scholar 

  18. 18.

    Kinniburgh, D., Cooper, D.: PhreePlot—creating graphical output with PHREEQC (2011).

  19. 19.

    Kestin, J., Sengers, J.V., Kamgar-Parsi, B., Levelt-Sengers, J.M.: Thermophysical properties of fluid H2O. J. Phys. Chem. Ref. Data 13, 175–183 (1984)

    Article  Google Scholar 

  20. 20.

    Kolditz, O., Bauer, S., Bilke, L., Böttcher, N., Delfs, J.O., Fischer, T., Görke, U.J., Kalbacher, T., Kosakowski, G., McDermott, C.I., Park, C.H., Radu, F., Rink, K., Shao, H., Shao, H.B., Sun, F., Sun, Y.Y., Singh, A.K., Taron, J., Walther, M., Wang, W., Watanabe, N., Wu, Y., Xie, M., Xu, W., Zehner, B.: OpenGeoSys: an open-source initiative for numerical simulation of thermo-hydro-mechanical/chemical (THM/C) processes in porous media. Environm. Earth Sci. 67, 589–599 (2012)

    Article  Google Scholar 

  21. 21.

    Kulik, D.A., Wagner, T., Dmytrieva, S.V., Kosakowski, G., Hingerl, F.F., Chudnenko, K.V., Berner, U.: GEM-Selektor geochemical modeling package: revised algorithm and GEMS3K numerical kernel for coupled simulation codes. Computat. Geosci. 17, 1–24 (2013)

    Google Scholar 

  22. 22.

    Luckas, M., Krissmann, J.: Thermodynamik der Elektrolytlösungen: Eine einheitliche Darstellung der Berechnung komplexer Gleichgewichte. Springer, Berlin (2001)

    Book  Google Scholar 

  23. 23.

    Maddock, J., Bristow, P.A., Holin, H., Zhang, X., Lalande, B., Rade, J., Sewani, G., van den Berg, T.: Boost C++ libraries, math toolkit. Boost Version 1.47 (2010).

  24. 24.

    Michels, H.: The data plotting software DISLIN (2011).

  25. 25.

    Motulsky, H., Christopoulos, A.: Fitting models to biological data using linear and nonlinear regression. A practical guide to curve fitting, 2nd edn. GraphPad Software Inc., San Diego CA (2003)

    Google Scholar 

  26. 26.

    Nordstrom, D.K., Munoz, J.L.: Geochemical Thermodynamics, 2nd edn. Blackwell Scientific Publications, Boston (1994)

    Google Scholar 

  27. 27.

    Parkhurst, D.L., Appelo, C.A.J.: User’s guide to PHREEQC (version 2)—a computer program for speciation, batch-reaction, one-dimensional transport, and inverse geochemical calculations. Technical Report Water-Resources Investigations Report 99-4259 U.S. Geological Survey (1999)

  28. 28.

    Pitzer, K.S.: Thermodynamics of electrolytes. I. Theoretical basis and general equations. J. Phys. Chem. 77, 268–277 (1973)

    Article  Google Scholar 

  29. 29.

    Plantenga, T.D.: HOPSPACK 2.0 user manual: Version 2.0.2. Sandia Technical Report SAND 2009–6265 (2009)

  30. 30.

    Poeter, E.P., Hill, M.C.: Documentation 722 of UCODE: a computer code for universal inverse modeling; prepared in cooperation with the U.S. Army Corps of Engineers Waterways Experiment Station and the International Ground Water Modeling Center of the Colorado School of Mines. Denver: U.S. Geological Survey: Branch of Information Services (1998)

  31. 31.

    PostgreSQL Global Development Group: PostgreSQL—open source database: PostgreSQL version 9.1. (2012)

  32. 32.

    PostgreSQL Global Development Group: PostgreSQL 9.1.2 Documentation. PostgreSQL version 9.1 (2012).

  33. 33.

    Powell, M.J.D.: A direct search optimization method that models the objective and constraint functions by linear interpolation. In: Gomez, S., Hennart, J.P. (eds.) Advances in Optimization and Numerical Analysis of Mathematics and its Applications, vol. 275, pp. 51–67. Kluwer, Dordrecht (1993)

    Google Scholar 

  34. 34.

    Powell, M.J.D.: The BOBYQA algorithm for bound constrained optimization without derivatives. Report NA2009/06 Department of Applied Mathematics and Theoretical Physics, Cambridge England (2009)

  35. 35.

    Press, W.H., Teukolsky, S.A., Vetterling, W.T., Flannery, B.P.: Numerical Recipes 3rd Edition: The Art of Scientific Computing, 3rd edn. Cambridge University Press, Cambridge (2007)

    Google Scholar 

  36. 36.

    Qt Project: Qt cross-platform application and GUI framework, v. 4.7 (2011).

  37. 37.

    Robinson, R.A., Stokes, R.H.: Electrolyte Solutions, 2nd edn. Dover Publications, Mineola (2002)

    Google Scholar 

  38. 38.

    Runarsson, T., Yao, X.: Stochastic ranking for constrained evolutionary optimization. IEEE T. Evolut. Comput. 4, 284–294 (2000)

    Article  Google Scholar 

  39. 39.

    Sanderson, C.: Armadillo: An Open Source C++ 747 Linear Algebra Library for Fast Prototyping and Computationally Intensive Experiments. Report Version 2.2, revised 10.2011 NICTA, St Lucia (2010)

  40. 40.

    Taron, J., Elsworth, D.: Thermal-hydrologic-mechanical-chemical processes in the evolution of engineered geothermal reservoirs. Int. J. Rock Mech. Min. 46, 855–864 (2009)

    Article  Google Scholar 

  41. 41.

    Thomsen, K.: Aqueous electrolytes: model parameters and process simulation. Ph.D. thesis Department of Chemical Engineering, Technical University of Denmark (1997)

  42. 42.

    Wagner, T., Kulik, D.A., Hingerl, F.F., Dmytrieva, S.V.: GEM-Selektor geochemical modeling package: TSolMod library and data interface for multicomponent phase models. Can. Mineral. 50, 1173–1195 (2012)

    Article  Google Scholar 

  43. 43.

    Zhu, C., Hu, F.Q., Burden, D.S.: Multi-component reactive transport modeling of natural attenuation of an acid ground water plume at a uranium mill tailings site. J. Contam. Hydrol. 52, 85–108 (2001)

    Article  Google Scholar 

  44. 44.

    Zhu, C., Lu, P., Zheng, Z., Ganor, J.: Coupled alkali feldspar dissolution and secondary mineral precipitation in batch systems: 4. Numerical modeling of reaction path. Geochim. Cosmochim. Acta 74, 3963–3983 (2010)

    Article  Google Scholar 

Download references

Author information



Corresponding author

Correspondence to Thomas Wagner.

Rights and permissions

Reprints and Permissions

About this article

Cite this article

Hingerl, F.F., Kosakowski, G., Wagner, T. et al. GEMSFIT: a generic fitting tool for geochemical activity models. Comput Geosci 18, 227–242 (2014).

Download citation


  • Geochemical modeling
  • Activity model
  • Parameter regression
  • Chemical equilibrium
  • Regression tool
  • Reactive transport