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 for being embedded in that density, plus a pair term with each neighbor. Since 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 of the atoms, with .
Functional form. For one species,
Here is the contribution of a neighbor at distance to the density at an atom, is the embedding function, and is a pair term, mostly repulsive. All three vanish beyond a cutoff . For several species, depends on the species of atom , on the species of atom , and on the pair of species.
Forces. The derivative of with respect to the distance of one pair collects three terms, so
A pair force thus depends on the densities at both of its atoms, so the forces need two passes: one to compute all , 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 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, comes from free-atom electron densities, and and 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 , the change
leaves unchanged for every configuration, since . The scaling , leaves unchanged too. So only combinations of the functions are physical, and a fit must fix the gauge, for example by asking at the density 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.
EAM-ENERGY-FORCES(r_1..r_N, F, f, φ, r_c)- 1
ρ_i ← 0 for each atom i; U ← 0 - 2
for each pair i < j with r = |r_ij| < r_c: - 3
ρ_i ← ρ_i + f(r); ρ_j ← ρ_j + f(r); U ← U + φ(r) - 4
for each atom i: U ← U + F(ρ_i) - 5
for each pair i < j with r = |r_ij| < r_c: - 6
g ← (F'(ρ_i) + F'(ρ_j)) f'(r) + φ'(r) ▷ dU/dr for this pair - 7
F_i ← F_i - g r_ij / r; F_j ← F_j + g r_ij / r - 8
return U, ρ, F
With a Verlet neighbor list, both passes cost at fixed density, about twice the cost of a pair potential. In parallel codes, the second pass needs the of atoms owned by other processors, which is one extra communication step per force call.
What it counts
The model gives the energy 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 is linear, , then is a pair potential, such as the Lennard-Jones potential. The nonlinearity of is the whole difference. A convex with , such as , makes each extra bond worth less than the one before.
- Finnis-Sinclair and second-moment potentials. The same form with , 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 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 , no pair term, and a density function with at distance 1 and beyond the first neighbors. A dimer at distance 1 has at each atom, so , an energy of per bond. An equilateral triangle with side 1 has at each atom, so for 3 bonds, an energy of 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 nearest neighbors has at each atom and cohesive energy per atom. Remove one atom: its neighbors each lose one neighbor. The unrelaxed vacancy formation energy is
For fcc, : , while , so . A nearest-neighbor pair model gives , 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, . In EAM, the embedding term adds to a term proportional to , and gets no such term. So a convex gives , 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 depends only on distances.
- The gauge change above leaves energies and forces unchanged; the tests check this on random clusters.
- If , and have continuous first derivatives and and go to zero with their derivatives at , 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.
# 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
- 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
- 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
- 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
- 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.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Code (python) | I0 not checked yet |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag 4CFCM8 Edit this page History Report an error Markdown