# IT4Innovations 2022
# JK

easyblock = 'ConfigureMake'

name = 'BAGEL'
version = '1.2.2'

homepage = "http://www.nubakery.org"
description = """BAGEL (Brilliantly Advanced General Electronic-structure Library)
is a parallel electronic-structure program."""

toolchain = {'name': 'intel', 'version': '2021b'}
toolchainopts = {'usempi': True, 'optarch': 'march=core-avx2', 'opt': '03'}

# clone github repo and create an archive manually, do not use release
#source_urls = ['https://github.com/qsimulate-open/bagel/archive/refs/tags/']
sources = ['v%(version)s.tar.gz']
checksums = ['9f1ebcce6d8565446ab7bd4724e5ad8e0f74e9b4c8382f45ff3225860a1ec5b9']

builddependencies = [
    ('Autotools', '20210726'),
]

dependencies = [
    ('Boost', '1.77.0'),
    ('libxc', '5.1.6'),
]

# Hack, because bagel-v1.1.1 uses outdated filenames:
preconfigopts = 'sed -i "s|-gcc-mt||g" configure.ac && '
preconfigopts += './autogen.sh && '
preconfigopts += 'I_MPI_ICC=mpiicc MPICC=mpiicc I_MPI_CXX=mpigcc MPICXX=mpigcc CXXFLAGS="$CXXFLAGS -DNDEBUG -std=c++98 -lstdc++" '
configopts = ' --with-boost=$BOOST_ROOT --with-mpi=intel --enable-mkl --with-libxc '

sanity_check_paths = {
    'files': ['bin/BAGEL', 'lib/libbagel.%s' % SHLIB_EXT],
    'dirs': []
}

moduleclass = 'phys'
