Setting up an electronic minimization: Difference between revisions
Line 76: | Line 76: | ||
=== Creating the POTCAR file === | === Creating the POTCAR file === | ||
We have already decided to use the LDA, so we consult the table on the [[Available_pseudopotentials#Standard_potentials| available pseudopotential]] page and find that for Ga and As, the Ga_d and As potentials are recommended. Assuming there is a {{FILE|POTCAR}} folder in <code>~/POTS/</code>, 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 === | === Creating the KPOINTS file === |
Revision as of 15:17, 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 the best practices for choosing an XC functional page.
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 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:
- 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 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
Creating the INCAR file
Related tags and articles
INCAR, POSCAR, KPOINTS, POTCAR, KSPACING