Graph Neural Network · message passing
QM9 benchmark: 134k small molecules, 12 properties (HOMO, LUMO, dipole, ...).
Modern GNNs reach chemical accuracy (~1 kcal/mol) on energies.
# PyTorch Geometric — 10 lines
import torch
from torch_geometric.nn import GCNConv, global_mean_pool
class MolGNN(torch.nn.Module):
def __init__(self, d=64):
super().__init__()
self.c1 = GCNConv(11, d)
self.c2 = GCNConv(d, d)
self.out = torch.nn.Linear(d, 1)
def forward(self, x, edge_index, batch):
h = self.c1(x, edge_index).relu()
h = self.c2(h, edge_index).relu()
return self.out(global_mean_pool(h, batch))