# 10.1. Preparing the ground state data

A DFPT calculation starts by performing a self-consistent calculation to compute the ground-state of the system. In particular, ground-state wavefunctions are directly used in the next step of DFPT calculation. Hence, as we will see below, the are explicitly saved as the output of ground-state calculation.

We use boron nitride to demonstrate various aspects of DFPT workflow. The input file for the ground-state calculation is shown below:

Warning

Through out the following examples, we choose simulation parameters to obtain fast results. However, for production runs one must perform convergence tests to determine optimized parameters according to desired accuracy.

```
info.calculationType = 'self-consistent'
info.savepath = './results/bn_real_scf'
element(1).species = 'B'
element(1).path = './B_AtomicData.mat'
element(2).species = 'N'
element(2).path = './N_AtomicData.mat'
atom.element = [1 2]
atom.xyz = 6.85*[0 0 0;.25 .25 .25]
domain.latvec = 6.85*[.5 .5 0;.5 0 .5;0 .5 .5]
domain.lowres = 0.2
functional.libxc = true
functional.list = {'XC_GGA_X_PBE','XC_GGA_C_PBE'}
kpoint.gridn = [3 3 3]
kpoint.sigma = 0 % advised for dfpt non-metallic systems
mixing.tol = 1e-8*[1 1] % advised for dfpt
option.saveWavefunction = 1 % required for dfpt
diffop.method = 'fft' % required for dfpt
domain.fourierInit = false % required for dfpt
```

The keywords are similar to a typical ground state calculation. However, extra attention must be paid to the following keywords which directly affect the DFPT workflow:

`functional.libxc`

Current DFPT implementation covers LDA and GGA XC-functionals. In case of LDA, one can either use built-in RESCU’s implementation or the one provided through LibXC library. However, PBE functionality is only provided through LibXC interface of RESCU, hence corresponding keyword value must be set to true;`kpoint.gridn`

We strongly recommend to use an odd and \(\Gamma\) centered ground state reciprocal space sampling. Although this is optional in case of DFPT dielectric constant calculation (where only \(\Gamma\) point is required), for calculating the dynamical matrix, RESCU currently only accepts an identical sampling for phonons wave-vectors (except in case of \(\Gamma\) phonons);`kpoint.sigma`

In current DFPT implementation, systems with a non-zero electronic band-gap are assumed to have zero smearing parameter. Therefore, it is important to properly set this parameter (zero for this example) to ensure consistency in using ground-state data in DFPT calculations;

Important

Currently RESCU associates non-zero `kpoint.sigma`

values with systems with zero electronic
band-gap in DFPT simulations.

`mixing.tol`

This is a central keyword that controls the accuracy of calculated response functions. It is often required to converge the ground state wavefunctions to a higher accuracy for the subsequent DFPT calculation. As any other quantities, it is always the best practice to perform convergence test to find the suitable tolerance value for any production run. However, we have observed that a tolerance of`1e-8`

often suffices to produces accurate response functions;`option.saveWavefunction`

Ground state wavefunctions are directly used within the DFPT workflow, and currently RESCU requires that they should be stored for later use in DFPT calculation;`diffop.method`

In current DFPT implementation it should be set to`'fft'`

. This is to minimize numerical errors associated with evaluating numerical derivatives of various fields required in DFPT workflow;`domain.fourierInit`

For same reasons as previous keywrod, it should be set to`false`

.

Once the input file is ready, RESCU is executed as follows

```
rescu -i bn_real_scf
```

Upon completion, the ground state wavefunctions and electronic density are calculated, and the next step in DFPT workflow, i.e. evaluating first-order perturbed wavefunctions, self-consistent potential and electronic density can be executed.