Skip to content

Materials Assembly ​

sci-form supports assembly of Metal-Organic Frameworks (MOFs) and other crystalline structures from Secondary Building Units (SBUs) and topological blueprints. This module handles periodic unit cells, coordination geometries, and framework construction.

The reference, measured deviation, confidence region and limitations for this method are recorded in Scientific validation.

Unit Cell and Lattice Vectors ​

Lattice Parameters ​

A crystallographic unit cell is defined by six parameters:

ParameterSymbolDescription
a,b,cLengthsEdge lengths in Ångströms
αAngleAngle between b→ and c→
βAngleAngle between a→ and c→
γAngleAngle between a→ and b→

Lattice Matrix ​

The lattice vectors are stored as rows of a 3×3 matrix M:

M=(a→b→c→)

For the general triclinic case:

a→=(a,0,0)b→=(bcos⁡γ,bsin⁡γ,0)c→=(ccos⁡β,ccos⁡α−cos⁡βcos⁡γsin⁡γ,c⋅v)

where v ensures the correct volume.

Coordinate Transforms ​

Fractional → Cartesian:

r→cart=MT⋅f→

Cartesian → Fractional:

f→=(M−1)T⋅r→cart

Volume ​

V=a→⋅(b→×c→)=det(M)

Periodic Boundary Conditions ​

Wrapping fractional coordinates into [0,1):

f→wrapped=f→−⌊f→⌋

Minimum image distance under periodicity:

Δf→=Δf→−round(Δf→)d=|MT⋅Δf→|

Supercell Generation ​

A (na×nb×nc) supercell replicates atoms at:

f→ijk=f→0+(i,j,k)(na,nb,nc),i∈[0,na),j∈[0,nb),k∈[0,nc)

Lattice vectors scale: a→′=naa→, etc.

Framework Assembly ​

Assembly Pipeline ​

  1. Select topology: Define node positions and edge connectivity (pcu, dia, sql, or an RCSR net from topology_data)
  2. Place metal nodes: Position SBU at each topology vertex with appropriate coordination geometry
  3. Orient linkers: Use Rodrigues rotation to align linker SBUs along each edge direction
  4. Select linker per edge type: Inequivalent edges can use different linker SBUs
  5. Build crystal: Combine all atoms with fractional coordinates into a CrystalStructure

Topologies ​

Built-in homogeneous nets (Topology::pcu/dia/sql/...) and data-driven RCSR nets share the same assembler. Topology::from_name accepts both, and Topology::from_net converts a topology_data::NetData entry into the symmetry-expanded graph used by assembly.

TopologyCoordinationNodesEdgesDescription
pcu613Primitive cubic — octahedral nodes
dia424Diamond — tetrahedral nodes
sql412Square lattice — square planar nodes
bcu828Body-centred cubic
fcu12424Face-centred cubic
nbo424NbO net — square-planar nodes
kgm436Kagomé lattice
hxl613Hexagonal lattice
pillared_sql613Pillared square lattice
acs626RCSR net (P6₃/mmc)
afw4918RCSR net with two edge types
sod41224Sodalite net
pts448PtS net (data-driven expansion)
xah5 / 449RCSR net with two edge types
tfy4 / 3184288Large RCSR net with two edge types

Nodes/edges are the symmetry-expanded counts in one unit cell.

SBU Types ​

Metal Node: A central metal atom with connection points arranged in the specified coordination geometry.

rust
let node = Sbu::metal_node(30, 2.0, CoordinationGeometry::Tetrahedral);

The first argument is the atomic number (30 = Zn).

Linear Linker: A bridging unit connecting two metal nodes.

rust
let linker = Sbu::linear_linker(&[6, 6, 6], 1.4, "BDC");

Elements are atomic numbers (6 = C).

Rodrigues Rotation ​

Linkers are oriented from the default x^ direction to the edge direction using the Rodrigues rotation formula:

R(v→)=v→cos⁡θ+(k^×v→)sin⁡θ+k^(k^⋅v→)(1−cos⁡θ)

where k^ is the rotation axis (normalized cross product of x^ and the target direction) and θ is the angle between them.

API ​

Rust ​

rust
use sci_form::materials::{CoordinationGeometry, Sbu, Topology, UnitCell};

let cell = UnitCell::cubic(10.0);
let node = Sbu::metal_node(30, 2.0, CoordinationGeometry::Octahedral);
let linker = Sbu::linear_linker(&[6, 6], 1.4, "carboxylate");
let topology = Topology::pcu();

let crystal = sci_form::assemble_framework(&node, &linker, &topology, &cell);
println!("{} atoms", crystal.num_atoms());

For nets with inequivalent edges, pass one linker per edge type:

rust
let topology = Topology::from_name("xah")?;
let linkers = [
    Sbu::linear_linker(&[6], 1.4, "short"),
    Sbu::linear_linker(&[7], 1.2, "long"),
];
let crystal =
    sci_form::assemble_framework_with_linkers(&node, &linkers, &topology, &cell);

Edge i uses linkers[topology.edge_types[i]]. If the linker list is shorter than the type index, the last linker is reused. Topologies without edge_types (older serialized data) default to type 0.

CLI ​

bash
# Unit cell info
sci-form cell --a 10 --b 10 --c 10 --alpha 90 --beta 90 --gamma 90

# Framework assembly
sci-form assemble --topology pcu --a 10.0 --metal 30 --geometry octahedral

Python ​

python
import sci_form

cell = sci_form.create_unit_cell(10.0, 10.0, 10.0, 90.0, 90.0, 90.0)
print(cell.volume)

# topology, metal (atomic number), geometry, lattice_a, supercell
crystal = sci_form.assemble_framework("pcu", 30, "octahedral", 10.0, 1)
print(crystal.num_atoms)

Python and WASM currently expose the single-linker wrapper; the multi-linker assembler is available from Rust.

Validation ​

  • Cubic cell: Volume =a3, all angles 90°
  • Coordinate roundtrip: frac → cart → frac recovers original
  • PBC wrapping: All fractional coords in [0,1) after wrapping
  • Minimum image: Distance is always ≤ half the cell diagonal
  • Supercell scaling: (2×2×2) supercell has 8× the atoms
  • Extended nets (F67): node counts, coordination and edge-type counts match pormake's .cgd data
  • Multi-edge assembly: unit tests in materials::assembly check that xah uses the linker selected by each edge_types entry

Released under the MIT License.