# IT4Innovations
# LK 2023

name = 'GROMACS'
version = '2023'
local_plum_ver = '2.9.0'
versionsuffix = '-CUDA-12.2.0-PLUMED-2.9.0-mpi'

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 binaries.

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

toolchain = {'name': 'foss', 'version': '2022a'}
toolchainopts = {'openmp': True, 'usempi': True}

source_urls = [
    'https://ftp.gromacs.org/pub/gromacs/',
    'ftp://ftp.gromacs.org/pub/gromacs/',
]
sources = [SOURCELOWER_TAR_GZ]
patches = [
    'GROMACS-2023.1_set_omp_num_threads_env_for_ntomp_tests.patch',
    'GROMACS-2023.1_fix_tests_for_gmx_thread_mpi.patch',
]
checksums = [
    {'gromacs-2023.tar.gz': 'ac92c6da72fbbcca414fd8a8d979e56ecf17c4c1cdabed2da5cfb4e7277b7ba8'},
    {'GROMACS-2023.1_set_omp_num_threads_env_for_ntomp_tests.patch': '7f41bda16c9c2837624265dda4be252f655d1288ddc4486b1a2422af30d5d199'},
    {'GROMACS-2023.1_fix_tests_for_gmx_thread_mpi.patch': '6df844bb3bbc51180446a3595c61a4ef195e5f975533a04cef76841aa763aec1'},
]

builddependencies = [
    ('CMake', '3.24.3'),
    ('scikit-build', '0.15.0'),
]

dependencies = [
    ('CUDA', '12.0.0', '', SYSTEM),
    ('UCX-CUDA', '1.12.1', '-CUDA-%(cudaver)s'),
    ('Python', '3.10.4'),
    ('SciPy-bundle', '2022.05'),
    ('networkx', '2.8.4'),
    ('PLUMED', local_plum_ver, '-mpi'),
]

configopts = '-DGMX_MPI=ON'

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.4.2', {
        'preinstallopts': 'export CMAKE_ARGS="-Dgmxapi_ROOT=%(installdir)s ' +
                          '-C %(installdir)s/share/cmake/gromacs_mpi/gromacs-hints_mpi.cmake" && ',
        'source_tmpl': 'gromacs-2023.3.tar.gz',
        'start_dir': 'python_packaging/gmxapi',
        'checksums': ['4ec8f8d0c7af76b13f8fd16db8e2c120e749de439ae9554d9f653f812d78d1cb'],
    }),
]

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

moduleclass = 'bio'
