# Crystalline silicon
# Convergence of the number of bands in the transition space.

ndtset     2
#bs_loband1  4 nband1  5
bs_loband1  3 nband1  6
bs_loband2  2 nband2  7
bs_loband3  2 nband3  8
#bs_loband5  1 nband5  8

bs_coulomb_term      10 # Coulomb term evaluated within the diagonal approximation.

irdwfk  1
irdscr  1

#getwfk  20              # Trick to read the same file tbs_o3_DS20_WFK in each dataset
#getscr  20              # Same trick for the SCR file



# Definition of the k-point grid
# MUST equal the grid used for generating the WFK file.
kptopt 1          # Option for the automatic generation of k points,
ngkpt  4 4 4 
nshiftk 1
chksymbreak 0             # Mandatory for using symmetry-breaking k-meshes in the BS code.
shiftk    0.11 0.21 0.31  # This shift breaks the symmetry of the k-mesh.

# BSE run with Haydock iterative method (only resonant + W + v)
optdriver 99  # BS calculation

bs_calctype       1
mbpt_sciss          0.8 eV  # Scissors operator used to correct the KS band structure.
bs_exchange_term  1       # Exchange term included.
bs_coupling       0       # Tamm-Dancoff approximation.


bs_freq_mesh 0 6 0.02 eV  # Frequency mesh.

bs_algorithm        2      # Haydock method.
bs_haydock_niter   100     # Max number of iterations for the Haydock method.
bs_haydock_tol     0.05 0  # Tolerance for the iterative method.
zcut               0.15 eV # complex shift to avoid divergences in the continued fraction.

ecutwfn 12.0               # Cutoff for the wavefunction.
ecuteps 2.0               # Cutoff for W and /bare v used to calculate the BS matrix elements.
inclvkb 2
gw_icutcoul 3               # Legacy value

# VARIABLES COMMON TO THE DIFFERENT DATASETS

# Definition of the unit cell: fcc
acell 3*10.217         # This is equivalent to   10.217 10.217 10.217
rprim  0.0  0.5  0.5   # FCC primitive vectors (to be scaled by acell)
       0.5  0.0  0.5
       0.5  0.5  0.0

# Definition of the atom types
ntypat 1         # There is only one type of atom
znucl 14         # The keyword "zatnum" refers to the atomic number of the
                 # possible type(s) of atom. The pseudopotential(s)
                 # mentioned in the "files" file must correspond
                 # to the type(s) of atom. Here, the only type is Silicon.

# Definition of the atoms
natom 2           # There are two atoms
typat 1 1         # They both are of type 1, that is, Silicon.
xred              # Reduced coordinate of atoms
   0.0  0.0  0.0
   0.25 0.25 0.25

# Definition of the planewave basis set 
ecut 12         # Maximal kinetic energy cut-off, in Hartree

istwfk *1
nstep  50      # Maximal number of SCF cycles
diemac 12.0


 pp_dirpath "$ABI_PSPDIR"
 pseudos "Pseudodojo_nc_sr_04_pw_standard_psp8/Si.psp8"

##############################################################
# This section is used only for regression testing of ABINIT #
##############################################################
#%%<BEGIN TEST_INFO>
#%% [setup]
#%% executable = abinit
#%% test_chain = tbs_1.abi, tbs_2.abi, tbs_3.abi, tbs_4.abi
#%% [files]
#%% files_to_test = 
#%%   tbs_3.abo, tolnlines= 10, tolabs=  1.1e-2,    tolrel=  4.0e-2, fld_options = -ridiculous
#%% [paral_info]
#%% max_nprocs = 4
#%% [extra_info]
#%% authors = M. Giantomassi
#%% keywords = GW, BSE
#%% description = 
#%%   Crystalline silicon
#%%   Convergence of the number of bands in the transition space.
#%%<END TEST_INFO>
