Skip to content

Migration guide from Crystal-Builder ​

The headless core of Crystal-Builder (xtal/, about 95,000 lines) is the behavioural reference. xtalforge ports it to Rust and exposes the same work on four surfaces. This page maps each module and command and records the differences that will bite a script.

Modules ​

Crystal-Builder (xtal/)xtalforgeNotes
core/elements.py, core/pyykko.pyxtalforge-core (elements, data)same element table, one JSON bundle
core/lattice.py, core/structure.pyxtalforge-core (lattice, structure)fractional [f64; 3]; Angstrom/degrees at the API
core/p1.pyxtalforge-core::p1provenance kept on every expanded atom
core/supercell.py, core/slab.pyxtalforge-core and xtalforge-commandscommands are undoable documents
core/neighbors.py, core/bonds.py, core/rings.pyxtalforge-corelinked-cell neighbors; periodic rings keep images
core/groups.py, core/measure.pyxtalforge-coregroup finder and measures
io/xtalforge-ioformat registry, project zip, trajectories
symmetry/xtalforge-symmetrymoyo backend; our own dataset types
ff/xtalforge-ffUFF/UFF4MOF, QEq/EQeq/EEQ, Ewald, FIRE/L-BFGS, vibrations, engines
ff/ase_engine.py, ff/mace, ff/orb, ff/mattersimPython MlCalculatorPython bridge, not native Rust
builder/ (or build/)xtalforge-buildmolecules, carbon, polymers, hydrogens, fragments
mof/ (PORMAKE port)xtalforge-mofcurated topology/block subset, not the full database
analysis/ (PXRD, grids, porosity, nets)xtalforge-analysisRCSR index embedded
powder/ (indexing, Le Bail, Pawley, Rietveld)xtalforge-analysis (modules indexing, lebail, pawley, rietveld) and xtalforge powder ...there is no separate powder crate; refinement ranks are documented per page
modules/, workspace/xtalforge-moduleson-disk runs and reports
agent/xtalforge-agentverbs, session, diagnostics, MCP, skill
plugins.pyxtalforge registries and Python Pluginsno global loader
cli.pyxtalforge-clisame operations, --json on every command
xtalapp/ (PySide6 + VTK)out of scopeno GUI; xtalforge-view + the agent renderer

CLI commands ​

Crystal-BuilderxtalforgeNotes
infoxtalforge infosummary; --json is the structured form
renderxtalforge renderSVG or PNG, orthographic; no VTK, no labels
capabilitiesxtalforge capabilitiesruntime features, engines, bundles, formats, verbs
skill`xtalforge skill pathlist
mcpxtalforge mcpJSON-RPC over stdio; no window proxy
symmetryxtalforge symmetry ...detect, standardize, primitive, subgroups, k-path
convertxtalforge convertloss warnings become errors with --strict
bondsxtalforge bondsgraph with periodic images
typesxtalforge ff typesUFF atom types and confidence
formatsxtalforge formatsregistry and capabilities
modulesxtalforge-modules Rust APIno CLI command; the registry, jobs and run records are library-only
enginesxtalforge ff enginesprobe result per engine
runxtalforge scriptJSON command list, undoable
buildersxtalforge build ..., xtalforge mof ...names differ; --help lists the options
agentxtalforge agent script.jsonone process, one session

Agent verbs ​

Crystal-Builder's agent calls Python methods; xtalforge calls verbs by name. The workflow maps one to one:

Crystal-Builder agentxtalforge verb
session.openload
session.infoinfo
session.warnings/diagnosticsdiagnostics
session.supercellsupercell
session.wrapwrap
session.add_hydrogenshydrogens
session.optimizeoptimize
session.symmetrysymmetry
session.pxrdpxrd
session.porosityporosity
session.uffuff_energy
session.renderrender
session.undo/redoundo/redo
change loghistory, changes
capabilitiescapabilities

Behavioural differences ​

  • Units. Angstrom and degrees at every boundary; eV, eV/Angstrom and GPa for energies, forces and stress. Crystal-Builder's UFF internals are kcal/mol; the conversion happens inside the UFF model.
  • Errors. Every error has a stable code(); the CLI prints it in JSON and uses exit code 3, Python raises XtalforgeError with the code as the first argument, WASM throws an object with code.
  • No panics on user input. A malformed file or an impossible option is a typed error. A panic is a bug.
  • Determinism. The same input and options give the same output independent of thread count. Randomised builders take an explicit seed.
  • Pictures. The renderer is a small orthographic rasteriser, not VTK. It has no transparency, ambient occlusion or text labels; it is meant for an assistant to see the model.
  • No window. The GUI, the window proxy and the mcp.json discovery are not ported. The MCP server is the transport.
  • Curated data. The MOF builder ships a small illustrative topology/block subset. The full PORMAKE database is an external bundle, not part of the crate.
  • Powder ranking. The automatic table ranks extinction classes by a Le Bail BIC and Pawley-fits every leading (cell, class); the 1 % Rwp tie rule orders it. Read docs/algorithms/ for the exact procedure.
  • Python-only ML. MACE, ORB-v3 and MatterSim run through ASE in Python; the Rust ml feature is a declared no-op.
  • MCP cancellation. Verbs are synchronous; a client that must stop one terminates the server. The size limits bound the work.

Moving a script ​

  1. Replace xtal imports with the Rust crate, the Python package or the CLI.
  2. Replace exceptions with the stable codes; do not parse the message.
  3. Replace VTK screenshots with render.
  4. Replace session method calls with verb names and JSON arguments.
  5. Check every unit at the boundary once; the internal units are not public.
  6. Run the same structure through info and diagnostics first; they catch most migration mistakes (wrong cell, lost symmetry, missing hydrogens).