Spin-DFT tutorial

Requirements

Software components

  • nanotools

  • RESCU+

Pseudopotentials

I will need the following pseudopotential.

  • Fe_AtomicData.mat

Let’s copy it from the pseudo database to the current working directory and export RESCUPLUS_PSEUDO=$PWD.

References

Briefing

In this tutorial, I show how to calculate the magnetic moment of the Fe crystal in the collinear spin framework.

Code

Create the script etot.py as follows

from nanotools import Atoms, Cell, System, TotalEnergy
cell = Cell(avec=[[-1.435, 1.435, 1.435], [1.435, -1.435, 1.435], [1.435, 1.435, -1.435]], resolution=0.10)
with open("fe.xyz", "w") as f:
   f.write(\
"""1
s x y z sz
Fe 0. 0. 0. 2.
""")
atoms = Atoms(fractional_positions="fe.xyz")
sys = System(cell=cell, atoms=atoms)
sys.hamiltonian.ispin = 2
sys.atoms.set_initial_magnetic_moments("fe.xyz")
calc = TotalEnergy(sys)
calc.solve()

Explanations

Here is a high level view of the calculation workflow:

  1. Create a TotalEnergy calculator (see the tutorial on TotalEnergy).

  2. Solve the Kohn-Sham equation self-consistently calling solve.

  3. Analyze the data and look at the results.

Total energy calculator

I first create a System object. I define a body centred cubic (BCC) cell with lattice parameter 2.87 Ang. I specify the atom position and species via an xyz-file fe.xyz. The system is created with degenerate spin by default. I change to collinear spin setting sys.hamiltonian.ispin = 2. The spin frameworks relate to the value of ispin as follows:

  • 1: degenerate

  • 2: collinear

  • 4: non-collinear

I then set the initial magnetic moment calling sys.atoms.set_initial_magnetic_moments("fe.xyz"). The function set_initial_magnetic_moments will read fe.xyz and look for the position of the column sz. The magnetic moment of each atom will be initialized to the value of the column sz, in units of Bohr magnetons (i.e. each electron has spin 1/2).

Solve the Kohn-Sham equation

RESCU+’s solvers are invoked calling the solve method

calc.solve()

The method writes all parameters to a JSON file, then calls the relevant (Fortran) program, then loads the data back into the calculator. The output of rescuplus goes to nano_scf_out.h5 and nano_scf_out.json.

Analyze the data

I can now read the data using the read method of TotalEnergy.

from nanotools import TotalEnergy
calc = TotalEnergy.read("nano_scf_out.json")

and get the magnetic moment with the get_total_magnetic_moment method. For example,

print(calc.get_total_magnetic_moment())

gives 2.224. This is indeed quite close to the theoretical and experimental values reported in Jiang et al. which are 2.17 and 2.22 respectively.