Python wrapper functions for Theriak-Domino.
Project description
pytheriak
Python wrapper functions for Theriak-Domino.
Installation
You can install the package from pypi.org. Run the following to install:
pip install pytheriak
Usage
Run theriak from your python script
Import the wrapper module.
from pytheriak import wrapper
First, create a TherCaller-object.
The programs_dir
must be set to the Programs directory of your Theriak-Domino installation. Specify the database (ensure that you correctly specify the file extension e.g., .txt or .bs). Specify your version of Theriak-Domino for completeness.
To run Theriak from Python, the database file should be in the same directory as your python script. On Windows you must also have a theriak.ini in the directory.
theriak = wrapper.TherCaller(programs_dir="..\Programs",
database="a database file",
theriak_version="v2023.01.02beta")
As input for Theriak define:\
- Pressure in bars.
pressure = 4000
- Temperature in degree celsius.
temperature = 550
- Bulk composition following the Theriak-Domino format: Elements in uppercase followed by (number of moles).
bulk = "AL(2)SI(1)O(?)"
Then call minimisation() on the TherCaller-object.
rock, element_list = theriak.minimisation(pressure, temperature, bulk)
This method returns a Rock-object containing all the properties of the minimised system and an element list. The list acts as an element - index lookup table for all compositional vectors of the Rock (bulk and phase compositions).
Access the properties of the Rock-object
An easy way to checkout all accessible properties is looking at the object's attributes using ...
dir(rock)
Useful rock properties are:
rock.g_system # Gibbs free energy of the system [J]
rock.bulk_composition_moles # Bulk composition [mol]
rock.mineral_assemblage # List of stable solid phases
...
Mineral (and fluid) assemblage contain Mineral- and Fluid-Objects which hold the phase related properties.
mineral = rock.mineral_assemblage[i]
mineral.name # Phase name from database
mineral.n # Amount of phase [mol]
mineral.composition_apfu # Mineral composition [apfu]
...
A quick, easy and pythonic way to retrieve properties is using list comprehensions.
[mineral.name for mineral in rock.mineral_assemblage]
[mineral.composition_apfu for mineral in rock.mineral_assemblage]
Cite pytheriak
The pytheriak package is registered on Zenodo. If you use pytheriak in your research, please cite it using the following DOI:
License
Theriak-Domino/pytheriak is licensed under the GNU General Public License v3.0. See LICENSE for more details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pytheriak-1.1.1.tar.gz
.
File metadata
- Download URL: pytheriak-1.1.1.tar.gz
- Upload date:
- Size: 23.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1019-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b272edbcd787ca8ff781ffe804e4ed6d7dcb509d65f82899a136713f5fe4ab3e |
|
MD5 | 9cdcb0d2f392c0cf10796aa67db5b6a1 |
|
BLAKE2b-256 | 127bbfe83ef442ed2e13298b690e7807ede1a063daefaf598d77d5aad7b65f49 |
File details
Details for the file pytheriak-1.1.1-py3-none-any.whl
.
File metadata
- Download URL: pytheriak-1.1.1-py3-none-any.whl
- Upload date:
- Size: 23.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.7.1 CPython/3.12.1 Linux/6.2.0-1019-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0954afc377a83027a55dfeae0e9d2e3984bf6017dc560eecd6d1888224500753 |
|
MD5 | 770fa4503717c70f1492b0d49c086a90 |
|
BLAKE2b-256 | e71b315c5090fe2177c70a5b81f3167b101d01599029bd52e1375b5d46e36f6f |