Defects, surfaces and diffusion

Adsorption energy and adsorption site

Relax an Al(111) slab with its bottom layers fixed, optimize a Na atom on four adsorption sites, and compare the adsorption energies to find the preferred site.

Category
Defects, surfaces and diffusion
APIs used
ase.build.add_adsorbateFixAtomsFixCartesianase.optimize.BFGSscf_stylemix_precond
Script
adsorption_energy.py

The adsorption energy Eads is the total energy of the adsorption system minus the energies of the clean surface and of the reference state of the adsorbate. Here the adsorption of a Na atom on Al(111) is compared for four sites: ontop, bridge, fcc and hcp. The energy per atom of bcc Na metal is used as the reference for Na.

Eads=Eslab+Na−Eslab−ENa (bulk)

The lower Eads, the more stable the site. The differences of Eads between the sites do not depend on the reference chosen for Na, and this example uses them to find the preferred site.

Procedure

  1. calculate the energy per atom of bcc Na
  2. fix the bottom two layers of a 3×3, 4-layer Al(111) slab (36 atoms) with FixAtoms and optimize the clean surface
  3. put Na on each site with add_adsorbate, fix its lateral position with FixCartesian, and optimize the structure
  4. print the adsorption energy, the energy relative to the most stable site and the height above the surface
adsorption_energy.pyDownload
"""
Advance/OF-DFT example: adsorption energy and preferred site of Na on Al(111).

The slab is relaxed with the bottom layers fixed (FixAtoms). The lateral
position of the adsorbate is fixed (FixCartesian) so that each site is kept.

    E_ads = E(slab + Na) - E(slab) - E(Na, bcc bulk per atom)

Copyright (C) 2026 AdvanceSoft Corporation, All rights reserved.
"""

from ase.build import add_adsorbate, bulk, fcc111
from ase.constraints import FixAtoms, FixCartesian
from ase.optimize import BFGS

from aofdft.calculator import AOFDFTCalculator

VPS_DIR = "path/to/DFT_DATA19_AS/VPS"  # edit these two paths for your environment
PAO_DIR = "path/to/DFT_DATA19_AS/PAO"

N_LAYERS = 4  # Al layers; the bottom 2 layers are fixed
FMAX     = 0.05  # convergence of the structure optimization (eV/Angstrom)


def attach_calc(atoms, label):
    atoms.calc = AOFDFTCalculator(
        console       = False,
        logging_file  = f"{label}.log",
        kin_type      = "AS26",
        kin_model     = "Crystal26",
        vps_dir       = VPS_DIR,
        pao_dir       = PAO_DIR,
        scf_must_conv = True,
        scf_style     = "bulk",  # the preset for bulk crystals also suits these metal slabs
        mix_precond   = None,    # without the Thomas-Fermi preconditioner of the preset
    )


def make_slab():
    slab = fcc111("Al", size=(3, 3, N_LAYERS), a=4.05, vacuum=8.0)  # 3x3 in the surface plane, 36 atoms
    # fix the bottom two layers (tag 1 = top layer, tag N_LAYERS = bottom layer)
    slab.set_constraint(FixAtoms(mask=slab.get_tags() > N_LAYERS - 2))
    return slab


# 1) reference: bulk Na (bcc) per atom, in a 2x2x2 repetition of the cubic cell (16 atoms)
na_bulk = bulk("Na", "bcc", a=4.23, cubic=True).repeat((2, 2, 2))
attach_calc(na_bulk, "na_bulk")
e_na = na_bulk.get_potential_energy() / len(na_bulk)

# 2) clean slab, relaxed
slab = make_slab()
attach_calc(slab, "al111_clean")
BFGS(slab, logfile="al111_clean_opt.log").run(fmax=FMAX)
e_slab = slab.get_potential_energy()

# 3) Na on each site, relaxed
print(" site   | E_ads (eV) | rel. (eV) | height (A)")
results = {}
for site in ("ontop", "bridge", "fcc", "hcp"):
    atoms = make_slab()
    add_adsorbate(atoms, "Na", height=2.5, position=site)
    i_na = len(atoms) - 1
    atoms.set_constraint([atoms.constraints[0], FixCartesian(i_na, mask=(True, True, False))])

    attach_calc(atoms, f"na_{site}")
    BFGS(atoms, logfile=f"na_{site}_opt.log").run(fmax=FMAX)

    e_ads  = atoms.get_potential_energy() - e_slab - e_na
    height = atoms.positions[i_na, 2] - atoms.positions[:-1, 2].max()
    results[site] = (e_ads, height)

e_min = min(e for e, _ in results.values())
for site, (e_ads, height) in results.items():
    print(f" {site:6s} | {e_ads:10.3f} | {e_ads - e_min:9.3f} | {height:6.2f}", flush=True)

Example output

Results with v1.0.0 (Crystal26). Each structure optimization converged in 7 to 17 steps.

text
 site   | E_ads (eV) | rel. (eV) | height (A)
 ontop  |      0.200 |     0.112 |   2.70
 bridge |      0.094 |     0.006 |   2.68
 fcc    |      0.088 |     0.000 |   2.66
 hcp    |      0.088 |     0.001 |   2.66

The threefold hollow sites (fcc and hcp) are the most stable, and the ontop site above an Al atom is 0.11 eV less stable. The bridge site differs from them by 0.006 eV. Na sits closer to the surface on the more stable sites. The difference between fcc and hcp (0.001 eV) is below the accuracy of the calculation, so the two cannot be distinguished here.

The values of Eads themselves are positive for all sites. The absolute adsorption energy is a difference between states with different environments, Na adsorbed on the surface and Na in the bulk metal, so errors of the model tend to remain in it. The differences between the sites compare similar environments, where such errors largely cancel.

Notes

  • The atoms of a fcc111(..., size=(3, 3, N_LAYERS)) slab are tagged 1, 2, ... from the top layer down. FixAtoms(mask=slab.get_tags() > N_LAYERS - 2) fixes the bottom two layers at their bulk positions.
  • add_adsorbate(atoms, "Na", height=2.5, position="fcc") places the atom 2.5 Angstrom above the top layer. position can be "ontop", "bridge", "fcc" or "hcp".
  • The lateral position (x, y) of the adsorbate is fixed with FixCartesian(i_na, mask=(True, True, False)) and only its height (z) is relaxed. Otherwise an atom placed on an unstable site would move to a stable one, and the sites could not be compared.
  • One Na atom on a 3×3 surface cell is a coverage of 1/9 monolayer. Use a larger surface cell to reduce the interaction between adsorbates.
  • The 3×3 surface cell is also used because, with v1.0.0, the results change when the cell has a short period. The pseudo-atomic orbitals of Na extend farther than those of Al, so the cell must be larger than the 2×2 cell used for slabs of Al alone. For the same reason the Na reference is calculated in a 2×2×2 repetition of the cubic bcc cell (16 atoms).
  • The adsorption energy depends on the number of layers and the vacuum thickness. Use the same slab and the same settings for all calculations that are compared.
  • The slabs and the Na reference are calculated with the preset for bulk crystals, scf_style="bulk", without its Thomas-Fermi preconditioner (mix_precond=None). For this system the SCF needs fewer iterations without it. The presets are listed in Controlling and monitoring the SCF.
  • The charge transfer on adsorption can be visualized as in Charge redistribution by adsorption.

Improving the accuracy and SCF convergence of AdvanceSoft26 for systems with surfaces and vacuum is part of the development roadmap.