# Copyright (C) 2016-2018 Quantum ESPRESSO
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License. See the file `License' in the root directory
# of the present distribution.

TEST-SUITE  v6.4
------------------

Type 'make' for the list of possible options. Currently only PW, CP, PH, EPW
are supported.

'make compare' compare the latest run of tests (SERIAL or PARALLEl) and 
redirect the output to a file called "out.XXX.`date +%Y%m%d_%H%M%S`" 
'XXX' is replaced by the name of the package ('PW', 'CP', 'EPW')

Clean all test files and leave only benchmark reference via 'make clean'
command



REFERENCE OUTPUTS
-----------------

Most reference outputs have been computed using GCC 4.8.5 with the following
"configure" options:

./configure --enable-openmp --disable-parallel --with-netlib

DFLAGS         = -D__OPENMP -D__GFORTRAN -D__STD_F95 -D__FFTW
CFLAGS         = -O3 $(DFLAGS) $(IFLAGS)
F90FLAGS       = $(FFLAGS) -x f95-cpp-input -fopenmp
FFLAGS         = -O3 -g -fopenmp
FFLAGS_NOOPT   = -O0 -g
LD             = gfortran
LDFLAGS        = -g -pthread -fopenmp


During execution:

OMP_NUM_THREADS = 4

#################################################################################################
# TEST DESCRIPTIONS and what is tested.
#################################################################################################

#################################################################################################
# PWSCF tests
#################################################################################################
######################
# pw_atom : O and Ni #
######################
The following features of the code are tested:
- occupancies from input, also with spin polarization
- PBE and spin-polarized PBE
- PBE and s-PBE stress
- atomic occupations: Ni d8s2 and d9s1

#####################
# pw_berry : PbTiO3 #
#####################
The following features of the code are tested:
- scf: Q function in real space (tqr=.true.)
- nscf: Berry phase calculation (with and without empty bands)

##################
# pw_b3lyp-O : O #
##################
The following features of the code are tested:
- B3LYP hybrid functional (spin polarized), Gamma

##################
# pw_b3lyp-h2o : H2O #
##################
The following features of the code are tested:
- structural optimization with B3LYP, unpolarized, Gamma

##################################
# pw_cluster : N and NH4 and H2O #
##################################
The following features of the code are tested:
- Martyna-Tuckermann method for isolated systems
- Makov-Payne correction for isolated systems

###############
# pw_dft : Si #
###############
The following features of the code are tested:
- Various flavours of XC (GGA, no hybrid-meta-nonlocal XC)

#########################
# pw_dipole : CO and Ni #
#########################
The following features of the code are tested:
- dipole field correction

#####################
# pw_electric : Si  #
#####################
The following features of the code are tested:
- finite electric field using Berry's phase approach

#######################
# pw_eval_infix : Si  #
#######################
The following features of the code are tested:
- parser

###################
# pw_gau-pbe : Si #
###################
The following features of the code are tested:
-GAU-PBE functional

###############
# pw_hse : Si #
###############
The following features of the code are tested:
- HSE hybrid functional, nq=1
- HSE hybrid functional, nq=2
- HSE hybrid functional, nq=4

####################
# pw_langevin : H2 #
####################
The following features of the code are tested:
- Langevin dynamics, Smart Monte Carlo algorithm

###################
# pw_lattice : H2 #
###################
The following features of the code are tested:
- all bravais lattices, CELL_PARAMETERS, a b c parameters
- Gamma and automatic k-points

##################
# pw_lda+U : FeO #
##################
The following features of the code are tested:
- LDA+U with standard and user-defined occupancies
- forces and stresses, gamma-only case
- lda_plus_u_kind=1, collinear and noncollinear

####################
# pw_lsda : Ni fcc #
####################
The following features of the code are tested:
- LSDA with starting magnetization and free occupancies
- core corrections
- davidson and cg diagonalizations
- simple, TF, local-TF mixing, ndim=4,8
- constrained occupancies: tot_magnetization, nelup+neldw
- LSDA stress
- non-scf calculation

###############
# pw_md : Si  #
###############
The following features of the code are tested:
- verlet algorithm
- potential extrapolation
- wavefunction extrapolation

#####################
# pw_metaGGA : C4H6 #
#####################
The following features of the code are tested:
- meta-GGA

#####################
# pw_metal : Al fcc #
#####################
The following features of the code are tested:
- occupancies: all smearing schemes, tetrahedra
- stress in metals
- non-scf calculation with smearing and tetrahedra

########################
# pw_noncolin : Fe bcc #
########################
The following features of the code are tested:
- noncollinear magnetization
- davidson and cg diagonalizations
- constraints: atomic, atomic direction, total magnetization
- noncollinear stress
- non-scf calculation, tetrahedra
- hybrid functionals (norm-conserving)

##########################
# pw_paw-atom : O and Cu #
##########################
The following features of the code are tested:
- PAW

#####################
# pw_paw-bfgs : H2O #
#####################
The following features of the code are tested:
- PAW with bfgs

#######################
# pw_paw-vcbfgs : H2O #
#######################
The following features of the code are tested:
- PAW with variable-cell bfgs

##################
# pw_pbeq2d : Cu #
##################
The following features of the code are tested:
- Modified PBE functional PBEQ2D

###############
# pw_pbe : Si #
###############
The following features of the code are tested:
- BE0 hybrid functional, nq=1
- BE0 hybrid functional, nq=2
- BE0 hybrid functional, nq=4

#########################
# pw_plugin-pw2casino : #
#########################
The following features of the code are tested:
- interface with CASINO

#################
# pw_relax : CO #
#################
The following features of the code are tested:
- forces
- bfgs and damped dynamics
- energies, forces, bfgs with saw-like electric field
- bfgs with external forces

##################
# pw_relax2 : Al #
##################
The following features of the code are tested:
- forces in metals
- bfgs_ndim=3

###################
# pw_scf : Si fcc #
###################
The following features of the code are tested:
- davidson and cg diagonalizations
- simple, TF, local-TF mixing, ndim=4,8
- Gamma, automatic, list of k-points (tpiba, crystal, tpiba_b)
- disk_io, force_symmorphic, use_all_frac options
- stress with k-points and at Gamma
- non-scf calculation
- old "ncpp" format for pseudopotentials

#########################
# pw_spinorbit : Pt fcc #
#########################
The following features of the code are tested:
- spin-orbit + noncollinear magnetization
- spin-orbit stress
- non-scf calculation, tetrahedra

#######################################
# pw_uspp : Cu fcc and H2O and Ni fcc #
#######################################
The following features of the code are tested:
- US PP, both single and double grid
- davidson and cg diagonalizations
- simple, TF, local-TF mixing, ndim=4,8
- stress with single and double grid
- non-scf calculation
- hybrid functionals (pbe0/hse, gamma/k, real/G-space)
- old Vanderbilt format for pseudopotentials
- Fake coulombian (1/r) pseudopotential
- core corrections
- stress with core corrections
- non-scf calculation

####################
# pw_vc-relax : As #
####################
The following features of the code are tested:
- Variable-cell optimization (both damped dynamics and bfgs) at zero pressure and under an external pressure

#################
# pw_vc-md : As #
#################
The following features of the code are tested:
- Variable-cell dynamics (Wentzcovitch dynamics) at zero pressure and under an external pressure

##############
# pw_vdw : C #
##############
The following features of the code are tested:
- Dispersion (van der Waals) interactions with DFT-D2 and DFT-D3 (Grimme)
- As above, with vdW-DF[1-4] (nonlocal) functionals
- As above, with vdW-DF-C09  (nonlocal) functionals
- As above, Tkatchenko-Scheffler
- XDM dispersion correction.


#################################################################################################
# PH tests
#################################################################################################
#######################
# ph_base : Si, C, Ni #
#######################
The following features of the code are tested:
- Calculation of phonon frequencies for insulators and metals, using USPP and PAW

#################
# ph_metal : Al #
#################
The following features of the code are tested:
- Calculation of phonon frequencies, phonon DOS, el-ph for a nonmagnetic metals, using NCPP

######################
# ph_U_metal_us : Fe #
######################
The following features of the code are tested:
- Calculation of phonon frequencies for a ferromagnetic metal, with Hubbard U, using USPP

##########################
# ph_U_insulator_us : BN #
##########################
The following features of the code are tested:
- Calculation of phonon frequencies for a nonmagnetic insulator, with frac. translations, 
  with Hubbard U, using USPP

#######################
# ph_U_metal_paw : Ni #
#######################
The following features of the code are tested:
- Calculation of phonon frequencies for a ferromagnetic metal, with Hubbard U, using PAW

###########################
# ph_U_insulator_paw : BN #
###########################
The following features of the code are tested:
- Calculation of phonon frequencies for a nonmagnetic insulator, with frac. translations, 
  with Hubbard U, using PAW

#################################################################################################
# HP tests
#################################################################################################
############################
# hp_insulator_us : LiCoO2 #
############################
The following features of the code are tested:
- Calculation of U for a nonmagnetic insulator, with USPP

#######################################
# hp_insulator_us_intersiteV : LiCoO2 #
#######################################
The following features of the code are tested:
- Calculation of U and V for a nonmagnetic insulator, with USPP

##############################
# hp_insulator_us_magn : NiO #
##############################
The following features of the code are tested:
- Calculation of U for an antiferromagnetic insulator, with USPP

##########################
# hp_insulator_paw : BN #
##########################
The following features of the code are tested:
- Calculation of U for a 2D nonmagnetic insulator, with PAW, with fractional translations

################################
# hp_insulator_paw_magn : CrI3 #
###############################
The following features of the code are tested:
- Calculation of U for a 2D ferromagnetic insulator, with PAW

#########################
# hp_metal_us_magn : Ni #
#########################
The following features of the code are tested:
- Calculation of U for a ferromagnetic metal, with USPP

##########################
# hp_metal_paw_magn : Fe #
##########################
The following features of the code are tested:
- Calculation of U for a ferromagnetic metal, with PAW

#########################################
# hp_metal_paw_magn_intersiteV : LiNiO2 #
#########################################
The following features of the code are tested:
- Calculation of U and V for a ferromagnetic metal (it is a metal even
at the DFT+U+V level for the rhombohedral structure), with PAW

#################################################################################################
# EPW tests
#################################################################################################
#############################
# epw_base: B-doped diamond # 
#############################
The following features of the code are tested:
- Correct unfolding from IBZ to full BZ
- Correct Wannier interpolation
- Phonon & electron self-energy
- Eliashberg a2F
- Homogeneous fine k and q-grid integration
- Test nesting function
- Test spectral function
- Test parallel_k (epw1.in)
- Test parallel_q (epw2.in)
- Test restart feature epwread = .true. (epw2.in)
- Test band_plot (epw3.in)
- Test iverbosity = 1 (epw4.in)
- Test phonon spectral function (epw5.in)
- Test band parallelism, etf_mem 2 (epw6.in)
- Test restart feature (epw7.in)
- Test cumulant (epw8.in)
- Test Wannier function plot (epw11.in)

#################
# epw_metal: Pb #
#################
The following features of the code are tested:
- Test metals (epw.in)
- Test crystal ASR (epw2.in)

###############
# epw_mob: Si #
###############
The following features of the code are tested:
- Test crystal ASR and etf_mem 1 (epw1.in)
- Test scattering rates and mobility (epw2.in)
- Test restart option, same input as epw2.in (epw3.in)
- Test indirect absortpion (epw4.in)

####################
# epw_mob_ibte: Si #
####################
The following features of the code are tested:
- Test the iterative BTE without using k-point symmetry (epw2.in)
- Test scissor (epw2.in)
- Test multiple temperature (epw2.in)
- Test 2 Fermi level (VBM and CBM) calculation (epw2.in)
- Test restart feature of IBTE, same input as previous (epw3.in)
- Test the iterative BTE without k-point symmetry (epw4.in)

Note 1: scf.in, nscf.in, ph.in and epw1.in are given but not tested (too long)
Note 2: epw2.in and epw3.in should give the same results but 
slightly differs because of convergence and symmetries being not exact
(two k-points related by symmetry do not yield exactly the same results). 

##############
# epw_pl: Si #
##############
The following features of the code are tested:
- Test plasmon spectral functions (epw1.in)

##################
# epw_polar: SiC #
##################
The following features of the code are tested:
- Test the polar Wannier interpolation (epw1.in)
- Test band parallelism with polar (epw2.in)
- Test screening (epw3.in)

###############
# epw_soc: Pb #
###############
The following features of the code are tested:
- Test SOC (epw.in)
- Test crystal ASR with SOC (epw2.in)

###################
# epw_super: MgB2 #
###################
The following features of the code are tested:
- Test isotropic Eliashberg superconductivity (epw1.in)
- Test anisotropic Eliashberg superconductivity (epw2.in)
- Test anisotropic Eliashberg superconductivity restart from interrupted q-point while writing ephmat using 'restart.fmt' (epw3.in)
- Test anisotropic Eliashberg superconductivity restart by reading ephmat files (after writing ephmat files) (epw4.in)

#################
# epw_trev: SiC #
#################
The following features of the code are tested:
- Time-reversal symmetry when inversion sym. is not part of the small group of q. (epw.in)

######################
# epw_trev_uspp: SiC #
######################
The following features of the code are tested:
- Time-reversal symmetry when inversion sym. is not part of the small group of q 
  in calculation using ultrasoft pseudopotentials. (epw.in)

#####################
# epw_trev_paw: SiC #
#####################
The following features of the code are tested:
- Time-reversal symmetry when inversion sym. is not part of the small group of q
  in calculation using PAW datasets. (epw.in)

####################
# not_epw_comp: Si #
####################
This test is to compare electron-phonon matrix element produced directly by the phonon code 
and by EPW. It requires modification to the phonon code. 
Note that this folder is NOT tested in the test-suite but is here as it can be useful. 











