Surface diffusion energy barriers using ASE constraints

In this tutorial, we will calculate the energy barrier that was found using the NEB method in the Surface diffusion energy barriers using the Nudged Elastic Band (NEB) method tutorial. Here, we use a simple FixedPlane constraint that forces the Au atom to relax in the yz-plane only:

from import add_adsorbate, fcc100
from ase.calculators.emt import EMT
from ase.constraints import FixAtoms, FixedPlane
from ase.optimize import QuasiNewton

# 2x2-Al(001) surface with 3 layers and an
# Au atom adsorbed in a hollow site:
slab = fcc100('Al', size=(2, 2, 3))
add_adsorbate(slab, 'Au', 1.7, 'hollow'), vacuum=4.0)

# Make sure the structure is correct:
# from ase.visualize import view
# view(slab)

# Fix second and third layers:
mask = [atom.tag > 1 for atom in slab]
# print(mask)
fixlayers = FixAtoms(mask=mask)

# Constrain the last atom (Au atom) to move only in the yz-plane:
plane = FixedPlane(-1, (1, 0, 0))

slab.set_constraint([fixlayers, plane])

# Use EMT potential:
slab.calc = EMT()

for i in range(5):
    qn = QuasiNewton(slab, trajectory='mep%d.traj' % i)
    # Move gold atom along x-axis:
    slab[-1].x += slab.get_cell()[0, 0] / 8

The result can be analysed with the command ase gui mep?.traj -n -1 (choose Tools ‣ NEB). The barrier is found to be 0.35 eV - exactly as in the NEB tutorial.

Here is a side-view of the path (unit cell repeated twice):