Osman Goni Ridwan

VASP cheat sheet · Essentials

VASP POSCAR cheat sheet

POSCAR holds the cell and the atoms. This sheet explains every line, the rules VASP applies when it reads them, selective dynamics and fixed cells, and how to reuse CONTCAR; the checker reads your file the way VASP does.

Checked against VASP 6.6.1 · Updated

The short version

  1. The species come from POTCAR, in the order of the counts line. The species-name line is only a label: keep it, and keep it in the same order as the POTCAR.
  2. Write coordinates with at least 7 significant digits, or VASP may find a lower symmetry than the crystal has.
  3. Use Direct (fractional) coordinates; Cartesian ones are multiplied by the scaling factor.
  4. Selective-dynamics flags act on the fractional (lattice-vector) components, not on x, y and z, except in IBRION = 5 phonon runs.
  5. Continue a relaxation with cp CONTCAR POSCAR. A CONTCAR from MD carries velocities and more; strip them before using it elsewhere.

Check a POSCAR

Paste a POSCAR or CONTCAR. The checker reads it the way VASP does and reports the species, the cell, the shortest distance between atoms (periodic images included) and the problems it finds. It runs in your browser.

The format, line by line

LineHoldsRules and traps
1A commentFree text. Old VASP 4 files put the element symbols here.
2Scaling factorOne number multiplies the lattice vectors and Cartesian positions. A negative number is the cell volume in ų instead. Three positive numbers scale x, y and z separately.
3–5Lattice vectors a1, a2, a3Cartesian components in Å (before scaling). A left-handed set (negative triple product) is fixed by swapping two vectors, together with the matching columns of the Direct coordinates.
6Species namesOptional and only a label: VASP takes the species from POTCAR and keeps just 2 characters of each name, so Fe1 Fe2 both become Fe. If names and POTCAR disagree, VASP warns and uses POTCAR.
7Atoms per speciesIn the order of the POTCAR. The same element may appear in two groups (Fe O Fe) to give them different per-species values, such as the U of DFT+U; MAGMOM is set per atom and needs no extra group. Machine-learned force fields reject two groups with the same name.
8Selective dynamicsOptional; only the first letter (S) matters. Adds three T/F flags to each position line.
9Direct or CartesianC or K as first letter means Cartesian (Å, scaled); anything else is Direct (fractional).
10 …One position per atomAs many lines as the sum of line 7, in the same species order. At least 7 significant digits.
AfterVelocities and MD dataWritten by VASP into CONTCAR during molecular dynamics: lattice velocities, then ion velocities (Å/fs when Cartesian; not scaled), then predictor–corrector data that cannot be written by hand.

Examples

Minimal POSCAR: cubic BN, primitive fcc cell
Cubic BN
3.615
0.0 0.5 0.5
0.5 0.0 0.5
0.5 0.5 0.0
B N
1 1
Direct
0.00 0.00 0.00
0.25 0.25 0.25
Selective dynamics: fix the bottom layers of a slab
Al(100) slab, 3 layers, bottom 2 fixed
1.0
2.8637824     0.0000000     0.0000000
0.0000000     2.8637824     0.0000000
0.0000000     0.0000000    24.0500000
Al
3
Selective dynamics
Direct
0.0000000  0.0000000  0.0000000   F F F
0.5000000  0.5000000  0.0841996   F F F
0.0000000  0.0000000  0.1683992   T T T

The first two atoms stay fixed and the third relaxes. A flag constrains a fractional component, so T T F on a tilted cell is not the same as fixing z.

A negative scale sets the volume (here 40 cubic angstrom)
Si, simple cubic test cell, volume fixed by the scale
-40.0
1.0 0.0 0.0
0.0 1.0 0.0
0.0 0.0 1.0
Si
1
Direct
0.0 0.0 0.0

Selective dynamics and fixed cells

  • In relaxations and MD, the T/F flags refer to the fractional components of each position, whether the positions are written in Direct or Cartesian form.
  • In finite-difference phonon runs the flags refer to Cartesian components, and only IBRION = 5 honours them.
  • Removing the Selective dynamics line frees every atom again.
  • Selective dynamics cannot constrain the cell. To keep the out-of-plane vector of a slab fixed while the in-plane ones relax, use LATTICE_CONSTRAINTS (from VASP 6.5.0 in practice; see the table below), or relax with a fixed cell (ISIF = 2).

Reusing CONTCAR

  • CONTCAR has the POSCAR format, so cp CONTCAR POSCAR continues a relaxation.
  • After molecular dynamics, CONTCAR also holds velocities and predictor–corrector data. Keep them to continue the same run; delete the predictor–corrector block before switching ensemble (NVT to NpT, say), or the run crashes; delete everything after the positions before using the structure for anything else.
  • VASP 6.4.2 wrote POTCAR hash codes into the CONTCAR species line, which breaks phonopy and other tools; 6.4.3 copies your POSCAR labels again.
  • Positions in CONTCAR after a long relaxation can carry numerical noise that lowers the symmetry: symmetrize with a symmetry tool before a production run if the symmetry matters.

Related INCAR tags

TagWhat it doesDefaultWhat to useWatch out
SYMPRECTolerance for finding symmetry from the POSCAR positions.1E-5Raise it only for imprecise coordinates.
LATTICE_CONSTRAINTSThree logicals that freeze or free the lattice components during a cell relaxation or MD.no constraintsSlab or 2D sheet: .TRUE. .TRUE. .FALSE. keeps the out-of-plane vector fixed.With IBRION = 1 or 2 from VASP 6.4.3, with ISIF = 4 or 5 from 6.5.1; it was ignored for IBRION = 1 or 2 before 6.5.0. In non-orthogonal cells the angles are not conserved.

Check what VASP read

Species, counts and positions
sed -n '6,7p' POSCAR                     # species names and counts (VASP 5 and later format)
grep TITEL POTCAR                        # the potentials, one per species, in file order
grep "ions per type" OUTCAR              # the counts VASP used
grep -A 4 "position of ions in fractional coordinates" OUTCAR   # first positions; raise 4 to the number of atoms

The order of the TITEL lines must match the species line of POSCAR. The POTCAR sheet shows how to build and check a POTCAR without printing it.

Common mistakes

  • Species order in POSCAR different from the POTCAR order: VASP only warns, and the run uses the wrong elements on the wrong sites.
  • Expecting the species line to choose the element; POTCAR does.
  • Long labels such as Nd1 Nd2: both are truncated to Nd, and with VASP's machine-learned force fields two groups with the same name stop the run.
  • Coordinates with too few digits (0.3333 for 1/3): lost symmetry.
  • Cartesian positions with a scale other than 1: they are scaled too.
  • Reading selective-dynamics flags as x, y, z in a relaxation.
  • An MD CONTCAR, with its velocity blocks, reused for a different kind of run.
  • A counts line that does not match the number of position lines.

The physics behind this sheet

  • Lecture 13: The reciprocal lattice and the Brillouin zone (in preparation)
  • Lecture 21: Forces, stress and structural relaxation (in preparation)

Further reading

  1. VASP Wiki, “POSCAR” (the full format specification, selective dynamics and velocities). · vasp.at/wiki
  2. VASP Wiki, “CONTCAR” (what VASP writes back, and restarting molecular dynamics). · vasp.at/wiki
  3. VASP Wiki, “LATTICE_CONSTRAINTS” (fixing lattice components in relaxations and MD). · vasp.at/wiki