vsepr-rs
A lightweight, high-performance molecular geometry optimizer based on VSEPR (Valence Shell Electron Pair Repulsion) theory.
vsepr-rs is designed as a scaffolder or pre-optimizer. It quickly transforms raw or overlapping coordinates into a chemically sensible 3D structure that can then be passed to more rigorous force fields like UFF (Universal Force Field) for final refinement.
Features
- VSEPR-Based Reasoning: Automatically determines ideal bond angles and local geometries based on Steric Numbers (SN), considering valence electrons, bond orders, and formal charges.
- Generic Interface: Uses traits (
AtomTrait,BondTrait) allowing you to optimize your own data structures directly without conversion. - Robust Initialization: Includes deterministic jitter to break symmetry, enabling reliable convergence even from origin-stacked or perfectly linear starting coordinates.
- Physics-Aware Refinement:
- Corrects bond lengths based on bond order and covalent radii.
- Maintains local planarity for sp2 centers.
- Includes dihedral (1-4 torsion) constraints for aromatic systems.
- Prevents steric clashing with non-bonded repulsion.
- Zero Dependency: Built purely on the Rust standard library for maximum portability and fast compilation.
Installation
Or add this to your Cargo.toml:
[]
= "1.0.0"
Quick Start
Implement AtomTrait and BondTrait for your structures and run the optimizer.
use ;
Testing Your Implementation
If you are implementing custom traits, you can verify your integration by checking if the distances between atoms after optimization approach their covalent sums.
How it Works
- Topology Analysis: Builds an adjacency list and calculates VSEPR geometries for each center.
- Deterministic Jitter: Adds a small, reproducible offset to coordinates to break symmetry traps.
- Iterative Relaxation: Applies a lightweight force field including bond springs, VSEPR angle springs, planarity forces, and non-bonded repulsion until the structure settles.
License
MIT or Apache-2.0
Author
Forblaze Project
Website: https://forblaze-works.com/