# IT4Innovations
# LK 2024

easyblock = 'MakeCp'

name = 'Wannier90'
version = '3.1.0'
versionsuffix = '-serial'

homepage = 'http://www.wannier.org'
description = """A tool for obtaining maximally-localised Wannier functions"""

toolchain = {'name': 'intel', 'version': '2024a'}
toolchainopts = {'usempi': True}

github_account = 'wannier-developers'
source_urls = [GITHUB_LOWER_SOURCE]
sources = [{'download_filename': 'v%(version)s.tar.gz', 'filename': SOURCELOWER_TAR_GZ}]
patches = ['Wannier90_3x_ignore_makeinc.patch']
checksums = [
    '40651a9832eb93dec20a8360dd535262c261c34e13c41b6755fa6915c936b254',  # wannier90-3.1.0.tar.gz
    '561c0d296e0e30b8bb303702cd6e41ded54c153d9b9e6cd9cab73858e5e2945e',  # Wannier90_3x_ignore_makeinc.patch
]

buildopts = 'all F90=$F90 MPIF90=$MPIF90 FCOPTS="$FFLAGS" LDOPTS="$FFLAGS" '
buildopts += 'LIBDIR="$LAPACK_LIB_DIR" LIBS="$LIBLAPACK" '

# compile serial version for use with VASP per
# https://www.vasp.at/wiki/index.php/Makefile.include#Wannier90_.28optional.29
#buildopts += 'COMMS=mpi'

files_to_copy = [(['wannier90.x', 'postw90.x'], 'bin'), (['libwannier.a'], 'lib')]

sanity_check_paths = {
    'files': ['bin/wannier90.x', 'bin/postw90.x', 'lib/libwannier.a'],
    'dirs': []
}

moduleclass = 'chem'
