Skip to content

Periodic molecules and space groups ​

sci-form exposes the 230 International Tables for Crystallography (ITC) space groups and a periodic molecular-graph builder. Together they cover the two common entry points for crystal data: symmetry metadata and an explicit fractional-coordinate geometry with bonds across cell boundaries.

flowchart LR
    A["ITC number or Hermann–Mauguin symbol"] --> B[SpaceGroup lookup]
    B --> C["number · symbol · crystal system<br/>lattice type · point group · operations"]
    C --> D["generate_equivalent_positions(site)<br/>(Rust)"]
    E["elements + fractional coords + cell"] --> F[frac_to_cart]
    F --> G["pair distances over images<br/>(-1,0,+1)³"]
    G --> H["bonds with image + distance + order"]
    H --> I[PeriodicMolecule]

Space groups ​

The catalogue contains all 230 ITC groups. Each SpaceGroup record has:

FieldMeaning
numberITC number 1..=230
symbolHermann–Mauguin symbol, e.g. P 21/c
crystal_systemtriclinic, monoclinic, orthorhombic, tetragonal, trigonal, hexagonal or cubic
lattice_typeprimitive, body-centred, face-centred, base-centred, …
point_grouppoint-group symbol
operationsgeneral-position rotation/translation pairs

Lookup contracts:

  • space_group_by_number(n) returns None/JSON null for integers outside 1..=230; fractional, NaN or infinite numbers are input errors (ValueError / {"error": ...}).
  • space_group_by_symbol(s) ignores spaces (P21/c and P 21/c are the same) but is case-sensitive; unknown symbols return None/null.
  • all_space_groups() returns all 230 (number, symbol) pairs with unique numbers and unique symbols; every symbol round-trips to its number.

SpaceGroup::generate_equivalent_positions(site) applies every operation to a fractional site, wraps duplicate positions across the cell boundaries and deduplicates with a 1e-4 fractional tolerance. It is available in Rust only; the Python/WASM surfaces expose the lookup records, not the expansion helper.

Periodic molecules ​

build_periodic_molecule takes atomic numbers, fractional coordinates and a unit cell (a, b, c, α, β, γ) in Å/degrees:

  1. Fractional coordinates are converted to Cartesian coordinates.
  2. Every atom pair is checked over the 27 neighbouring images (-1, 0, +1)³ using covalent radii plus bond_tolerance.
  3. A bond is kept when 0.4 Å < d < r_i + r_j + tolerance. Transition-metal pairs use 0.3 × tolerance to suppress spurious long contacts.
  4. Bond order is assigned from the distance ratios (DOUBLE below 0.85 × (r_i + r_j), TRIPLE below 0.75 ×, otherwise SINGLE).
  5. Each bond records atom_i, atom_j, the periodic image and the measured distance in Å.

bond_tolerance is extra tolerance in Å:

SurfaceOmitted / None0.0
Rustengine default 0.3 Åno extra tolerance
Python0.3 Åno extra tolerance
WASMrequired argumentno extra tolerance

The WASM surface takes the tolerance explicitly, so 0.0 never selects the engine default there.

Measured example ​

For a cubic 5 Å cell with carbon at fractional (0, 0, 0) and (0.34, 0, 0):

text
cart_coords = [[0, 0, 0], [1.7, 0, 0]]
bond        = atom 0–1, image [0,0,0], distance 1.7000000000000002 Å, SINGLE
tolerance 0 → no bond

Validation rejects empty geometries, element/coordinate count mismatches, non-finite coordinates, elements outside Z=1..=118, a degenerate cell (including non-positive lengths or angles outside (0°, 180°)) and a negative or non-finite tolerance.

Limits ​

  • The builder does not expand a space group into a full unit cell; use the symmetry operations or CIF atom sites for that.
  • Only the (-1, 0, +1) image range is searched. Very long bonds or cells that place a bonded neighbour beyond one cell are not perceived.
  • Bond orders are distance heuristics for visualisation and topology, not a quantum-chemical bond-order calculation.
  • The space-group catalogue is the ITC standard setting; alternative settings are not exposed.

Surfaces ​

SurfaceEntry points
Rustmaterials::space_groups::{space_group_by_number, space_group_by_symbol, all_space_groups}, periodic::build_periodic_molecule
Pythonspace_group_by_number, space_group_by_symbol, all_space_groups, build_periodic_molecule
WASMspace_group_by_number, space_group_by_symbol, all_space_groups, build_periodic_molecule
CLIspace-group, all-space-groups, periodic-molecule

See the Rust API, Python API and TypeScript API for the per-surface signatures, and CIF I/O for file parsing.

Released under the MIT License.