# IT4Innovations 
# LK 2021

name = 'Libint'
version = '2.6.0'
local_lmax = 6
# custom configuration, to be used as dependency for CP2K
versionsuffix = '-lmax-%s-cp2k' % local_lmax

homepage = 'https://github.com/evaleev/libint'
description = """Libint library is used to evaluate the traditional (electron repulsion) and certain novel two-body
 matrix elements (integrals) over Cartesian Gaussian functions used in modern atomic and molecular theory."""

toolchain = {'name': 'GCC', 'version': '10.2.0'}
toolchainopts = {'pic': True, 'cstd': 'c++11'}

source_urls = ['https://github.com/evaleev/libint/archive']
sources = ['v%(version)s.tar.gz']
patches = [
    'Libint-%(version)s_fix-LIBINT2-MAX-AM-default1.patch',
    'Libint-2.6.0_remove-test-eri.patch',
]
checksums = [
    '4ae47e8f0b5632c3d2a956469a7920896708e9f0e396ec10071b8181e4c8d9fa',  # v2.6.0.tar.gz
    # Libint-2.6.0_fix-LIBINT2-MAX-AM-default1.patch
    'e5445c89639d113be7726c2bc1164d2f6ea75e76abbb1c94acd55c508693d5ab',
    # Libint-2.6.0_remove-test-eri.patch
    'e47868901250078adeb35b80ab866ba8063ad9756881d1b557cb925334df653b',
]

builddependencies = [
    ('Autotools', '20200321'),
    ('GMP', '6.2.0'),
    ('Boost', '1.74.0'),
    ('Eigen', '3.3.8'),
    ('Python', '3.8.6'),
]

# configure options as required by CP2K,
# see Jenkinsfile in https://github.com/cp2k/libint-cp2k
local_eri_max_am = '%s,%s' % (local_lmax, local_lmax - 1)
local_eri23_max_am = '%s,%s' % (local_lmax + 2, local_lmax + 1)

libint_compiler_configopts = '--enable-eri=1 --enable-eri2=1 --enable-eri3=1 --with-max-am=%s ' % local_lmax
libint_compiler_configopts += '--with-eri-max-am=%s ' % local_eri_max_am
libint_compiler_configopts += '--with-eri2-max-am=%s ' % local_eri23_max_am
libint_compiler_configopts += '--with-eri3-max-am=%s ' % local_eri23_max_am
libint_compiler_configopts += '--enable-generic-code --disable-unrolling'

with_fortran = True

moduleclass = 'chem'
