This code allows calculating the abundances of prebiotic molecules inside planetesimals in the early solar system, which could provide a potentially habitable world with key ingredients for the formation of life. Simulation in C++ (which is using the proprietary FORTRAN library ChemApp, not included in repo), Python3, R, and a Makefile for easy building.
Klaus Paschek 
Publications based on this code:
- Paschek, K., Kohler, K., Pearce, B. K. D., Lange, K., Henning, T. K., Trapp, O., Pudritz, R. E., & Semenov, D. A. (2022). Possible Ribose Synthesis in Carbonaceous Planetesimals. Life, 12(3), 404. doi:10.3390/life12030404
- Paschek, K., Semenov, D. A., Pearce, B. K. D., Lange, K., Henning, T. K., & Pudritz, R. E. (2023). Meteorites and the RNA World: Synthesis of Nucleobases in Carbonaceous Planetesimals and the Role of Initial Volatile Content. The Astrophysical Journal, 942(1), 50. doi:10.3847/1538-4357/aca27e
- Paschek, K., Lee, M., Semenov, D. A., & Henning, T. K. (2024). Prebiotic Vitamin B3 Synthesis in Carbonaceous Planetesimals. ChemPlusChem, 89(4), e202300508. doi:10.1002/cplu.202300508
This Code needs the proprietary FORTRAN library ChemApp to function. It is not provided in this repository. This software is distributed by GTT-Technologies and provided by this company as binaries. A free light version with limited capabilities is available, the full functionality allowing for more chemical substances and elements is available as a paid version. For the chemical reactions provided here, the paid full version is necessary.
After cloning this repository, the ChemApp binaries are needed. In the Makefile the directory containing the binaries has to be specified using the variable LIBSDIR. Open the Makefile and change the variable accordingly, e.g.:
LIBSDIR = ./chemapp-v<your_version>/
Further, the gcc compiler is needed for mixed compiling of the FORTRAN libraries with the C++ code. This is done using the flag -lgfortran and already set up in the Makefile. At least a C++11-standard compatible version of gcc is needed. gcc is usually preinstalled on Linux or can be installed (including make) using the command:
sudo apt install build-essential
For the use of the CHNOSZ database one needs to install R:
sudo apt-get install r-base r-base-dev
To install CHNOSZ one needs to start R in the terminal and execute the following commands:
you@your_machine$ R
> install.packages("CHNOSZ")
> q()
Save workspace image? [y/n/c]: nFurther, on needs Python3 (usually already preinstalled on Linux), e.g.:
sudo apt install python3.5
For the Python3 code to work one needs the following libraries:
pybind11numpyscipymatplotlibpandasrpy2mathdatetimecalenderdatetimecalendarpathlibsyscsvtqdmcontextlibwarnings
If not installed yet, they can be installed using pip3, e.g.:
pip3 install pybind11
First, one has to compile the C++ code together with ChemApp into a Cython module to be usable in Python3. This can be done easily using the Makefile by simply typing in the directory with the cloned directory:
make
This will automatically build the software using gcc and pybind11. To run a reaction one has to run now the Python3 script:
python3 prebiotic_synthesis.py <target_molecule>[/<target_molecule_2>] [<reaction_no.> OR all] [<pressure_in_bar>]
E.g.:
python3 prebiotic_synthesis.py adenine 1 100
Several target molecules can be given separated by / to start the abundance calculation for all of them simultaneously:
python3 prebiotic_synthesis.py adenine/ribose 1 100
The default pressure is set to 100 bar and can be used by just giving no explicit value:
python3 prebiotic_synthesis.py adenine 1
Some reaction numbers are already set up in the script and one can run all these reactions at once by using either all:
python3 prebiotic_synthesis.py adenine/ribose/cytosine all 100
Or by just neglecting the reaction number completely (be aware that now one can't give an explicit value for the pressure and the default 100 bar will be used):
python3 prebiotic_synthesis.py adenine/ribose/cytosine
The target molecule(s) has/have to be set up (each) as a csv file in the subdirectory ./reaction_info/ with the filename as <target_molecule>_<reaction no.>.csv, e.g., adenine_1.csv.
In these csv files the reactants and products have to be listed together with their phase and initial concentration (normalized to water), e.g.:
H2O,product
CO,gas,0.00000175
H2,gas,0.00000175
NH3,gas,0.007
H2O,liq,0.0
adenine,aq,0.0
adenine,cr,0.0Molecule names have to follow the naming convention of CHNOSZ.
The first line defines the role of water and the second argument can be either reactant, product, or solvent if water does not take part in the reaction.
The phase of the molecule can be gas, liq (for water only), aq (aqueous --- solved in water), or cr (crystal --- solid).
The files giving the thermodynamic temperature profiles over time and for several radii inside the planetesimals have to be given in the subdirectory ./temps_input/ as csv files.
In these files, the first row has to define the radii in meters inside the planetesimal, and the first column the time after formation in years. The temperatures have to be given in kelvins.
| time | radius 1 | radius 2 | ... |
|---|---|---|---|
| time 1 | temperature time 1 radius 1 | temperature time 1 radius 2 | ... |
| time 2 | temperature time 2 radius 1 | temperature time 2 radius 2 | ... |
| ... | ... | ... | ... |
Example:
| 0 | 50 | 1050 | ... |
|---|---|---|---|
| 20 | 161.3 | 161.3 | ... |
| 30 | 161.5 | 161.4 | ... |
Example csv:
0,50,1050,...
20,161.3,161.3,...
30,161.5,161.4,...These temperature files are read in and the calculations are starting. The in the Python3 script provided plotting routines will then give the resulting plots in the subdirectory ./results/ as pdf files.