Last active
November 22, 2024 19:41
-
-
Save tadeu/d62f1a2e25bc3ca89f05ba307321b4ae to your computer and use it in GitHub Desktop.
reaktoro-fecl2-thermoddem.ipynb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"nbformat": 4, | |
"nbformat_minor": 0, | |
"metadata": { | |
"colab": { | |
"provenance": [], | |
"name": "reaktoro-fecl2-thermoddem.ipynb", | |
"authorship_tag": "ABX9TyNb+WtG4lphHgVghn+5rrUj", | |
"include_colab_link": true | |
}, | |
"kernelspec": { | |
"name": "python3", | |
"display_name": "Python 3" | |
}, | |
"language_info": { | |
"name": "python" | |
} | |
}, | |
"cells": [ | |
{ | |
"cell_type": "markdown", | |
"metadata": { | |
"id": "view-in-github", | |
"colab_type": "text" | |
}, | |
"source": [ | |
"<a href=\"https://colab.research.google.com/gist/tadeu/d62f1a2e25bc3ca89f05ba307321b4ae/reaktoro-h2o.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": { | |
"id": "XL3_91MlS0F9" | |
}, | |
"outputs": [], | |
"source": [ | |
"!pip install -q condacolab\n", | |
"import condacolab\n", | |
"condacolab.install()\n", | |
"!conda config --remove channels defaults\n", | |
"!conda config --add channels conda-forge\n", | |
"!conda install reaktoro --quiet --yes" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"import reaktoro as rkt\n", | |
"\n", | |
"db = rkt.PhreeqcDatabase(\"thermoddem-v1.10.dat\")\n", | |
"species = [\"H2O\", \"Cl-\", \"Illite(FeII)\"]\n", | |
"formulas = [str(db.species(s).formula()) for s in species]\n", | |
"print(formulas)" | |
], | |
"metadata": { | |
"id": "AMa_2ng_TNsq", | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"outputId": "2190b03f-101f-405b-ca2c-39353f4e908c" | |
}, | |
"execution_count": 2, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"['H2O', 'Cl-', 'K0.85Fe0.25Al2.35Si3.4O10(OH)2']\n" | |
] | |
} | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"source": [ | |
"water = rkt.AqueousPhase(rkt.speciate(formulas))\n", | |
"water.set(rkt.ActivityModelPhreeqc(db))\n", | |
"\n", | |
"mineral = rkt.MineralPhases(rkt.speciate(formulas))\n", | |
"\n", | |
"system = rkt.ChemicalSystem(db, water, mineral)\n", | |
"\n", | |
"for s in system.species():\n", | |
" try:\n", | |
" db.species(s.name())\n", | |
" except RuntimeError as e:\n", | |
" print(e)\n", | |
" print(s.repr())" | |
], | |
"metadata": { | |
"colab": { | |
"base_uri": "https://localhost:8080/" | |
}, | |
"id": "infhwTGSVPP0", | |
"outputId": "dfbe9fd3-5e96-45d0-e448-f4cf3296a9cc" | |
}, | |
"execution_count": 3, | |
"outputs": [ | |
{ | |
"output_type": "stream", | |
"name": "stdout", | |
"text": [ | |
"\u001b[1;31m***ERROR*** Could not find any Species object with name FeCl2!.\n", | |
"\u001b[0m\n", | |
"FeCl2!\n", | |
"\u001b[1;31m***ERROR*** Could not find any Species object with name FeO!.\n", | |
"\u001b[0m\n", | |
"FeO!\n" | |
] | |
} | |
] | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment