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.

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=(abc)

For the general triclinic case:

a=(a,0,0)b=(bcosγ,bsinγ,0)c=(ccosβ,ccosαcosβcosγsinγ,cv)

where v ensures the correct volume.

Coordinate Transforms

Fractional → Cartesian:

rcart=MTf

Cartesian → Fractional:

f=(M1)Trcart

Volume

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

Periodic Boundary Conditions

Wrapping fractional coordinates into [0,1):

fwrapped=ff

Minimum image distance under periodicity:

Δf=Δfround(Δf)d=|MTΔf|

Supercell Generation

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

fijk=f0+(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, etc.)
  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. Build crystal: Combine all atoms with fractional coordinates into a CrystalStructure

Topologies

TopologyCoordinationNodesEdgesDescription
pcu613Primitive cubic — octahedral nodes
dia424Diamond — tetrahedral nodes
sql412Square lattice — square planar nodes

SBU Types

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

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

Linear Linker: A bridging unit connecting two metal nodes.

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

Rodrigues Rotation

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

R(v)=vcosθ+(k^×v)sinθ+k^(k^v)(1cosθ)

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::{create_unit_cell, assemble_framework};

let cell = create_unit_cell(10.0, 10.0, 10.0, 90.0, 90.0, 90.0);
let crystal = assemble_framework("Zn", "BDC", "pcu", &cell);

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 Zn --geometry octahedral

Python

python
import sci_form
cell = sci_form.unit_cell(10.0, 10.0, 10.0, 90.0, 90.0, 90.0)
print(cell.volume())       # 1000.0
print(cell.parameters())   # (a, b, c, alpha, beta, gamma)

crystal = sci_form.assemble_framework("pcu", 10.0, "Zn", "octahedral")
print(crystal.num_atoms())

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

Released under the MIT License.