# Basic magnetism

In this tutorial we will demonstrate how to perform magnetic calculations using FLEUR. Our example will be a simple two atom unit-cell of iron in which we will study collinear magnetism.

### Fe in fcc structure

In its ground state Fe crystallizes in a bcc structure, but it is also possible to synthesize Fe in an fcc structure, e.g., fcc Fe clusters may form by fast annealing of Fe in a Cu matrix. In this tutorial we will consider such a structure and investigate different magnetic configurations of such a setup.

## Ferromagnetism vs. Antiferromagnetism

When comparing ferromagnetic (FM) and antiferromagnetic (AFM) configurations of a crystal, often the minimal unit cells for these different magnetic states vary in size. This implies that one has to be careful to adjust the parametrization of the calculation to be analogous. Especially the k-point mesh dimensions have to be scaled reciprocal to the unit cell dimensions. Other parameters have to be set to identical values. If one wants to avoid such a parameter adjustment step another option is to have a common chemical unit cell as a starting point for all calculations.

In this tutorial we choose this latter approach and set up a two-atom fcc unit cell that can be used to investigate the ferromagnetic state, as well as an antiferromagnetic configuration in (001) direction. The `inpFeSimple.txt`

inpgen input in the `FeSimple`

directory can be used to generate such a Fleur setup. It implements the two-atom fcc unit cell as a tetragonal cell (`'tP'`

). Change into the mentioned directory and display this input.

```
cd FeSimple ; cat inpFeSimple.txt
```

Note that for an fcc lattice constant the lattice parameters for this two-atom tetragonal unit cell are and .

Use the inpgen input to generate a Fleur input.

```
inpgen -f inpFeSimple.txt
```

The generated `inp.xml`

file already is ready for a magnetic calculation. You can see this from two important differences with respect to a non-magnetic simulation:

- The number of spins is no longer one, but two:

```
<magnetism jspins="2" />
```

- The initial occupations are no longer equivalent for both spin directions in the species definition:

```
<electronConfig flipSpins="F">
<coreConfig>(1s1/2) (2s1/2) (2p1/2) (2p3/2)</coreConfig>
<valenceConfig>(3s1/2) (3p1/2) (3p3/2) (4s1/2) (3d3/2) (3d5/2)</valenceConfig>
<stateOccupation state="(3d3/2)" spinUp="1.20000000" spinDown="1.20000000"/>
<stateOccupation state="(3d5/2)" spinUp="2.90000000" spinDown=".70000000"/>
</electronConfig>
```

So we initially start with a magnetic moment of

Please note that
- the system is magnetic because `inpgen`

by default assumes that some elements lead to magnetic setups. This is of course not always correct and you should therefore monitor this choice.
- the moment choosen here is also a default value. It is the value of the moment for the starting charge density, so its value will determine the convergence and possibly the state we converge to, but the final magnetic moment will of course be determind in the SCF cycle.

In order to generate more complex magnetic setups and to control the magnetism on a finer level you can provide more details in the input for `inpgen`

.

```
fcc Fe, Cu lattice constant, two atom unit cell
&lattice latsys='tP' a=4.822468248 c=6.82 /
2
26 0.0 0.0 0.0 : 2.2
26 0.5 0.5 0.5 : 2.2
```

Here, we added the initial moment to each atom. This will overwrite the defaults. Instead of giving the moment directly here, you can also specify only the special values `up`

and `down`

to keep the default value and to modify only the direction.

In oder to perform a simulation for the ferro- and anti-ferro-magnetic state we now use this idea and create two directories:

```
mkdir FM ; cd FM ; inpgen -f ../inpFeFM.txt ; cd -
```

```
mkdir AFM ; cd AFM ; inpgen -f ../inpFeAFM.txt ; cd -
```

**Please have a look at the generated inp.xml files. **

You should e.g. confirm and understand: - that the FM state only has a single species, while the AFM states needs two species corresponding to the different initial moments - that the two species in the AFM state differ by their initial moments

Then you can run `FLEUR`

until it converges. Please note that the default of `itmax=15`

is not sufficent, so you should either
- start `FLEUR`

several times until you reach convergence
- increase the `itmax`

parameter.

```
cd FM ; fleur_MPI ; cd -
```

```
cd AFM; fleur_MPI ; cd -
```

The charge density distance output of the calculations should indicate convergence. Extract the total energy from the last iteration of both calculations and compare them. You should find that from our calculations (with default parameters) the FM configuration is preferred and has a small energy advantage of about for the unit cell or per atom.

```
for f in FM/out AFM/out; do grep -H "total energy" $f | tail -1; done
```

Another quantity we can extract for magnetic calculations are the magnetic moments in the MT spheres. For this two-atom type system you can easily find these entries for the last SCF iteration by invoking

```
grep "magneticMoment" FM/out.xml | tail -n 4
```

and

```
grep "magneticMoment" AFM/out.xml | tail -n 4
```

Doing this for the `out.xml`

files of the two calculations should show for the FM calculation a magnetic moment of about in both MT spheres and for the AFM calculation a magnetic moment of about with opposite signs in the two MT spheres.

One can also extract for each spin the total charges in the whole unit cell. We do that for the FM calculation. For the last iteration we obtain the respective entries with:

```
grep "spinDependent" FM/out.xml | tail -n 2
```

Subtracting the spin 2 charge from the spin 1 charge and dividing by 2 (for the two atoms in the unit cell) should give a magnetic moment of about per atom.

# Further studies:

Several other possible ways of generating magnetic setups are possible and are sometimes useful. For example, the option `flipSpin`

can be used to create a different magnetic state.
```