#
# BENZENE MOLECULE for PARATEC/ESPRESSO/SIESTA
#
# this example teaches to select unit-cell size and number of unoccupied states,
# to generate SIESTA wavefunctions
# to iteratively compute self-energy at quasiparticle energy and to get absolute
# quasiparticle energies relative to the vacuum level
#
# ----------------------------------------
#
# get size of FFT grid and dielectric matrix (directory 0)
# ng = 2637 in ./0-gsphere/g_eps.out ==> use approximately that many unoccupied states
# ESPRESSO: grid3 = 144 in ./0-gsphere/g_rho.out ==> run espresso on 144 processors
#
sh ./script_0
#
# create symbolic links
#
# Enter PARATEC or ESPRESSO directory.
sh ./script_1
#
# generate charge density, do post-processing (directory 1)
# PARATEC: run nscf calculation, generate WFN/RHO/VXC/vxc.dat (directory 2)
# ESPRESSO: run nscf calculation, run pw2bgw wrapper (directory 2)
# multiply dx,dy,dz from ./1-scf/surface.out by a factor of 2 to get unit-cell size
# electrostatic potential averaged on unit-cell faces in ./1-scf/velec_avg_face.out is used via keyword avgpot_outer in sig.inp
# the averaging is taken on planes 0.5 0.5 0.5 because benzene is at the origin of the coordinate system
#
PARATEC: Submit script_2. Suggested ncpu = 128, walltime = 6:00:00
ESPRESSO: Submit script_2. Suggested ncpu = 144, walltime = 6:00:00
#
# Leave PARATEC or ESPRESSO directory.
# run siesta, denchar, grid2cube (directory 3)
# this step is performed in serial because denchar doesn't run in parallel
# grid2cube step is to generate rho and vxc for running Sigma on top of SIESTA (not done in this example)
# note that Denchar.MaxX = a1 * (nr1 - 1) / nr1 in ./3-siesta/in_denchar, same for MaxY and MaxZ
# this is needed to generate wavefunctions on periodic grid, not on general grid
#
sh ./script_3
#
# run siesta2bgw wrapper (directory 3)
# for siesta-2, set wfng_gamma_real = .true. in ./3-siesta/siesta2bgw.inp
# for siesta-3, set wfng_gamma_real = .false. in ./3-siesta/siesta2bgw.inp
# this controls the naming convention of siesta wavefunction files
#
Submit script_4. Suggested ncpu = 144, walltime = 0:15:00
#
# compute inverse dielectric matrix, calculate quasiparticle energies
# run Sigma twice to compute self-energy at quasiparticle energy (this should be done iteratively until convergence)
# include states up to 6.0 Ry + ./1-scf/velec_avg_face.out = 82.05637958 eV
# for PW, there are 2699 states
#
Submit script_6. Suggested ncpu = 256, walltime = 0:30:00
#
