Restarting finite differences calculations
It is possible to restart finite difference calculations using IBRION = 6 and CHECKPOINT_FD. The displacements are written to a vaspcheckfd.h5 file. For details of a general finite difference calculation, see the phonons from finite differences. Here, we will concern ourselves with restarting and splitting finite difference calculations.
Mind: This can only be done using IBRION = 6. We recommend using this generally over IBRION = 5.
|
There are several options for the CHECKPOINT_FD tag. The default is CHECKPOINT_FD = RESET, which creates a new vaspcheckfd.h5 file and updates the file during the calculation after each displacement. CHECKPOINT_FD = CONTINUE continues from the last completed displacement and CHECKPOINT_FD = PREPARE creates the displacements and stops after the electronic minimization for the equilibrium structure. CHECKPOINT_FD = SINGLE is used to run individual displacements.
We will describe the restart procedure and splitting a calculation below. As an example, we take a 3x3x1 graphene supercell POSCAR file from the phonon tutorials.
C18 1.0 7.3521657209830806 0.0000000000000000 0.0000000000000000 -3.6760828604915403 6.3671622872044793 0.0000000000000000 0.0000000000000000 0.0000000000000000 8.0000000000000000 C 18 direct 0.1111111111111133 0.2222222222222200 0.0000000000000000 C 0.1111111111111133 0.5555555555555532 0.0000000000000000 C 0.1111111111111133 0.8888888888888866 0.0000000000000000 C 0.4444444444444466 0.2222222222222200 0.0000000000000000 C 0.4444444444444466 0.5555555555555532 0.0000000000000000 C 0.4444444444444466 0.8888888888888866 0.0000000000000000 C 0.7777777777777801 0.2222222222222200 0.0000000000000000 C 0.7777777777777799 0.5555555555555532 0.0000000000000000 C 0.7777777777777799 0.8888888888888866 0.0000000000000000 C 0.2222222222222200 0.1111111111111133 0.0000000000000000 C 0.2222222222222200 0.4444444444444466 0.0000000000000000 C 0.2222222222222199 0.7777777777777799 0.0000000000000000 C 0.5555555555555532 0.1111111111111133 0.0000000000000000 C 0.5555555555555534 0.4444444444444466 0.0000000000000000 C 0.5555555555555532 0.7777777777777799 0.0000000000000000 C 0.8888888888888866 0.1111111111111133 0.0000000000000000 C 0.8888888888888866 0.4444444444444466 0.0000000000000000 C 0.8888888888888866 0.7777777777777799 0.0000000000000000 C
along with a 4x4x1 k-mesh in our KPOINTS file:
K points 0 Gamma 4 4 1 0 0 0
and PAW C_s 04May1998 POTCAR.
The following INCAR file with modifications will be used thoughout:
SYSTEM = graphene ENCUT = 400 # electronic PREC = Accurate NELMIN = 5 EDIFF = 1e-8 ISMEAR = -1 SIGMA = 0.2 LREAL = .FALSE. LWAVE = .FALSE. LCHARG = .FALSE. # ionic (finite differences) IBRION = 6 POTIM = 0.015
Restarting a finite difference calculation
The calculation failed after a certain point or has accidentally been cancelled:
DAV: 9 -0.181350430125E+03 -0.25600E-06 -0.38452E-08 848 0.118E-03 0.774E-04 DAV: 10 -0.181350430581E+03 -0.45554E-06 -0.20686E-08 864 0.738E-04 0.208E-04 DAV: 11 -0.181350430676E+03 -0.94857E-07 -0.22346E-09 704 0.354E-04 0.207E-04 srun: Job step aborted: Waiting up to 32 seconds for job step to finish. slurmstepd-test01: error: *** JOB 254054 ON test01 CANCELLED AT 2026-01-19T16:25:49 *** slurmstepd-test01: error: *** STEP 254054.0 ON test01 CANCELLED AT 2026-01-19T16:25:49 ***
In the directory, you will see the vaspcheckfd.h5 file. It contains the displacement calculations that have been completed up to the point of the crash:
h5ls vaspcheckfd.h5 data-1 Group displacements Group symmetry Group
Restart the calculation by adding CHECKPOINT_FD = CONTINUE to the INCAR:
SYSTEM = graphene ENCUT = 400 # electronic PREC = Accurate NELMIN = 5 EDIFF = 1e-8 ISMEAR = -1 SIGMA = 0.2 LREAL = .FALSE. LWAVE = .FALSE. LCHARG = .FALSE. # ionic (finite differences) IBRION = 6 POTIM = 0.015 CHECKPOINT_FD = CONTINUE
and resubmit your calculation in the directory. The finite differences calculation will continue after an SCF step has been done and the stdout reads
Continuing from previous run
The calculation finishes as normal when all displacements have been completed and the phonon modes calculated:
h5ls vaspcheckfd.h5 data-1 Group data-2 Group data-3 Group data-4 Group displacements Group symmetry Group
Splitting a finite difference calculation
For large structures, it may be easier to split the displacements into separate calculations. This is done in three steps:
- Preparing the separate displacements -
CHECKPOINT_FD = PREPARE - Single displacement calculations -
CHECKPOINT_FD = SINGLE - Collected finite differences -
CHECKPOINT_FD = CONTINUE
1. Preparing the displacements
The displacements can be prepared using the CHECKPOINT_FD = PREPARE tag:
SYSTEM = graphene ENCUT = 400 # electronic PREC = Accurate NELMIN = 5 EDIFF = 1e-8 ISMEAR = -1 SIGMA = 0.2 LREAL = .FALSE. LWAVE = .FALSE. # ionic (finite differences) IBRION = 6 POTIM = 0.015 CHECKPOINT_FD = PREPARE
This creates CONTCAR_disp-N files containing each of the displacements in the parent directory and you can see the following in the stdout:
Creating CONTCAR files for finite difference displacements
and in the vaspcheckfd.h5 file:
h5ls vaspcheckfd.h5
metadata Group
subdir_prefix Dataset {SCALAR}
total_count Dataset {SCALAR}
2. Single displacement calculations
Create directories disp-N for each of the CONTCAR_disp-N file and run the calculations separately. To this end, copy all restart files in the subdirectory, rename CONTCAR_disp-N to POSCAR, set CHECKPOINT_FD = SINGLE in the INCAR file and run the calculation:
max=$(printf "%s\n" CONTCAR_disp-* | sed 's/.*-//' | sort -n | tail -1)
for i in $(seq 1 $max); do
mkdir -p disp-$i
cp CONTCAR_disp-$i disp-$i/POSCAR
cp INCAR POTCAR KPOINTS vasp.run disp-$i/
sed -i 's/PREPARE/SINGLE/g' disp-$i/INCAR
echo """
NCORE = 4
ICHARG = 1
LCHARG = F
""" >> disp-$i/INCAR
cd disp-$i
ln -s ../CHGCAR
cd ..
done
Each INCAR file in the directories will then look like:
SYSTEM = graphene ENCUT = 400 # electronic PREC = Accurate NELMIN = 5 EDIFF = 1e-8 ISMEAR = -1 SIGMA = 0.2 LREAL = .FALSE. LWAVE = .FALSE. LCHARG = .FALSE. # ionic (finite differences) IBRION = 6 POTIM = 0.015 CHECKPOINT_FD = SINGLE NCORE = 4 ICHARG = 1
| Important: You can set different NCORE settings in these calculations, offering parallelization that is not otherwise possible for finite differences. |
| Tip: The calculation can optionally be restarted from WAVECAR or CHGCAR files. |
In each subdirectory, you can see that a single displacement has been recorded in the stdout:
Computing single independent displacement for finite differences
and to the vaspcheckfd.h5 file:
h5ls vaspcheckfd.h5 data-1 Group
3. Collected finite differences
Return to the parent directory and combine these separate displacements into one finite difference calculation using the CHECKPOINT_FD = CONTINUE tag:
SYSTEM = graphene ENCUT = 400 # electronic PREC = Accurate NELMIN = 5 EDIFF = 1e-8 ISMEAR = -1 SIGMA = 0.2 LREAL = .FALSE. LWAVE = .FALSE. LCHARG = .FALSE. # ionic (finite differences) IBRION = 6 POTIM = 0.015 CHECKPOINT_FD = CONTINUE
| Warning: It is possible to combine the finite difference calculations in a different directory but you must include the vaspcheckfd.h5 from the prepare step (as it contains the name of the subdirectories as metadata) and the subdirectories including the corresponding vaspcheckfd.h5. |
Running this calculation, you can see that each of the single displacements are combined into one calculation in the stdout:
Combining displacements from subdirectories
and vaspcheckfd.h5 file:
h5ls vaspcheckfd.h5
metadata Group
subdir_prefix Dataset {SCALAR}
total_count Dataset {SCALAR}
The information about the computed phonon modes is written to stdout and OUTCAR file below Eigenvectors and eigenvalues of the dynamical matrix in the same way as in phonons from finite differences.
Practical hints
- The phonon frequencies will differ slightly between one run and the split calculation, on the order of the 4th or 5th significant figure. We do not expect this to be significant.
- You can use this method for any electron-phonon calculations.
- You can set different NCORE settings in these calculations, offering parallelization that is not otherwise available for finite differences.
- Make sure to check that you are using the correct vaspcheckfd.h5 file with each calculation, particularly the split calculation. If data is read from an inappropriate vaspcheckfd.h5 file, you will see it with the following warning:
----------------------------------------------------------------------------- | | | EEEEEEE RRRRRR RRRRRR OOOOOOO RRRRRR ### ### ### | | E R R R R O O R R ### ### ### | | E R R R R O O R R ### ### ### | | EEEEE RRRRRR RRRRRR O O RRRRRR # # # | | E R R R R O O R R | | E R R R R O O R R ### ### ### | | EEEEEEE R R R R OOOOOOO R R ### ### ### | | | | Checkpoint file vaspcheckfd.h5 is incompatible: NIONS mismatch | | (file=54, current=128). Ensure that your calculational settings are | | identical between runs. In particular, check POSCAR, KPOINTS, | | POTCAR, and INCAR files. | | | | ----> I REFUSE TO CONTINUE WITH THIS SICK JOB ... BYE!!! <---- | | | -----------------------------------------------------------------------------
- We recommend using the CHGCAR file from the parent directory of the split calculation for the indiviudal displacements to speed up the calculation. Link this with
ln -s ../CHGCAR, making sure to setLWAVE = .FALSE.andLCHARG = .FALSE.so that the original wavefunction and charge density are not overwritten. Also setICHARG = 1in order that the charge density is used, rather than starting from scratch.