How do you teach a computer to do chemistry — and why is that one of the hardest sums in the universe?
Everything you can see, touch, taste, or smell is made of atoms. That much you probably know. But here is the strange part: even though we have known about atoms for over a hundred years, predicting exactly how they will behave — whether two of them will stick together, how much energy that takes, what shape the result will be — is so difficult that the fastest supercomputers on Earth still struggle with it.
This book is about a clever escape route. Instead of solving the impossibly hard sums every single time, scientists are now teaching computers to guess the answers — and to guess them well. The paper this book is built around, nablaDFT, is one chapter in that story — and it has a sequel, ∇²DFT, that we'll reach at the very end. We are going to climb all the way up to the real equations in them. Every single one. But we will build the ladder rung by rung, and we will not leave you behind.
You'll meet four kinds of coloured boxes. They're signposts, so you always know what you're looking at:
Two more, for the parts where we get rigorous. A bordered theorem box states a precise result:
And a proof box, with a ruled left margin and numbered steps, walks through the derivation line by line, ending in a small ∎:
A promise about the maths: nothing is hand-waved. Every equation gets decoded symbol by symbol, the big ones get worked through with actual numbers, and the central results get fully proved. You'll need to be comfortable with the idea of a derivative (a slope) and to have seen what a grid of numbers — a matrix — is. Everything else, we build here. Two chapters are marked with a ½ — 3½ (the laws of energy) and 6½ (matrix anatomy). These are deeper, undergraduate-level interludes; the numbered chapters around them stand on their own if you'd rather save the ½ chapters for a second pass.
Picture the tiniest piece of a thing you could ever break it into and still have it be that thing. Break gold into smaller and smaller bits and eventually you reach a single gold atom. Break it once more and it stops being gold. That's an atom: the smallest unit of a chemical element.
Each atom has two parts. In the middle sits a heavy nucleus — a tight clump of protons (each carrying one unit of positive charge) and neutrons (no charge). Around it live the electrons — feather-light specks, each carrying one unit of negative charge. A neutral atom has exactly as many electrons as protons, so the charges cancel.
The cartoon you're about to see makes the nucleus and electrons look close together. They are not. Let's put real numbers on it, because the emptiness matters.
0.0000000001 metres across — that's \(10^{-10}\) m, a length so useful in chemistry it has its own name, the ångström (Å).0.00000000000001 m — that's \(10^{-14}\) m, roughly ten thousand times smaller than the atom.What keeps the electrons from drifting away? The same thing that makes a balloon stick to your hair: electric charge. The rule is simple and was written down by Charles-Augustin de Coulomb in 1785. Opposite charges pull together; like charges push apart. And the strength follows a tidy formula — Coulomb's law:
Hold onto this formula. The push and pull between charges is the force of chemistry — every bond, every reaction, every equation later in this book is, underneath, electrons and nuclei obeying Coulomb's law. When we build the energy machine in Chapter 3, this is what's inside it.
Different elements differ in one number: how many protons (and so electrons) they have. Hydrogen has 1, carbon has 6, oxygen has 8, and so on. The famous periodic table is nothing more mysterious than these elements lined up in order, grouped so that atoms which behave alike sit together — and they behave alike because their outermost electrons are arranged alike. Chemistry, again, is electrons.
The nablaDFT paper restricts itself to molecules built from just eight of these elements — the common ingredients of drug-like molecules. Worth meeting them, because every molecule in that 100-terabyte dataset is made of only these:
When atoms come close, their outer electrons rearrange — sometimes the atoms grip each other and form a chemical bond, building a molecule: water, caffeine, aspirin, the proteins in your cells. The shape, the strength, the energy of every one of those bonds is decided by what the electrons do.
Here is where physics gets strange, and you simply have to trust the experiments — because they have been done, thousands of times, and they always say the same impossible thing. An electron is not a tiny ball with a definite position. When nobody is measuring it, an electron behaves like a wave: a spread-out, blurry swell of "could-be-here."
Two reasons, one theoretical and one you can practically see.
The theoretical hint came from Louis de Broglie in 1924. He proposed that every moving particle has a wavelength, tied to how much momentum (mass × velocity) it carries:
The thing you can practically see is the double-slit experiment. Fire electrons one at a time at a wall with two narrow slits. If electrons were little balls, each would go through one slit or the other, and you'd get two stripes on the screen behind. Instead you get many stripes — a banded pattern that only makes sense if each electron went through both slits as a wave and interfered with itself, the way two sets of ripples on a pond cross and add up. A single electron, interfering with itself. That is the experiment that forces the wave on us.
The mathematical object that describes this blur has a name you will meet on every page from here on: the wave function, written with the Greek letter psi, \(\Psi\). It is a map. Feed it a point in space; it returns a number, the wave's height there. That number can be positive or negative, because waves go up and down.
But a wave's height isn't directly something you can measure. What you can measure is where the electron turns up when you look. The link between the two is the single most important rule in quantum mechanics, due to Max Born:
If \(|\Psi|^2\) is a probability spread over space, then adding it up over all of space must give 1 — the electron is definitely somewhere. Adding up a smooth thing over space is exactly what an integral does, so:
Read \(\int \cdots \, dV\) as "sweep through every little box of volume in space and total it up." Setting that total to 1 is called normalizing the wave function. Let's actually do it, in the simplest possible world.
Play with this exact box below. Each allowed wave has a whole number of humps (\(n = 1, 2, 3, \dots\)) — half-waves that fit the walls perfectly, like the harmonics of a guitar string. More humps means more wiggle, more wiggle means more energy.
Change \(n\), the number of humps. Watch the wave \(\Psi\) (purple), the probability \(|\Psi|^2\) (pink, always positive), and the energy \(E_n\) — which grows as \(n^2\).
An atom is a 3-D box — really a 3-D well, the Coulomb pull of the nucleus. The allowed electron-waves in that well are called orbitals, and just like the box, only certain shapes are permitted. The lowest ones have names you may have heard:
Each electron also carries a curious built-in two-way property called spin — loosely like a tiny compass needle that can point only "up" or "down." It isn't really spinning, but the name stuck. Spin matters because of a strict rule (the Pauli exclusion principle): no two electrons in an atom can be in exactly the same state. So each orbital holds at most two electrons — one spin-up, one spin-down — and then it's full. This is why electrons stack into shells instead of all piling into the lowest orbital, and it's the reason the periodic table has the shape it does.
If all the information about an electron is hidden inside \(\Psi\), how do we get a real number — like its energy or momentum — back out? With an operator: a machine that does something to the wave function. You already know one operator intimately from calculus: the derivative \(\frac{d}{dx}\) is a machine that takes a function and hands back its slope.
In quantum mechanics, every measurable quantity has an operator. Momentum, for instance, is measured by this one:
So a wave function is the complete description of an electron, and operators are how we interrogate it. If you knew \(\Psi\) for every electron in a molecule, you'd know everything. The entire field exists to do one thing:
Find the wave function.
Easy to say. The next chapter is the equation that decides what \(\Psi\) is even allowed to be — and why finding it is so brutally hard.
There is one equation that decides which wave functions nature permits. Erwin Schrödinger wrote it in 1926, and the nablaDFT paper puts it on its very first page. In its time-independent form — the version for a molecule sitting still in its lowest state — it is just three symbols:
You already met this shape at the end of Chapter 2: an operator acts on a wave and gives back the same wave times a number. Let's meet all three pieces, because once this single line is yours, you own the spine of the whole paper.
The blurry map of all the electrons, from Chapter 2. It's the unknown we're solving for — like the \(x\) in a school equation, except instead of one number it's an entire function spread across space. For a molecule with many electrons, \(\Psi\) depends on the positions of all of them at once. Hold that thought; it's where the trouble starts.
A plain number: the total energy of the molecule in that state. Energy is the universe's accounting system. Like a ball on a hillside, a molecule always rolls toward the lowest energy it can reach — and that lowest-energy state, the ground state, is almost always the one we want, because it's the one molecules actually sit in at rest.
The star. The hat means "operator," and \(\hat H\) is the special operator that measures total energy. Rather than hand it to you as a black box, let's build it, because it's made of exactly two ideas — and you already know both.
Piece one: motion energy (kinetic). A moving thing has energy of motion. From Chapter 2, momentum is "how fast the wave wiggles," via the operator with a derivative in it. Kinetic energy in physics is \(\tfrac{p^2}{2m}\) (momentum squared over twice the mass). Squaring the momentum operator means applying that derivative twice — a second derivative. In 3-D, the "second derivative in every direction" has a symbol of its own, the one that names this whole paper:
Piece two: position energy (potential). Charges that attract or repel store energy depending on how far apart they are — that's Coulomb's law from Chapter 1. We bundle all of that into a potential-energy operator \(\hat V\). Put the two pieces together and you have the whole machine:
For an actual molecule — many electrons, many nuclei — \(\hat V\) is not one term but a sum of every Coulomb interaction in the system. Here is the complete thing. It looks fearsome; we'll dismantle it term by term, and you'll find there are no surprises in it:
Here's the first great simplification, and it's allowed by a simple observation. The lightest nucleus (a single proton) is about 1,836 times heavier than an electron. Heavier means slower — vastly slower. From an electron's frantic point of view, the nuclei are practically nailed in place, like boulders to a swarm of flies.
So we cheat, productively: treat the nuclei as frozen, solve for the lightning-fast electrons in that fixed scaffold, and only afterward worry about how the nuclei themselves might shift. This is the Born–Oppenheimer approximation, and it's the unspoken floor beneath essentially all of computational chemistry — including every calculation in nablaDFT.
Now put equation 1 back together. \(\hat H\Psi = E\Psi\) says: "when the energy-machine acts on the right wave, it returns that very same wave, just scaled by a number — the energy." That's the pattern from the momentum example in Chapter 2.
This pattern is so important it has a name. \(\Psi\) is an eigenfunction of \(\hat H\), and \(E\) is its eigenvalue. (German eigen = "own, characteristic.") Most waves, fed into \(\hat H\), come out scrambled into a different shape. Only special "characteristic" waves come back unchanged-but-scaled. Those, and only those, are the wave functions nature allows — and each one comes with its own energy.
Eigen-problems are easiest to feel with a small matrix instead of an operator, so let's do one entirely by hand.
Build that 2×2 yourself below. Drag the matrix entries and watch its eigenvectors — the special directions that don't get knocked off course — snap to new angles.
A grey vector is being transformed by the matrix into a coloured one. Spin the grey vector with the slider. When the coloured arrow lines up perfectly with the grey one (just longer or shorter, not rotated), you've found an eigenvector — and the stretch factor is its eigenvalue.
Our 2×2 had two numbers. A real molecule's wave function lives in a space so large it defies picturing. Here's the catastrophe in arithmetic.
Before we start turning the Schrödinger equation into something a computer can chew on, we need to slow down and meet the laws that energy obeys. These are not decorations — they are the load-bearing walls. The variational principle in particular is the single idea that makes Hartree–Fock, DFT, and almost every method in both papers actually work. This chapter is more demanding than the ones around it; everything here is derived, not asserted. Take it slowly, and the rest of the book becomes inevitable rather than mysterious.
The proofs ahead lean on a handful of bits of notation and a few facts that are genuinely easy once spelled out — but baffling if dropped on you mid-derivation. So let's collect them here, slowly and with no proof of its own required. Come back to this box any time a later step looks like it skipped something; the missing rung is almost certainly here.
That's the whole toolkit. None of it is hard; it's just vocabulary plus two switch-like facts (the δ symbol and the trace identity). With these in hand, every derivation in this chapter and the rigorous ones later will read as a sequence of small, checkable steps — no leaps.
Physicists working on atoms got tired of writing \(\hbar\), the electron mass \(m_e\), the electron charge \(e\), and the constant \(4\pi\varepsilon_0\) in every single equation. So they simply defined all four to equal 1. This is the system of atomic units (a.u.), and it is what both papers — and all of quantum chemistry — actually use.
Keep the conversion \(1\,E_{\text h} \approx 627.5\) kcal/mol in mind: the "chemical accuracy" target from Chapter 8 (1 kcal/mol) is therefore about \(1/627.5 \approx 1.6 \times 10^{-3}\) Hartree. Every error bar in both papers is quoted in these units.
So far we've used the time-independent Schrödinger equation, \(\hat H\psi = E\psi\). It is a snapshot. The full law includes time, and reads:
Let's prove that energy doesn't drift over time. The expected energy of any state is \(\langle \hat H\rangle = \langle\Psi|\hat H|\Psi\rangle\). We show its time derivative is zero.
Here is the most important single statement in this entire book. It is what lets us find approximate answers without ever solving the impossible equation exactly. Take any normalized trial wave function \(\psi\) you like — a guess, however crude. Compute its expected energy. The claim is that this number can never dip below the true ground-state energy:
The proof is short and it is the reason the principle is trustworthy. The trick is to expand the unknown trial state in the (also unknown, but guaranteed to exist) complete set of true eigenstates.
Chapter 7 claimed that once you know the energy, the forces follow by differentiating, \(\vec F = -\nabla E\). That is true, but there's a subtlety worth making rigorous: the wave function itself changes when you move a nucleus, so naively you'd expect extra terms. The Hellmann–Feynman theorem says those extra terms vanish.
Now specialize \(\lambda\) to the position of a nucleus. The only part of \(\hat H\) that depends on a nuclear coordinate is the electron–nucleus attraction and nucleus–nucleus repulsion — both ordinary Coulomb terms. So the force on a nucleus is just the classical electrostatic force exerted on it by the electron cloud and the other nuclei. This is the rigorous foundation under "forces are the gradient of the energy" — the principle that drives the relaxation trajectories of Chapter 9. A neural network that predicts energy well, and is smooth, automatically predicts these forces.
One last law, and a strikingly specific one. For any system bound purely by Coulomb forces — which is to say, every atom and molecule — the average kinetic and potential energies are not independent. They are chained in a fixed ratio.
We can derive it cleanly from the variational principle itself, using a scaling trick — which also shows how deeply the variational idea runs.
Four laws: energy is conserved, no trial state beats the ground state, forces are electrostatic, and kinetic and potential energies are chained together. With these in hand, the methods of the next chapters stop looking like clever hacks and start looking like the only reasonable things to do. Onward — to turning the wave into numbers, now knowing exactly why minimizing energy is the right move.
We ended Chapter 3 stuck: the perfect equation is unsolvable, and we can't even store its answer. This chapter is the escape, and it rests on one of the most powerful ideas in all of mathematics. You half-know it already — it's how mixing paint works.
Think about ordinary arrows (vectors) on a flat page. Pick two reference arrows — one pointing right, one pointing up. Any arrow on the page can be built as "so much right plus so much up." The arrow pointing northeast at some length is just, say, \(3\) rights \(+ 2\) ups. Two numbers, \((3, 2)\), capture the whole arrow. You've turned a geometric object into a short list of numbers.
Here is the leap: functions behave just like arrows. A wave function is a kind of "arrow" in an enormous space where each "direction" is a simple, standard shape. Pick a fixed set of those standard shapes — the paper calls them basis functions, written \(\lvert\phi_i\rangle\) — and any wave function can be built as a weighted sum of them, exactly like the arrow. The weights are a short list of numbers. That list is something a computer can hold.
The paper writes this build-from-pieces idea as equation 2 — a single electron's orbital \(\lvert\psi_m\rangle\) assembled from basis pieces \(\lvert\phi_i\rangle\):
In real calculations — and in nablaDFT — the basis pieces are Gaussian functions: little bell-shaped bumps, \(e^{-\alpha r^2}\), each centred on an atom. Why bells? Because there's a mathematical miracle: when you multiply two Gaussians, or integrate them, you get another Gaussian. Those integrals (which we're about to need by the millions) become quick and exact instead of nightmarish. Chemistry runs on Gaussians for this one practical reason.
def2-SVP. It looks like a licence plate; it's actually a recipe. def2 is the family (designed in Karlsruhe, Germany). SV = "split valence" — use a couple of Gaussians for each important outer electron so the orbital can flex in size. P = "polarization" — toss in a few extra higher-shape (p- and d-like) bells so orbitals can lean and distort when atoms bond. Bigger basis = more pieces = more accurate and more expensive. def2-SVP is a sensible middle: good enough to trust, small enough to run a million times.
Here's the payoff, and we're going to earn it rather than be handed it. Start from Schrödinger and substitute our basis expansion. Watch the smooth equation collapse into a grid of numbers in four moves.
That last line, packed into matrix shorthand, is precisely how the paper writes equation 3 — known as the Roothaan equation:
And the two grids are filled by exactly the integrals our derivation produced (the paper's equations 4 and 5):
We derived the Roothaan equation by substituting the basis expansion and "testing" against each basis function. That works, but it hides why this is the right equation. The honest origin is the variational principle from Chapter 3½: the best coefficients are the ones that make the energy as low as possible. Let's show that minimizing the energy forces exactly this matrix equation into existence.
With the perfect arrow basis — right and up — the two reference arrows were at a clean right angle, totally independent. Overlap between them was zero, and the "overlap grid" would just be the boring identity (1's on the diagonal, 0's elsewhere). But our Gaussian bells, parked on neighbouring atoms, do spill into each other's space. They are not independent. \(\mathbf S\) is the bookkeeping that records exactly how much each pair leans on its neighbour. Let's compute one entry.
There's a snake in the grass. Remember term 3 from Chapter 3 — electrons pushing each other? To build the Fock matrix \(\mathbf F\), you need to know the electron cloud's shape, because each electron feels the average push of all the others. But the cloud's shape is the answer — it comes from the very coefficients \(\mathbf c\) you're trying to find. You need the answer to build the equation whose answer you need. A perfect chicken-and-egg.
The escape is wonderfully simple: guess, then improve, then repeat until nothing changes. This loop is called the Self-Consistent Field (SCF) method, and it's the actual engine cranking inside every DFT calculation in the paper.
Once the loop converges, you have the mixing numbers \(C\), and you can rebuild the actual orbital at any point in space. The paper writes this (equation 6) using a shorthand called Einstein summation, where a repeated index secretly means "sum over it":
It says the same thing as equation 2 — "the orbital is the basis pieces \(\phi_\mu\) weighted by the mixing numbers \(C\)" — now read at an actual location \(\vec r_1\). (The repeated \(\mu\) means "sum over all pieces.") From these weights we assemble the single most useful object in the whole method, the density matrix (equation 7):
Term 3 from Chapter 3 — electrons pushing electrons — is what makes the wave function explode into that \(10^{60}\)-number monster. Density Functional Theory, or DFT, is a Nobel-winning dodge around it, and it's the method the entire nablaDFT paper is built on. The idea is so audacious it was barely believed at first.
Instead of tracking the full tangled wave function \(\Psi\) — which depends on the positions of all the electrons at once — DFT asks a far humbler question:
"How thick is the electron cloud at each point?"
That thickness is the electron density, written \(\rho(\vec r)\) ("rho"). It's just one number at each point in ordinary 3-D space — no matter how many electrons there are. Compare that to \(\Psi\), which needs a separate coordinate for every electron. The density is dramatically simpler. The only question is: could something so simple possibly contain enough information? The shocking answer is yes.
It is worth seeing why Theorem 1 is true, because the proof is one of the most elegant short arguments in physics — a clean proof by contradiction — and because it shows the theorem isn't a hopeful approximation but an exact fact. First, the precise statement.
The setup: two molecules might have different nuclear arrangements — different external potentials \(v\) and \(v'\), hence different Hamiltonians \(\hat H\) and \(\hat H'\) and different ground states \(\psi\) and \(\psi'\). We assume, for contradiction, that they nonetheless produce the same density \(\rho\), and derive an impossibility.
There's still a problem. The theorems promise the magic functional \(E[\rho]\) exists, but they don't tell you its formula — and the kinetic energy of a cloud of interacting electrons is itself fiendish to write down. Kohn and Sham's 1965 fix is the trick that made DFT actually usable, and it's beautifully sneaky.
Invent a pretend molecule. Imagine a fake system of electrons that don't interact at all — no term 3, no tangle — but which are rigged to have the exact same density as the real, messy molecule. Because the fake electrons are independent, each one obeys its own simple, solvable equation. We get nearly all the energy easily from the fake system, then sweep every difference between fake and real into a single correction term. That correction has a name you'll see in the equations: exchange–correlation.
Let's make the "pretend molecule" rigorous. We split the exact energy functional into pieces we can compute exactly and one piece we can't:
Now apply the variational principle one more time — minimize this \(E[\rho]\) subject to keeping \(N\) electrons. Because \(\rho\) is built from the fake orbitals \(\phi_i\) (with \(\rho = \sum_i |\phi_i|^2\)), minimizing over the orbitals yields a set of single-particle equations that look exactly like a Schrödinger equation for one electron moving in an effective potential. (The machinery is the same "set the derivative to zero" move you saw give Roothaan–Hall in Chapter 4 — here each derivative is a functional derivative, the continuous cousin defined just below, but the spirit is identical.) The result:
With the Kohn–Sham trick, the energy grid \(\mathbf F\) from Chapter 4 (now properly called the Kohn–Sham matrix) splits into three understandable pieces. The paper writes equation 8:
Since nobody knows the exact \(E_{\text{xc}}\), scientists have built a ladder of ever-better approximations — physicists half-jokingly call it "Jacob's Ladder," climbing from earth toward the heaven of the exact answer. Each rung feeds the functional more information about the density:
ωB97X-D — a high, costly rung that mixes in a dose of "exact exchange." The -D tacked on the end stands for a dispersion correction: a patch for the gentle stickiness (van der Waals forces) that even hybrids otherwise miss. This is a deliberately accurate, expensive choice — part of why the dataset weighs 100 terabytes.The lowest rung, the Local Density Approximation (LDA), is worth deriving because its exchange energy can be pinned down exactly — and the form is surprisingly clean. The idea: at each point in the molecule, pretend the electron gas has the uniform density found right there, and use the known exchange energy of a uniform gas. The remarkable part is that we can find the density-dependence by pure scaling, without any hard integral.
Every higher rung of the ladder refines this. GGA adds a dependence on the density's gradient \(\nabla\rho\) (how fast the cloud is changing, not just how thick it is). Meta-GGA adds the kinetic-energy density \(\tau\). And hybrids mix in a fraction of "exact exchange" computed the expensive Hartree–Fock way. Each rung feeds the functional strictly more information about the local shape of the cloud.
Here's a concrete flaw worth seeing explicitly, because it explains why exchange is non-negotiable. The Hartree term \(J[\rho]\) — the cloud's electrostatic push on itself — is summed over the whole density. But consider a hydrogen atom, which has exactly one electron. That single electron has no other electron to repel. Yet:
Finally, the molecule's complete energy. The paper writes it as equation 9. It looks dense, but every piece is now an old friend — we've spaced it out so you can see the seams:
Notice the star of Chapter 4 — the density matrix \(D\) — appears in every single term. Get the density, and the total energy falls right out. That's the engine. And the whole point of nablaDFT is to make this engine run without the crushing cost of the SCF loop — by teaching a machine to skip straight to the answer.
Everything so far has been climbing toward one object. The grand prize of the whole calculation — the thing nablaDFT ultimately wants a computer to guess — is the Hamiltonian matrix \(\mathbf{H}\). Hold it, and the energy, the orbitals, the density, and a dozen other properties all unlock. Let's look at how it's organised, why its structure matters, and what its hidden eigenvalues tell you about the real world.
The paper draws \(\mathbf H\) (equation 10) as a big grid that is itself carved into smaller rectangles called blocks:
Here's a small mercy hiding in the structure. The influence of atom \(i\) on atom \(j\) is the same as the influence of \(j\) on \(i\) — so \(H_{ij} = H_{ji}\). The matrix is a perfect mirror image across its diagonal (mathematicians say Hermitian, or for real numbers, symmetric). That means you only ever need to work out half of it — the bottom triangle — and the top half comes free. A useful saving, and the neural networks exploit it.
Now for why this matrix is worth so much. Remember Chapter 3: solving \(\mathbf F\mathbf c = \varepsilon\mathbf S\mathbf c\) means finding the eigenvalues of the matrix. Each eigenvalue \(\varepsilon\) is the energy of one orbital. So the matrix secretly contains a whole ladder of energy levels — and electrons fill that ladder from the bottom up, two per rung (one spin-up, one spin-down, per Chapter 2's Pauli rule).
Two rungs on that ladder have special names and enormous importance:
That gap even sets a molecule's colour. A photon of light with just the right energy can kick an electron from HOMO to LUMO; the molecule absorbs that colour and reflects the rest. The size of the gap picks which colour gets absorbed. The redness of a tomato and the green of a leaf are HOMO–LUMO gaps you can see. Let's compute one.
Fill the energy ladder yourself below. Add electrons, watch them stack two-per-rung, and see the HOMO–LUMO gap — and the molecule's predicted colour — change.
Electrons fill from the bottom, two per rung (↑↓). The gap between the highest filled rung (HOMO) and lowest empty one (LUMO) sets reactivity and colour. Change the number of electrons and the spacing of the levels.
The paper adds a crucial warning: the entries of this matrix are not smooth. Nudge an atom a hair, and the numbers can jump in jagged, hard-to-predict ways. That bumpiness is exactly what flexible machine-learning models handle well and rigid formulas handle badly.
And there's the cost. Solving for these eigenvalues by the honest SCF route scales roughly as \(N^3\) — triple the atoms and the work grows about 27-fold. Build the demo below to feel that wall, and to see why a fast neural-network guess is worth so much.
Every atom you add doesn't just add a row — it adds a whole row and column of blocks, and the solve-cost grows like \(N^3\). Drag to add atoms and watch both explode.
That \(N^3\) wall is the whole motivation for the next chapter. If a machine could look at a molecule and simply predict this matrix — skipping the SCF loop entirely — chemistry would speed up by orders of magnitude. So: can it?
Chapter 6 showed that the Hamiltonian matrix is the object both papers ultimately want to predict, and that it's organised in blocks, one per pair of atoms. That was the sketch. This chapter is the dissection: where each number in the matrix actually comes from, why the matrix has the symmetries it has, why most of it is nearly zero — and crucially, why that near-emptiness is the entire reason a neural network can predict it at all. We'll also finish the eigenvalue story properly, with the orthogonalization step real codes use. Like Chapter 3½, this is a rigorous detour; the reward is that the machines of Chapter 7 will make complete structural sense.
Recall from Chapter 4 that we expand orbitals in basis functions \(\phi\). We can now be precise about what those functions look like. Each one factorizes into a radial part (how it fades with distance from its atom) times an angular part (its shape and orientation):
This is why the matrix blocks have the sizes they do. The block \(\mathbf H_{ij}\) coupling atoms \(i\) and \(j\) is a rectangle whose dimensions are (number of basis functions on \(i\)) × (number on \(j\)). Let's count for real atoms in the def2-SVP basis the papers use.
Chapter 6 mentioned the matrix is symmetric as a "free gift." Here's the rigorous reason. The Hamiltonian operator \(\hat H\) is self-adjoint (Hermitian) — a physical requirement, because it guarantees energies come out as real numbers rather than imaginary ones. Self-adjointness of the operator forces a symmetry on its matrix:
Here is the single most important structural fact for understanding why machine learning works on this problem. The off-diagonal blocks of the matrix — the couplings between distant atoms — are not just small. They die off exponentially with distance. Let's see why, from the Gaussian basis.
Chapter 6 read orbital energies off the matrix as eigenvalues. But there's a wrinkle we can now resolve rigorously. Because the basis isn't orthonormal — the overlap matrix \(\mathbf S\) isn't the identity (Chapter 4) — the equation to solve isn't the textbook \(\mathbf H\mathbf c = \varepsilon\mathbf c\) but the generalized eigenproblem \(\mathbf H\mathbf c = \varepsilon\mathbf S\mathbf c\). Here is how real codes turn it back into a standard one.
The eigenvalues \(\varepsilon_i\) of \(\tilde{\mathbf H}\) are the orbital energies. Order them, fill two electrons into each from the bottom (the aufbau principle, enforced by Pauli from Chapter 2), and the highest filled and lowest empty levels are the HOMO and LUMO whose gap you computed by hand in Chapter 6. This orthogonalization-then-diagonalization is the step that costs \(O(N^3)\) — the matrix operations grow as the cube of the basis size — which is the precise origin of the "\(N^3\) wall" the interactive demo let you feel.
Finally, the payoff that makes the matrix worth predicting: once you have it (and the density matrix \(\mathbf D\) built from the occupied eigenvectors, Chapter 4), real chemical quantities come out by simple operations. Two rigorous examples.
Solving DFT honestly means grinding the SCF loop from Chapter 4 until it converges — hours for a medium molecule. nablaDFT's plan: pay that cost once for a giant pile of molecules, then train a neural network to learn the pattern from input (the atoms and their positions) to output (the energy or the matrix). Afterward, a brand-new molecule's answer takes a heartbeat. This chapter meets the machines, and the genuine physics built into each one.
A neural network is a long chain of simple steps. At each step it takes numbers, multiplies and adds them in adjustable ways (the adjustable numbers are called weights), and passes the result on. None of the physics is programmed in. Instead, the network learns by example.
Learning works like this. You show the network a molecule whose true energy you already computed with DFT. The network makes a guess. You measure how wrong it was with a loss function — typically the squared error:
Then comes the clever part, gradient descent. Think of the loss as a landscape, with the network's thousands of weights as the coordinates and the height as how-wrong-you-are. You want the lowest valley. So you feel the slope under your feet — the gradient, our friend \(\nabla\) again — and take a small step downhill. Repeat millions of times, across millions of molecules, and the network slowly descends into a valley where its guesses are good.
Every model in the paper shares the same four-stage skeleton; they differ in how they build the third stage, the interaction, where atoms share information.
Picture the molecule as a graph — atoms are dots, and nearby atoms are joined by lines. The networks learn by playing a kind of telephone game on this graph: every atom sends a little "message" (a bundle of numbers describing itself) to its neighbours, each atom gathers the messages it receives and updates its own description, and you repeat for a few rounds. After round one, each atom knows about its immediate neighbours; after round two, about neighbours-of-neighbours; and so on, until information has rippled across the whole molecule. This is called message passing, and it's the shared soul of all four models.
SchNet's insight: how much one atom influences another should depend on how far apart they are. It writes the update as equation 11:
A subtlety: you can't just feed the raw distance (say, "1.4 ångström") into the network — a single number is too blunt, and the network learns smoother patterns if distance is spread across many gentle features. So SchNet expands each distance into a whole bank of overlapping bell-shaped detectors, called radial basis functions (RBFs):
Because the filter depends only on distance — never on which way the molecule points — SchNet's predictions are unchanged if you rotate the whole molecule. This property is called invariance, and it's exactly what real physics demands: a molecule's energy doesn't care which way it's facing. Let's make "invariance" precise, because the next models hinge on a sharper version of it.
Between rounds, SchNet needs to "bend" its numbers so it can learn curved relationships — a perfectly straight machine can only ever learn straight lines. It uses a smooth bending function, the shifted softplus (equation 12):
Why does smoothness matter so much? Because a force is how energy changes as you move an atom — and "how something changes as you move" is a derivative. In physics, force is the negative gradient of energy:
So once the network can predict energy \(E\), it gets the forces for free by differentiating — but only if every step in the network is smooth enough to differentiate. That's the whole reason for the gentle shifted-softplus instead of a function with corners. The \(\nabla\) that named the paper shows up one last time, right here, turning predicted energies into the forces that push atoms around.
DimeNet spotted a gap in SchNet. Distances alone can make two genuinely different molecules look identical to the machine. The fix: also pay attention to angles — the bend formed by triples of atoms. DimeNet passes messages that carry this directional information (equation 13):
After all messages have flowed, DimeNet gathers them into a final description of each atom (equation 14):
Plainly: "atom \(i\)'s final description \(h_i\) is the sum of all messages \(m_{ji}\) its neighbours sent it." From \(h_i\) the network reads the energy. The paper reports DimeNet (and its faster sequel DimeNet++) clearly beats SchNet — angles really do carry information distances miss.
SchNet and DimeNet predict a single number (the energy). But the real grand prize from Chapter 6 was the entire Hamiltonian matrix. Two models chase it. SchNOrb extends SchNet to output the matrix blocks. PhiSNet goes further and bakes in the rotation rule from the invariance/equivariance box above.
Recall the subtlety: spin a molecule and its energy is unchanged (invariant — easy), but its Hamiltonian matrix must co-rotate in a precise, mathematically-required way (equivariant — hard). A model ignorant of this could give different matrices for the same molecule at different tilts — plainly wrong. PhiSNet builds the rule in from the ground up by storing its numbers in a special rotation-aware form, which the paper describes by its shape (equation 15):
The clever \((L+1)^2\) deserves unpacking, and it ties straight back to the orbital shapes from Chapter 2. The features are organised by spherical harmonics — the natural set of "wave shapes on the surface of a sphere," labelled by a level \(\ell = 0, 1, 2, \dots\). You've already seen the first few:
So nablaDFT built a colossal library and trained these machines on it. What did they learn? The honest answer has three parts — and some of them did not go the way you'd hope. That candour is exactly what makes it good science.
Before any result makes sense, you need a yardstick for "how wrong." The paper uses the Mean Absolute Error (MAE): for each test molecule, take the size of the gap between the guess and the truth, then average over all of them.
Chemists have a famous target called chemical accuracy: get within about \(1\) kilocalorie per mole of the truth, and your prediction is trustworthy enough to do real chemistry with. In the energy units these models use (Hartree, written \(E_{\text h}\)), that bar is roughly:
So the game is to push the MAE below roughly \(1.6\times10^{-3}\) Hartree. Keep that number in mind as the finish line while we look at how the models actually did.
The dataset holds 1,004,918 molecules and 5,340,152 conformations (a conformation being one frozen 3-D pose — the Born–Oppenheimer snapshots from Chapter 3). Every one was computed with full DFT at the ωB97X-D/def2-SVP level using the Psi4 software. The whole thing fills around 100 terabytes.
When they trained the matrix-predictor PhiSNet on larger and larger slices, its error fell steadily — on one test, its Hamiltonian MAE dropped from 7.4 down to 2.9 (in units of \(10^{-3}\) Hartree) as the training set grew. The hopeful reading: these models haven't hit their ceiling — feed them more and they keep improving.
One telling exception proved the point. The plain linear-regression baseline — the simplest possible model — barely improved at all with more data (it sat near 4.6, in units of \(10^{-2}\) Hartree, no matter what). That's the signature of a model too simple to use what the extra data offers. More food only helps if you're able to digest it.
Here's the result the paper is most candid about. On the famous older benchmarks (called QM9 and MD17), these models are spectacular — DimeNet++ reaches an energy MAE around 0.00023 Hartree on QM9, comfortably past the chemical-accuracy finish line. But on nablaDFT's far more varied, drug-like molecules, the same kind of model managed only about 3.2 ×10⁻² Hartree on the hardest test — more than a hundred times worse, and nowhere near the bar.
Why the collapse? Because the older benchmarks ask an easier question. Understanding which question is the key to the whole paper — and it's best seen as the difference between kinds of exams.
Two smaller findings sharpen the picture. Some deep models, trained on only small slices of data, did worse than the dumb linear baseline — flexibility is useless without enough examples to pin it down. And one matrix-model, SchNOrb, wouldn't even train successfully on the larger sets, a reminder that these machines remain finicky and far from solved.
It would be easy to read all this as failure. It is the opposite. The paper's real contribution is an honest, hard yardstick — plus the giant, carefully-computed dataset needed to attack it. Earlier tests flattered the models; nablaDFT shows the field exactly where the real work remains. (The 100-terabyte size is itself a consequence of that honesty: a high, expensive hybrid functional and a real basis set for five million poses is what rigor costs.)
A good benchmark isn't there to crown winners. It's there to show you, honestly, how far you still have to go.
Two years after the first paper, the same team came back with a sequel — and gave it a sequel's name. If the original was nablaDFT (\(\nabla\)DFT), this one is ∇²DFT, "nabla-squared DFT." The little square is a chemist's in-joke: you met \(\nabla^2\) back in Chapter 3 as the operator for an electron's motion energy. Here it just means "more" — a bigger, richer, more honest second pass at the same dream. Everything you learned still holds; this chapter is what the team added once they had the first benchmark to learn from.
The first move was simply scale. ∇²DFT roughly doubles the molecules and triples the conformations of the original. The numbers, straight from the paper:
The headline new idea isn't size — it's a new kind of data, and it solves a problem we quietly skipped. All through this book, we computed the energy of a molecule frozen in one pose (a "conformation," from Chapter 3). But molecules are floppy, and a randomly-generated pose is usually an awkward, high-energy one. What chemists actually want is the relaxed pose — the molecule settled into its most comfortable, lowest-energy shape, like a dropped string slithering into a heap.
Finding that comfortable shape is called geometry optimization (or relaxation), and it works exactly like the gradient descent from Chapter 7 — but now you're rolling the physical molecule downhill in energy instead of rolling a network's weights downhill in error. At each step you compute the forces (remember, \(\vec F = -\nabla E\)), nudge every atom a little in the direction it's being pushed, and repeat until nothing wants to move. The sequence of poses along the way — from awkward start to relaxed finish — is a trajectory.
The first dataset mainly stored the Hamiltonian and overlap matrices. ∇²DFT keeps those but saves far more from each DFT run — 17 molecular properties plus the complete wavefunction object (the full output of the Psi4 solver). That last part matters: with the entire wavefunction in hand, you can compute almost any property you want later, without rerunning anything. Several of these quantities are old friends from earlier chapters:
The original paper tested two things: predicting the Hamiltonian, and predicting energy. ∇²DFT builds a proper benchmark with three tasks and a tidy, extendable framework holding ten models — including several that postdate the first paper. The three tasks:
The results rhyme with the first paper's, and deepen its central warning.
There were honest stumbles too, faithfully reported: PhiSNet, the best matrix-predictor, failed to finish training on the largest data splits even after 1,920 hours of GPU time — a reminder that these machines remain finicky and costly. And the surprise from the first paper held: modelling the full electronic structure (as SchNOrb does) helped it predict plain energies about as well as the specialised energy models, hinting that teaching a network real quantum structure makes it better at everything.
Same dream, sharper tools, and the same honest answer: getting closer, not yet there.
Find the
wave.
You just climbed from "what is an atom" to fifteen equations out of a real research paper — through Coulomb's law, the wave function, the Schrödinger equation, the basis-set translation, the self-consistent field, density functional theory, the block Hamiltonian, gradient descent, and four neural networks built to guess it all — and then on to its sequel, with relaxation trajectories and a stable of ten models. You met the same chase that has occupied physicists for a hundred years, and you didn't skip the maths. Not bad for one little book.
Based on nablaDFT: Large-Scale Conformational Energy and Hamiltonian Prediction benchmark and dataset, Khrabrov et al., Phys. Chem. Chem. Phys., 2022, 24, 25853–25863; and its sequel ∇²DFT: A Universal Quantum Chemistry Dataset of Drug-Like Molecules and a Benchmark for Neural Network Potentials, Khrabrov et al., NeurIPS 2024 (arXiv:2406.14347). Equations and figures (dataset sizes, error values, the level of theory) are drawn from those papers. All illustrations original.