Creating Surfaces

From Deskins Group Resources

Creating surfaces can be tricky, especially for those beyond low-index surfaces. Make sure you understand surface nomenclature and structure. There are some resources here. Google has many other resources. Several surface science books are available.


Using ASE

With ASE you first import or create a crystal structure, then you cut it. Below is sample code to do this.

#! /usr/bin/env python
from ase.io import read, write
from ase import visualize
from ase.visualize import view
from ase.build import surface 
from ase.lattice.spacegroup import crystal

#Create anatase crystal
ana = crystal(['Ti', 'O'], basis=[(0, 0, 0), (0.0, 0.0, 0.2065783973500112)],
          spacegroup=141, cellpar=[3.82, 3.82, 9.71, 90, 90, 90])
 
#Create 101 surface with 5 layers, 10 angs vacuum
s = surface(ana, (1,0,1), 5, vacuum=10)
#remove excess top
del s[s.positions[:, 2] > 22.5]
#remove bottom layers
del s[s.positions[:, 2] < 12.5]

#Expand the surface
s = s.repeat((1,2,1))

#Export surface
write('slab-rutile.xyz',s)
write('POSCAR',s)
view(s)

Or you can import bulk crystal before cutting the surface.

ana = read('anatase.cif')

Or

ana = read('POSCAR-ana-bulk')