Guide · VASP · 10 min read
How do I build a surface slab in VASP (layers, vacuum, fixed bottom layers)?
Checked against the docs · VASP wiki · Last checked 12 November 2026 · Spot a mistake? Tell us
Short answer
Cut the slab from your bulk crystal at the bulk lattice constant, stack several layers, and add vacuum along the surface normal (the VASP wiki's nickel slabs use 5 layers and about 10 Å of vacuum). Fix the bottom layers with Selective dynamics and F F F flags, relax only the atoms (ISIF = 2), use one k-point along the normal (a mesh like 9 9 1), and add LDIPOL = .TRUE. with IDIPOL = 3 when the two faces differ.
What is a slab model?
A slab is a supercell (see How do I build a supercell?) with three features:
- Layers. A number of atomic planes cut from the bulk crystal parallel to the surface you want, such as the (100) or (111) plane.
- Vacuum. Empty space along the surface normal, so the slab does not touch its periodic copy. The slab then has two surfaces, top and bottom.
- Fixed layers. The bottom layers are usually held at their bulk positions to stand in for the crystal underneath, and only the top layers relax.
The wiki's Ni 100 surface relaxation tutorial is a complete small example: nickel's (100) surface, one atom per layer, 5 layers, about 10.6 Å of vacuum, the bottom 3 layers fixed and the top 2 relaxed.
How many layers and how much vacuum do I need?
The wiki gives examples, not a rule. These are its starting points:
| Source | Layers | Vacuum | Fixed | Relaxed |
|---|---|---|---|---|
| Ni(100) tutorial | 5 | 3 × 3.53 = 10.59 Å | bottom 3 | top 2 |
| Ni(111) tutorial | 5 | about 10.2 Å | bottom 3 | top 2 |
| Computing the work function | 8 to 12 Å on each side, with the atoms centered in the cell |
The work-function page's rule of thumb is for computing a work function, where the vacuum must hold a flat, field-free region; it warns that too little vacuum leaves a field in it and gives wrong values. The Electrostatic corrections page adds that when a slab carries a dipole, too small a cell lets the charge slosh into the vacuum, and that convergence often improves with a wider vacuum.
The wiki's tutorials do not show how to test that the number of layers and the vacuum are enough; a convergence test on your own system, in the quantity you will report, settles it.
What it depends on:
- What you will compute. A work function needs a wide, field-free vacuum; a relaxation or surface energy is the case of the nickel tutorials.
- Whether the two faces are the same. An asymmetric slab, such as one with an adsorbate on one side, carries a dipole and needs the correction below.
- The lattice constant. The tutorials cut nickel's slabs at 3.53 Å, and do not say where that value comes from or which lattice constant to use. To find the one your own settings give for the bulk, see How do I fit an equation of state?
How do I write the slab's POSCAR?
Here is the wiki's Ni(100) tutorial POSCAR:
fcc (100) surface
3.53
.50000 .50000 .00000
-.50000 .50000 .00000
.00000 .00000 5.00000
5
Selective Dynamics
Kartesisch
.00000 .00000 .00000 F F F
.00000 .50000 .50000 F F F
.00000 .00000 1.00000 F F F
.00000 .50000 1.50000 T T T
.00000 .00000 2.00000 T T TWhat each part does:
- The scaling factor
3.53is nickel's lattice constant; every vector and Cartesian position is multiplied by it. - The first two vectors span one atom per layer in the surface plane (a p(1x1) cell). The third is 5 lattice constants long: the slab takes up about 2 of them and the rest is vacuum.
Selective Dynamicsturns on the per-atom flags; thePOSCARpage says only the first character,Sors, matters.Kartesischselects Cartesian coordinates: the page says only the first character counts, andC,c,Korkall mean Cartesian.- The flags
F F Fhold an atom still;T T Tlet it move. ThePOSCARpage notes they refer to directions along the lattice vectors, even when the positions are Cartesian. Here the bottom three layers are fixed and the top two relax.
Two things to keep in mind:
- Only one side relaxes. Fixing the bottom layers makes the two surfaces different: the top is relaxed, the bottom is bulk-like. This matters for the surface energy below.
- Use enough digits in your own files: the
POSCARpage recommends at least 7 significant digits.
Which INCAR and KPOINTS settings does a slab need?
Relax the atoms, not the cell. ISIF = 2, the default for most runs, relaxes positions only. A setting that relaxes the cell would also change the vacuum: the Volume relaxation page notes that its procedure relaxes along all the lattice vectors, and points to LATTICE_CONSTRAINTS "for the vacuum in a surface relaxation". For a 2D material in the plane of the first two vectors, the LATTICE_CONSTRAINTS page suggests LATTICE_CONSTRAINTS = .TRUE. .TRUE. .FALSE. to relax the in-plane lattice and keep the vacuum direction fixed; with IBRION = 1 or 2 it needs VASP 6.4.3 or later.
One k-point along the normal. The tutorial's KPOINTS is:
k-points
0
Monkhorst-Pack
9 9 1
0 0 0"Only one k point in z-direction for surface", in the tutorial's words; it notes the odd mesh is centered on Γ. If you use KSPACING instead of a KPOINTS file, the formula on the KSPACING page gives a single point along any direction whose reciprocal vector is short enough, which a long vacuum axis makes it.
The tutorial's INCAR for the Ni(100) relaxation, as a worked example rather than a recipe:
ISTART = 0; ICHARG = 2
ENCUT = 270
ISMEAR = 2 ; SIGMA = 0.2
ALGO = Fast
EDIFF = 1E-6
ISPIN = 2
MAGMOM = 5*1
NSW = 100
POTIM = 0.8
IBRION = 1Methfessel-Paxton smearing for a metal (see Which smearing should I use?), spin polarization with a starting moment of 1 on each of the 5 atoms (see How do I set up a magnetic calculation?), and the RMM-DIIS relaxer. The Structure optimization page adds that with IBRION = 1, complex surfaces, where the charge density converges slowly, may need NELMIN = 8 rather than the 4 that suits simple bulk.
When do I need a dipole correction?
When the slab is not the same on both sides, it carries a net dipole along the normal. The wiki's Electrostatic corrections page gives the combination for surfaces:
LDIPOL = .TRUE.
IDIPOL = 3
DIPOL = 0.5 0.5 0.5IDIPOL = 3computes the dipole along the third lattice vector, the surface normal here, and corrects the energy. The IDIPOL page says to useIDIPOL1 to 3 for slabs, with the surface normal as the chosen direction.LDIPOL = .TRUE.also corrects the potential and the forces; without it, the Electrostatic corrections page says, the potential and forces may be slightly off. The potential correction needs the normal to be orthogonal to the other two lattice vectors.DIPOLsets the center the dipole is measured from, in direct coordinates; the DIPOL page says it should roughly be the slab's center of mass, and that only its component along the normal matters for a surface.
The LDIPOL page warns that the correction can slow the electronic convergence considerably, because charge moves from one side of the slab to the other. It suggests AMIN = 0.01 to damp that sloshing, more electronic steps (NELM) if needed, and EDIFF = 1E-6, and says an unconverged dipole correction can give wrong forces. The Electrostatic corrections page also suggests converging the orbitals without LDIPOL first.
Charged slabs are different. The NELECT page says the total energy of a charged slab cannot be corrected: it depends linearly on the width of the vacuum. Only relative energies between charged slabs with the same vacuum may be useful.
How do I check the slab?
Read the forces. OUTCAR prints a block headed POSITION and TOTAL-FORCE (eV/Angst) at each ionic step. In the tutorial, the fixed bottom layers keep large forces (about 0.4 eV/Å on the bottom atom) because they cannot move; only the free layers' forces need to fall below your threshold.
Measure the layer relaxation. The tutorial compares interlayer spacings in the relaxed CONTCAR with the bulk spacing: for Ni(100), the top spacing contracts by 3.9% and the next one expands by 1.8%.
Compute the surface energy from matching runs. The tutorial defines the surface energy of the unrelaxed slab as half the difference between the slab's energy and the same number of bulk atoms, σ = ½ (E_slab − N × E_bulk), the half because a slab has two surfaces. Because only the top side relaxes, it then adds the whole relaxation energy to the unrelaxed value for the relaxed surface: 0.86 eV becomes 0.84 eV per surface cell for Ni(100). The bulk energy must be comparable with the slab's: the ENCUT page warns that total energies from runs with different cutoffs cannot be compared, and the Ni 111 high-precision tutorial reruns its clean-surface reference at the higher cutoff before computing an adsorption energy for the same reason.
What goes wrong with slabs?
| Mistake | What you would see | What to do |
|---|---|---|
Relaxing the cell (ISIF = 3) with vacuum in it | The vacuum direction changes along with the slab | ISIF = 2, or LATTICE_CONSTRAINTS to keep the vacuum direction fixed. |
| Too little vacuum | A field in the vacuum, wrong work functions, slow convergence with a dipole | Widen the vacuum; 8 to 12 Å on each side for a work function. |
| An asymmetric slab without a dipole correction | Energies, potential and forces affected by the repeated dipoles | IDIPOL = 3, and LDIPOL = .TRUE. for the potential and forces. |
| The dipole correction on from the start, converging badly | Many electronic steps, charge sloshing between the faces | Converge without LDIPOL first; try AMIN = 0.01; tighten EDIFF. |
| More than one k-point along the normal | A slower run with nothing gained along the vacuum | Use 1 subdivision along the normal, as in 9 9 1. |
| Waiting for the fixed layers' forces to vanish | A relaxation judged unfinished because of forces that cannot relax | Judge convergence by the free atoms' forces. |
| Halving the relaxation energy as well when one side relaxes | A relaxed surface energy that is off by half the relaxation | Follow the tutorial: σ = σ(unrelaxed) + E(relaxation). |
In Build, Cut a surface makes a slab from the bulk cell by its Miller indices, the number of layers and the vacuum, shared above and below; Add vacuum along c adds empty space to a cell you already have. When the k-points are set by a spacing, Verlet works the mesh out again for the slab. Verlet cannot mark atoms as fixed yet: add the Selective dynamics flags to the POSCAR yourself and bring it in with Replace in Build, and Verlet keeps them. Everything above works without it.