Published June 25, 2026 | Version v1
Software Restricted

Inverse IMPRESSION: Predicting molecular structure from sparse NMR data, proof-of-concept using a graph neural network

  • 1. ROR icon University of Bristol

Description

Code, trained models, and data accompanying the paper:
Inverse IMPRESSION: Structure Elucidation from NMR Data using Graph Neural Networks

Given a set of ¹H/¹³C chemical shifts and H–H/C–H coupling constants (J > 2 Hz), the inverse IMPRESSION model predicts pairwise interatomic distances, which are thresholded to assign molecular connectivity. Structures with ambiguous heteroatom positions (2–3 degenerate O, N, or F atoms) are resolved by enumerating all chemically valid bond permutations and ranking them with the forward IMPRESSION model.

Overall top-1 success rate on the DFT test set (N = 1538): 32.4%

Files included

Test Set

  • molecule_list.csv — molecule IDs, data source (CSD, OTAVA, ChEMBL, NMRShiftDB), and SMILES string for each of the 1538 test molecules

Input Data

  • test_atoms.csv — input atom features (¹H/¹³C chemical shifts, element types) for 1538 test molecules
  • test_pairs.csv — input pair features (coupling constants, ground-truth interatomic distances)

Pre-computed Data

  • predicted_pairs.csv — predicted interatomic distances for all atom pairs (Step 1 output)
  • out_df.csv — per-molecule bond assignment summary, 1-shot and 10 noise runs (Step 1 output)
  • ranked_10shot.csv — molecules correctly identified at top-1 rank by forward model ranking of 10-shot predictions (Step 1.5 output)
  • correct_mols.csv — molecules correctly identified at top-1 rank by heteroatom enumeration (Step 2 output)
  • rankings.csv — forward-model ranking results per enumerated molecule (Step 2 output)

Models and Code

  • inverse_model.torch — trained inverse IMPRESSION model checkpoint
  • 3D_forward_model.torch — trained forward IMPRESSION model checkpoint used to rank 10-shot predictions (Step 1.5)
  • 2D_forward_model.torch — trained forward IMPRESSION model checkpoint used to rank heteroatom enumeration candidates (Step 2)
  • inv_IMP_code.zip — all code, scripts and README

Reproducing the Published Results

Download all files, extract the zip file, move the other files into the resulting inv_IMP directory and run from inside the directory.

unzip inv_IMP_code.zip

mv molecule_list.csv test_atoms.csv test_pairs.csv predicted_pairs.csv out_df.csv ranked_10shot.csv correct_mols.csv rankings.csv inverse_model.torch 3D_forward_model.torch 2D_forward_model.torch inv_IMP/

cd inv_IMP/

To reproduce Table 1 and Table 2 from the manuscript from the pre-computed outputs, run:

python 3_compute_results.py

Executing this data analysis requires only standard Python packages (os, sys, pandas, numpy) and completes in under one minute.

Table 1: Bond assignment accuracy (inverse model only, N = 1538)

  1-shot 10-shot Ranked top in 10-shot
Success rate 10.4% 12.7% 12.5%

Table 2: Full pipeline (inverse model + heteroatom enumeration)

Subset N 1-shot 10-shot Ranked top Ranked top + enum
Max 1 of each heteroatom 235 65.5% 80.0% 78.3% 78.3%
2–3 degenerate (1 element type) 454 1.3% 1.8% 1.8% 57.3%
2–3 degenerate (>1 element type) 218 0.0% 0.0% 0.0% 24.8%
>3 of any heteroatom 631 0.0% 0.0% 0.0% 0.0%
Overall 1538 10.4% 12.7% 12.5% 32.4%

Reproducing Predictions

To reproduce the precomputed data requires installing the correct packages and running the model and enumeration in full.

Environment Setup (~10 minutes)

conda create -n inv_imp python=3.11 -y
conda activate inv_imp
pip install torch==2.3.0 --index-url https://download.pytorch.org/whl/cpu
pip install dgl==1.1.3 -f https://data.dgl.ai/wheels/torch-2.1/repo.html
pip install -r requirements.txt

DGL must be installed from its own wheel index as shown above. Do not run pip install dgl without the -f flag as this may fetch an incompatible version.

Execution of Python Scripts (~2.5 hrs on a standard laptop)

Steps 1, 1.5 and 3 reproduce Table 1; all steps reproduce Table 2.

python 1_inverse_prediction.py (~10 minutes — inverse model, 1-shot and 10-shot distance prediction)
python 1_5_rank_10shot_predictions.py (~15 minutes — forward model ranking of 10-shot predictions)
python 2_enumeration_and_ranking.py (~2 hrs — heteroatom enumeration and forward model ranking)
python 3_compute_results.py (<1 minute — compute and print results tables)

Data Structure

test_atoms.csv — one row per atom across all 1538 molecules

Column Type Description
molecule_name str Molecule identifier
atom_index int Atom index within molecule
typestr str Element symbol (H, C, N, O, F)
shift float NMR chemical shift (ppm); 0 if not observed

test_pairs.csv — one row per directed atom pair (both i→j and j→i) across all molecules

Column Type Description
molecule_name str Molecule identifier
atom_index_0 int Index of first atom
atom_index_1 int Index of second atom
nmr_types str Coupling type label (e.g. 1JCH, 3JHH)
coupling float Observed coupling constant (Hz); 0 if below 2 Hz threshold
distance float True DFT interatomic distance (Å)
path_len int Shortest bond-path length (1 = bonded)
bond_existence int 1 if bonded, 0 otherwise

out_df.csv — per-molecule bond assignment summary from Step 1

Column Type Description
molecule_name str Molecule identifier
mae float Mean absolute distance error across all pairs (Å)
path_len_errors float Number of bond-assignment errors (1-shot)
pred_0_mae … pred_9_mae float Distance prediction MAE for each of the 10 noise runs
pred_0_path_len_errors … pred_9_path_len_errors float Number of incorrectly predicted bonds for each noise run

predicted_pairs.csv — all columns of test_pairs.csv (with nmr_types → og_nmr_types, distance → dist), plus Step 1 predictions:

Column Type Description
predicted_distance float Inverse model prediction (1-shot, no noise)
predicted_distance_0 … predicted_distance_9 float Predictions from 10 independent noise runs
predicted_path_len int 1 if predicted_distance < 1.8 Å and not a 2JHH pair
path_len_errors float Absolute bond-assignment error (1-shot)

Heteroatom Subset Definitions (Table 2)

Subset Criterion Method
Max 1 of each heteroatom ≤1 O, ≤1 N, ≤1 F 1-shot / 10-shot only
2–3 degenerate (1 element type) Exactly one of {O, N, F} has count 2–3 10-shot + enumeration
2–3 degenerate (>1 element type) Two or more of {O, N, F} have count 2–3 10-shot + enumeration
>3 of any heteroatom Any count > 3 Not enumerated

Inverse Model Architecture

Parameter Value
Architecture Graph Transformer Network (GTN)
Node inputs ¹H and ¹³C chemical shifts
Edge inputs JCH and JHH coupling constants (> 2 Hz)
Output Pairwise interatomic distances (Å)
Bond cutoff 1.8 Å
Embedding dimension 48
Attention heads 1
Layers 6
Training set 13,964 HCNOF molecules (IMPRESSION Gen2 DFT database)

Files

Restricted

The record is publicly accessible, but files are restricted. Log in to check if you have access.