# IT4Innovations
# LK 2021

easyblock = 'ConfigureMake'

name = 'PLUMED'
version = '2.7.2'

homepage = 'https://www.plumed.org'
description = """PLUMED is an open source library for free energy calculations in molecular systems which
 works together with some of the most popular molecular dynamics engines. Free energy calculations can be
 performed as a function of many order parameters with a particular  focus on biological problems, using
 state of the art methods such as metadynamics, umbrella sampling and Jarzynski-equation based steered MD.
 The software, written in C++, can be easily interfaced with both fortran and C/C++ codes.
"""

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

source_urls = ['https://github.com/plumed/plumed2/releases/download/v%(version)s/']
sources = [SOURCE_TGZ]
checksums = ['6069bc134f74cb15dd63e27e3587a15a31a9ddd9e7eebdd717da898f31512645']

dependencies = [
    ('zlib', '1.2.11'),
    ('GSL', '2.6'),
    ('Python', '3.8.6'),
    ('SciPy-bundle', '2020.11'),
    ('Boost', '1.74.0'),
]

preconfigopts = 'env FC=$MPIF90 LIBS="$LIBLAPACK $LIBS" '
configopts = '--exec-prefix=%(installdir)s --enable-gsl --enable-modules=all --enable-python '
configopts += '--enable-boost_graph --enable-boost_serialization '
configopts += '--enable-asmjit '
prebuildopts = 'source sourceme.sh && '

# make sure that ld.gold linker is used
# required to work around problems like "ld: BFD (GNU Binutils) 2.30 assertion fail elf.c:3564"
# (problem with intel build but maintain consistency between easyconfigs)
buildopts = 'LD_RO="ld.gold -r -o"'

# install path for PLUMED libraries must be included in $LD_LIBRARY_PATH when Python bindings get built/installed
preinstallopts = 'LD_LIBRARY_PATH="%(installdir)s/lib:$LD_LIBRARY_PATH" '

sanity_check_paths = {
    'files': ['bin/plumed', 'lib/libplumedKernel.%s' % SHLIB_EXT, 'lib/libplumed.%s' % SHLIB_EXT],
    'dirs': [],
}

sanity_check_commands = ["python -c 'import plumed'"]

modextrapaths = {
    'PLUMED_KERNEL': 'lib/libplumedKernel.%s' % SHLIB_EXT,
    'PLUMED_ROOT': 'lib/plumed',
    'PYTHONPATH': 'lib/plumed/python',
}

moduleclass = 'chem'
