# IT4Innovations
# LK 2021

name = 'GROMACS'
version = '2021.4'
local_plum_ver = '2.7.3'
versionsuffix = '-PLUMED-%s' % local_plum_ver

homepage = 'https://www.gromacs.org'
description = """
GROMACS is a versatile package to perform molecular dynamics, i.e. simulate the
Newtonian equations of motion for systems with hundreds to millions of
particles.

This is a GPU enabled build, containing both MPI and threadMPI builds.

It also contains the gmxapi extension for the single precision MPI build.
"""

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

source_urls = [
    'https://ftp.gromacs.org/pub/gromacs/',
    'ftp://ftp.gromacs.org/pub/gromacs/',
]
sources = [SOURCELOWER_TAR_GZ]

patches = [
    'GROMACS-2019_fix_omp_num_threads_and_google_test_death_style_in_tests.patch',
    'GROMACS-2019_increase_test_timeout_for_GPU.patch',
    'GROMACS-2021_fix_gmxapi_gmx_allowed_cmd_name.patch',
    'GROMACS-2020.5_fix_threads_gpu_Gmxapitests.patch',
]

checksums = [
    'cb708a3e3e83abef5ba475fdb62ef8d42ce8868d68f52dafdb6702dc9742ba1d',
    '406f5edd204be812f095a6f07ebc2673c5f6ddf1b1c1428fd336a80b9c629275',
    '0d16f53d428155197a0ed0b0974ce03422f199d7c463c4a9156a3b99e3c86234',
    'b7ffb292ec362e033db1bedd340353f0644dbaae872127750f3dda1ac7e87d49',
    '89fbb7e2754de45573632c74f53563bb979df9758c949238a35865391d6b53fb',
]


builddependencies = [
    ('CMake', '3.18.4'),
    ('scikit-build', '0.11.1'),
]

dependencies = [
    ('Python', '3.8.6'),
#    ('SciPy-bundle', '2020.11'),
    ('networkx', '2.5'),
    ('PLUMED', local_plum_ver),
]

exts_defaultclass = 'PythonPackage'

exts_default_options = {
    'source_urls': [PYPI_SOURCE],
    'use_pip': True,
    'download_dep_fail': True,
    'sanity_pip_check': True,
}

exts_list = [
    ('gmxapi', '0.2.0', {
        'preinstallopts': "export GMXTOOLCHAINDIR=%(installdir)s/share/cmake/gromacs_mpi && ",
        'checksums': ['3954bf123da12fc60bcfaeed8263f5e2d3e16e5136c2bb5c8207b20fa7406788'],
    }),
]

modextrapaths = {
    'PYTHONPATH': 'lib/python%(pyshortver)s/site-packages',
}

moduleclass = 'bio'
