Skip to content

sci-form reuse audit and port plan ​

Source: sci-form commit 6b78c7aa427519cb7f67d26c781a3f8e01117552, crate version 1.0.0, MIT, MSRV 1.89. The line counts below were checked against the source on 2026-11-08; the roadmap table is still accurate.

Inventory ​

SourceLinesPublic surface checkedTestsPlan
materials/cif.rs708reader, loop/table parser, writer9Port into xtalforge-io::cif; split into tokenizer, loop parser, item resolver and writer.
materials/cell.rs1048lattice, supercell, PXRD, symmetry expansion, porosity helpers14Split across core, analysis and symmetry; do not port as one file.
materials/space_group_table.rs6750static tables and lookups2Do not port; replaced by moyo. Keep tests as extra checks.
materials/space_groups.rs273operation helpers6Do not port; replaced by moyo.
materials/scattering_factors.rs396Cromer-Mann coefficients3Port into xtalforge-analysis::pxrd; coefficients to data/.
materials/assembly.rs829SBU assembly and topology helpers19Study for the MOF builder; the PORMAKE path in Crystal-Builder is the reference.
materials/sbu.rs257SBU records2Study; data to data/ if used.
materials/topology_data.rs734topology tables1Study; data to data/ if used.
materials/geometry_opt.rs661geometry optimizer7Port into xtalforge-ff::optimize; split.
materials/variable_cell.rs501variable-cell relaxation5Port into xtalforge-ff::optimize; split.
forcefield/uff.rs513UFF terms and calculator8Compare with Crystal-Builder ff/uff/; port the better-tested parts.
forcefield/params.rs391UFF parameters3Parameters to data/; loader tested.
forcefield/atom_typer.rs247UFF atom typing4Compare with Crystal-Builder typer; port the reference behaviour.
forcefield/minimizer.rs222L-BFGS wrapper3Port into xtalforge-ff::optimize with cancellation and progress.
charges_eeq/*2928EEQ/EEQBC charges and data12Port EEQ as an extra charge method; eeqbc_data.rs becomes a data file.
smiles.rs875SMILES parser11Port into xtalforge-build::smiles; split.
graph.rs627molecular graph9Port into xtalforge-build::smiles; split.
stereo.rs1121stereochemistry10Port into xtalforge-build::smiles; split.
rings/sssr.rs568SSSR ring perception7Port into xtalforge-core::rings; make periodic-aware and split.
rings/aromaticity.rs219aromaticity4Port into xtalforge-core::rings.
periodic.rs399element data5Port into xtalforge-core::elements; data to data/.
surface/sasa.rs335accessible surface4Port into xtalforge-analysis as an optional helper.
kmesh.rs1094k-point meshes17Study for phonon DOS (Task 4.8.3).
fd_gradient.rs86finite-difference gradient check2Port as a test helper.
xtb/, eht/, pm3/, conformer.rs, etkdg.rslargequantum and embedding enginesmanyDo not port; use through the optional sci-form feature.

Quality gate for every port (Task 0.4.2) ​

  1. Read the complete source file and list its public functions.
  2. Remove unwrap, expect and panics on input; return typed errors.
  3. Adapt to our types, units and error codes.
  4. Translate any non-English text (none found in the first scan on 2026-11-08; accented author names such as Rappé are allowed).
  5. Split under 500 lines with a written split plan.
  6. Keep or recreate the tests; add the origin comment and the THIRD_PARTY.md entry.

Overlap with Crystal-Builder (Task 0.4.3) ​

AreaCrystal-Buildersci-formReference for golden data
CIFgemmi-based reader/writerown parserCrystal-Builder behaviour; sci-form code base
PXRDanalysis/pxrd.py and materials/scattering_factors.rsmaterials/cell.rs helpersCrystal-Builder output
UFFff/uff/forcefield/uff.rsCrystal-Builder unless sci-form is proven more accurate on the corpus
Porositygrid and Zeo++cell helpersCrystal-Builder
Ringsperiodic core/rings.pySSSR in rings/Crystal-Builder periodic rings; sci-form algorithm adapted
MOF assemblyvendored PORMAKEmaterials/assembly.rsPORMAKE in Crystal-Builder

Crystal-Builder is the default reference because xtalforge must reproduce it. A sci-form implementation replaces it only where a corpus comparison proves it more accurate, and the choice is recorded in the algorithm page.

sci-form feature policy (Task 0.4.4) ​

  • Dependency: sci-form = "1" from crates.io, optional, never a path dependency, so published crates build.
  • Scope: xTB, EHT and PM3 quantum methods only. Crystal-related code is ported into our crates, not pulled through this dependency.
  • Boundary: sci-form types are converted to ours in one private module; no sci-form type appears in the public API.
  • Surfaces: the feature is available in the Rust API and CLI; Python wheels may include it as an opt-in build; it is disabled in the default WASM build for size and because the engines need threads and external data.
  • Default: off everywhere; the default build stays pure Rust.
  • Validation: the sci-form feature links the published crate and the quantum tests check finite water energies, conservative GFN2 forces and the refusal paths. A cross-check against a real xtb binary is not run here because the binary is not installed; the external-engine tests elsewhere use simulated executables.