# IT4Innovations
# LK 2023

easyblock = 'CMakeMake'

name = 'OpenMM'
version = '7.5.0'

homepage = 'https://openmm.org'
description = "OpenMM is a toolkit for molecular simulation."

toolchain = {'name': 'fosscuda', 'version': '2020b'}
toolchainopts = {'opt': True}

source_urls = ['https://github.com/openmm/openmm/archive/']
sources = ['%(version)s.tar.gz']
patches = ['%(name)s-%(version)s_fix_path_to_nvcc.patch']
checksums = [
    '516748b4f1ae936c4d70cc6401174fc9384244c65cd3aef27bc2c53eac6d6de5',  # 7.5.0.tar.gz
    '050d5b81e70b34d06ef87eafc6d540b2cf716a61f53b1d2a3786504da3ec2e3c',  # OpenMM-7.5.0_fix_path_to_nvcc.patch
]

builddependencies = [
    ('CMake', '3.18.4'),
    ('Doxygen', '1.8.20'),
]

separate_build_dir = True

dependencies = [
    ('Python', '3.8.6'),
    ('SciPy-bundle', '2020.11'),
    ('SWIG', '4.0.2'),
]

# Flags for CUDA-enabled build
configopts = "-DOPENMM_BUILD_CUDA_LIB=ON"

pretestopts = "export OPENMM_CUDA_COMPILER=nvcc && CTEST_OUTPUT_ON_FAILURE=1"
local_ignore_pattern = "(Integrator)|(Thermostat)|(Barostat)|(Rpmd)|(Amoeba)"
runtest = """test -e ARGS="-E \'%s\'" """ % local_ignore_pattern

preinstallopts = ' export OPENMM_INCLUDE_PATH=%(installdir)s/include && '
preinstallopts += ' export OPENMM_LIB_PATH=%(installdir)s/lib && '

# required to install the python API
#installopts = ' && cd python && python setup.py build && python setup.py install --prefix=%(installdir)s'

#sanity_check_paths = {
#    'files': ['lib/libOpenMM.%s' % SHLIB_EXT, 'lib/python%(pyshortver)s/site-packages/simtk/openmm/openmm.py'],
#    'dirs': []
#}

#sanity_check_commands = ["python -m simtk.testInstallation"]

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

moduleclass = 'bio'
