Algorithm Search⌘K

Modeladvanced

Embedded atom method

Also called EAM potential.

A potential for metals in which each atom's energy is a function of the electron density summed from its neighbors, plus a pair term.

The embedded atom method (EAM) is an interatomic potential for metals. Each atom sits in the electron density that its neighbors make at its position, and it gets an energy F(ρ)F(\rho) for being embedded in that density, plus a pair term with each neighbor. Since FF is not linear, the energy of a bond depends on how many other bonds the atom has, so the model is many-body and cannot be written as a sum over pairs. It costs about as much as a pair potential, and it fixes the main failures of pair potentials for metals: vacancy energies that are too high and the Cauchy relation between the elastic constants.

The machine

Unknowns. The positions r1,…,rNr_1, \ldots, r_N of the atoms, with rij=∣ri−rj∣r_{ij} = |r_i - r_j|.

Functional form. For one species,

U=∑iF(ρi)+∑i<jϕ(rij),ρi=∑j≠if(rij).U = \sum_{i} F(\rho_i) + \sum_{i<j} \phi(r_{ij}), \qquad \rho_i = \sum_{j \ne i} f(r_{ij}).

Here f(r)f(r) is the contribution of a neighbor at distance rr to the density at an atom, FF is the embedding function, and ϕ\phi is a pair term, mostly repulsive. All three vanish beyond a cutoff rcr_c. For several species, FF depends on the species of atom ii, ff on the species of atom jj, and ϕ\phi on the pair of species.

Forces. The derivative of UU with respect to the distance of one pair collects three terms, so

Fi=−∇iU=−∑j≠i[(F′(ρi)+F′(ρj))f′(rij)+ϕ′(rij)]ri−rjrij.F_i = -\nabla_i U = -\sum_{j \ne i} \left[\big(F'(\rho_i) + F'(\rho_j)\big) f'(r_{ij}) + \phi'(r_{ij})\right] \frac{r_i - r_j}{r_{ij}} .

A pair force thus depends on the densities at both of its atoms, so the forces need two passes: one to compute all ρi\rho_i, and one to add the pair forces.

Parameters, fitted and derived. The three functions are the parameters. The form is derived: Daw and Baskes obtained it from density functional theory, with the density at an atom approximated by a sum of atomic densities, and Finnis and Sinclair obtained F(ρ)=−AρF(\rho) = -A\sqrt{\rho} from tight-binding theory, in which the band energy grows as the square root of the second moment of the density of states. The functions themselves are fitted. In Foiles, Baskes and Daw, ff comes from free-atom electron densities, and FF and ϕ\phi are fitted to the lattice constant, the elastic constants, the sublimation energy and the vacancy formation energy of each metal. Later fits use many quantum energies and forces as well.

Gauge freedom. The functions are not unique. For any constant kk, the change

F(ρ)→F(ρ)+kρ,ϕ(r)→ϕ(r)−2kf(r)F(\rho) \to F(\rho) + k\rho, \qquad \phi(r) \to \phi(r) - 2k f(r)

leaves UU unchanged for every configuration, since ∑ikρi=2k∑i<jf(rij)\sum_i k\rho_i = 2k\sum_{i<j} f(r_{ij}). The scaling f→sff \to s f, F(ρ)→F(ρ/s)F(\rho) \to F(\rho / s) leaves UU unchanged too. So only combinations of the functions are physical, and a fit must fix the gauge, for example by asking F′(ρˉ)=0F'(\bar\rho) = 0 at the density ρˉ\bar\rho of the perfect crystal. The separation of the energy into "embedding" and "pair" parts has no meaning on its own.

Standing assumptions. The electron density at an atom is a sum of spherical contributions of its neighbors, so the model has no angular terms. This suits metals with nearly free electrons and filled or nearly filled d bands, such as the fcc metals Cu, Ag, Au, Ni, Pd and Pt. Covalent materials with directional bonds, such as silicon, need angular terms.

  1. EAM-ENERGY-FORCES(r_1..r_N, F, f, φ, r_c)
  2. 1ρ_i ← 0 for each atom i; U ← 0
  3. 2for each pair i < j with r = |r_ij| < r_c:
  4. 3ρ_i ← ρ_i + f(r); ρ_j ← ρ_j + f(r); U ← U + φ(r)
  5. 4for each atom i: U ← U + F(ρ_i)
  6. 5for each pair i < j with r = |r_ij| < r_c:
  7. 6g ← (F'(ρ_i) + F'(ρ_j)) f'(r) + φ'(r) ▷ dU/dr for this pair
  8. 7F_i ← F_i - g r_ij / r; F_j ← F_j + g r_ij / r
  9. 8return U, ρ, F

With a Verlet neighbor list, both passes cost O(N)O(N) at fixed density, about twice the cost of a pair potential. In parallel codes, the second pass needs the F′(ρj)F'(\rho_j) of atoms owned by other processors, which is one extra communication step per force call.

What it counts

The model gives the energy UU and the forces, and through simulation, static calculations and molecular dynamics:

  • Bulk properties: lattice constants, cohesive energies, elastic constants and phonons.
  • Defects: the formation and migration energies of vacancies and interstitials, surface and grain boundary energies, and dislocation cores. Barriers come from saddle points, for example with the nudged elastic band method.
  • Alloys: heats of mixing and segregation, with functions for each species.
  • Thermal behavior: melting, thermal expansion and diffusion, from molecular dynamics.

Relation to other models

  • Pair potentials. If FF is linear, F(ρ)=cρF(\rho) = c\rho, then U=∑i<j[ϕ(rij)+2cf(rij)]U = \sum_{i<j} [\phi(r_{ij}) + 2c f(r_{ij})] is a pair potential, such as the Lennard-Jones potential. The nonlinearity of FF is the whole difference. A convex FF with F′′>0F'' > 0, such as −ρ-\sqrt\rho, makes each extra bond worth less than the one before.
  • Finnis-Sinclair and second-moment potentials. The same form with F=−AρF = -A\sqrt\rho, from tight binding. The two models differ in the fitting, not in the form.
  • Modified EAM and bond-order potentials. Modified EAM adds angular terms to the density, for metals with partly filled d bands and for silicon. Bond-order potentials such as Tersoff's make the strength of each bond depend on the angles to the other bonds.
  • Machine-learned potentials. The Behler-Parrinello potential has the same structure, a sum of atomic energies that depend on the neighborhood, but it replaces F(∑f)F(\sum f) by a neural network of many descriptors of that neighborhood.
  • Continuum models. The Cauchy-Born rule maps a uniform strain of the crystal to a strain energy density, and EAM is a common atomistic model behind it.

Known results in the model

The results below are exact properties of the form, hand computations checked by the tests, and measurements.

Bonds weaken with coordination (a hand computation). Take F(ρ)=−ρF(\rho) = -\sqrt\rho, no pair term, and a density function with f=1f = 1 at distance 1 and f=0f = 0 beyond the first neighbors. A dimer at distance 1 has ρ=1\rho = 1 at each atom, so U=−2U = -2, an energy of −2-2 per bond. An equilateral triangle with side 1 has ρ=2\rho = 2 at each atom, so U=−32=−4.243U = -3\sqrt 2 = -4.243 for 3 bonds, an energy of −1.414-1.414 per bond. A pair potential gives the same energy per bond in both.

Vacancy energy (a hand computation). In the same model, a crystal in which each atom has zz nearest neighbors has ρ=z\rho = z at each atom and cohesive energy Ec=zE_c = \sqrt z per atom. Remove one atom: its zz neighbors each lose one neighbor. The unrelaxed vacancy formation energy is

Ev=z(z−z−1).E_v = z\left(\sqrt z - \sqrt{z - 1}\right).

For fcc, z=12z = 12: Ev=12(3.4641−3.3166)=1.7698E_v = 12(3.4641 - 3.3166) = 1.7698, while Ec=3.4641E_c = 3.4641, so Ev/Ec=0.511E_v / E_c = 0.511. A nearest-neighbor pair model gives Ev/Ec=1E_v / E_c = 1, as the interatomic potential page shows. The tests build a 108-atom fcc crystal in a periodic box and recover these values. Real fcc metals have a ratio well below 1, and the fitted EAM functions reproduce the measured vacancy energies, which is one reason the model is used.

The Cauchy relation (theorem). For a cubic crystal with central pair forces, with each atom a center of inversion and no applied pressure, C12=C44C_{12} = C_{44}. In EAM, the embedding term adds to C12−C44C_{12} - C_{44} a term proportional to F′′(ρˉ)F''(\bar\rho), and C44C_{44} gets no such term. So a convex FF gives C12>C44C_{12} > C_{44}, as in most fcc metals, and the model can fit both constants.

Other exact properties.

  • The total force is zero and the energy does not change under rotations, since UU depends only on distances.
  • The gauge change above leaves energies and forces unchanged; the tests check this on random clusters.
  • If ff, FF and ϕ\phi have continuous first derivatives and ff and ϕ\phi go to zero with their derivatives at rcr_c, the forces are continuous and the energy is conserved in molecular dynamics up to the integrator error.

Accuracy (measurements). Daw, Foiles and Baskes review comparisons with experiment for surfaces, defects, alloys and liquid metals. The model is weakest where angular forces matter: bcc transition metals with partly filled d bands, and covalent materials.

Code

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

embedded_atom_method.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/embedded-atom-method/. The authors are listed in prov/4CFCM8.jsonl.

import math
from typing import Callable, Optional

Point = list[float]
Fn = Callable[[float], float]


def _separation(ri: Point, rj: Point, box: Optional[float]) -> list[float]:
    d = [a - b for a, b in zip(ri, rj)]
    if box is not None:
        d = [x - box * round(x / box) for x in d]
    return d


def eam_energy_forces(
    positions: list[Point],
    embed: Fn,
    dembed: Fn,
    density: Fn,
    ddensity: Fn,
    pair: Fn,
    dpair: Fn,
    rc: float,
    box: Optional[float] = None,
) -> tuple[float, list[float], list[list[float]]]:
    """The EAM energy U = sum_i F(rho_i) + sum_{i<j} phi(r_ij), with rho_i = sum_{j != i} f(r_ij).

    One species. embed, density and pair are F, f and phi; the d-functions
    are their derivatives. f and phi are taken as zero from rc on. With box
    set, the box is cubic and periodic and pairs use the nearest image, which
    needs rc <= box / 2. Returns (U, rho, forces).
    """
    if box is not None and rc > box / 2:
        raise ValueError("the cutoff must be at most half the box")
    n = len(positions)
    rho = [0.0] * n  # @line L1
    u = 0.0  # @line L1
    close = []
    for i in range(n):  # @line L2
        for j in range(i + 1, n):  # @line L2
            d = _separation(positions[i], positions[j], box)
            r = math.sqrt(sum(x * x for x in d))
            if r >= rc:  # @line L2
                continue
            close.append((i, j, r, d))
            fr = density(r)  # @line L3
            rho[i] += fr  # @line L3
            rho[j] += fr  # @line L3
            u += pair(r)  # @line L3
    for i in range(n):  # @line L4
        u += embed(rho[i])  # @line L4
    dF = [dembed(x) for x in rho]
    forces = [[0.0] * len(positions[0]) for _ in range(n)]
    for i, j, r, d in close:  # @line L5
        g = (dF[i] + dF[j]) * ddensity(r) + dpair(r)  # @line L6
        for q in range(len(d)):
            c = g * d[q] / r
            forces[i][q] -= c  # @line L7
            forces[j][q] += c  # @line L7
    return u, rho, forces  # @line L8


def fcc_lattice(cells: int, a: float) -> list[Point]:
    """An fcc crystal of 4 cells^3 atoms with cubic lattice constant a, in a box of side cells a."""
    basis = [(0, 0, 0), (0.5, 0.5, 0), (0.5, 0, 0.5), (0, 0.5, 0.5)]
    return [
        [a * (x + b[0]), a * (y + b[1]), a * (z + b[2])]
        for x in range(cells)
        for y in range(cells)
        for z in range(cells)
        for b in basis
    ]
test_embedded_atom_method.py 187 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/embedded-atom-method/. The authors are listed in prov/4CFCM8.jsonl.

import math
import random

import pytest

from embedded_atom_method import eam_energy_forces, fcc_lattice

# The page example: F(rho) = -sqrt(rho), f(r) = ((rc - r) / (rc - 1))^2 with f(1) = 1, no pair term.
RC = 1.2


def sqrt_embed(x):
    return -math.sqrt(x)


def sqrt_dembed(x):
    return -0.5 / math.sqrt(x) if x > 0 else 0.0


def step_density(r):
    return ((RC - r) / (RC - 1)) ** 2 if r < RC else 0.0


def step_ddensity(r):
    return -2 * (RC - r) / (RC - 1) ** 2 if r < RC else 0.0


def zero(r):
    return 0.0


def page_model(positions, box=None):
    return eam_energy_forces(positions, sqrt_embed, sqrt_dembed, step_density, step_ddensity, zero, zero, RC, box)


# A smooth model for the derivative tests.
RC2 = 2.5


def s_embed(x):
    return -math.sqrt(x + 0.1) + 0.05 * x * x


def s_dembed(x):
    return -0.5 / math.sqrt(x + 0.1) + 0.1 * x


def s_density(r):
    return (RC2 - r) ** 3 if r < RC2 else 0.0


def s_ddensity(r):
    return -3 * (RC2 - r) ** 2 if r < RC2 else 0.0


def s_pair(r):
    return (RC2 - r) ** 3 / r ** 2 if r < RC2 else 0.0


def s_dpair(r):
    return (-3 * (RC2 - r) ** 2 / r ** 2 - 2 * (RC2 - r) ** 3 / r ** 3) if r < RC2 else 0.0


def smooth_model(positions, box=None, k=0.0):
    """The smooth model after the gauge change F + k rho, phi - 2 k f, which leaves U unchanged."""
    return eam_energy_forces(
        positions,
        lambda x: s_embed(x) + k * x,
        lambda x: s_dembed(x) + k,
        s_density,
        s_ddensity,
        lambda r: s_pair(r) - 2 * k * s_density(r),
        lambda r: s_dpair(r) - 2 * k * s_ddensity(r),
        RC2,
        box,
    )


def random_cluster(rng, n, side, dmin):
    out = []
    while len(out) < n:
        p = [rng.uniform(0, side) for _ in range(3)]
        if all(math.dist(p, q) >= dmin for q in out):
            out.append(p)
    return out


def numeric_forces(model, positions, eps=1e-6, **kw):
    out = []
    for i in range(len(positions)):
        row = []
        for q in range(3):
            plus = [p[:] for p in positions]
            minus = [p[:] for p in positions]
            plus[i][q] += eps
            minus[i][q] -= eps
            row.append(-(model(plus, **kw)[0] - model(minus, **kw)[0]) / (2 * eps))
        out.append(row)
    return out


def test_dimer_and_trimer():
    u, rho, _ = page_model([[0, 0, 0], [1, 0, 0]])
    assert rho == [pytest.approx(1), pytest.approx(1)]
    assert u == pytest.approx(-2)
    tri = [[0, 0, 0], [1, 0, 0], [0.5, math.sqrt(3) / 2, 0]]
    u, rho, f = page_model(tri)
    assert u == pytest.approx(-3 * math.sqrt(2))
    assert u / 3 == pytest.approx(-1.41421, abs=1e-5)  # energy per bond falls from 2 to 1.414


def test_fcc_cohesive_and_vacancy_energy():
    a = math.sqrt(2)  # nearest-neighbor distance 1
    pos = fcc_lattice(3, a)
    box = 3 * a
    n = len(pos)
    u, rho, f = page_model(pos, box)
    assert all(x == pytest.approx(12) for x in rho)
    assert u / n == pytest.approx(-math.sqrt(12))
    assert max(abs(c) for row in f for c in row) < 1e-9
    uv, _, _ = page_model(pos[1:], box)
    ev = uv - (n - 1) / n * u
    assert ev == pytest.approx(12 * (math.sqrt(12) - math.sqrt(11)))
    assert ev == pytest.approx(1.7698, abs=1e-4)
    assert ev / math.sqrt(12) == pytest.approx(0.5109, abs=1e-4)


def test_forces_match_finite_differences_free_cluster():
    rng = random.Random(1)
    pos = random_cluster(rng, 7, 2.5, 0.8)
    _, _, f = smooth_model(pos)
    num = numeric_forces(smooth_model, pos)
    for row, nrow in zip(f, num):
        for c, nc in zip(row, nrow):
            assert c == pytest.approx(nc, abs=1e-5)


def test_forces_match_finite_differences_periodic():
    rng = random.Random(2)
    box = 5.2
    pos = random_cluster(rng, 12, box, 0.8)
    _, _, f = smooth_model(pos, box=box)
    num = numeric_forces(smooth_model, pos, box=box)
    for row, nrow in zip(f, num):
        for c, nc in zip(row, nrow):
            assert c == pytest.approx(nc, abs=1e-5)


def test_total_force_is_zero():
    rng = random.Random(3)
    pos = random_cluster(rng, 10, 3.0, 0.8)
    _, _, f = smooth_model(pos)
    for q in range(3):
        assert abs(sum(row[q] for row in f)) < 1e-10


def test_gauge_change_leaves_energy_and_forces():
    rng = random.Random(4)
    pos = random_cluster(rng, 9, 3.0, 0.8)
    u0, _, f0 = smooth_model(pos)
    for k in (0.7, -1.3):
        u1, _, f1 = smooth_model(pos, k=k)
        assert u1 == pytest.approx(u0, abs=1e-10)
        for row0, row1 in zip(f0, f1):
            for c0, c1 in zip(row0, row1):
                assert c1 == pytest.approx(c0, abs=1e-10)


def test_linear_embedding_is_a_pair_potential():
    rng = random.Random(5)
    pos = random_cluster(rng, 8, 3.0, 0.8)
    c = 0.4
    u, _, _ = eam_energy_forces(pos, lambda x: c * x, lambda x: c, s_density, s_ddensity, s_pair, s_dpair, RC2)
    pair_sum = 0.0
    for i in range(len(pos)):
        for j in range(i + 1, len(pos)):
            r = math.dist(pos[i], pos[j])
            pair_sum += s_pair(r) + 2 * c * s_density(r)
    assert u == pytest.approx(pair_sum)


def test_rejects_long_cutoff_in_small_box():
    with pytest.raises(ValueError):
        page_model([[0, 0, 0], [1, 0, 0]], box=2.0)

References

  1. Murray S. Daw and M. I. Baskes, Embedded-atom method, derivation and application to impurities, surfaces, and other defects in metals, Physical Review B 29(12), 1984, 6443-6453, the energy as embedding functions of the host electron density plus a pair repulsion, and its derivation from density functional theory
  2. S. M. Foiles, M. I. Baskes and M. S. Daw, Embedded-atom-method functions for the fcc metals Cu, Ag, Au, Ni, Pd, Pt, and their alloys, Physical Review B 33(12), 1986, 7983-7991, the fitted embedding functions and pair terms for six fcc metals and the alloy model
  3. Murray S. Daw, Stephen M. Foiles and Michael I. Baskes, The embedded-atom method, a review of theory and applications, Materials Science Reports 9(7-8), 1993, 251-310, the review of the form, the fitting, the limits of pair potentials for metals and the applications
  4. M. W. Finnis and J. E. Sinclair, A simple empirical N-body potential for transition metals, Philosophical Magazine A 50(1), 1984, 45-55, the square-root embedding term from the second moment of the tight-binding density of states

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW4 complete
  • a review of the text: no review record reviews/4CFCM8/text.yaml