Expand description
Safe calls into the d-SEAMS C API.
d-SEAMS classifies the molecules of a simulation frame. This crate gives Rust programs its analyses: CHILL and CHILL+ ice labels, Steinhardt order parameters, primitive rings, cages, radial distribution functions, hydrogen bonds, topological fingerprints and planar brine fronts.
The crates.io package is dseams. The library keeps the name seams,
so code says use seams::System.
§Quick example
Coordinates and cutoffs are in angstroms. This program classifies the
eight-atom cubic ice cell that diamond8 returns:
let (xyz, edge) = seams::diamond8();
seams::set_num_threads(1)?;
let mut system = seams::System::new()?;
system.set_ortho(&xyz, edge, edge, edge)?;
assert_eq!(system.count(), 8);
let ice = system.chill_plus(&seams::ChillOptions::default())?;
assert_eq!(ice.counts[seams::Label::Cubic as usize], 8);
let orders = system.q4q6(3.5)?;
assert!(orders.q6.iter().all(|value| value.is_finite()));§How the crate is organised
A System holds one frame. System::set_ortho, System::set_frame,
System::set_atoms and System::read fill it, and every analysis is
a method on it. A cell is nine numbers in the LAMMPS order: origin, edge
lengths, then the tilts xy, xz and yz.
- Ice labels:
System::chillandSystem::chill_plusreturn aClassificationindexed byLabel. They takeChillOptions. - Order parameters:
System::q4q6,System::steinhardt,System::qlandSystem::q6bar. - Structure:
System::neighboursgivesNeighbours,System::ringsgivesRings, andSystem::cagesgivesCages.System::signature_cagescounts closed cages by ring signature. - Periodic geometry:
System::voronoigivesVoronoiCells. - Distributions and bonds:
System::rdf,System::running_cn,System::density,System::hbondsandSystem::directed_hbonds.HbondLifetimeAccumulatorfollows ordered or unordered bond pairs across frames. - Topology:
System::fingerprint,System::prismsandSystem::domains. - Ice fronts in brine:
System::brinegivesBrine.
Analyses with several settings take an options struct that implements
Default, so you change only the fields you need. Neighbour lists and
rings can be iterated.
§Errors, ownership and threads
Every call that can fail returns Result<T, Error>. An
Error carries the engine’s message and, when the crate names it, a
Status. Each handle (System, Neighbours, Rings, Cages,
Fingerprint, Brine and VoronoiCells) owns a native object and frees it in
Drop.
A handle may move to another thread (Send). It is not Sync,
because the C library requires exclusive use of a handle. Separate
handles may run the Steinhardt calls on separate threads. The OpenMP
width set by set_num_threads is process-global.
§Choosing a libseams
The dseams-sys build script links the shared libseams in the
directory named by SEAMS_LIBDIR when that variable is set. Otherwise it
uses the bundled feature, which compiles the engine from source and
reads LAMMPS dumps and XYZ files, or an installed library found through
pkg-config. A bundled build also enables chemfiles and readcon-core when
pkg-config finds them. has_chemfiles and has_readcon report the
linked engine’s readers. cargo add dseams --features bundled is the
shortest way to a working build.
The raw C declarations are re-exported as ffi.
§Learn more
The book has a getting-started page and tutorials that run the analyses on real frames. The engine book covers the science behind each analysis.
Re-exports§
pub use seams_sys as ffi;
Structs§
- Bond
Options - Knobs for a hydrogen-bond count.
- Brine
- Owned planar ice-front measurement.
- Brine
Fronts - The two planar crossings of an ice slab.
- Brine
Options - Knobs for a planar ice front.
- Brine
Profile - Concentration profile along the brine axis.
- Cage
Counts - Disjoint cage populations.
- Cage
Options - Knobs for hexagonal and double-diamond cages.
- Cages
- Owned hexagonal and double-diamond membership.
- Chill
Options - Knobs for CHILL and CHILL+.
- Classification
- CHILL or CHILL+ labels and the nine population counts.
- Contacts
- Mutual nearest unlike contacts of a site table.
- Density
Options - Knobs for the axial number density.
- Density
Profile - Number density along one cell axis.
- Directed
Bond Options - Geometric settings for a directed donor–hydrogen–acceptor bond.
- Directed
Hbond - One directed hydrogen bond in frame order.
- Distribution
- Partial radial distribution.
- Distribution
Options - Knobs for a partial RDF, its running coordination, or the integral.
- Domain
Options - Knobs for a domain search.
- Domain
Report - Largest polar or apolar domain.
- Fingerprint
- Owned topological fingerprint.
- Fingerprint
Options - Knobs for a topological fingerprint.
- Hbond
Lifetime Accumulator - Streaming native accumulator for consecutive saved frames.
- Hbond
Lifetime Curve - Correlation of starting hydrogen-bond pairs and their continuous survival.
- Hbond
Lifetime Fit - Native integrated and single-exponential hydrogen-bond decay times.
- KnnOptions
- Knobs for a k-nearest neighbour list.
- Neighbour
Options - Knobs for a neighbour list.
- Neighbour
Pair - One directed neighbour pair. The self entry is omitted.
- Neighbour
Pairs - Iterator of directed neighbour pairs.
- Neighbours
- Owned neighbour list.
- Order
Options - Knobs for q_l on a named graph.
- Pockets
- Brine pockets trapped in the ice.
- Prism
Census - Perfect and imperfect prism counts by ring size.
- Prism
Options - Knobs for prism stacks.
- Q4Q6
- Local q4 and q6 on the cutoff shell.
- Q6Bar
- Lechner-Dellago q6-bar and the ice count above a cut.
- Q6Bar
Options - Knobs for the q6-bar ice summary.
- Rejection
- Molal rejection coefficient.
- Ring
Iter - Iterator of primitive rings. Each item is a
Resultof vertex indices. - Ring
Options - Knobs for primitive rings.
- Rings
- Owned primitive-ring set.
- Running
Coordination - Running coordination number along a partial RDF.
- Sheet
Options - Knobs for a monolayer ring histogram.
- Signature
Match - Closed cages whose ring census matches a signature.
- Signature
Options - Knobs for a signature cage census.
- Steinhardt
- Local Steinhardt parameter, and the average when it was requested.
- Steinhardt
Options - Knobs for a local Steinhardt parameter on the cutoff shell.
- System
- One frame: coordinates, a cell, and the analyses that read them.
- Voronoi
Cells - An owned periodic Voronoi tessellation.
- Voronoi
Face - An image-resolved face of a periodic Voronoi cell.
- Voronoi
View - Borrowed geometry of every cell, in frame order.
Enums§
- Axis
- Cell axis.
- Cage
Label - Per-atom cage membership. The four codes are disjoint.
- Chill
Rule - CHILL+ threshold table.
- Domain
Subset - Domain subset. The values match the C API.
- Error
- A failed call. The message is
seams_handle_errorwhen the call had a handle. - Graph
- Neighbour graph.
- Label
- CHILL and CHILL+ atom label.
Classification::counts[label as usize]is the population. - Ring
Symmetry - Primitive-ring symmetry class.
- Site
Kind - Site-table kind.
- Status
- Status codes. The numeric values match
seams_status.
Functions§
- abi
- ABI number compiled into this library. The value is 1.
- diamond8
- Eight-atom cubic diamond used by the crate examples.
- has_
chemfiles - Whether the linked engine reads formats provided by chemfiles, including PDB and GRO.
- has_
readcon - Whether the linked engine reads
.confiles through readcon-core. - label_
name - Short name of a CHILL+ label.
- nframes
- Count frames in a trajectory path.
- num_
threads - OpenMP width the next call will use.
- ring_
symmetry_ name - Short name of a ring-symmetry code.
- set_
num_ threads - Set the OpenMP width for the next call. Zero restores the library default.
- version
- Library version text, for example
2.14.1.