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

Uploaded Source

Built Distribution

pytheriak-0.0.16-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytheriak-0.0.16.tar.gz
  • Upload date:
  • Size: 22.8 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.16.tar.gz
Algorithm Hash digest
SHA256 64aaa3b5a729dbfa8e0bb50576754ddd528c2296a449307aa9bd9a7a1f73a0e9
MD5 ef84339112b841946ff033c1c35b6244
BLAKE2b-256 4ed80a3c5361717bb7080324b83b64fffd73ceecbd3aea7cf5c4483582e0d8e2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytheriak-0.0.16-py3-none-any.whl
  • Upload date:
  • Size: 22.2 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.16-py3-none-any.whl
Algorithm Hash digest
SHA256 e6c7f2fe3bd97ad1a1a7ae8e2faae7e8dc02c7990f2f982fc74eb7bf7aee5e22
MD5 264024a596c0b45913337b864355db65
BLAKE2b-256 a886bc4b5953d43b593cea3f49be055dec88b216f150e7bcd05d3918d8d2820d

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