Skip to content

ponyofshadows/balancer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

English | 中文文档

reaction-balancer

A precise chemical-equation balancer that uses exact rational arithmetic and CIAAW atomic weights to generate printable recipe sheets (Excel format) from Markdown input.

Features

1. Exact scientific computation

  • Uses CIAAW (2024) standard atomic weights.
  • All internal math uses sympy.Rational (exact fractions), eliminating round-off errors.
  • Linear algebra–based solver ensures correct balancing or gives an informative error if impossible.

2. Flexible input syntax

  • Supports parentheses and fractional subscripts:
    • Ni(NO3)2(H2O)6
    • Fe7/8Se
    • La1.8Sr0.2CuO4.12
  • Optional basis specification (e.g., ) allows partial balancing, which is useful for sol–gel and oxide-precursor routes.

3. Automatic Excel output

  • Produces a ready-to-print xlsx recipe sheet with formatted layout.
  • Column widths, styles, and alignment handled automatically—no manual editing required.

4. Reproducible and traceable

  • Input is a Markdown document, allowing you to record:
    • sample IDs
    • furnace schedule
    • experimental notes
  • Perfect for lab notebooks and long-term traceability.

5. Designed for materials synthesis

Suitable for:

  • solid-state reactions
  • flux growth
  • hydrothermal / sol-gel precursor balancing
  • cuprates, pnictides, nickelates, chalcogenides, and general inorganic synthesis

Installation

pip install balancer

or if using uv:

uv tool install balancer

Usage

Run the following command in any directory:

python -m balancer
# or use uv:
# uv run balancer

This program needs an input file (default: ./input.md).

If input.md is not found, a template will be automatically created in the current working directory.

Example input: INPUT_EXAMPLE

Corresponding output: OUTPUT_EXAMPLE

You may also specify an explicit filepath:

balancer <filepath>

About

A precise chemical-equation balancer that uses exact rational arithmetic and CIAAW atomic weights to generate printable recipe sheets (Excel format) from Markdown input.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages