# IT4Innovations
# LK 2023

name = 'WIEN2k'
version = '23.2'

homepage = 'http://www.wien2k.at/'
description = """The program package WIEN2k allows to perform electronic structure calculations of solids
using density functional theory (DFT). It is based on the full-potential (linearized) augmented plane-wave
((L)APW) + local orbitals (lo) method, one among the most accurate schemes for band structure calculations.
WIEN2k is an all-electron scheme including relativistic effects and has many features."""

toolchain = {'name': 'intel', 'version': '2022a'}
import os
if os.environ.get("CLUSTERNAME") in ["KAROLINA"]:
    toolchainopts = {'usempi': True, 'optarch': 'march=core-avx2', 'pic': True}
else:
    toolchainopts = {'usempi': True, 'pic': True}

sources = ['%(name)s_%(version)s.tar']
patches = [
    'WIEN2k-21.1_fix_libxc_for_lapw0_mpi.patch',
#   'WIEN2k-21.1_fix_system_stderr_redirection.patch',
]
checksums = [
    {'WIEN2k_23.2.tar': '8ae0dda4b6d960c37f359b3d4198dd3953058efe2eae94083e91ddd619392cce'},
    {'WIEN2k-21.1_fix_libxc_for_lapw0_mpi.patch': '1cc480a4824d9185ad5918dfc68c47bcb7826114626c8133d573be901bbdca84'},
    {'WIEN2k-21.1_fix_system_stderr_redirection.patch': 'cdba467b0b6f2b310c2e1e2a3e6cabe75f8fd15ee0f7c14f8ef80c7e48073bdd'},
]

dependencies = [
    ('Python', '3.10.4'),
    ('Perl', '5.34.1'),
    ('DFT-D3', '3.2.0'),
    ('ELPA', '2021.11.001'),
    ('FFTW', '3.3.10'),
    ('libxc', '5.2.3'),
]

osdependencies = [('glibc-devel', 'libc6-dev')]  # required for libpthread.a

# remote = 'pbsssh'
# If using a Slurm batch system it is highly recommended to use
# 'srun -n_NP_ _EXEC_' for wien_mpirun
wien_mpirun = 'mpirun  -np _NP_ _EXEC_'
use_remote = False
mpi_remote = False
wien_granularity = True
taskset = 'no'

# Change as needed, these are the defaults
# nmatmax = 19000
# nume = 6000

fix_perl_shebang_for = [
    'iniel_pressure_in2reader.pl_lapw',
    'iniel_pressure_reader.pl_lapw',
    'setrmt_lapw',
    'elast_setup_input.pl_lapw',
    'bashtime2csh.pl_lapw',
]

moduleclass = 'chem'
