Skip to content

Conformer

3D conformer generation from a molecular graph. Conformer takes an Atomistic (typically from a SMILES / BigSMILES parse, which carries no coordinates) and returns a structure with embedded 3D positions, using the molrs backend. Available via import molpy as mp (mp.conformer.Conformer).

Quick reference

Symbol Summary Preferred for
Conformer Generate 3D coordinates for a graph Turning a parsed graph into a 3D structure
ConformerReport Per-run summary of the generation pipeline Inspecting which stages ran / succeeded
ConformerStageReport Single-stage record within a report Debugging a specific embedding stage
  • Builderprepare_monomer / generate_3d wrap conformer generation into the monomer-preparation flow.

Full API

conformer

3D conformer generation for molpy molecules (molrs-backed).

:class:Conformer subclasses :class:molrs.Conformer and overrides :meth:Conformer.generate to marshal :class:molpy.Atomistic across the molrs boundary: it folds formal charges into the form the molrs pipeline expects, runs the inherited Rust generator, and re-adopts the result as a molpy graph-backed Atomistic. The heavy lifting — fragment / distance-geometry build, energy minimisation, rotor search, stereo guard — runs inside molrs.

The report types are inherited verbatim from molrs (re-exported here, not re-declared). The optional RDKit backend (:mod:molpy.adapter.rdkit) remains available as a separate external adapter.

Conformer

Bases: Conformer

3D conformer generator for molpy molecules.

Subclasses :class:molrs.Conformer; the constructor parameters (speed, add_hydrogens, seed) are inherited unchanged. Only the molpy-side marshalling in :meth:generate is added.

Examples:

>>> from molpy.parser import parse_molecule
>>> mol = parse_molecule("CCO")
>>> mol_3d, report = Conformer(seed=42).generate(mol)
>>> mol_3d.n_atoms   # heavy atoms + added hydrogens
9
generate
generate(mol)

Generate 3D coordinates, returning a fresh molpy Atomistic.

mol is already a molrs graph (Atomistic is-a molrs.Graph), so the inherited Rust generator embeds it directly — no translation. molrs reads the canonical integer "formal_charge" key for valence filling ([N+] / [N-] hydrogen counts); the parsers emit that key, so a charged input must already carry it. molrs clones the graph internally, so the input is not mutated.

Parameters:

Name Type Description Default
mol Atomistic

Input molecular graph. Element symbols and bond orders are required; coordinates may be missing.

required

Returns:

Type Description
Atomistic

A tuple of the generated structure (a molpy Atomistic) and the

ConformerReport

per-stage :class:molrs.ConformerReport.

Raises:

Type Description
ValueError

If mol has no atoms.