Khanij
Khanij (खनिज — Sanskrit for "mineral, born from mining") is a geology and mineralogy engine for the AGNOS scientific computing ecosystem.
It provides mineral properties, crystal systems, rock classification, soil composition, radiometric dating, tectonics, volcanic processes, ore deposit modeling, and more — all built on the hisab numerical library.
Quick Start
Add khanij to your Cargo.toml:
[]
= "0.1"
use *;
// Mineral identification
let quartz = quartz;
assert!;
// Formula parsing (handles Unicode subscripts, hydrates, solid solutions)
let f = parse.unwrap; // gypsum
assert_eq!;
assert_eq!;
// Rock cycle
let next = rock_cycle_next;
assert_eq!;
// Radiometric dating
let age = c14_age; // 50% modern carbon remaining
assert!; // ~one half-life
// Geologic timescale
assert_eq!;
Optional Features
Enable optional integrations with other AGNOS crates:
| Feature | Dependency | Capabilities |
|---|---|---|
chemistry |
kimiya | Mineral composition, dissolution kinetics, lattice energy, Gibbs stability |
thermodynamics |
ushma | Geothermal gradients, heat flow, metamorphic facies |
fluids |
pravash | Groundwater flow, sediment transport, Hjulstrom curves, Shields parameter |
mechanics |
dravya | Mohr-Coulomb failure, seismic velocities, slope stability |
weather |
badal | Climate-driven weathering and erosion |
logging |
tracing-subscriber | Runtime logging via KHANIJ_LOG env filter |
[]
= { = "0.1", = ["chemistry", "fluids"] }
Modules
| Module | Domain |
|---|---|
mineral |
Mineral properties, Mohs/Vickers/Knoop hardness |
crystal |
Crystal system classification (7 systems) |
crystallography |
Unit cells, Miller indices, Bragg diffraction |
formula |
Chemical formula parser (Unicode, hydrates, solid solutions) |
rock |
Rock types, bulk density, porosity, rock cycle |
soil |
USDA texture classification, horizons, fertility, hydraulic conductivity |
texture |
Wentworth grain size, phi scale, sorting, igneous/metamorphic fabrics |
geochemistry |
TAS classification, ASI, Mg#, Rayleigh fractionation |
volcanic |
VEI, magma viscosity, eruption columns, pyroclastic flows |
weathering |
Physical/chemical weathering rates, erosion |
sediment |
Sediment production, transport capacity, budgets |
stratigraphy |
Systems tracts, sea-level cycles, Walther's Law |
tectonics |
Euler poles, spreading rates, subduction geometry, ocean depth |
glaciology |
Glen's flow law, mass balance, isostatic rebound |
hydrothermal |
Alteration zones, metal solubility, ore grade estimation |
ore |
Deposit classification, cutoff grade, NPV, tonnage-grade curves |
timescale |
Geologic time (eons, eras, periods, epochs), age classification |
dating |
Radiometric dating (U-Pb, K-Ar, Rb-Sr, C-14, Sm-Nd, Lu-Hf), isochrons |
grid |
2D geologic grids, stratigraphic columns |
stability |
Gibbs energy, phase stability, reaction spontaneity (chemistry) |
geothermal |
Heat flux, metamorphic facies, intrusion cooling (thermodynamics) |
hydrology |
Darcy flow, Theis/Cooper-Jacob, Shields parameter (fluids) |
rock_mechanics |
Mohr-Coulomb, seismic velocities, slope stability (mechanics) |
Requirements
- Rust: 1.89+ (edition 2024)
- MSRV: 1.89
License
GPL-3.0-only. See LICENSE for details.