# IT4Innovations 2020

easyblock = 'EB_PSI'

name = 'PSI4'
version = '1.3.2'
versionsuffix = '-Py-3.6'

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 = [
    ('Py', '3.6', '', True),
    ('scipy', '1.3.0', '', ('Py', '3.6')),
    #  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', '-parallel'),
    #  Tests are failing with pytest 3.9.2
    ('pytest', '5.3.5', '', ('Py', '3.6')),
    ('networkx', '2.1', '', ('Py', '3.6')),
    ('deepdiff', '4.0.6', '', ('Py', '3.6')),
    ('pydantic', '1.4', '', ('Py', '3.6')),
    ('Pint', '0.11', '', ('Py', '3.6')),
]

builddependencies = [
    ('CMake', '3.16.2', '' ,True),
    # 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.6/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.6/site-packages'}

moduleclass = 'chem'
