Setting up an electronic minimization: Difference between revisions

From VASP Wiki
Line 9: Line 9:
'''Step 3''': Create a suitable {{FILE| POTCAR}} file by following the instructions on our [[Preparing a POTCAR | preparing a POTCAR]] page.
'''Step 3''': Create a suitable {{FILE| POTCAR}} file by following the instructions on our [[Preparing a POTCAR | preparing a POTCAR]] page.


'''Step 4''': Create a {{FILE| KPOINTS}} file to define the integration mesh in reciprocal space. Start with a [[KPOINTS#Regular_k-point_mesh| regular mesh]]. Usually Monkhorst-Pack meshes are more efficient than Gamma-centered meshes, but they might break the symmetry for certain structures. Consult the [[KPOINTS#Symmetry_reduction_of_the_mesh | symmetry reduction section]] of the {{FILE| KPOINTS}} page to select the appropriate mesh type.
'''Step 4''': Create a {{FILE| KPOINTS}} file to define the integration mesh in reciprocal space. Start with a [[KPOINTS#Regular_k-point_mesh| regular mesh]]. Usually Monkhorst-Pack{{cite|monkhorst:prb:1976}} meshes are more efficient than Gamma-centered meshes, but they might break the symmetry for certain structures. Consult the [[KPOINTS#Symmetry_reduction_of_the_mesh | symmetry reduction section]] of the {{FILE| KPOINTS}} page to select the appropriate mesh type.


'''Step 5''': Write an {{FILE| INCAR}} file. It is recommended to start from a rather minimal file, and only specify the most important tags like:
'''Step 5''': Write an {{FILE| INCAR}} file. It is recommended to start from a rather minimal file, and only specify the most important tags like:

Revision as of 16:07, 27 February 2025

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:

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 and choose appropriate parallelization tags for your actual calculation. Take note of the number of bands, NBANDS, and the number of k-points, NKPTS, especially.

Step 8 (optional): Add the parallelization tags NCORE and/or KPAR to the the INCAR file, according to the number of MPI ranks you want to let your calculation run on, and the dimensions of NBANDS and NKPTS. The number of MPI ranks N should be divisible by KPAR, and NCORE must be divisible by N/KPAR. Ideally the number of bands NBANDS will be a multiple of N/KPAR, but VASP will increase NBANDS automatically until this is the case.

Step 9: Run the calculation and monitor the screen output.

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

We create a regular Gamma-centered k-point mesh. 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 G 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 are not too confident in the choice of functional and 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


Related tags and articles

INCAR, POSCAR, KPOINTS, POTCAR, KSPACING

References