Molecular GNNs: Learning on Atoms and Bonds
Published:

Molecules as Graphs
A molecule \(G = (V, E, H, X)\) where:
- \(V\): atoms (carbon, oxygen, nitrogen, …)
- \(E\): bonds (single, double, triple, aromatic)
- \(H = \{h_v\}\): atom features (atomic number, charge, hybridisation, …)
- \(X = \{x_v\}\) with \(x_v \in \mathbb{R}^3\): 3D coordinates (from DFT calculations or conformer search)
The task: predict molecular properties from \(G\). Properties include:
- HOMO-LUMO gap (electronic structure, relevant to photovoltaics)
- Solubility (pharmaceutical drug delivery)
- Toxicity (drug safety screening)
- Binding affinity (protein-drug interaction)
- Dipole moment, polarisability (material properties)
From Fingerprints to GNNs
Intuition First: Morgan fingerprints work like a census of neighbourhoods. Each atom looks at the atoms within K bonds of it, hashes the whole pattern to a number, and reports that number. The GNN approach instead lets atoms talk to their neighbours iteratively — at round 1 atoms share their own identity, at round 2 they share what they heard from round 1, and so on. Unlike the fixed hash, GNN representations are learned end-to-end for the specific task, so they focus on the features that actually predict toxicity (or solubility, or binding), rather than encoding everything uniformly.
Traditional approach — Morgan fingerprints (ECFP):
- Encode each atom’s K-hop neighbourhood as a hash
- Sum over all atoms → fixed-size bit vector
- Feed to SVM or random forest
GNN approach:
- Run K rounds of message passing → node embeddings encode K-hop neighbourhoods
- Global pooling → graph embedding
- MLP → property prediction
GNNs outperform fingerprints because they learn task-specific features rather than encoding all structural information uniformly.
Level 1: 2D GNNs (Connectivity Only)
Standard GCN, GAT, or GIN on the molecular graph with:
- Node features: atomic number (one-hot), formal charge, number of Hs, hybridisation
- Edge features: bond type (single/double/triple/aromatic), is-conjugated, is-ring
Examples: MPNN (Gilmer et al., 2017), AttentiveFP.
Limitation: cannot distinguish stereoisomers (L-alanine and D-alanine have identical connectivity), and cannot represent any 3D quantity at all.
Level 2: 3D Distance-Based (Invariant)
Add interatomic distances as edge features. Build a graph where all atoms within a cutoff distance \(r_c\) are connected, not just bonded ones.
SchNet (Schütt et al., 2017): uses continuous-filter convolutions, with the filter generated from radial basis functions of the distance:
\(W\) is a filter-generating network and \(\odot\) is elementwise. Because distances are invariant under the full \(\mathrm{E}(3)\) — rotations, translations and reflections — the model is \(\mathrm{E}(3)\)-invariant. Two consequences follow directly: it cannot output vector quantities, and it assigns enantiomers identical predictions.
QM9 performance: SchNet reaches chemical accuracy on several QM9 targets — notably the atomisation energies — at a small fraction of the cost of the DFT calculations that produced the labels.
Level 3: Angular GNNs (Bond Angles)
Why are distances not enough? The careful statement matters here, because the loose one is false. A complete pairwise distance matrix does determine the geometry up to rigid motion and reflection, and therefore determines every bond angle. The problem is that models never see the complete matrix: they build a cutoff graph, keeping only distances below \(r_c\). From that partial set the angles are genuinely not recoverable, and two different structures can produce identical cutoff-graph distance multisets. That gap — not some impossibility about distances in principle — is what angular models close. Note also what stays out of reach: bond angles are unsigned and reflection-invariant, so adding them does not make a model chirality-aware.
DimeNet (Klicpera et al., 2020): messages live on directed edges rather than nodes, and each edge message is updated using the angle it makes with adjacent incoming edges:
\(\theta_{kji}\) is the angle at \(j\) between the edges \(ji\) and \(jk\); the exclusion \(k \ne i\) prevents a message from immediately feeding back on itself. DimeNet uses spherical Bessel functions for the radial basis and spherical harmonics for the angular basis.
SphereNet: adds torsion (dihedral) angles — the angle between two planes defined by four atoms. Torsions are signed, and the sign flips under reflection, which is what finally makes chirality visible to the model. With distances, angles and torsions together, the local 3D geometry is fully specified.
Level 4: Equivariant GNNs
Equivariant models process 3D positions as vectors, satisfying \(\Phi(\rho_{\text{in}}(g)x) = \rho_{\text{out}}(g)\Phi(x)\) for \(\mathrm{E}(n)\) or \(\mathrm{SE}(3)\). They can predict both scalar properties (energy, with \(\rho_{\text{out}} = I\)) and vector properties (forces, with \(\rho_{\text{out}}(g) = Q\)) without violating symmetry.
EGNN: invariant distance-based messages plus equivariant coordinate updates. Simple, fast, effective for energies and forces; blind to chirality.
NequIP: TFN-style irrep features inside a message-passing network. Its headline result is data efficiency — competitive interatomic potentials from small training sets.
MACE: many-body interactions built from repeated tensor products. Among the strongest reported results on MD17-style force-field benchmarks.
Benchmarks
QM9: 134k small organic molecules (up to 9 heavy atoms). 12 quantum chemical properties (HOMO energy, LUMO energy, dipole moment, etc.) computed by DFT.
MD17: molecular dynamics trajectories. Predict energy and forces at each timestep. Tests generalisation to conformational space.
OGB-molhiv / OGB-molpcba: large-scale drug discovery benchmarks (41k/437k molecules).
PDBbind: protein-ligand binding affinity from crystal structures.
Reading Benchmark Numbers
The usual way this progression is presented — a single column of QM9 errors, one row per model — is worth treating with care, and this post deliberately does not reproduce one.
Three reasons. QM9 has twelve targets with different units and different difficulty, so “the QM9 error” is not a well-defined quantity; a model can lead on dipole moment and trail on the HOMO-LUMO gap. Chemical accuracy is likewise target-dependent — it is conventionally 1 kcal/mol \(\approx 0.043\) eV for energies, and quoting one threshold across all properties is a category error. And several of the strongest equivariant models, NequIP and MACE among them, were built and evaluated as interatomic potentials on MD17-style force-field tasks rather than on QM9 property regression, so placing them in the same column as SchNet or DimeNet compares numbers that were never measured on the same task.
What is robust is the ordering of information, which is the point the hierarchy is really making:
- connectivity alone cannot represent 3D structure
- distances add geometry but remain \(\mathrm{E}(3)\)-invariant, so no vector outputs and no chirality
- angles recover what a cutoff distance graph loses
- torsions add reflection sensitivity
- equivariant features add vector and higher-degree outputs
Each step strictly increases what the model can represent. How much accuracy that converts into is an empirical question, and the honest place to get the number is the paper reporting the specific target and split you care about.
Summary
| Level | Geometry used | Key model | Symmetry | Can output vectors? |
|---|---|---|---|---|
| 2D (connectivity) | None | MPNN, GIN | Permutation only | No |
| Distances | \(\lVert x_i - x_j \rVert\) | SchNet | \(\mathrm{E}(3)\)-invariant | No |
| Distances + angles | \(\theta_{kji}\) | DimeNet | \(\mathrm{E}(3)\)-invariant | No |
| + torsions | \(\varphi_{ijkl}\) (signed) | SphereNet | \(\mathrm{SE}(3)\)-invariant | No |
| Full equivariance | 3D vectors, irreps | EGNN, NequIP, MACE | \(\mathrm{E}(n)\) / \(\mathrm{E}(3)\)-equivariant | Yes |
For industrial drug discovery, 2D GNNs suffice for fast virtual screening. For physics-accurate property prediction and force fields — anywhere you need forces, not just energies — equivariant models are the only ones that can express the target at all.
References
- Gilmer, J., Schoenholz, S. S., Riley, P. F., Vinyals, O., & Dahl, G. E. (2017). Neural Message Passing for Quantum Chemistry. ICML 2017 (MPNN: unified message passing framework for quantum chemistry, benchmarked on QM9).
- Schütt, K. T., Kindermans, P.-J., Sauceda Felix, H. E., Chmiela, S., Tkatchenko, A., & Müller, K.-R. (2017). SchNet: A Continuous-Filter Convolutional Neural Network for Modeling Quantum Interactions. NeurIPS 2017 (SchNet: continuous-filter convolutions over interatomic distances for E(3)-invariant molecular property prediction).
- Klicpera, J., Groß, J., & Günnemann, S. (2020). Directional Message Passing for Molecular Graphs. ICLR 2020 (DimeNet: directional message passing over bond angles, recovering angular structure that a cutoff-distance model loses — bond angles alone are still reflection-invariant).
- Liu, Y., Wang, L., Liu, M., Lin, Y., Zhang, X., Oztekin, B., & Ji, S. (2022). Spherical Message Passing for 3D Molecular Graphs. ICLR 2022 (SphereNet: extends DimeNet with torsion angles for full 3D geometry encoding).
