easyblock = 'PythonPackage'

name = 'horton'
version = '2.0.0'

homepage = 'http://theochem.github.io/horton'
description = """HORTON is a Helpful Open-source Research TOol for N-fermion systems, written
 primarily in the Python programming language. (HORTON is named after the helpful
 pachyderm, not the Canadian caffeine supply store.) The ultimate goal of HORTON
 is to provide a platform for testing new ideas on the quantum many-body problem
 at a reasonable computational cost. Although HORTON is primarily designed to be
 a quantum-chemistry program, it can perform computations involving model
 Hamiltonians, and could be extended for computations in nuclear physics."""

toolchain = {'name': 'intel', 'version': '2015b'}

source_urls = ['https://github.com/theochem/horton/releases/download/%s' % version]
sources = [SOURCE_TAR_GZ]

pyver = '2.7.10'
hdf5ver = '1.8.15-patch1'
versionsuffix = '-Python-%s-HDF5-%s-serial' % (pyver, hdf5ver)

dependencies = [
    ('Python', pyver),
    ('h5py', '2.5.0', versionsuffix),
    ('matplotlib', '1.4.3', '-Python-%s' % pyver),
    ('sympy', '0.7.6.1', '-Python-%s' % pyver),
    ('Libint', '2.0.3'),
    ('libxc', '2.2.2'),
]

prebuildopts = ' '.join([
    'BLAS_EXTRA_COMPILE_ARGS=-DMKL_ILP64:-I${MKLROOT}/include',
    'BLAS_LIBRARY_DIRS=${MKLROOT}/lib/intel64',
    'BLAS_LIBRARIES=mkl_intel_ilp64:mkl_core:mkl_sequential:pthread:m:mkl_def',
])

# Avoid need for X11 in tests by specifying "backend: agg" in matplotlibrc
runtest = ' '.join([
    'export MATPLOTLIBRC=$PWD;',
    'echo "backend: agg" > $MATPLOTLIBRC/matplotlibrc;',
    '%s python setup.py build_ext -i; ' % prebuildopts,
    'nosetests -v',
])

pyshortver = '.'.join(pyver.split('.')[:2])
sanity_check_paths = {
    'files': [],
    'dirs': ['lib/python%s/site-packages/horton' % pyshortver],
}

moduleclass = 'chem'
