Energy cut-off (Ecut) and k-points convergence tests automatically in VASP

Energy Cut-Off (Ecut) and k-Point Convergence Tests in VASP | Automated Scripts

Github

Overview

1. ‚Ecut.sh‚: Performs DFT energy / lattice parameters convergence test for varying energy cutoff, also showing total simulation time for each cutoff step.
2. ‚k_sampling.sh‚:  Performs DFT energy / lattice parameters convergence test for varying k-space sampling, also showing total simulation time for each step.

1. Energy cutoff convergence test

The following is a bash script, run it with:
Place ‚python_run.py‘, ‚Ecut.sh‘ in the same folder, then make it executable and run it with:
sudo chmod +x Ecut.sh
./Ecut.sh

This script performs the DFT energy/lattice parameters convergence test for varying energy cutoff parameter. The script is running from the best settings to the worst, i.e., the first one will be calculated with the E_cutoff = ENCUT_MAX. If you allow in INCAR to optimize lattice parameters, the output will also show changes in them. The output will be in the same folder as the VASP data (‚directory_path‘) and will be named: ‚ENCUT_CONVERGENCE_TEST_ENERGY_and_LATT_PARAMETERS.txt‚. In this file, each column corresponds to the following: 1.(Energy cutoff [eV]) 2.(Total simulation time for the current energy cutoff [minutes]) 3.(Total energy [eV]) 4.(Difference in total energy between the best set energy cutoff and its current value [eV]) 5. to 10.(Lattice parameters [A, °]), 11. to 16.(Difference in lattice parameters from the best energy cutoff [A, °])

 

Prerequisities

  • Bash
  • Python 3.x
  • py4vasp (pip install py4vasp)
  • VASP compiled with HDF5 
  • mdtraj (pip install mdtraj)
  • numpy (pip install numpy)

Usage

Set the directory with the prepared VASP folder in 'Ecut.sh':
directory_path="/home/lebedmi2/VASP_calculations_ALL/test_only/Fe_bcc/Fe_2"
#Set parameters of energy_cutoff test and the number of processors for the VASP
ENCUT_MAX=800
ENCUT_MIN=400
ENCUT_STEP=25
NUMBER_OF_PROCESSORS=12
VASP_BINARY_NAME="vasp_std"
After running the script: an example of content of ENCUT_CONVERGENCE_TEST_ENERGY_and_LATT_PARAMETERS.txt:
After running the script: an example of content of plotted graph ‚Ecut.png‘:

2. K-points convergence test

The following is a bash script, run it with:
Place ‚p_change_kpoints.py‘, ‚python_run.py‘, ‚k_sampling.sh‘ in the same folder, then make it executable and run it with:
sudo chmod +x k_sampling.sh
./k_sampling.sh

This script performs the DFT energy/lattice parameters convergence test for varying k-points. In this script, everything above .4 is rounded up, e.g., if k1 = 3.4231, it will be set as 4. If k1 = 3.39, then it will be 3. Everthing below 1 will be rounded to 1, e.g., if k1 = 0.213 (very large supercell), it will be set as 1. Script is running from the best settings to the worst, i.e., the first one will be calculated the smallest k_spacing (e.g., 0.0175, which has the largest numbers of k-sampling). If you allow in INCAR to optimize lattice parameters, the output will also show changes in them. The output will be in the same folder as the VASP data (‚directory_path‘) and will be named: K_SAMPLING_CONVERGENCE_TEST_ENERGY_and_LATT_PARAMETERS.txt„. In this file, each column corresponds to the following: 1.(Energy cutoff [eV]) 2.(Total simulation time for the current energy cutoff [minutes]) 3.(Total energy [eV]) 4.(Difference in total energy between the best set energy cutoff and its current value [eV]) 5. to 10.(Lattice parameters [A, °]), 11. to 16.(Difference in lattice parameters from the best energy cutoff [A, °])

 

Prerequisities

  • Bash
  • Python 3.x
  • py4vasp (pip install py4vasp)
  • VASP compiled with HDF5
  • mdtraj (pip install mdtraj)
  • numpy (pip install numpy)

Usage

Set the directory with the prepared VASP folder in 'k_sampling.sh':
directory_path="/home/lebedmi2/VASP_calculations_ALL/test_only/Fe_bcc/Fe_2"
#Set parameters of the equidistant k_spacing and the number of processors for VASP and name of its binary
k_spacing_MIN=0.0175
k_spacing_MAX=0.1
STEP=0.0025
NUMBER_OF_PROCESSORS=12
VASP_BINARY_NAME="vasp_std"
After running the script: an example of content of K_SAMPLING_CONVERGENCE_TEST_ENERGY_and_LATT_PARAMETERS.txt: