Usability helpers (Phase 11)
These helpers close the audit findings without changing the 1.x API.
One-call IO
read(path)reads a structure from disk, detects the format from the extension or content and returns aReadResult { structure, warnings }.read_str(text, hint)is the text variant;hintmay be empty for content sniffing.write(path, &structure)chooses the writer from the path extension and uses the atomic writer.- Python exposes
read(path)andwrite(path, text, format_hint=""); WASM exposesread(text, hint)(no filesystem).
Threads and errors
set_threads(threads)installs the process-wide Rayon pool; the Rust entry point isset_global_threads(threads). The CLI--threadsuses a scopedParallelOptionspool, the RustParallelOptions::installdoes the same for a single call. WASM records the browser-thread exception.error_category(code)maps a stable code toinput,unsupported,numerical,limit,engineorinternal. Every crate error also exposesError::category(), and the CLI/WASM error objects carrycategory.StructureWarningis the structured warning type (code,message,atoms,fields,hint);Structure::warnings()collects it from the reader metadata and everyStructureSummaryincludes it.deprecation_warning(name, replacement)emits aDeprecationWarningin Python and aconsole.warnin WASM; the Rust/CLI helper isxtalforge_core::warn_deprecated. Seedocs/guide/deprecation.md.
Molecules, sketches, fragments, guests
molecule_from_smiles(smiles, seed=7, iterations=1500)parses and embeds a molecule in 3D. CLIxtalforge molecule --smiles ….sketch_roundtrip(smiles)parses a sketch and writes it back as the canonical depth-first SMILES. CLIxtalforge sketch.fragment_library()lists the embedded fragments,fragment_names()is the name list, andfragment_structure(name)embeds one. CLIxtalforge fragment [NAME].substitute_structure(text, index, element)replaces one asymmetric site after the clearance rules. CLIxtalforge substitute.place_guest_structure(host, guest, offset, clearance)places a guest molecule after a periodic clearance check. CLIxtalforge guest.- WASM names are the same with
_infofor object-returning results (fragment_info,substitute_info,place_guest_info).
The option spellings on every surface are in docs/api/naming.md.
