# Setting up the DMFT loop

### The spin-polarized QSGW starting point

This tutorial assumes you have a converged spin-polarized QSGW calculation and you want to do a DMFT calculation on top of it.

Note: Of course you can also do LDA+DMFT. The procedure is basically the same, but you can ignore all reference to any sigm file.

### Input folders, files and programs

Once you have a converged spin-polarized QSGW calculation you still need some additional files to run lmfdmft and ctqmc. You can find them below (just copy paste the text inside the respective files).

Let’s assume qsgw-ni is the folder with the QSGW calculation and dmftrun is the one where you want to perform the DMFT calculations, then you dispatch relevant input files into this folder meant for DMFT calculations:

mkdir dmftrun
cp qsgw-ni/{ctrl,basp,site,rst,sigm}.ni dmftrun    # relevant QSGW output files


For DMFT calculations we need three files separately, indmfl.ni,PARAMS,Trans.dat. Please copy the text from below into respective files.

The indmfl file, named as indmfl.ni looks like:

0.1 1.2 1 2                # hybridization Emin and Emax, measured from FS, renormalize for interstitials, projection type
1 0.0025 0.0025 600 -3.000000 1.000000  # matsubara, broadening-corr, broadening-noncorr, nomega, omega_min, omega_max (in eV)
1                                     # number of correlated atoms
1     1   0                           # iatom, nL, locrot
2   2   1                           # L, qsplit, cix
#================ # Siginds and crystal-field transformations for correlated orbitals ================
1     5  5       # Number of independent kcix blocks, max dimension, max num-independent-components
1     5  5       # cix-num, dimension, num-independent-components
#---------------- # Independent components are --------------
'x^2-y^2' 'z^2' 'xz' 'yz' 'xy'
#---------------- # Sigind follows --------------------------
1 0 0 0 0
0 2 0 0 0
0 0 3 0 0
0 0 0 4 0
0 0 0 0 5
#---------------- # Transformation matrix follows -----------
0.70710679 0.00000000   0.00000000 0.00000000   0.00000000 0.00000000   0.00000000 0.00000000   0.70710679 0.00000000
0.00000000 0.00000000   0.00000000 0.00000000   1.00000000 0.00000000   0.00000000 0.00000000   0.00000000 0.00000000
0.00000000 0.00000000   0.70710679 0.00000000   0.00000000 0.00000000  -0.70710679 0.00000000   0.00000000 0.00000000
0.00000000 0.00000000   0.00000000 0.70710679   0.00000000 0.00000000   0.00000000 0.70710679   0.00000000 0.00000000
-0.70710679 0.00000000   0.00000000 0.00000000   0.00000000 0.00000000   0.00000000 0.00000000   0.70710679 0.00000000


The PARAMS file looks like:

OffDiagonal  real
Sig  Sig.out
Gf  Gf.out
Delta  Delta.inp
cix  actqmc.cix
Nmax  300         # Maximum perturbation order allowed
nom  200          # Number of Matsubara frequency points sampled
exe  ctqmc        # Name of the executable
tsample  50       # How often to record measurements
M  1000000        # Total number of Monte Carlo steps per core
Ncout  100000     # How often to print out info
PChangeOrder  0.9         # Ratio between trial steps: add-remove-a-kink / move-a-kink
warmup  100000            # Warmup number of QMC steps
sderiv  0.02      # Maximum derivative mismatch accepted for tail concatenation
aom  10           # Number of frequency points used to determin the value of sigma at nom
U    4.0
J    0.3
nf0  8.0
beta 50.0


The Trans.dat file looks like:

  10 10 #  size of Sigind and CF
#---- Sigind follows
1    0    0    0    0    0    0    0    0    0
0    2    0    0    0    0    0    0    0    0
0    0    3    0    0    0    0    0    0    0
0    0    0    4    0    0    0    0    0    0
0    0    0    0    5    0    0    0    0    0
0    0    0    0    0    6    0    0    0    0
0    0    0    0    0    0    7    0    0    0
0    0    0    0    0    0    0    8    0    0
0    0    0    0    0    0    0    0    9    0
0    0    0    0    0    0    0    0    0   10
#---- CF follows
0.00000000  0.70710679   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000 -0.70710679   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000
0.00000000  0.00000000   0.00000000  0.70710679   0.00000000  0.00000000   0.00000000  0.70710679   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000
0.00000000  0.00000000   0.00000000  0.00000000   1.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000
0.00000000  0.00000000   0.70710679  0.00000000   0.00000000  0.00000000  -0.70710679  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000
0.70710679  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.70710679  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000
0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.70710679   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000 -0.70710679
0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.70710679   0.00000000  0.00000000   0.00000000  0.70710679   0.00000000  0.00000000
0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   1.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000
0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.70710679  0.00000000   0.00000000  0.00000000  -0.70710679  0.00000000   0.00000000  0.00000000
0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.70710679  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.00000000  0.00000000   0.70710679  0.00000000


Now copy the files inside the directory for DMFT calculations:

cp Trans.dat PARAMS indmfl.ni dmftrun # relevant DMFT input files

##### Edit the ctrl file

The impurity solver for DMFT for us is CT-QMC, which is a finite temperature solver, so we need to specify the temperature at which we want to solve the impurity Hamiltonian. Also DMFT being a dynamic self-consistent algorithm, we need to specify the number frequency points at which we want to compute single-particle spectral quantities. Also going from QSGW to DMFT, we need to downfold a large’ number of bands (inside the window of projection) on to a certain angular momentum of correlated atom. Accordingly we need to add some tokens to ctrl.ni.

# add some tokens at the end of ctrl.ni
cd dmftrun
echo 'DMFT    PROJ=2 NLOHI=1,8 BETA=50 NOMEGA=999 KNORM=0' >> ctrl.ni


The token DMFT_NLOHI defines the projection window in band index, DMFT_BETA is the inverse temperature in eV$^{-1}$ and DMFT_NOMEGA is the number of Matsubara frequencies in the mesh. Some details of the projection procedure are controlled by DMFT_PROJ and DMFT_KNORM, but you are not meant to change their value.

At the end, you can see how your ctrl.ni should look like the following.

# Autogenerated from init.ni using:
# blm ni --gw --wsitex --mag --nit=20 --nk=12 --nkgw=8 --gmax=8.7

# Variables entering into expressions parsed by input
% const nit=20
% const met=5
% const nsp=2 so=0
% const lxcf=2 lxcf1=0 lxcf2=0     # for PBE use: lxcf=0 lxcf1=101 lxcf2=130
% const pwmode=0 pwemax=3          # Use pwmode=1 or 11 to add APWs
% const sig=12 gwemax=2 gcutb=3.3 gcutx=2.7  # GW-specific
% const nkabc=12 nkgw=8 gmax=8.7
% const bxc0=0

VERS  LM:7 FP:7 # ASA:7
IO    SHOW=f HELP=f IACTIV=f VERBOS=35,35  OUTPUT=*
EXPRESS
# Lattice vectors and site positions
file=   site

# Basis set
gmax=   {gmax}                   # PW cutoff for charge density
autobas[pnu=1 loc=1 lmto=5 mto=4 gw=1 pfloat=2]

# Self-consistency
nit=    {nit}                    # Maximum number of iterations
mix=    B2,b=.3,k=7              # Charge density mixing parameters
conv=   1e-5                     # Convergence tolerance (energy)
convc=  3e-5                     # tolerance in RMS (output-input) density

# Brillouin zone
nkabc=  {nkabc}   # 1 to 3 values.  Use n1<0 => |n1| ~ total number
metal=  {met}     # Management of k-point integration weights in metals

# Potential
nspin=  {nsp}                    # 2 for spin polarized calculations
so=     {so}                     # 1 turns on spin-orbit coupling
xcfun=  {lxcf},{lxcf1},{lxcf2}   # set lxcf=0 for libxc functionals

#SYMGRP i r4x r3d
HAM
PWMODE={pwmode} PWEMIN=0 PWEMAX={pwemax}  # For APW addition to basis
FORCES={so==0} ELIND=-0.7
RDSIG={sig} SIGP[EMAX={gwemax}]  # Add self-energy to LDA
BXC0={bxc0}
GW    NKABC={nkgw} GCUTB={gcutb} GCUTX={gcutx} DELRE=.01 .1
GSMEAR=0.003 PBTOL=1e-3
SPEC
ATOM=Ni         Z= 28  R= 2.354453  LMX=3  LMXA=4  MMOM=0 0 0.6
DMFT    PROJ=2 NLOHI=1,8 BETA=50 NOMEGA=999 KNORM=0


### Prepare a vanishing impurity self-energy

At this point we need the lmfdmft executable on the path. On scarf the easiest way to do that is to access one compute node and load the relevant modules and run the lmfdmft interactively. You start the loop from scratch by creating an empty impurity self-energy:

# boilerplate code to start interactive session on SCARF and prepare the environment ...
bsub -Is -n 24 -q scarf-rhel7 -R "span[hosts=1]" /bin/bash
module use /home/cseg/scarf590/opt/modules/o

cd dmftrun
lmfdmft -vnkabc=24 --rs=1,0 --ldadc=28.95 -job=1 ctrl.ni


Or lmfdmft can be run in parallel mode using:

mpirun -n 24 lmfdmft -vnkabc=24 --rs=1,0 --ldadc=28.95 -job=1 ctrl.ni


Here ldadc=28.95 is the double counting correction. The choice is governed by the expression for double counting correction for a multi-orbital system in the fully localized limit (FLL), with U = 4.0 eV, J = 0.3 eV, n = 8 (number of electrons in 3-d states of Nickel);

Edc=U(n-1/2)-J(n-1)/2


You can check that the line

Missing sigma file : create it and exit ...
`

is written at the end of the log.

The calculation has stopped just after reading the indmfl.ni. A text file called sig.inp has been created. It is formatted with the first column being the Matsubara frequencies (in eV) and then 0.0 repeated for a number of columns equal to twice the number of m channels (e.g. ten columns for d-type impurity grouped in real and imaginary parts).

Of course, if you want you can start from non-vanishing sig.inp files (e.g. from a previously converged DMFT loop).