Skip to content

MolGR

MolGR (Molecular Graph Reconstructor) is a chemical perception tool that reconstructs molecular graphs from 3D atomic coordinates under specified total charge and spin multiplicity constraints.

CI PyPI PyPI downloads Wheel Platforms Python C++ Development status Typing Languages Ruff License

简体中文 · Documentation · Quickstart · Examples · Benchmarks · Citation

Overview

MolGR infers initial connectivity from interatomic distances and covalent radii, then assigns initial bond orders using local geometry and functional group patterns. Starting from this graph, MolGR adjusts bond orders, formal charges, and unpaired electron assignments and explores resonance forms along conjugated systems to generate and screen candidate molecular graphs. For metal complexes, it scores each candidate metal electronic state together with its corresponding ligand structures.

The returned RDKit Mol retains every input atom, including all explicit hydrogens, at its original 3D coordinates. It records the reconstructed bond orders, formal charges, and unpaired electron counts. By default, MolGR also infers coordination bonds and assigns stereochemistry.

RDKit intermediate graphs after failure (left), input coordinates (middle), and MolGR reconstructions (right) for two metal complexes.

The top row shows a dinuclear molybdenum complex and the bottom row an Fe–Pd–Fe complex. Compare the XYZ coordinates in the middle with the MolGR result on the right to see the inferred metal–ligand bonds. The left column shows the intermediate graphs RDKit retained when bond-order assignment failed. Inputs, reference structures, and figure reproduction

Installation

pip install molgr

Quickstart

Reconstruct JEGLOA, a neutral singlet ruthenium complex. The dimethyl selenide ligand (CH₃–Se–CH₃) binds to Ru through selenium. Starting from the full XYZ coordinates in ångströms, check the Ru formal charge and the two Se–C bonds.

from molgr.interface import xyz_to_rdmol

xyz = """18
JEGLOA
Ru  0.6582  0.0880  0.0953
Se -1.8765 -0.3106  0.5345
Cl  0.0449  0.9180 -2.1073
Cl  0.7384 -2.2004 -0.7085
O   0.4757  2.9874  1.0039
O   1.3429 -1.0920  2.8174
O   3.5613  0.2857 -0.8340
C   0.5432  1.8818  0.6655
C   1.0785 -0.6381  1.7872
C   2.4742  0.2203 -0.4623
C  -2.4172 -1.2315 -1.1019
H  -3.5200 -1.3117 -1.0927
H  -1.9265 -2.2201 -1.0715
H  -2.0277 -0.6453 -1.9558
C  -2.6366  1.4348  0.0693
H  -2.1449  1.7684 -0.8658
H  -2.4206  2.1303  0.9008
H  -3.7289  1.3184 -0.0550
"""
mol = xyz_to_rdmol(xyz, total_charge=0, spin_multiplicity=1)
ru, se = mol.GetAtomWithIdx(0), mol.GetAtomWithIdx(1)
se_c_bonds = sum(atom.GetSymbol() == "C" for atom in se.GetNeighbors())
print("Ru formal charge:", ru.GetFormalCharge())
print("Se-C bonds:", se_c_bonds)
Ru formal charge: 2
Se-C bonds: 2

The JEGLOA reference structure is on the left and the reconstruction results for each method are on the right.

The JEGLOA reference structure is on the left and the reconstruction results for each method are on the right.

Coordinates are from tmQMg (Kneiding et al.). The reference is the JEGLOA Lewis graph in tmQMg-Corrected v2026-11-23. JEGLOA reference and structural evidence · Data credits and licenses · Benchmark settings

Benchmarks

Reference-graph match rates, reconstruction outcomes and runtime distributions for seven methods across five datasets

The benchmark used MolGR commit 0714b6e. All seven methods processed the same 560,384 structures. Compare all seven methods and locate the frozen data

Documentation

  • Start — render the Fe–Pd–Fe complex with rdkit-dof and inspect its coordination bonds.
  • Usage guide — process batches, choose a backend, and diagnose failed reconstructions.
  • API reference — look up inputs, return values, configuration defaults, and diagnostics.
  • Reconstruction model — understand charge and spin constraints and the limits of the chemical representation.

Citation

We are preparing a MolGR preprint for submission to ChemRxiv.

Cite the software as Miao-jiong Tang and Ying-zi Luo, MolGR (Molecular Graph Reconstructor), with the release tag or commit used in your work. For benchmark comparisons, also cite the dataset releases listed in the protocol and report the reconstruction and comparison time limits. MolGR releases · Benchmark protocol