Skip to content

JAFF

Just Another Fancy Format
An astrochemical network parser and multi-language code generator

Welcome to JAFF

JAFF is a comprehensive tool for working with astrochemical reaction networks. It provides a unified interface for parsing multiple network formats, analyzing chemical species and reactions, and generating optimized code for numerical simulations in multiple programming languages: C, C++, Fortran, Python, Rust, Julia, and R.

Key Features

Multi-Format Support

Parse networks from major astrochemistry databases including KIDA, UDFA, PRIZMO, KROME and UCLCHEM with automatic format detection.

Validation & Analysis

Automatically validate mass and charge conservation, analyze stoichiometry and extract elemental composition from complex chemical formulas.

Code Generation

Generate optimized code for reaction rates, ODEs, Jacobians, and flux calculations in C, C++, Fortran, Python, Rust, Julia, and R with optional common subexpression elimination (CSE).

Temperature Dependent Rates

Evaluate rate coefficients with support for complex temperature dependencies, photochemistry, and cosmic ray ionization.

Template System

Powerful template language (JAFF directives) for customizing code generation to match your simulation framework.


Quick Example

from jaff import Network

# Load a chemical network
net = Network("networks/react_COthin")

# Access species information
print(f"Network contains {len(net.species)} species")
print(f"First species: {net.species[0].name}, mass: {net.species[0].mass} amu")

# Access reactions
for reaction in net.reactions[:3]:
    print(reaction.get_sympy())  # Symbolic representation

# Generate code
from jaff import Codegen
cg = Codegen(network=net, lang="cxx")
rate_code = cg.get_rates(idx_offset=0, rate_var="rate", brac_format="[]")
print(rate_code)

Use Cases

Astrochemistry Simulations

Generate efficient ODE solvers for modeling chemical evolution in:

  • Interstellar clouds - dark clouds, molecular clouds
  • Protoplanetary disks - planet formation environments
  • Planetary atmospheres - exoplanet and solar system atmospheres
  • Stellar outflows - AGB stars, supernovae

Network Analysis

  • Compare different reaction databases
  • Identify missing species or reactions
  • Validate stoichiometric conservation
  • Extract element density matrices

Code Integration

  • Generate code compatible with existing simulation frameworks
  • Customize output format with templates
  • Optimize for performance with CSE
  • Support multiple programming languages

Supported Network Formats

Format Description Reference
KIDA Kinetic Database for Astrochemistry A&A, 689, A63 (2024)
UDFA UMIST Database for Astrochemistry A&A, 682, A109 (2024)
PRIZMO Uses -> separator with VARIABLES{} MNRAS 494, 4471 (2020)
KROME Comma-separated with @format: header MNRAS 439, 2386 (2014)
UCLCHEM Comma-separated with ,NAN, marker AJ 154 38 (2017)

What's Next?

  • Getting Started


    Install JAFF and run your first network analysis

    Installation Guide

  • User Guide


    Learn how to work with networks, species, and reactions

    User Guide

  • Code Generation


    Generate optimized code for your simulations

    Code Generation Guide

  • API Reference


    Complete API documentation for all modules

    API Docs


Community & Support


Citation

If you use JAFF in your research, please cite:

@software{jaff2024,
  title = {JAFF: Just Another Fancy Format},
  author = {JAFF Team},
  year = {2024},
  url = {https://github.com/tgrassi/jaff},
  version = {0.1.0}
}

License

JAFF is released under the MIT License.


New to astrochemistry?

Check out our Basic Concepts page to learn about chemical networks, reaction rates, and how JAFF can help your research.

Ready to dive in?

Jump straight to the Quick Start Guide to start using JAFF in minutes!