Skip to content

Benchmark reconstruction from Molfile or SDF

Reconstruct from the coordinates already in a molecular file, then compare the result with its stored graph. The example uses a metal complex from the fixture directory. 简体中文

Run one structure

From the repository root, activate the benchmark environment and run the molybdenum complex MoNNMo.sdf.

source .venv-benchmark/bin/activate
python -m benchmarks.molfile_xyz_benchmark.run \
  --input tests/data/sdf/MoNNMo.sdf --limit 1 \
  --out benchmarks/_runs/molfile-demo

In the output directory, results.csv has seven rows for the same case_idx, one per method. Read evaluator_decision for the outcome and error for details of a failed attempt. The file summary.csv groups counts and timings by method. CSV fields and denominators

Run a directory of files

Set --input to a directory to scan it recursively. The runner collects .mol, .molfile, and .sdf files, sorts by path, then applies --limit. This example takes up to five files.

python -m benchmarks.molfile_xyz_benchmark.run \
  --input tests/data/sdf --limit 5 \
  --out benchmarks/_runs/molfile-first-five

Each file contributes one case. For a multi-record SDF, the runner reads the first record. Use a separate file for each structure to compare them individually.

Coordinates and reference graph

  1. RDKit reads the source molecule, preserves explicit hydrogens, and checks for conformer coordinates. The reader uses sanitize=False, removeHs=False, and strictParsing=False.
  2. The runner derives total formal charge and radical-electron count from the source and converts its coordinates to XYZ. Each method reconstructs from those coordinates. The RDKit graph from the same file is the reference.
  3. An unreadable file or missing conformer produces a skipped record for each method. Look up the case ID in the per-case results for the reason. Input preparation