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:
| Field | Meaning |
|---|---|
number | ITC number 1..=230 |
symbol | Hermann–Mauguin symbol, e.g. P 21/c |
crystal_system | triclinic, monoclinic, orthorhombic, tetragonal, trigonal, hexagonal or cubic |
lattice_type | primitive, body-centred, face-centred, base-centred, … |
point_group | point-group symbol |
operations | general-position rotation/translation pairs |
Lookup contracts:
space_group_by_number(n)returnsNone/JSONnullfor integers outside1..=230; fractional,NaNor infinite numbers are input errors (ValueError/{"error": ...}).space_group_by_symbol(s)ignores spaces (P21/candP 21/care the same) but is case-sensitive; unknown symbols returnNone/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:
- Fractional coordinates are converted to Cartesian coordinates.
- Every atom pair is checked over the 27 neighbouring images
(-1, 0, +1)³using covalent radii plusbond_tolerance. - A bond is kept when
0.4 Å < d < r_i + r_j + tolerance. Transition-metal pairs use0.3 × toleranceto suppress spurious long contacts. - Bond order is assigned from the distance ratios (
DOUBLEbelow0.85 × (r_i + r_j),TRIPLEbelow0.75 ×, otherwiseSINGLE). - Each bond records
atom_i,atom_j, the periodicimageand the measured distance in Å.
bond_tolerance is extra tolerance in Å:
| Surface | Omitted / None | 0.0 |
|---|---|---|
| Rust | engine default 0.3 Å | no extra tolerance |
| Python | 0.3 Å | no extra tolerance |
| WASM | required argument | no 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):
cart_coords = [[0, 0, 0], [1.7, 0, 0]]
bond = atom 0–1, image [0,0,0], distance 1.7000000000000002 Å, SINGLE
tolerance 0 → no bondValidation 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
| Surface | Entry points |
|---|---|
| Rust | materials::space_groups::{space_group_by_number, space_group_by_symbol, all_space_groups}, periodic::build_periodic_molecule |
| Python | space_group_by_number, space_group_by_symbol, all_space_groups, build_periodic_molecule |
| WASM | space_group_by_number, space_group_by_symbol, all_space_groups, build_periodic_molecule |
| CLI | space-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.