Skip to main content

Python wrapper functions for Theriak-Domino.

Project description

pytheriak

DOI

Python wrapper functions for Theriak-Domino.

Installation

PyPI Compatible Python Versions

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:

  1. Pressure in bars.
pressure = 4000
  1. Temperature in degree celsius.
temperature = 550
  1. 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:

DOI

License

Theriak-Domino/pytheriak is licensed under the GNU General Public License v3.0. See LICENSE for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytheriak-1.1.2.tar.gz (317.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytheriak-1.1.2-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

Details for the file pytheriak-1.1.2.tar.gz.

File metadata

  • Download URL: pytheriak-1.1.2.tar.gz
  • Upload date:
  • Size: 317.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pytheriak-1.1.2.tar.gz
Algorithm Hash digest
SHA256 822b00ae6a6cee14d673a75ca59565b6ee20a06030ed3cc67e4703ca446f3a93
MD5 debf532adf817790adfd3cfd25c13eba
BLAKE2b-256 91318ae3225445a244e6386b299db41280f2066432d43b933ad547136613f6a0

See more details on using hashes here.

File details

Details for the file pytheriak-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: pytheriak-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for pytheriak-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8969e40274a453673c67e4222b0bf2a096fb93bfa3171bdb63cb8aacd25fb10c
MD5 e86e212c0dac960dcc8007e8525beb6f
BLAKE2b-256 ff0e18a6de87f9b9be6195341de173207404cdde1df601da56223ce172242870

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page