Skip to main content

Wrappers to call and read_out theriak from python.

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:\

  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 ...

vars(rock).keys()

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]

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-0.0.15.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

pytheriak-0.0.15-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytheriak-0.0.15.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for pytheriak-0.0.15.tar.gz
Algorithm Hash digest
SHA256 ee34b6bc6796eac36876be9d6b11bf50a17f7e5c507c93ee0df3805d4ec9e9b4
MD5 2cbfdfbeee6bce5e934ab5c36f58a32f
BLAKE2b-256 d4e84c1e012ed6e66e38b1813006dfb274b77fadeb8caa14c05284428bd5fde7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytheriak-0.0.15-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.10

File hashes

Hashes for pytheriak-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 01bc27706c50d23ed008644723999487c6fb1b306cca93d8d0006955c5986506
MD5 b5c5dffb4211a3a2eaf1e162d0cb456c
BLAKE2b-256 a261827d3e1e8206325981c71ce97195ec0660b48d365a12a4f14fd84024f805

See more details on using hashes here.

Supported by

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