# IT4Innovations 2022
# JK

easyblock = 'MakeCp'

name = 'DL_MG'
version = '3.0.0'

homepage = 'https://bitbucket.org/dlmgteam/dl_mg_code_public/src/master/'
description = """DL_MG is a parallel (MPI+OpenMP) 3D geometric high order finite difference multigrid solver for Poisson and Poisson-Boltzmann Equations written in Fortran."""

toolchain = {'name': 'intel', 'version': '2021b'}
toolchainopts = {'usempi': True, 'openmp': False}

sources = ['dlmg-v%(version)s.tar.gz']
patches = ['DL_MG-3.0.0-intel-2021b-disable-openmp.patch']
checksums = [
    '5f70339c35e5dfd4b25935570b95798391c6aceef23ccfe68cc2b1a2406c409d',  # dlmg-v3.0.0.tar.gz
    '2a26acffb55095936147a8ef5db2105d691d257a86106e5459913403eb0c7380',  # DL_MG-3.0.0-intel-2021b-disable-openmp.patch
]

# have to disable openmp for VASP to link against DL_MG library
buildopts = ' PLATFORM=RH65_workstation_intel16_intelmpi USE_MPI=yes '

files_to_copy = ''

postinstallcmds = [
    ' mkdir %(installdir)s/lib ',
    ' cp %(builddir)s/dlmg-v%(version)s/lib/* %(installdir)s/lib '
]

sanity_check_paths = {
    'files': ['lib/libdlmg.a', 'lib/dl_mg.mod'],
    'dirs': ['lib']
}

moduleclass = 'phys'
