# Basic magnetism

## Objectives

• Setting up a magnetic calculation in FLEUR.
• Using additional features of inpgen for magnetic systems.
• Learning how to create different magnetic setups.

## Introduction

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.

In its ground state, Fe crystallizes in a bcc structure and in this tutorial, we will consider such a structure and investigate different magnetic configurations of such a setup.

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.

{hint} Steps Steps needed for a magnetic FLEUR calculation and for comparing the FM and AFM configurations: 1. Create aninp.xmlfile usinginpgen with additional information 2. Run FLEUR to achieve self-consistency for the FM and the AFM configuration 3. Inspect the output

## FLEUR steps

### inpgen

In this tutorial, we choose a very simple two-atom bcc 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 FeBCC directory can be used to generate such a Fleur setup. It implements the two-atom bcc unit cell as a simple cubic cell ('sc'). Change into the mentioned directory and display this input.

bash
cd FeBCC ; cat inpFeSimple.txt


Note that we use the experimental lattice constant of bcc Fe $a_\text{bcc}=2.87~\text{\AA}$ and the corresponding scaling factor to convert to Bohr radii as the length scale. We also specify with the &exco xctyp="vwn" / line that the VWN LDA XC functional will be used. This is not required for this tutorial section, but in a later section noncollinear magnetism will be discussed and for such calculations we prefer the use of LDA XC functionals. The choice at this place is made to obtain comparable results between the two tutorial sections.

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:

1. The number of spins is no longer one, but two:
<magnetism jspins="2" />

1. 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>


{note} Please note: - the system is magnetic becauseinpgen 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.


BCC Fe, simple cubic cell, two atoms &lattice latsys='sc' a=2.87 a0=1.88973 / 2 26 0.0 0.0 0.0 : 2.2 26 0.5 0.5 0.5 : 2.2

&exco xctyp="vwn" /

{note} Initial moment
Here, we added the initial moment in $\mu_\text{B}$ to each atomic position **(The 2.2 after the colon!)**. 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 order to perform simulations for the ferro- and antiferromagnetic configurations, we now use this idea and create two directories:

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

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

Please have a look at the input file for inpgen and generated inp.xml files to understand what we are doing here.

You should e.g. confirm and understand:
- that the FM configuration only has a single atom species, while the AFM configuration needs two atom species, associated with the different initial moments
- that the two atom species in the AFM configuration differ by their initial moments


Then you can run FLEUR until it converges. Please note that the default of itmax=15 is not sufficient, 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 $30~\text{mHtr}$ for the unit cell or $15~\text{mHtr}$ 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. The probably most human readable version of this information is provided in the out file in a table with the title "Spin Magn. mom.". We can inspect this with

grep -A 4 "Spin Magn. mo" FM/out | tail -n 5


and

grep -A 4 "Spin Magn. mo"  AFM/out | tail -n 5


These tables in general give you the information of the magnetic moments and their orientation in space. For this simple collinear calculation without spin-orbit coupling, only the magnitude of the moment is well-defined and given in the first column.

In our example, we can see that we obtain for the FM calculation a magnetic moment of about $2.23~\mu_\text{B}$ in both MT spheres and for the AFM calculation a magnetic moment of about $1.55~\mu_\text{B}$ with opposite signs in the two MT spheres.

{hint} Hint You can also use thesmmat the end of the lines to do agrep smm out.

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:

bash
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 $2.20~\mu_\text{B}$ per atom. For the AFM case the total moment vanishes.

Several other possible ways of generating magnetic setups are possible and are sometimes useful. For example, the option flipSpins can be used to create a different magnetic configuration. If activated it swaps up and down occupations for the different states in the generation of the starting electron density

<electronConfig flipSpins="F">
...
</electronConfig>


Further options related to magnetism are also discussed in the following tutorials and on the documentation website

https://www.flapw.de/MaX-7.0/documentation/magnetism/