pytheriak


Namepytheriak JSON
Version 1.1.1 PyPI version JSON
download
home_page
SummaryPython wrapper functions for Theriak-Domino.
upload_time2024-02-11 13:11:38
maintainer
docs_urlNone
authorPhilip Hartmeier
requires_python>=3.10,<4.0
licenseGPL-3.0-or-later
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # pytheriak
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7945482.svg?style=flat)](https://doi.org/10.5281/zenodo.7945482)

Python wrapper functions for Theriak-Domino.

## Installation
[![PyPI](https://img.shields.io/pypi/v/pytheriak.svg?style=flat)](https://pypi.python.org/pypi/pytheriak)
[![Compatible Python Versions](https://img.shields.io/pypi/pyversions/pytheriak.svg?style=flat)](https://pypi.python.org/pypi/pytheriak/)

You can install the package from pypi.org.
Run the following to install:

```python
pip install pytheriak
```

## Usage

### Run theriak from your python script

Import the wrapper module.

```python
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.
```python
theriak = wrapper.TherCaller(programs_dir="..\Programs",
                             database="a database file",
                             theriak_version="v2023.01.02beta")
```
As input for Theriak define:\
1. Pressure in bars.
```python
pressure = 4000
```
2. Temperature in degree celsius.
```python
temperature = 550
```
3. Bulk composition following the Theriak-Domino format: Elements in uppercase followed by (number of moles).
```python
bulk = "AL(2)SI(1)O(?)"
```
Then call minimisation() on the TherCaller-object.
```python
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 ...
```python
dir(rock)
```
Useful rock properties are:
```python
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.
```python
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.
```python
[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](https://zenodo.org/badge/DOI/10.5281/zenodo.7945482.svg?style=flat)](https://doi.org/10.5281/zenodo.7945482)

## License

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

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pytheriak",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.10,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Philip Hartmeier",
    "author_email": "philip.hartmeier@hotmail.com",
    "download_url": "https://files.pythonhosted.org/packages/12/7b/bfe83ef442ed2e13298b690e7807ede1a063daefaf598d77d5aad7b65f49/pytheriak-1.1.1.tar.gz",
    "platform": null,
    "description": "# pytheriak\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7945482.svg?style=flat)](https://doi.org/10.5281/zenodo.7945482)\n\nPython wrapper functions for Theriak-Domino.\n\n## Installation\n[![PyPI](https://img.shields.io/pypi/v/pytheriak.svg?style=flat)](https://pypi.python.org/pypi/pytheriak)\n[![Compatible Python Versions](https://img.shields.io/pypi/pyversions/pytheriak.svg?style=flat)](https://pypi.python.org/pypi/pytheriak/)\n\nYou can install the package from pypi.org.\nRun the following to install:\n\n```python\npip install pytheriak\n```\n\n## Usage\n\n### Run theriak from your python script\n\nImport the wrapper module.\n\n```python\nfrom pytheriak import wrapper\n```\nFirst, create a TherCaller-object.\\\nThe `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.\\\nTo 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.\n```python\ntheriak = wrapper.TherCaller(programs_dir=\"..\\Programs\",\n                             database=\"a database file\",\n                             theriak_version=\"v2023.01.02beta\")\n```\nAs input for Theriak define:\\\n1. Pressure in bars.\n```python\npressure = 4000\n```\n2. Temperature in degree celsius.\n```python\ntemperature = 550\n```\n3. Bulk composition following the Theriak-Domino format: Elements in uppercase followed by (number of moles).\n```python\nbulk = \"AL(2)SI(1)O(?)\"\n```\nThen call minimisation() on the TherCaller-object.\n```python\nrock, element_list = theriak.minimisation(pressure, temperature, bulk)\n```\nThis 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).\n\n### Access the properties of the Rock-object\n\nAn easy way to checkout all accessible properties is looking at the object's attributes using ...\n```python\ndir(rock)\n```\nUseful rock properties are:\n```python\nrock.g_system                   # Gibbs free energy of the system [J]\nrock.bulk_composition_moles     # Bulk composition [mol]\nrock.mineral_assemblage         # List of stable solid phases\n...\n```\nMineral (and fluid) assemblage contain Mineral- and Fluid-Objects which hold the phase related properties.\n```python\nmineral = rock.mineral_assemblage[i]\n\nmineral.name                    # Phase name from database\nmineral.n                       # Amount of phase [mol]\nmineral.composition_apfu        # Mineral composition [apfu]\n...\n```\nA quick, easy and pythonic way to retrieve properties is using list comprehensions.\n```python\n[mineral.name for mineral in rock.mineral_assemblage]\n[mineral.composition_apfu for mineral in rock.mineral_assemblage]\n```\n\n## Cite pytheriak\n\nThe pytheriak package is registered on Zenodo. If you use pytheriak in your research, please cite it using the following DOI:\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.7945482.svg?style=flat)](https://doi.org/10.5281/zenodo.7945482)\n\n## License\n\nTheriak-Domino/pytheriak is licensed under the GNU General Public License v3.0. See [LICENSE](LICENSE) for more details.\n",
    "bugtrack_url": null,
    "license": "GPL-3.0-or-later",
    "summary": "Python wrapper functions for Theriak-Domino.",
    "version": "1.1.1",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e71b315c5090fe2177c70a5b81f3167b101d01599029bd52e1375b5d46e36f6f",
                "md5": "770fa4503717c70f1492b0d49c086a90",
                "sha256": "0954afc377a83027a55dfeae0e9d2e3984bf6017dc560eecd6d1888224500753"
            },
            "downloads": -1,
            "filename": "pytheriak-1.1.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "770fa4503717c70f1492b0d49c086a90",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10,<4.0",
            "size": 23733,
            "upload_time": "2024-02-11T13:11:36",
            "upload_time_iso_8601": "2024-02-11T13:11:36.897338Z",
            "url": "https://files.pythonhosted.org/packages/e7/1b/315c5090fe2177c70a5b81f3167b101d01599029bd52e1375b5d46e36f6f/pytheriak-1.1.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "127bbfe83ef442ed2e13298b690e7807ede1a063daefaf598d77d5aad7b65f49",
                "md5": "9cdcb0d2f392c0cf10796aa67db5b6a1",
                "sha256": "b272edbcd787ca8ff781ffe804e4ed6d7dcb509d65f82899a136713f5fe4ab3e"
            },
            "downloads": -1,
            "filename": "pytheriak-1.1.1.tar.gz",
            "has_sig": false,
            "md5_digest": "9cdcb0d2f392c0cf10796aa67db5b6a1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10,<4.0",
            "size": 23676,
            "upload_time": "2024-02-11T13:11:38",
            "upload_time_iso_8601": "2024-02-11T13:11:38.004013Z",
            "url": "https://files.pythonhosted.org/packages/12/7b/bfe83ef442ed2e13298b690e7807ede1a063daefaf598d77d5aad7b65f49/pytheriak-1.1.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-11 13:11:38",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pytheriak"
}
        
Elapsed time: 4.17063s