Skip to main content

Crate uff_relax

Crate uff_relax 

Source
Expand description

§uff-relax

uff-relax is a fast, parallelized molecular structure optimizer using the Universal Force Field (UFF) and the FIRE (Fast Iterative Relaxation Engine) algorithm.

§Features

  • Fast: Optimized force calculations with spatial partitioning (Cell Lists).
  • Parallel: Automatic multi-threading using Rayon for large systems.
  • Flexible: Supports periodic boundary conditions (Orthorhombic and Triclinic).
  • Easy to use: Simple API for defining atoms, bonds, and running optimizations.

§Quick Start

use uff_relax::{System, Atom, Bond, UnitCell, UffOptimizer};
use glam::DVec3;

// Define atoms
let atoms = vec![
    Atom::new(6, DVec3::new(0.0, 0.0, 0.0)),
    Atom::new(6, DVec3::new(1.5, 0.0, 0.0)),
];
// Define bonds
let bonds = vec![Bond { atom_indices: (0, 1), order: 1.0 }];
// Setup system
let mut system = System::new(atoms, bonds, UnitCell::new_none());
// Optimize
UffOptimizer::new(100, 1e-2).optimize(&mut system);

Re-exports§

pub use atom::Atom;
pub use atom::Bond;
pub use atom::UffAtomType;
pub use cell::UnitCell;
pub use cell::CellType;
pub use forcefield::System;
pub use forcefield::EnergyTerms;
pub use optimizer::UffOptimizer;
pub use params::get_uff_params;
pub use params::element_symbol;

Modules§

atom
cell
forcefield
math
optimizer
params
spatial

Functions§

init_parallelism
Initializes the Rayon thread pool. If num_threads is Some(n), it sets that specific number. If num_threads is None, it checks RAYON_NUM_THREADS env var or defaults to 4.