use-bond 0.1.0

Chemical bond primitives for RustUse
Documentation
  • Coverage
  • 100%
    47 out of 47 items documented1 out of 1 items with examples
  • Size
  • Source code size: 32.35 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.29 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 3s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-chemistry
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-bond

Small chemical bond primitives for RustUse chemistry crates.

use-bond represents bond identity, kind labels, orders, atom endpoint references, participants, polarity labels, strength labels, optional displayable lengths, optional angle/reference labels, and lightweight descriptors. It stays structural and intentionally avoids molecular simulation, quantum chemistry, force fields, reactions, molecule parsing, and external chemistry formats.

What this crate provides

Item Purpose
Bond Chemical bond identity and optional metadata
BondKind Bond kind labels
BondOrder Bond order labels
FractionalBondOrder Rational fractional bond order
BondEndpoint Validated atom endpoint reference
BondParticipant Validated bond participant reference
BondLength Positive displayable bond length
BondPolarity Bond polarity labels
BondStrength Bond strength labels
BondDescriptor Lightweight descriptor or reference label
BondValidationError Structured validation errors

Installation

[dependencies]
use-bond = "0.1.0"

Quick Examples

Create a simple covalent bond

use use_bond::{Bond, BondKind, BondOrder};

let bond = Bond::new(BondKind::Covalent).with_order(BondOrder::Single);

assert_eq!(bond.kind(), BondKind::Covalent);
assert_eq!(bond.order(), Some(BondOrder::Single));

Create a bond between endpoint references

use use_bond::{Bond, BondEndpoint, BondKind, BondOrder};

# fn main() -> Result<(), Box<dyn std::error::Error>> {
let bond = Bond::between(
    BondEndpoint::new("O")?,
    BondEndpoint::new("H")?,
    BondKind::Covalent,
)
.with_order(BondOrder::Single);

assert_eq!(bond.endpoints().len(), 2);
assert_eq!(bond.to_string(), "O-H covalent bond (single)");
# Ok(())
# }

Attach lightweight descriptors

use use_bond::{Bond, BondKind, BondLength, BondPolarity, BondStrength};

# fn main() -> Result<(), Box<dyn std::error::Error>> {
let bond = Bond::new(BondKind::Hydrogen)
    .with_polarity(BondPolarity::Polar)
    .with_strength(BondStrength::Weak)
    .with_length(BondLength::new(190.0, "pm")?)
    .try_with_angle_label("donor-H-acceptor")?;

assert_eq!(bond.kind(), BondKind::Hydrogen);
assert_eq!(bond.length().map(ToString::to_string), Some(String::from("190 pm")));
# Ok(())
# }

Scope

  • Represents chemical bond identity, kind, order, endpoint references, participants, polarity, strength, optional displayable length, optional angle/reference labels, and descriptors.
  • Keeps endpoints as structural labels. It does not validate periodic-table membership or parse molecule formats.
  • Keeps bond length as a positive finite value with a caller-provided unit string. It does not convert units or perform dimensional analysis.
  • Uses rational fractional bond orders instead of floating-point enum payloads.
  • No molecular geometry.
  • No force-field calculations.
  • No orbital theory or quantum chemistry.
  • No electronegativity calculations.
  • No reactions or stoichiometry.
  • No molecule parsing.
  • No SMILES, InChI, MOL, SDF, PDB, or other external chemical file formats.
  • No runtime network access or external chemistry database.

Relationship to use-chemistry

use-bond is a focused child crate for chemical bond primitives. The use-chemistry umbrella crate reexports it alongside element, formula, compound, molecule, isotope, periodic-table, atomic-number, atomic-mass, and electron-shell helpers.