{"id":32178318,"url":"https://github.com/thermohub/thermofun","last_synced_at":"2026-01-27T16:10:05.225Z","repository":{"id":45031364,"uuid":"193498925","full_name":"thermohub/thermofun","owner":"thermohub","description":"A code for calculating the standard state thermodynamic properties at a given temperature and pressure.","archived":false,"fork":false,"pushed_at":"2025-12-12T17:20:58.000Z","size":20181,"stargazers_count":30,"open_issues_count":3,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2026-01-14T07:37:10.766Z","etag":null,"topics":["chemical-reactions","enthalpy","entropy","equation-of-state","geochemical-data","geochemical-modeling","geochemistry","gibbs-energy","heat-capacity","reaction","substance","thermodynamic-properties","thermodynamics","thermodynamics-models"],"latest_commit_sha":null,"homepage":"https://thermohub.org/thermofun/thermofun/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-2.1","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thermohub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2019-06-24T12:14:34.000Z","updated_at":"2025-12-30T07:47:21.000Z","dependencies_parsed_at":"2025-12-13T04:01:18.046Z","dependency_job_id":null,"html_url":"https://github.com/thermohub/thermofun","commit_stats":{"total_commits":963,"total_committers":10,"mean_commits":96.3,"dds":0.5794392523364487,"last_synced_commit":"ecf510b841f87f56165eb8d39e484d2d1c2e4728"},"previous_names":["thermomod/thermofun"],"tags_count":40,"template":false,"template_full_name":null,"purl":"pkg:github/thermohub/thermofun","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thermohub%2Fthermofun","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thermohub%2Fthermofun/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thermohub%2Fthermofun/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thermohub%2Fthermofun/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thermohub","download_url":"https://codeload.github.com/thermohub/thermofun/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thermohub%2Fthermofun/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28672326,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T20:48:19.482Z","status":"ssl_error","status_checked_at":"2026-01-22T20:48:14.968Z","response_time":144,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chemical-reactions","enthalpy","entropy","equation-of-state","geochemical-data","geochemical-modeling","geochemistry","gibbs-energy","heat-capacity","reaction","substance","thermodynamic-properties","thermodynamics","thermodynamics-models"],"created_at":"2025-10-21T20:53:25.116Z","updated_at":"2026-01-27T16:10:05.202Z","avatar_url":"https://github.com/thermohub.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ThermoFun\nLinux, OSX, Windows\n\n[![Build Status](https://dev.azure.com/mirondanro/thermohub/_apis/build/status/thermohub.thermofun?branchName=master)](https://dev.azure.com/mirondanro/thermohub/_build/latest?definitionId=9\u0026branchName=master)\n\nA code for calculating the standard state thermodynamic properties of substances and reactions at a given temperature and pressure. \n\nIf you use it in your work please cite the JOSS publication \n[![DOI](https://joss.theoj.org/papers/10.21105/joss.04624/status.svg)](https://doi.org/10.21105/joss.04624)\n\n- [Code documentation](https://docs.hdoc.io/dmiron/thermofun/?target=_blank)\n- [Simple C++ API example](#simple-c-api-example)\n- [Try ThermoFun](#try-thermofun-in-your-browser-click-launch-binder)\n- [Python example](#simple-python-api-example)\n- [Install using Conda](#installation-using-conda)\n- [Build and install using cmake](#install-thermofun-using-cmake)\n- [Build and install using cmake and conda](#compile-and-install-thermofun-using-cmake-and-conda)\n- [Reporting bugs](#reporting-bugs)\n- [Contributing](#contributing-with-development)\n\n## Try ThermoFun in your browser click launch binder\n\n[![Binder](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/gh/thermohub/thermofun-jupyter/master?urlpath=lab/)\n\nWait until the Jupyter Lab Notebook server starts (~1 min) then double click on any `how-to-...` tutorial notebook. Binder is a free service and not using the browser tab for more than a few miuntes will turn off the virutal server. To restart the Jupyter Lab Notebook server click again on the launch binder icon above. Refreshing the webpage will not help restarting the  server. \n\nMore information on Jupyter Notebooks: [Jupyter Documentation](https://jupyter.readthedocs.io/en/latest/index.html)\n\n## Simple C++ API example\n\n* Using a json database file\n\n```\n#!c++\nint main()\n{\n    // Create the batch object using a database file in JSON\n    ThermoFun::ThermoBatch batch(\"Resources/Databases/aq17-thermofun.json\");\n\n    // Optional: set units, default units are in SI\n    batch.setPropertiesUnits({\"temperature\", \"pressure\"},{\"degC\",\"bar\"});\n\n    // Optional: change default significant digits\n    batch.setPropertiesDigits({\"gibbs_energy\",\"entropy\", \"volume\", \"enthalpy\", \"temperature\", \"pressure\"}, {0, 1, 2, 0, 0, 0});\n\n    // Retrieve the entropy of H2O\n    double H2Oentropy = batch.thermoPropertiesSubstance( 300, 2000, \"H2O@\", \"entropy\").toDouble();\n\n    // Retrieve the derivative of G with respect to T\n    double H2OdGdT = batch.thermoPropertiesSubstance( 300, 2000, \"H2O\", \"entropy\").toThermoScalar().ddt;\n\n    // Write results to a comma separate files for a list of T-P pairs, substances, and properties\n    batch.thermoPropertiesSubstance({{25, 1},{40, 1},{70, 100},{90, 100},{100, 100}}, // list of T-P pairs\n                                    {\"Al+3\", \"OH-\", \"SiO2@\"},                         // list of substance symbols\n                                    {\"gibbs_energy\",\"entropy\", \"volume\", \"enthalpy\"}  // list of properties\n                                   ).toCSV(\"results.csv\");                            // output\n    return 0;\n}\n```\n\n* Using the database client and retrieving a ThermoDataSet from the remote database. This example uses the [`thermohubclient`](https://github.com/thermohub/thermohubclient)\n\n```\n#!c++\nint main()\n{\n    // Initialize a database client object\n    ThermoFun::DatabaseClient dbc;\n\n    // Create a ThermoFun database using the records list\n    ThermoFun::Database db(dbc.getDatabase('aq17'));\n\n    // Initialize an batch object using the database\n    ThermoFun::ThermoBatch batch (db);\n\n    // Optional set calculation and output preferences\n    ThermoFun::OutputSettings op;\n    op.isFixed = true;\n    op.outputSolventProperties       = true;\n    op.reactionPropertiesFromReactants   = false;\n    op.substancePropertiesFromReaction   = false;\n    batch.setOutputSettings(op);\n\n    // Optional set units and significant digits\n    batch.setPropertiesUnits({\"temperature\", \"pressure\"},{\"degC\",\"bar\"});\n    batch.setPropertiesDigits({ \"reaction_gibbs_energy\",\"reaction_entropy\", \"reaction_volume\",\n                                \"reaction_enthalpy\",\"logKr\", \"temperature\", \"pressure\"}, {0, 4, 4, 4, 4, 0, 0});\n\n    batch.thermoPropertiesReaction({{25,1}}, {\"AmSO4+\", \"MgSiO3@\"}, {\"reaction_gibbs_energy\", \"reaction_entropy\",\n                                    \"reaction_volume\", \"reaction_enthalpy\", \"logKr\"}).toCSV(\"results.csv\");\n\n    batch.thermoPropertiesReaction({0,20,50,75},{0,0,0,0},{\"AmSO4+\", \"MgSiO3@\"}, {\"reaction_gibbs_energy\", \"reaction_entropy\",\n                                    \"reaction_volume\", \"reaction_enthalpy\", \"logKr\"}).toCSV(\"results.csv\");\n}\n\n```\n\n## Simple Python API example\n\n* Using a json database file\n\n```\n#!Python\nimport thermofun as fun\nimport thermohubclient as hubclient\n\nproperties = fun.ThermoPropertiesSubstance\n\nengine = fun.ThermoEngine(\"Resources/databases/aq17-thermofun.json\")\n\nprop = engine.thermoPropertiesSubstance(373.15, 100000000, \"H2O@\")\n\nprint(prop.gibbs_energy.val)\nprint(prop.gibbs_energy.ddt)\nprint(prop.entropy.val)\nprint(prop.gibbs_energy.ddp)\nprint(prop.gibbs_energy.err)\nprint(prop.gibbs_energy.sta)\n\n# Create the engine object using a database file in JSON\nbatch = fun.ThermoBatch(\"Resources/databases/aq17-thermofun.json\")\n\n# Optional: change default units\nbatch.setPropertiesUnits([\"temperature\", \"pressure\"],[\"degC\",\"bar\"])\n\n# Optional: change default significant digits\nbatch.setPropertiesDigits([\"gibbs_energy\",\"entropy\", \"volume\", \"enthalpy\", \"temperature\", \"pressure\"], [0, 1, 2, 0, 0, 0])\n\nH2Oentropy = batch.thermoPropertiesSubstance( 300, 2000, \"H2O@\", \"entropy\").toDouble()\nprint(H2Oentropy)\n\nV = batch.thermoPropertiesSubstance( 250, 1000, \"H2O@\", \"volume\").toThermoScalar()\n\n# Write results to a comma separate files for a list of T-P pairs, substances, and properties\nbatch.thermoPropertiesSubstance( [[25, 1],[40, 1],[70, 100],[90, 100],[100, 100]],  # // list of T-P pairs\n                                 [\"Al+3\", \"OH-\", \"SiO2@\"],                          # // list of substance symbols\n                                 [\"gibbs_energy\",\"entropy\", \"volume\", \"enthalpy\"]   # // list of properties\n                               ).toCSV(\"results.csv\")    \n```\n\n* Using the database client and retrieving a ThermoDataSet from the remote database. This example uses the `thermohubclient`, that can be installed from conda-forge executing `conda install -c conda-forge thermohubclient`\n\n```\n#!Python\nimport thermofun as fun\nimport thermohubclient as hubclient\n\nprint(\"\\n# Initialize a database client object\\n\")\ndbc = hubclient.DatabaseClient()\n\nprint(\"ThermoDataSets\")\nfor t in dbc.availableThermoDataSets():\n    print(f'{t}')\nprint('\\n')\n\naq17 = fun.Database(dbc.getDatabase('aq17'))\n\nprint(\"\\n# Initialize an interface object using the database\\n\")\nbatch2 = fun.ThermoBatch(aq17)\n\nprint(\"\\n# Optional: set the solvent symbol used for calculating properties of aqueous species\\n\")\nbatch2.setSolventSymbol(\"H2O@\")\n\nprint(\"\\n# Optional set calculation and output preferences\\n\")\nop = fun.BatchPreferences()\nop.isFixed = True\nop.outputSolventProperties       = True\nop.reactionPropertiesFromReactants   = False\nop.substancePropertiesFromReaction   = False\nbatch2.setBatchPreferences(op)\n\nprint(\"\\n# Optional set units and significant digits\\n\")\nbatch2.setPropertiesUnits([\"temperature\", \"pressure\"],[\"degC\",\"bar\"])\n\nbatch2.setPropertiesDigits([\"gibbs_energy\",\"entropy\", \"volume\",\n                            \"enthalpy\",\"logKr\", \"temperature\", \"pressure\"], [0, 4, 4, 4, 4, 0, 0])\n\nprint(\"\\n# Do calculations and write output\\n\")\nbatch2.thermoPropertiesSubstance([[25,1]], [\"NaCO3-\", \"Mg+2\"], [\"gibbs_energy\", \"entropy\",\n                                \"volume\", \"enthalpy\"]).toCSV(\"results_dbc.csv\")\n```\n\n## Installation using Conda\n\nThermoFun can be easily installed using [Conda](https://conda.io/docs/) package manager. If you have Conda installed, first add the conda-forge channel by executing \n\n```\n#!bash\nconda config --add channels conda-forge\n```\n\ninstall ThermoFun by executing the following command:\n\n```\n#!bash\nconda install thermofun\n```\n\nConda can be installed from [Miniconda](https://conda.io/miniconda.html).\n\n## Install ThermoFun using CMake\n\n* Make sure you have g++, cmake and git installed. If not, install them (on Ubuntu Linux):\n\n```\n#!bash\nsudo apt-get install g++ cmake git\n```\n\n* Download ThermoFun source code using git clone\n\n* In a terminal, at the home directory level e.g. ```\u003cuser\u003e@ubuntu:~$``` copy-paste and run the following code:\n\n```\n#!bash\ngit clone https://github.com/thermohub/thermofun.git \u0026\u0026 cd thermofun \n```\n\n* In the terminal you should be in ```~/thermofun$```.\n\n### (A) Build and install ThermoFun library (working with json database files)\n\nThis option allows the user to build thermofun library that works with a user provided thermodynamic database file in json format and has only one thirdpary library dependency. To build thermofun with access to the thermohub thermodynamic database cloud and local server see bellow. \n\n#### Install Dependencies (if not using Conda environment)\n\nThe thermofun library uses nlohmann/json.hpp as thirdparty dependency to parse database files in json format. To install the header only json library in a terminal ```~/thermofun$``` execute the following: \n\n```\n#!bash\nsudo ./install-dependencies.sh\n```\n\n#### Compiling the C++ library\n\nIn the terminal ```~/thermofun$```, execute the following commands:\n\n```\n#!bash\nmkdir build \u0026\u0026 \\\ncd build \u0026\u0026 \\\ncmake .. \u0026\u0026 \\\nmake\n``` \n\nTo take advantage of parallel compilation use ```make -j3```. 3 representing the number of threads. \n\nFor a global installation of the compiled libraries in your system, execute:\n\n```\n#!bash\nsudo make install \n```\n\nThis will install Thermofun library and header files in the default installation directory of your system (e.g, ```/usr/local/``` or if conda is active, in the instalation directory of the conda environment).\n\nFor a local installation, you can specify a directory path for the installed files as follows:\n\n```\n#!bash\ncmake .. -DCMAKE_INSTALL_PREFIX=/home/username/local/\n```\nthen execute:\n\n```\nsudo make install \n```\n\nTo compile ThermoFun library in debug mode:\n\n```\n#!bash\ncmake .. -DCMAKE_BUILD_TYPE=Debug\n```\nthen execute:\n\n```\nsudo make install \n```\n\n### (B) Build and install ThermoFun library (working with access to the local and cloud ThemroHub database)\n\nThis option builds thermofun library together with the dbclient, which provides access to the local and cloud thermohub databases, allowing specific a ThermoDataSet to be used or a selection on elements of the thermodynamic data.\n\n#### Install ThermoHubClient\n\nClone and install ThermoHubClient library \n\n```\n#!bash\ngit clone https://bitbucket.org/gems4/thermohubclient.git\ncd thermohubclient\nsudo ./install-dependencies.sh\nmkdir build\ncd build\ncmake ..\nmake\n```\n\nFor a global installation of the compiled library in your system, execute:\n\n```\n#!bash\nsudo make install \n```\n\n## Compile and install ThermoFun using CMake and Conda \n\nThis procedure uses Conda for handling all the dependencies of ThermoFun and builds ThermoFun for Windows, Mac OS X, and Linux. \n\nOnce you have conda installed execute:\n\n```\n#!bash\nconda install -n base conda-devenv\n```\nThis installs conda-devenv, a conda tool used to define and initialize conda environments.\n\nDownload ThermoFun from github\n\n```\n#!bash\ngit clone https://github.com/thermohub/thermofun.git \u0026\u0026 cd thermofun \n```\n\nIn the next step we create a clean environment with all dependencies necessary to build ThermoFun, executing:\n\n```\n#!bash\nconda devenv \n```\n\nIn the next step we need to activate the thermofun environment \n\n```\n#!bash\nconda activate thermofun\n```\n\nRemember to always activate thermofun environment whenever you use ThermoFun from C++ or Python. This is because conda will adjust some environment variables in your system. \n\nNow we can proceed and [build ThermoFun using CMake.](#install-thermofun-using-cmake)\n\n## Reporting bugs\n\nTo report a bug, please go to [ThermoFun's Issues](https://github.com/thermohub/thermofun/issues/new) and enter a *descriptive title* and *write your issue with enough details*. Please provide a *minimum reproducible example* to be more efficient in identifying the bug and fixing it. \n\nFor questions and issues don't hesitate to chat with us on [Gitter](https://gitter.im/thermofun/community).\n\n## Contributing with development\n\nThe [Fork \u0026 Pull Request Workflow](https://docs.github.com/en/get-started/quickstart/contributing-to-projects) is used. Below is a summary of the necessary steps you need to take:\n\n1. Fork this repository\n2. Clone the repository at your machine\n3. Add your changes in a branch named after what's being done (`lower-case-with-hyphens`)\n4. Make a pull request to `thermohub/thermofun`, targeting the `main` branch\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthermohub%2Fthermofun","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthermohub%2Fthermofun","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthermohub%2Fthermofun/lists"}