Multiscale toolkit for simulating Ni-catalysed olefin chain growth, diffusion, and adsorption.
- Deterministic ODE reactor solver (
kinetic_model.core) that handles coupled reaction networks and capacity-weighted diffusion between compartments. - Machine-learning surrogates for adsorption capacities and intracrystalline diffusion (KNN/Gaussian-process regressors stored under
data/processed). - Thermochemistry and energy-profile tooling (
kinetic_model.energy_profile) to turn DFT results into relative free-energy landscapes and barrier dictionaries that plug directly into the reactor simulations. - Supplementary notebooks (
notebooks/) for training surrogates and analysing experimental/DFT data, plus reproducible examples inexamples/.
| Path | Purpose |
|---|---|
src/kinetic_model/core |
Base Reaction ODE solver, diffusion-aware reactor (Reaction_Diffusion), and Eyring rate helper. |
src/kinetic_model/constants |
ML models and utilities for adsorption/diffusion, energy-barrier loaders, and thermodynamic constants. |
src/kinetic_model/energy_profile |
Parsers for DFT folders, thermochemistry (harmonic, anharmonic, and free-rotor treatments), relative energy calculators, and plotting helpers. |
src/kinetic_model/simulation |
High-level simulation drivers (ReactorSimulation, chemisorption variants), reaction-list builders, plotting utilities, and synthetic-data generators. |
data/ |
Raw DFT structures, gas-phase molecules, YAML metadata, and pretrained .pkl surrogates (data/processed). |
examples/ |
Ready-to-run settings files and notebooks demonstrating energy-profile extraction. |
notebooks/ |
Jupyter notebooks for adsorption/diffusion model development and loading studies. |
tests/ |
Pytest suite that covers kinetic core logic, diffusion handling, rate calculations, and runner utilities. |
- Create an environment (optional but recommended):
or manually install Python ≥3.12.
conda env create -f environment.yml conda activate kinetic_model
- Install the package and dependencies:
The editable install exposes
pip install -r requirements.txt pip install -e .kinetic_modelfor notebooks, scripts, and tests.
from kinetic_model.simulation.run_reactor import ReactorSimulationChemisorptionSimplified
from kinetic_model.constants.energy_profile import EnergyBarriersSimplifyed
energy = EnergyBarriersSimplifyed(pressure=5.0, temperature=320.0)
sim = ReactorSimulationChemisorptionSimplified(
N=16,
T=320.0,
pressure=5.0,
L=8.0,
time_hours=2.0,
n_steps=500,
diff_model_path='../data/processed/diffusion_extrap_place_holder_model.pkl',
ads_model_path='../data/processed/knn_adsorption_slope_model.pkl',
energy_model=energy,
initial_concs={'CatC2(C2)': 1e-2, 'C2': 1}
)
distribution_df, probability_traces = sim.run()distribution_dfsummarises the final olefin chain-length distribution and probabilities.probability_traces(time-series DataFrame) tracks intra-/extra-crystalline concentrations for each chain length.
- Prepare DFT folders: populate
data/structures/<model_method>/<pathway>/<system>anddata/gas-phase-molecules/<model>/…withPOSCAR/mol.xyz,energy.dat,freq.txt, and optionalrotAtoms.yaml. - Compute thermochemistry:
from kinetic_model.energy_profile.energy_processing import calculate_relative_energies import os import numpy as np temperatures = [300] # Can be varied pressures = [101325.] # Can be carried models = ['QM-QM_TPSSh-PBED3'] # Options: ['QM-QM_M06L-PBED3', 'QM-QM_TPPSh-PBED3] pathways = ['trigonal'] # Options: ['trigonal', 'hexagonal'] ref_struc = '1' # Choose either 1 or 5 energy_type = 'Gibbs free energy' # Options: ['Electronic energy', 'Enthalpy', 'Gibbs free energy'] energy_unit = 'kJ/mol' # Options: ['eV', 'kJ/mol', 'kcal/mol'] custom_order = ["1", "2", "3", "4", "5", "5a", "6", "1p", "7", "8", "9", "5p", "6p", "1pp", "10", "11", "12", "5pp", "6pp", "1ppp", "2-3", "3-4", "6-1p", "7-8", "8-9", "6p-1pp", "10-11", "11-12", "6pp-1ppp"] # Use for sorting the intermediates in a table (or pd.DataFrame) rel_results = calculate_relative_energies( structures_dir=os.path.abspath('../data/structures'), molecules_dir=os.path.abspath('../data/gas-phase-molecules'), temperatures=temperatures, models=models, ref_struc=ref_struc, pathways=pathways, pressures=pressures )
- Convert to barriers: instantiate
EnergyBarriersorEnergyBarriersSimplifyedwith the target temperature/pressure; callget_energy_barriers()to obtain ΔG‡ dictionaries that feedprepare_constants_*or a custom simulation setup.
- Adsorption:
data/processed/knn_adsorption_model.pklcontains the grouped/scaled KNN (AdsorptionKNN/AdsorptionKNNSlopeExtrap). Re-train usingnotebooks/adsorbtion_process_ml.ipynb, thenjoblib.dumpthe estimator. - Diffusion:
data/processed/diffusion_model*.pklstores LightGBM-based regressors (seenotebooks/diffusion_process_ml.ipynb). Rates are later converted to s⁻¹ via pore-geometry scaling insideReactorSimulation. - DFT sources:
data/structures,data/gas-phase-molecules, anddata/formulae.yamldescribe the thermochemistry inputs. The minidata/READMEhighlights shared intermediates between pathways.
test_soft.ipynb- the main example file where you can find more detailed examples how to use current soft.examples/settings.yamlandexamples/c8_energy_profiles_settings.yamldemonstrate how to configure pathway, model, and plotting options for energy-profile reports.- Notebooks in
notebooks/reproduce adsorption/diffusion training, sanity-check Eyring prefactors, and explore C₂ loading. They assume you installed the package in editable mode so imports resolve.
- Run the full suite with
pytestfrom the repository root. Key tests (tests/test_core.py,tests/test_diffusion_behavior.py, etc.) validate ODE integration, diffusion bookkeeping, barrier-to-rate conversions, and runner wiring. - When adding features, prefer dropping new modules under
src/kinetic_modeland extend the pytest coverage alongside; notebooks and examples can reference the same public API.
The project is released under the MIT License
Questions or ideas? Open an issue or start a discussion in your preferred tracker—contributions that improve the kinetic workflow, data parsers, or surrogate accuracy are very welcome.