Taurex Python wrapper for the FORTRAN GGChem code.
Project description
GGchem
(c) Peter Woitke & Christiane Helling 2017
Fast thermo-chemical equilibrium code with or without equilibrium condensation down to 100K.
Please cite our A&A paper "Equilibrium chemistry down to 100 K. Impact of silicates and phyllosilicates on carbon/oxygen ratio"; P. Woitke, Ch. Helling, G. H. Hunter, J. D. Millard, G. E. Turner, M. Worters, J. Blecic, J. W. Stock; 2018; Astronomy & Astrophysics 614, 1; see GGchemPaper.pdf in this folder.
We would be interested to hear from you about what kind of applications you would like to use ggchem for, please let us know via email Peter Woitke (pw31@st-and.ac.uk) as well as if you have any questions or problems.
If your research results in any publications, please cite the above article and consider to give us co-author-ship.
To checkout the git repository and compile the code, use
git clone https://github.com/pw31/GGchem
cd GGchem/src16
cp makefile.prodimo makefile
make
The makefile.prodimo is for ifort compiler, adjust your own makefile if you want to compile e.g. with gfortran.
To run the code, type
cd ..
./ggchem input/default.in
It will create the output file "Static_Conc.dat", which contains all computed molecular, atom and ion particle densities, the electron density, solid and liquid particle densities, and supersaturation ratios:
- Tg: gas temperature [K],
- nHtot: total hydrogen nuclei particle density [cm-3],
- pges: total gas pressure [dyn/cm2]
- el ... W: atomic particle densities log10(natom)[cm-3]
- {mol}: molecular particle densities log10(nmol)[cm-3]
- S{cond}: supersaturation ratios log10(S) [-] of condensates
- n{cond}: concentration of condensed units per H nuclues log10(ncond/nHtot) [-]
- eps{el}: remainig element abundances in the gas phase [-]
- dust/gas: dust to gas mass ratio log10(rho_dust/rho_gas) [-]
- dustVol/H: dust volume per H nucleus log10(dust_volume) [cm3]
S{cond} and n{cond} are used in the header to distinguish between supersaturation ratio and concentration of condensed units, whereas {mol} (without the leading "n") is a molecular particle density.
To visualise the results, use e.g.
python tools/Plot_T.py
evince ggchem.pdf &
Customise your own model
To create your own model, make a copy of default.in and customize it to tell GGchem what it should do. You can also look at some of the other *.in files to lean from examples. Select or deselect elements by modifying the first line, default choice is
H He C N O Na Mg Si Fe Al Ca Ti S Cl K Li F P V Cr Mn Ni Zr W el
where "el" means to include atomic and molecular ions, and the electron density as well, assuming charge equilibrium. Molecules are included if they are made of the selected elements, otherwise they will be ignored.
Choose element abundances with parameter abund_pick. The default choice is abund_pick=3 for solar abundances from Asplund et al.(2009). There are additional pre-installed options to use data from "Abundances.dat", including "EarthCrust" (abund_pick=1), "Ocean" (abund_pick=2) and "Meteorites" (abund_pick=4) as listed in "Abundances.dat". If you want any other element abundances, use (abund_pick=0) followed by a name of a custom file with abundances, see, e.g. input/model_Crich.in.
Choose sources for equilibrium constants kp(T)-data, default choice is dispol_new.dat. There are 6 different fit-formulas implemented, see details in src16/smchem16.f (function gk). Data files having kp-data are in folder data:
dispol_StockKitzmann.dat : 2008, Diplomarbeit TU Berlin
dispol_StockKitzmann_withoutTsuji.dat : same, without Tsuji refits
dispol_BarklemCollet.dat : 2016, A&A 588, A96
dispol_SharpHuebner.dat : 1990, ApJSS 72, 417
dispol_Tsuji.dat : 1973, A&A 23, 411
dispol_GGchem.dat : old NIST-Janaf fits
dispol_fast.dat : 9-molecules from Heng&Tsai 2016
You can use combinations by setting dispol_file, dispol_file2, dispol_file3, dispol_file4 in your MyModel.in file, in which case the latter have preference over the former, and will overwrite previous data.
Choose whether you want to constrain the pressure (model_pconst=.true.) or the mass density (model_pconst=.false.).
You can run single point model (model_dim=0), linear track (model_dim=1) or 2D coverage (model_dim=2). Set parameters Tmin, Tmax and then pmax, pmin or nHmax, nHmin for model_pconst=.true. or .false., respectively. In the default model_dim=1 mode, ggchem will make a linear track in (logp, logT) parameter space with Npoints points.
If you want to switch on equilibrium condensation, set model_eqcond=.true. In that mode, the code will be much slower, and also possibly unstable. Always start from large T and then lower T SLOWLY with successive calls. The code will create and expand "database.dat" automatically from the results of every successful call, such that once you have filled in the (p,T)-plane with many points, the results will be faster and more reliable. The Gibbs-free energy data files are in folder data:
DustChem_GGchem.dat : old GGchem NIST-Janaf fits
DustChem_SUPCRTBL.dat : dG-fits from the SUPCRTBL database
(Zimmer et al. 2016, Computers and Geosciences, 90, 97)
DustChem.dat : currently used collection from both
The pure gas phase chemistry needs about 0.4 ms per call for T > 1000 K (real8 version) and about 3 ms per call for T < 1000 K (real16 version). These time measurements are for 16 elements + charge. Time requirement roughly scale as N^3, if N is the number of elements. The equilibrium condensation code requires many calls of the gas-phase equilibrium chemistry routine, and takes about 0.02-0.09 sec per call, depending on how much useful information is found in database.dat.
TauREx-GGchem plugin
A Python wrapper built using the TauREx is available. The wrapper also installs all available datafiles included with GGchem
Installation
You can install one of the prebuilt binary wheels for Windows, macOS and manylinux through pip:
pip install taurex_ggchem
Installing from source
To install from source a valid C/C++ and FORTRAN compiler must be present. You can compile it by doing:
git clone https://github.com/ucl-exoplanets/GGchem.git
cd GGchem
pip install .
Running in TauREx
Once installed you can select the chemical model through the chemistry_type keyword under Chemistry.
[Chemistry]
chemistry_type = ggchem
metallicity = 1.0
selected_elements = H, He, C, N, O, Ti, V, S, K
ratio_elements = C, N, Ti
ratios_to_O = 0.5,0.001, 1e-4
equilibrium_condensation = True
[Fitting]
Ti_O_ratio:fit = True
Ti_O_ratio:prior = "LogUniform(bounds=(-6,2))"
S_O_ratio:fit = True
S_O_ratio:prior = "LogUniform(bounds=(-6,2))"
metallicity:fit = True
metallicity:prior = "LogUniform(bounds=(-6,2))"
Input arguments:
Argument | Description | Type | Default | Required |
---|---|---|---|---|
dispol_files | Path to thermochemical data | list of strings | Built-in (BarklemCollet,StockKitzmann_withoutTsuji, WoitkeRefit ) | |
abundance_profile | Initial abundance profile. Either solar, meteor, ocean or earth | string | 'solar' | |
selected_elements | List of elements to include | list of string | All elements in GGchem | |
ratio_elements | List of elements to set the ratio | list of string | ||
ratios_to_O | ratio of each 'ratio_element' relative to oxygen | array | ||
he_h_ratio | He/H ratio | float | 0.083 | |
metallicity | Metallicity relative to initial abundance | float | 1.0 | |
include_charge | Include ions | bool | False | |
equilibrium_condensation | Include condenstation | bool | False | |
dustchem_file | Dust chemistry file | string | Built-in (DustChem.dat) | |
Tfast | Lowest temperature (K) to use faster method | float | 1000 | |
new_back_it | integer | 6 | ||
new_back_fac | float | 1e5 | ||
new_pre_method | integer | 2 | ||
new_full_it | bool | False | ||
new_fast_level | integer | 1 |
Retrieval Parameters:
Fitting Parameter | Description |
---|---|
metallicity | Metallicity relative to solar |
The wrapper will generate oxygen retrieval parameters for all metallic elements within the chemical model. If Ti is present (either by default or specifing in selected_elements) then a Ti_O_ratio retrieval parameter will be available. Using the default selected_parameters will give access to:
Fitting Parameter | Description |
---|---|
C_O_ratio | C/O ratio |
N_O_ratio | N/O ratio |
Na_O_ratio | Na/O ratio |
Mg_O_ratio | Mg/O ratio |
Si_O_ratio | Si/O ratio |
Fe_O_ratio | Fe/O ratio |
Al_O_ratio | Al/O ratio |
Ca_O_ratio | Ca/O ratio |
Ti_O_ratio | Ti/O ratio |
S_O_ratio | S/O ratio |
Cl_O_ratio | Cl/O ratio |
K_O_ratio | K/O ratio |
Li_O_ratio | Li/O ratio |
F_O_ratio | F/O ratio |
P_O_ratio | P/O ratio |
V_O_ratio | V/O ratio |
Cr_O_ratio | Cr/O ratio |
Mn_O_ratio | Mn/O ratio |
Ni_O_ratio | Ni/O ratio |
Zr_O_ratio | Zr/O ratio |
W_O_ratio | W/O ratio |
Running in Python
You can import the chemistry scheme in Python pretty easily
>>> from taurex_ggchem import GGChem
>>> gg = GGChem(metallicity=1.0,
selected_elements=['H','He','C','O','N','K'],
abundance_profile='earthcrust',
equilibrium_condensation=True)
You can either pass it into a TauREx forward model like so:
>>> tm = TransmissionModel(chemistry=gg)
Or use it independently to compute volume mixing ratios for gas-phase and condensates by passing in temperature and pressure ( Pascal ) arrays:
>>> nlayers = 100
>>> T = numpy.linspace(400,1000,nlayers)
>>> P = numpy.logspace(1,5, nlayers)
>>> gg.initialize_chemistry(nlayers=nlayers, temperature_profile=T, pressure_profile=P)
>>> gg.gases
['H', 'He', 'C', 'O', 'N',..., 'N3', 'O3', 'C3H']
>>> gg.mixProfile
array([[4.75989782e-04, 4.93144149e-04, 5.10561665e-04, ...,
2.89575385e-05, 2.47386006e-05, 2.10241059e-05],
...,
[2.49670621e-16, 1.44224904e-16, 8.29805526e-17, ...,
9.48249338e-42, 4.75884162e-42, 2.37999459e-42]])
>>> gg.condensates
['C[s]', 'H2O[s]', 'H2O[l]', 'NH3[s]', 'CH4[s]', 'CO[s]', 'CO2[s]']
>>> gg.condensateMixProfile
array([[0.00000000e+00, 0.00000000e+00, 0.00000000e+00,...,
0.00000000e+00, 0.00000000e+00],
[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,
0.00000000e+00, 9.82922802e-10, 1.88551848e-10, 2.88471985e-11,
4.40651877e-12, 6.95597887e-13],
...,
[0.00000000e+00, 0.00000000e+00, 0.00000000e+00, ...,
0.00000000e+00, 0.00000000e+00]])
Bibliography
If you use the plugin please cite the relevant articles. TauREx will output it at program end. You can get the citation from Python like so:
from taurex import __citations__
print(__citations__)
print(gg.nice_citation())
Which gives:
TauREx III: A fast, dynamic and extendable framework for retrievals
Al-Refaie, Ahmed F., Changeat, Quentin, Waldmann, Ingo P., Tinetti, Giovanna
arXiv, 1912.07759, 2019
Equilibrium chemistry down to 100 K - Impact of silicates and phyllosilicates on the carbon to oxygen ratio
Woitke, P., Helling, Ch., Hunter, G. H., Millard, J. D., Turner, G. E., Worters, M., Blecic, J., Stock, J. W.
A&A, 614, A1, 2018
You can also generate bibtex from the input file like so:
taurex -i myinput.par --bibtex mybib.bib
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 Distributions
Hashes for taurex_ggchem-1.0.5-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 268e952b4b099e0c9b5333211de66c8db5d6ff74cec10678e47d65c663c293db |
|
MD5 | 2abe55279e296ed63536021a69144a5f |
|
BLAKE2b-256 | 80ecc76074b96036683162d82a2cbcb6a1d7165888c53d7317b53dd918b38a22 |
Hashes for taurex_ggchem-1.0.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46ad0a90c46d944c974f48f608f59fcbfa621a0fd8c2e2cb6190f706a2681505 |
|
MD5 | 999e418b5cbc852205dd8ae5523c7996 |
|
BLAKE2b-256 | 1c5d613900e88e54fdca4702d29823a96c68d761dfe174625880edcb12e24851 |
Hashes for taurex_ggchem-1.0.5-cp312-cp312-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc1329395e8d76d9720b5b47d06e8b639bc406c9b8a97bd01490808c29ebac8e |
|
MD5 | 16073f7f97c7064c0e98df9d50136da3 |
|
BLAKE2b-256 | 8e9bd0ed10cee2da8af1b2889bfb1fb62629e55705b960993fb37c7722d8c270 |
Hashes for taurex_ggchem-1.0.5-cp312-cp312-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34279d87d11591ac31e7292242334038c7225567cc3d69c4ba7e52b23fca4605 |
|
MD5 | 3abb2170e946daabe40c0b2f4ec1bd8f |
|
BLAKE2b-256 | df86d49b0e7f511a102533fe4a508e28450a773e76a909cc607efabae5ae80f1 |
Hashes for taurex_ggchem-1.0.5-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c4e70047ff3cb315ec14022c8eda22ebede9d0ad36a85e9299857936d2daa2f7 |
|
MD5 | c388a7a034c0d60af826595db4935c72 |
|
BLAKE2b-256 | 459c6f9ecf1ec3f2c3840ff0ab9ae6e7d7908a0d9fb67bebabc0bf033fc9b8b5 |
Hashes for taurex_ggchem-1.0.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47840c3488dafe8352d6481efd9cdcadec84925dd011bbc8357c389ef8a1d470 |
|
MD5 | be2c06e30ea731891533e36e278bd3da |
|
BLAKE2b-256 | ce5909b73fe30c33961f4955f554583304ad1ed36cf576561c867673dce3e0b2 |
Hashes for taurex_ggchem-1.0.5-cp311-cp311-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 68a8050c021bd96b5385086b2fd66aa9290aa09f41bcaaa7fed6d2ade8cd548a |
|
MD5 | f462834181dfad5a52e1a2b7f9424426 |
|
BLAKE2b-256 | 0da6f305a8dc73cd332b41b5e4b125e2824dba900163e49906cb2311873430a6 |
Hashes for taurex_ggchem-1.0.5-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2f98c69d3f15a1aed326c6df1c69235826a934a9aa023f2603cd1b1eb9ee786 |
|
MD5 | b89badffbb2a75e516055215d184e868 |
|
BLAKE2b-256 | d0ce4650ce2f1d5a08c57e3d58cfb49001797fa827c9295fc1831177399dfe0b |
Hashes for taurex_ggchem-1.0.5-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c52b41cb77556c3545b6b46c0437deaf04199ddb61b1f9ba67cea5e9e07eb920 |
|
MD5 | 01d7f7ed100bce8e6afb4691a7db638b |
|
BLAKE2b-256 | e9802cd8e8cda4e32fabfa4dc60b80a3b9397612db134527e3e2f16ba2aa5bc3 |
Hashes for taurex_ggchem-1.0.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2f9cff9efeafa7a9591aa7ab2531c76b4556adb01fb647b93e82f68f3e15736 |
|
MD5 | cd61faf0354b3fff7e817bfe3ea846fa |
|
BLAKE2b-256 | 9db334d8d2d680678b9de7e5062391e672c4c8752dc05034d1e26d419f2d574b |
Hashes for taurex_ggchem-1.0.5-cp310-cp310-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 76feae3fd83148e6520dc129d64e0a3d9567bc0c48745c650581aa595af6d8c6 |
|
MD5 | 6587984a959861746b61f309ef82b402 |
|
BLAKE2b-256 | c56b6e49ad2dbcc33020b19d65cfe6f3dbd533d297798b00a5df7478000e524c |
Hashes for taurex_ggchem-1.0.5-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e01ae3555c7e0f9afb407288d6b905d31be0070108f8882bc503adfd88dfb513 |
|
MD5 | cd687e2c1eade28795e14e73e7bf15f4 |
|
BLAKE2b-256 | c87ad00bf47751e3ccc88fb9b10fdb334af1075b41b89d86dd10e0c637a8137e |
Hashes for taurex_ggchem-1.0.5-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82fc88734a955e8d08e118bf470500d10cad3dff226eff9361080e6938e22a9d |
|
MD5 | 33d0288d580f11c0e2e074e58355619b |
|
BLAKE2b-256 | 19035c5f7d42ce9f88bb2259f5ac523e59ad8fe9f3a2ee61211c146457f2d66c |
Hashes for taurex_ggchem-1.0.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4b1489909c44de56257c0b08fd42128d082650fcbc448120fab900bfcad24be |
|
MD5 | c40ad06c5831d7a10f93176c42cab851 |
|
BLAKE2b-256 | 69a3a7f4f36252e7def00ba54340b350f6a50a9465b0f9e49d7a74d29c5e9694 |
Hashes for taurex_ggchem-1.0.5-cp39-cp39-macosx_12_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0940ee98e52c30693a1f6529fe359e6566f72df409e228a4745c2329d22dc93 |
|
MD5 | 7f8cccfdc25f1bb1b39d04ef9b626882 |
|
BLAKE2b-256 | 00f48ff35230d1cf597f86389177ad59be2ac81ee9bb3cab876cec0aeeaff55e |
Hashes for taurex_ggchem-1.0.5-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 48b76cfbbd252f77076534f2111e4b57b79e6ad037e044349a572f941d3376c3 |
|
MD5 | d387471ab60d1cd5b40f187ab4b12235 |
|
BLAKE2b-256 | a8e91ffa91f8dbbea79d362e972fd0a7dd0ce8fc1ed5a5e1b5abd2affbcc1667 |