# IT4Innovations
# LK 2024

easyblock = 'MesonNinja'

name = 'DFT-D4'
version = '3.6.0'
versionsuffix = '-Python-%(pyver)s'

homepage = 'https://www.chemie.uni-bonn.de/pctc/mulliken-center/software/dftd4'
description = """Generally Applicable Atomic-Charge Dependent London Dispersion Correction."""

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

source_urls = ['https://github.com/dftd4/dftd4/archive/refs/tags/']
sources = ['v%(version)s.tar.gz']
patches = ['DFT-D4-3.2.0-remove_module_id.patch']
checksums = [
    '0e3e8d5f9e9e5414b9979967c074c953706053832e551d922c27599e7324bace',  # v3.6.0.tar.gz
    '8c3c81338cb57972580e4cf3db307aa2e44b8b3f6d1ba7ae24fa9d807490a93b',  # DFT-D4-3.2.0-remove_module_id.patch
]

builddependencies = [
    ('Ninja', '1.11.1'),
    ('Meson', '1.2.3'),
    ('CMake', '3.27.6'),
]

dependencies = [
    ('Python', '3.11.5'),
    ('cffi', '1.15.1'),
]

configopts = '-Dpython=true -Dfortran_link_args=-qopenmp -Dapi_v2=true'

sanity_check_paths = {
    'files': ['bin/dftd4', 'lib/libdftd4.a', 'lib/libdftd4.%s' % SHLIB_EXT, 'include/dftd4.mod'],
    'dirs': [],
}

sanity_check_commands = ["dftd4 --version"]

moduleclass = 'chem'
