# JH 2020

easyblock = 'EB_PSI'

name = 'PSI4'
version = '1.3.2'
versionsuffix = '-Python-%(pyver)s'

homepage = 'http://www.psicode.org/'
description = """PSI4 is an open-source suite of ab initio quantum chemistry programs designed for
 efficient, high-accuracy simulations of a variety of molecular properties. We can routinely perform
 local_computations with more than 2500 basis functions running serially or in parallel."""

toolchain = {'name': 'intel', 'version': '2020a'}
toolchainopts = {'usempi': True}

source_urls = ['https://github.com/psi4/psi4/archive']
sources = ['v%(version)s.tar.gz']
patches = ['PSI4-1.3.2_fix_cmake_release.patch']

dependencies = [
    ('Python', '3.8.2'),
    ('SciPy-bundle', '2020.03', versionsuffix),
    #  PCMSolver recent versions fail with recent intel local_compilers.
    #  Tried with intel/201{7,8}b, and versions 1.1.12, and 1.2.1
    #  See in more details: https://github.com/PCMSolver/pcmsolver/issues/159
    #  ('PCMSolver', '1.2.1'),
    ('CheMPS2', '1.8.9'),
    ('HDF5', '1.10.6', '', ('iimpi', '2020a')),
    #  Tests are failing with pytest 3.9.2
    ('pytest', '6.0.1', versionsuffix),
    ('networkx', '2.4', versionsuffix),
    ('deepdiff', '4.0.6', versionsuffix),
]

builddependencies = [
    ('CMake', '3.16.4'),
    # Perl needed for the ctest test suite during the installation, not for the pytest test suite after the installation
    # ('Perl', '5.28.0'),
]

configopts = '-DENABLE_MPI=ON -DENABLE_PLUGINS=ON -DENABLE_XHOST=OFF '
#  Install python mudule to the standard location instead of lib
configopts += '-DPYMOD_INSTALL_LIBDIR=/python3.7/site-packages '
#  Add bundled (downloaded) packages
# -DENABLE_simint=ON does not work with intel/2018, so have to make with GCCcore
configopts += '-DENABLE_dkh=ON -DENABLE_gdma=ON -DENABLE_resp=ON -DENABLE_snsmp2=ON -DENABLE_CheMPS2=ON '

# runtest uses ctest, and some of the thests have to be manually local_compared
# to the reference output (those tests are marked failed)
# After installing PSI4, you can test the package using psi4 --test command. (This uses pytest framework)
# runtest = '-L smoke'
runtest = False

modextrapaths = {'PYTHONPATH': 'lib/python3.7/site-packages'}

moduleclass = 'chem'
