Physics
Physics Feb 2026 · Part 2 of 2

Where machine learning comes in

Part 1 ended with one question: given where the atoms are, what is the energy? Every model is an attempt to answer it. This page is about letting a computer work out the answer instead of a human guessing it.

Start with Part 1 if it is still unread. This page assumes force is the slope of the energy, and that a pair potential adds up every pair of atoms.

1. The best answer is quantum mechanics, and it is painfully slow

Every model in Part 1 was a guess at the shape of the energy. There is one way to stop guessing: work out what the electrons are actually doing. That is quantum mechanics, and it gives real answers, bonds that break, metals that behave like metals, chemistry that happens.

The catch is the cost. Here are the real numbers from a simulation of one small molecule of five atoms, measured on a laptop:

MethodTime for one energyGood enough to…
Pair potential~0.000001 ssimulate argon
Classical force field~0.000001 ssimulate proteins, but bonds never break
Quantum mechanics (DFT)2.6 sget the chemistry right

2.6 seconds does not sound slow. But remember the loop: we need this every single step, and a step is one femtosecond. To simulate one nanosecond, still a very short time in biology, we need a million steps.

1,000,000 steps × 2.6 s ≈ one month of computing

And that is for five atoms. A protein has tens of thousands. This is the wall the whole field ran into.

the problem Fast or right, pick one
Everything useful sits along the bottom-left to top-right diagonal. The corner everybody actually wants, accurate and fast, was empty.

2. The idea: learn the answer from examples

Here is the trick, and it is simpler than it sounds.

We cannot afford to run quantum mechanics a million times. But we can afford to run it a few thousand times. So do that: pick a few thousand arrangements of the atoms, and compute the exact energy for each one. That is our set of examples.

Then fit a flexible mathematical function to those examples, one with enough knobs to bend into almost any shape. Afterwards, throw away the quantum calculation and just use the fit. The fit runs in microseconds.

This is the whole idea. Pay the expensive cost a few thousand times, up front. Then get answers essentially for free, forever.

The widget below shows this happening. The grey curve is the truth, which in real life we never get to see. The dots are the expensive calculations we chose to run. The blue curve is what a machine learning model builds from only those dots.

try it Learning a curve from a handful of expensive answers
4
quantum runs used
,
time that cost
,
worst error
,
verdict
,
With four examples the fit invents nonsense between them. By about fifteen it is nearly perfect. Notice where it stays worst longest: the steep wall on the left, where the curve changes fastest. Deciding which arrangements are worth computing is a real part of the job.

3. The catch: we cannot just feed in the coordinates

So we need a function that takes atom positions and returns energy. The obvious thing is to feed the raw numbers, x, y, z for every atom, straight into a neural network. This does not work, and the reason is important.

A molecule sitting in empty space has the same energy no matter where it is, no matter which way it is turned, and no matter what order we happen to list identical atoms in. Physics does not care about any of those. But the raw numbers change completely.

try it The molecule has not changed. The numbers have.
raw coordinates
,
distances between atoms
,
true energy
unchanged
Press the buttons. The raw coordinates jump around every time. The distances never move. The real energy never moves either, so distances are telling the truth about the molecule and raw coordinates are not.

If we trained a network on raw coordinates, it would waste all its effort learning that turning a molecule does nothing, and it would still get it wrong for angles it had never seen. Worse, it would give two different answers for the same molecule described two different ways.

4. The fix: describe each atom by what it can see

Instead of feeding in positions, we give the network a description of each atom's surroundings, built only out of distances and angles to its neighbours.

Think of it as a fingerprint of the neighbourhood. "There are two atoms about 1.1 Å away, one at 1.8 Å, nothing else nearby, and the angle between the first two is 109°." That description is unchanged if we move the molecule, turn it, or relabel identical atoms, because it never mentions where anything is in absolute terms.

drag it Drag a neighbour. Watch the fingerprint.
Dragging a neighbour changes the fingerprint, because the molecule really did change. Turning the whole thing leaves it completely still, because the molecule really did not. That is exactly the behaviour we needed and could not get from raw coordinates.

5. What exactly does the model predict?

This is the part people get most confused about, so here it is spelled out.

What comes out of the model is one number for the whole system: the total energy of all the atoms together. Plus the forces, which are just the slope of that one number, three numbers per atom. That is all. There is no separate prediction for each atom.

But inside, the model works atom by atom. Each atom's fingerprint goes through a small network which returns a number, and those numbers get added up:

total energy = sum over atoms of (each atom's own number)

So does that mean the model learns "the energy of one atom"? No, and this is the important bit.

Nobody ever tells the network what a single atom's energy should be. There is no such measurement. Quantum mechanics does not produce one either. The only thing ever compared against the truth is the sum.

The per-atom numbers are the network's own invention. It is free to divide the total between the atoms however it likes, as long as the total comes out right. Two differently trained networks will split it differently and both be equally correct. So we should not read a single atom's number as "how much energy this atom has": that quantity does not exist, because an atom's energy only means anything in relation to its neighbours.

Why bother splitting it up at all, then? Two reasons, both practical:

The widget below uses a real trained model. Drag the slider to stretch a bond in a methane molecule and watch what happens.

real model Invented shares, real total loading…
-
model total
-
quantum truth
-
difference
-
The grey bars are the five per-atom numbers the network made up. Watch how the departing hydrogen and the carbon trade energy back and forth as the bond stretches. Nobody taught it to do that, and nobody checked it.

The only thing that was ever checked is the pair on the right: the model's total against the quantum answer. Those two agree to a fraction of a kcal/mol across the whole stretch, which is the entire claim the model makes.

6. Two more pieces, and we have a real model

The sum is many-body, even though it looks like the pair sum

Adding up per-atom terms looks like the pair sum from Part 1, but there is a crucial difference. A pair term only ever sees two atoms. An atom's fingerprint sees all of its neighbours at once, so the network can learn exactly the kind of crowding effect that EAM had to hard-code, and anything else besides. It is many-body without anybody deciding in advance what the many-body rule should be.

It also means the model does not care how big the system is. Every hydrogen atom shares the same small network. Train on small molecules, run on large ones.

Learn from forces, not just energies

Every quantum calculation gives us the energy, one number. But it also gives us the force on every atom, almost for free. For a molecule of N atoms, that is 3N more numbers, all from the same expensive calculation.

why it matters What one expensive calculation gives us
Energies tell us how high the surface is at one point. Forces tell us which way it tilts and how steeply, the shape, not just the height. Three slopes still do not pin the curve perfectly, but they get us far closer than three heights alone, from the very same calculations. That is why a few thousand are enough instead of a few hundred thousand.

7. Putting it together

Here is the whole recipe, in order:

  1. Choose a few thousand arrangements of the atoms.
  2. Run the slow, accurate quantum calculation on each one. Keep the energy and the forces.
  3. Turn each atom's surroundings into a fingerprint of distances and angles.
  4. Train a small network: fingerprint in, that atom's energy out.
  5. Add up the atoms to get the total energy. Take its slope to get forces.
  6. Put those forces into the loop from Part 1 and run the simulation.

That is a machine-learned interatomic potential. It is not magic and it is not a black box replacing physics; it is a very good curve fit to a physics calculation we could not afford to keep repeating.

What it buys us. This exact recipe reproduces a quantum dissociation curve to within 0.3 kcal/mol, and runs about 17,000× faster than the quantum calculation it learned from, fast enough to run live in a browser tab.

8. What it does not fix

Worth being straight about, because these are real limits.

None of that stops it working. Modern general-purpose versions of this idea are trained on millions of structures across most of the periodic table, and they have genuinely changed what simulations people can run.

That is the end of the two-part explainer. Back to Part 1: How molecular dynamics works, or reach me on GitHub or by email.

Aayush Neupane
Aayush Neupane
CS Researcher & Engineer · MS CS, University of Kansas
More physics →