The calculation may fail to converge if the electronic minimisation parameters are not suitable.

First, the exchange correlation functional. The default choice is the Local Density Approximation and this will probably be
suitable in most cases. If the calculation fails to converge the parameter

`xc_functional : value`

can be used to try a Generalised Gradient functional. The options are `PW91` (Perdew Wang '91), `PBE`
(Perdew Burke Ernzerhof) and `RPBE` (Revised Perdew Burke Ernzerhof). When satisfied that a calculation has
completely converged with the LDA it is probably a good idea to rerun the whole calcualtion using a GGA functional to
check that the final result is not drastically different. In general the LDA is better suited to bulk calculations and
the GGA to surface calculations.

There is also the option of using a non-local `xc_functional` (for fixed cell calculations only). The options are
`
`

`HF Hartree-Fock
`

`SHF Screened Hartree-Fock
`

`EXX Exact exchange
`

`LDA-X Local Density Approximation for exchange
`

`LDA-C Local Density Approximation for correlation
`

Health warning; non-local xc functionals are very computationally expensive.

A cap can be placed on the maximum number of allowed SCF cycles. The calculation is stopped if the electronic
minimisation is unconverged after this many step. The keyword string is

`max_SCF_cycles : value`

If a calculation has taken more than 100 SCF cycles then it probably won't converge, although it does depend on the nature
of the system and the method used to treat any metallic species in the system

`metals_method : value`

For insulators no special treatment is required. Including a parameter

`fix_occupancy : true`

defines the system as an insulator and metals method will be set to a default value of NONE.

If the user defines

`fix_occupancy : false`

then by default a choice will be made by CASTEP for

`metals_method : EDFT`

Now with Ensemble Density Functional Theory (EDFT) the calculation is more likely to converge than with the alternative
method Density Mixing (DM) and will usually require fewer SCF cycles to minimise the electronic structure for a given ionic
structure. However, DM is much faster per SCF cycle than EDFT. For systems containing metallic atoms it is advisable to
first try DM with

`max_scf_cycles : 50`

and if this is failing to converge switch to EDFT.

The electronic minimisation is considered to have converged when the change in the total energy from one iteration to
the next remains below some tolerance value per atom for a few scf steps. The default value of the parameter

`elec_energy_tol : value`

is
eV per atom and is usually suitable but it might be suitable to reduce the strictness of this
tolerance limit if a calculation is consistently failing to converge. The number of iterations for which the change in
the total energy must remain below `elec_energy_tol` is the convergence window and it can be specified by.

`elec_convergence_win`

the default value is 3 but it must be at least 2.