Setting up an electronic minimization
Setting up an electronic minimization calculation using density-functional theory requires a few steps. The input files must be created or copied into the execution folder. This includes making a few choices for the k-point sampling and electronic smearing, minimization algorithm, and exchange-correlation functionals. A dry-run can be used to review settings and select appropriate parallelization tags. After running the calculation, the output can be analyzed.
Step-by-step instructions
Step 1: Create a POSCAR file containing the structure for which you want to compute the electronic groundstate. External Python tools like the Atomic Simulation Environment[1] or pymatgen[2] can help create structures.
Step 2: Choose an exchange-correlation (XC) functional appropriate for your material and quantity of interest according to our page recommending how to choose a XC method.
Step 3: Create a suitable POTCAR file by following the instructions on our preparing a POTCAR page.
Step 4: Create a KPOINTS file to define the integration mesh in reciprocal space. Start with a regular mesh. Usually Monkhorst-Pack[3] meshes are more efficient than Gamma-centered meshes, but they might break the symmetry for certain structures. Consult the symmetry reduction section of the KPOINTS page to select the appropriate mesh type.
Step 5: Write an INCAR file. It is recommended to start from a rather minimal file, and only specify the most important tags like:
- XC to specify the exchange-correlation functional you want to use.
- ALGO to select the algorithm for electronic minimization.
- ISMEAR to select the type of electronic smearing technique.
- SIGMA to choose an appropriate smearing width of the electronic smearing. A larger smearing might be required to converge the calculation if your KPOINTS mesh is less dense.
- ENCUT to set the plane-wave energy cutoff. ENCUT defaults to the largest ENMAX value found in the POTCAR file, but it is always a good idea to include it in the INCAR.
- EDIFF to specify the global break condition for the electronic self-consistent loop
Step 6 (optional): Select the appropriate version of the VASP executable. I.e. vasp_gam
if you only want to use the Gamma point for reciprocal space integration, vasp_ncl
for noncollinear calculations, or vasp_std
for anything else. Then Run a dry-run calculation. This will not only uncover some possibe errors in your input (e.g. mismatched POSCAR and POTCAR files; Unrecognized INCAR tag values; etc.), but also allow you to inspect the computational parameters in the OUTCAR file without actually running the calculation.
Step 7 (optional): Inspect the OUTCAR file of your dry-run. Take note of the number of bands, NBANDS, and the number of k-points, NKPTS, especially. Follow the guidelines on the optimizing the parallelization page to set NCORE and/or KPAR in the INCAR file.
Step 8: Run the calculation. If you are new to VASP, or unsure about the calculation setup, monitor the screen output. If there are problems with the electronic minimization, consult the page about troubleshooting electronic convergence.
Recommendations and advice
Example
We will do a small DFT calculation of GaAs in the zincblende structure, using the local-density approximation (LDA).
Setting up the POSCAR file
The POSCAR file starts with a comment line (useful for the structures name) and a scaling factor, which in our case corresponds to the lattice parameter of GaAs, around 5.65 Angstrom.
Zincblende GaAs 5.65000000000
Next we need to define the lattice vectors. Zincblende is a face-centered cubic (fcc) structure with two different elements in the unit cell. We can describe the fcc lattice with three vectors, pointing from the origin to the face-centers of the cube:
0.0000000000000000 0.5000000000000000 0.5000000000000000 0.5000000000000000 0.0000000000000000 0.5000000000000000 0.5000000000000000 0.5000000000000000 0.0000000000000000
Now we define the ion types, and in the line below the ion number for each type:
Ga As 1 1
Now we specify the coordinates of the atoms in direct coordinates, with Ga at the origin and As a quarter along the diagonal of the cube:
Direct 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.2500000000000000 0.2500000000000000 0.2500000000000000
We now have a finished POSCAR file:
Zincblende GaAs 5.65000000000 0.0000000000000000 0.5000000000000000 0.5000000000000000 0.5000000000000000 0.0000000000000000 0.5000000000000000 0.5000000000000000 0.5000000000000000 0.0000000000000000 Ga As 1 1 Direct 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.2500000000000000 0.2500000000000000 0.2500000000000000
If ASE[1] is installed, a few lines of Python code lead to an equivalent POSCAR file:
from ase.build import bulk
from ase.io.vasp import write_vasp
# Create bulk GaAs with the zincblende structure
atoms = bulk("GaAs", crystalstructure="zincblende", a=5.65)
# Export to POSCAR
write_vasp("POSCAR", atoms, direct=True, sort=False)
Creating the POTCAR file
We have already decided to use the LDA, so we consult the table on the available pseudopotential page and find that for Ga and As, the Ga_d
and As
potentials are recommended. Assuming there is a POTCAR folder in ~/POTS/
, we use the following command to create the appropriate POTCAR file for our GaAs structure:
cat ~/POTS/potpaw_LDA.64/Ga_d/POTCAR ~/POTS/potpaw_LDA.64/As/POTCAR >POTCAR
Creating the KPOINTS file
Since our structure is face-centered cubic, we create a regular Gamma-centered k-point mesh according to the symmetry considerations for
KPOINTS files. The first line is a comment, followed by a 0
to turn on automatic regular mesh construction. If the next line starts with an G
, a Gamma-centered k mesh is created, a line starting with M
would create a Monkhorst-Pack[3] mesh.
Regular k-point mesh 0 Gamma 7 7 7
Creating the INCAR file
We initially chose a robust and efficient combination of a blocked-Davidson algorithm and the RMM-DIIS algorithm which can be selected with ALGO = Fast
.
ALGO = Fast
GaAs is a semiconductor so we could use the tetrahedron method ISMEAR = -5
for our electronic smearing technique. But bandgaps are underestimated systematically by DFT and we might have made a mistake with the choice of functional or lattice parameter. Thus it is safer to select Gaussian smearing and a small smearing width.
ISMEAR = 0 SIGMA = 0.05
For an initial guess of the plane-wave cutoff energy ENCUT we can search for ENMAX in our POTCAR, e.g. by grep ENMAX POTCAR
, and find that Ga_d
has a larger ENMAX. Accordingly, we set:
ENCUT = 285
For the break condition of the self-consistent loop we select eV:
EDIFF = 1.0E-06
The complete INCAR file thus is:
ALGO = Fast ISMEAR = 0 SIGMA = 0.05 ENCUT = 285 EDIFF = 1.0E-06
Making a dryrun
We are not doing a noncollinear, nor a Gamma-only calculation, thus we execute a VASP dry-run with the standard executable:
/your/vasp_dir/bin/vasp_std --dry-run
Which will print a warning about the dry-run and some information about the MPI-ranks, and OMP-threads, the VASP version, and the input structure. If mistakes were made in the setup, e.g. if the order of elements in the POSCAR and POTCAR do not match, warnings will be printed here as well.
We can now check the OUTCAR file and find the total number of k-points, 20, and number of bands, 13. This means a relatively low number of bands and a decent number of k-points. If we want to run our calculation on 4 MPI ranks, setting KPAR = 4
is an excellent choice for parallelization.
Running the calculation
After adding KPAR = 4
to the INCAR file, we run the calculation on 4 MPI ranks:
mpirun -np 4 /your/vasp_dir/bin/vasp_std
The output should look close to this:
running 4 mpi-ranks, with 1 threads/rank, on 1 nodes distrk: each k-point on 1 cores, 4 groups distr: one band on 1 cores, 1 groups vasp.6.5.1 dev (build Feb 26 2025 12:50:33) complex POSCAR found type information on POSCAR GaAs POSCAR found : 2 types and 2 ions scaLAPACK will be used LDA part: xc-table for (Slater(with rela. corr.)+CA(PZ)) , standard interpolation POSCAR, INCAR and KPOINTS ok, starting setup FFT: planning ... GRIDC FFT: planning ... GRID_SOFT FFT: planning ... GRID WAVECAR not read entering main loop N E dE d eps ncg rms rms(c) DAV: 1 0.623554581675E+02 0.62355E+02 -0.70852E+03 528 0.135E+03 DAV: 2 -0.533869968845E+01 -0.67694E+02 -0.65382E+02 580 0.246E+02 DAV: 3 -0.978648308320E+01 -0.44478E+01 -0.44252E+01 635 0.613E+01 DAV: 4 -0.985351010781E+01 -0.67027E-01 -0.67012E-01 614 0.819E+00 DAV: 5 -0.985490478744E+01 -0.13947E-02 -0.13947E-02 641 0.931E-01 0.301E+00 RMM: 6 -0.966994775594E+01 0.18496E+00 -0.21049E-01 715 0.453E+00 0.175E+00 RMM: 7 -0.962995087362E+01 0.39997E-01 -0.10316E-01 701 0.182E+00 0.574E-01 RMM: 8 -0.962647531739E+01 0.34756E-02 -0.12691E-02 740 0.127E+00 0.937E-02 RMM: 9 -0.962642094759E+01 0.54370E-04 -0.21071E-03 758 0.536E-01 0.594E-02 RMM: 10 -0.962647445785E+01 -0.53510E-04 -0.39196E-04 793 0.212E-01 0.166E-02 RMM: 11 -0.962646307401E+01 0.11384E-04 -0.91587E-05 787 0.105E-01 0.529E-03 RMM: 12 -0.962646461316E+01 -0.15391E-05 -0.17585E-05 736 0.426E-02 0.297E-03 RMM: 13 -0.962646464058E+01 -0.27424E-07 -0.26909E-06 488 0.221E-02 1 F= -.96264646E+01 E0= -.96264646E+01 d E =-.203235E-08 writing wavefunctions
Related tags and articles
INCAR, POSCAR, KPOINTS, POTCAR, KSPACING