# FAQSCF

### What SCF solver methods are available in CASTEP?

The goal of the SCF solver is to find the ground-state wavefunctions (and density) which are the lowest-energy solutions to the Kohn-Sham equations (the fundamental equations of conventional density functional theory).

CASTEP has two main methods to solve the Kohn-Sham equations: density mixing (DM); and ensemble density functional theory (EDFT).

**Density mixing** is a fast, but potentially unstable method. Rather than attempting to compute the ground-state wavefunctions and density simultaneously, in the DM method the Kohn-Sham wavefunctions are first computed for a given input density, and then a separate "density mixing" algorithm is used to calculate an estimate of the ground-state density. This estimate is then used as the input density for a new iteration of the method. The algorithm continues until the estimated ground-state density is the same as the input density, which occurs when the ground state has been reached.

DM is CASTEP's default method unless a fixed-occupancy calculation is specified. You can force a calculation to use DM using

`elec_method : dm`

in the `param`

file.

**Ensemble density functional theory**
is a stable, but slow method of solving the Kohn-Sham equations. In EDFT the density is always computed directly from the estimated ground-state wavefunctions, and these wavefunctions are only ever updated in a way which brings them closer to the ground state.

You can select EDFT as the SCF method to use by setting

`elec_method : edft`

in the `param`

file.

### My SCF failed to converge. What can I do?

**Check your input makes physical/chemical sense**

It is not unusual to find that underlying an SCF convergence failure is some mistake in specifying the system. Common causes include

- The atomic co-ordination does not make physical sense, for example atoms are too close.
- Specifiying
`fix_occupancy=true`

when the system is really metallic. This selects the*allbands*SCF solver by default, which will probably fail to converge. - Specifying
`spin=0`

if the system is really magnetic. Even starting a spin-polarised calculation from a zero-spin initial state can cause SCF convergence failure, as the code does not know which way to break the spin symmetry. Atomic spin intialisation using`SPIN=s`

in`%BLOCK POSITIONS_CART`

will usually solve this.

**Density Mixing**

The density mixing algorithm used by Castep has several parameters that you can experiment with to improve its convergence. The main ones are:

`mixing_scheme`

There are two main density mixing schemes, one due to Broyden and one to Pulay. The default is Broyden, but if your system is not converging it is always worth trying Pulay.`mix_cut_off_energy`

The density mixing is actually performed in reciprocal space, and only plane-waves whose energy is less than`mix_cut_off_energy`

are mixed. If the high-energy components are causing problems, increasing`mix_cut_off_energy`

will improve the convergence. The default value is the plane-wave cut-off energy for the wavefunction and this is a sensible minimum value for the parameter; the maximum sensible value is given by cut_off_energy * (fine_grid_scale)^{2}.`mix_charge_amp`

(and`mix_spin_amp`

)

The density mixing takes a fraction of the proposed new density and the old density, and this fraction is set by`mix_charge_amp`

. The possible values of mix_charge_amp range from 0 to 1, where a smaller value can stabilise the algorithm but may lead to slow convergence, and a large value will generally either converge rapidly or fail to converge at all. For systems which are proving difficult to converge, sensible values are generally between 0.05 and 0.2. If your system is spin-polarised then you may also want to investigate the corresponding parameter for the spin-density mixing,`mix_spin_amp`

. This works in the same way as mix_charge_amp except that its values range from 0 to 2.

**Ensemble DFT**

EDFT is a very robust SCF solver, but much more expensive than density-mixing. But if DM still fails to converge after tweaking the parameters, then EDFT usually will. Select using `ELEC_METHOD=EDFT`