# Magnetic Force theorem

Calculating many different magnetic configurations self-consistently may be very time consuming. To get an approximate result for the differences between the investigated magnetic configurations one can also obtain the self-consistent solution just for one of the configurations and then modify the magnetic configuration on top of this self-consistent solution but perform only a single iteration to calculate the eigenvalues and eigenstates. As an approximation the differences in the total energies of the converged calculations can then also be obtained as the difference in the eigenvalue sums for the different configurations. This is the magnetic Force theorem.

## Force theorem for the magnetocrystalline anisotropy

In this example we will test this for the the magnetocrystalline anisotropy calculated already in MA4.

```
export THOME=$PWD
cd ForceTheorem/MAE ; inpgen -f inpCo.txt
```

**Modify in that directory the inp.xml file by adding the following section directly below the /output section:**

```
<forceTheorem>
<MAE theta="0.0 0.25*Pi 0.5*Pi 0.5*Pi" phi="0.0 0.0 0.0 0.5*Pi" />
</forceTheorem>
```

The presence of this section indicates to Fleur that after reaching self-consistency the respective Force theorem step has to be performed. In this case we specify the usage of the force theorem for the calculation of the magnetocrystalline anisotropy energy (MAE). The lists of angles specified in the respective MAE tag are the same as those we used before. For the i-th configuration the i-th entries of the lists are used.

Perform the fleur calculation.

```
fleur_MPI
```

The Force theorem results for the different configurations can be obtained from the `out.xml`

file. A good way of obtaining them is via the command `grep ev\-sum out.xml`

. `ev-sum`

denotes the eigenvalue sum for the respective calculation. Use the Python script from above to obtain the coefficients and also from the eigenvalue sums and visualize the result. How large is the deviation from the original determination of these coefficients? Keep in mind that this calculation was about 4 times faster since we only obtained a self-consistent result for one of the configurations.

```
grep ev\-sum out.xml
```

## Force theorem for spin-spiral calculations

FLEUR also has a mode to calculate the spin-spiral energy using the force-theorm approach. We revisit the system from the Spin-spiral tutorial MA3.

```
cd $THOME/ForceTheorem/SS
inpgen -f inpFeSpinSpiral.txt
inpgen -inp.xml -kpt grid=8,8,8
```

**Again modify the inp.xml file. Add the following section directly below the /output section:**

```
<forceTheorem>
<spinSpiralDispersion>
<q> 0.0 0.0 0.0 </q>
<q> 0.1 0.0 0.0 </q>
<q> 0.2 0.0 0.0 </q>
<q> 0.3 0.0 0.0 </q>
<q> 0.4 0.0 0.0 </q>
<q> 0.5 0.0 0.0 </q>
</spinSpiralDispersion>
</forceTheorem>
```

In addition you should set the reference state by setting the reference state to

```
<qss>0.0 0.0 0.0</qss>
```

and set the `default-3`

k-point set as well as the `beta`

angle to `Pi/2`

.

**Don't forget to also set the beta angle to 0.5*Pi.**

By running FLEUR the following calculations will be performed: * The reference state is calculated self-consistently, i.e. the charge density is converged * The force theorem is used to calculate eigenvalue sums for the q-vectors listed.

```
fleur_MPI
```

Again we extract the eigenvalue sums using a simple `grep ev\-sum out.xml`

.

```
grep ev\-sum out.xml
```

# Further studies:

As the force theorem always uses a reference calculation, you should check the dependence of you results from the choice of this state. For example in the spin-spiral example you could not use

```
<qss>0.0 0.0 0.0</qss>
```

but

```
<qss>0.5 0.5 0.0</qss>
```

as reference. The differences you will encounter give some ideas of the level of confidence you can have in the force theorem results.

```
```