Skip to main content

Crate molar_ff

Crate molar_ff 

Source
Expand description

Force-field atom typing, partial charges, and Amber mechanics for MolAR.

This crate assigns GAFF and GAFF2 atom types to a molecule. Typing is exposed through the ApplyFF trait, which is blanket-implemented for every MolAR object that exposes atoms and bonds — System, Topology, and the bound selection types.

use molar::prelude::*;
use molar_ff::{ApplyFF, FFType};

let mut sys = System::from_file("ligand.sdf")?;
sys.apply_ff(FFType::Gaff)?;                                  // whole system
sys.select_bound_mut("resname LIG")?.apply_ff(FFType::Gaff)?; // just a selection

§Input requirement

Molecules must already carry bond orders (SDF/mol2). Inputs without bond orders (PDB/GRO) return FFError::MissingBondOrders — ApplyFF does not perceive bond orders itself. To type such an input, run the opt-in PrepareForFF::prepare_for_ff first: it perceives connectivity, bond orders, charges, and (optionally) hydrogens, then the strict typing/charging operations apply.

amber::BondedModel assigns bonded parameters automatically and evaluates Amber bond, angle, proper, and improper energies and analytic forces. Missing parameters use bundled Amber correspondence rules; unresolved terms are errors. amber::AmberModel adds cutoff LJ/Coulomb interactions and an L-BFGS optimizer.

Modules§

amber
Amber mechanics, automatic GAFF/GAFF2 parameter completion, and minimization.
charge
Espaloma-charge partial charges from a fixed graph neural network.

Structs§

PrepareOptions
How to prepare a molecule for force-field typing and charging.

Enums§

ChargeError
Errors returned by ApplyCharges::apply_charges.
ChargeModel
The partial-charge model used by ApplyCharges::apply_charges.
FFError
Errors returned by ApplyFF::apply_ff.
FFType
The force field whose atom types should be assigned.

Traits§

ApplyCharges
Assign partial charges, writing the result into each atom’s charge.
ApplyFF
Assign force-field atom types, writing the result into each atom’s type_name.
PrepareForFF
Prepare a molecule for the strict ApplyFF / ApplyCharges operations (see the module docs).