# IT4Innovations 2022
# JK

easyblock = 'MakeCp'

name = 'VASP'
version = '6.3.2'
local_cudaversion = '11.6.0'
versionsuffix = '-CUDA-%s' % local_cudaversion

homepage = 'https://www.vasp.at'
docurls = 'https://www.vasp.at/wiki/index.php/The_VASP_Manual'
description = """
The Vienna Ab initio Simulation Package (VASP) is a local computer program for atomic scale
materials modelling, e.g. electronic structure calculations and quantum-mechanical molecular dynamics,
from first principles.

This is a GPU-enabled build.

To use VASP, you need an academic license from University of Vienna.
Follow the instructions at https://www.vasp.at/index.php/faqs.

Please send us the ID of your VASP license, list of authorized users for whom you require access,
and their email which is associated with your license (use only https://support.it4i.cz/rt).
We are responsible for verifying your licenses.
"""

toolchain = {'name': 'NVHPC', 'version': '22.2'}
toolchainopts = {'pic': True}

# Vasp is proprietary software, see http://www.vasp.at/index.php/faqs on
# how to get access to the code
sources = ['%(namelower)s.%(version)s.tgz']
patches = ['VASP-6.3.2-NVHPC-22.2-CUDA-11.6.0-adjust-makefile.patch']
checksums = [
    {'vasp.6.3.2.tgz': 'f7595221b0f9236a324ea8afe170637a578cdd5a837cc7679e7f7812f6edf25a'},
    {'VASP-6.3.2-NVHPC-22.2-CUDA-11.6.0-adjust-makefile.patch':
     '397bb216387c7817c052d7224be0c1712e44830e4b66c3843e064e547ccdc0ab'},
]

dependencies = [
    ('OpenMPI', '4.1.2', versionsuffix),
    ('FFTW.MPI', '3.3.8'),
    ('imkl', '2022.1.0', '', True),
    ('ScaLAPACK', '3.0'),
    ('HDF5', '1.12.1'),
    ('QD', '2.3.17'),
]

prebuildopts = 'cp arch/makefile.include.nvhpc_acc ./makefile.include && '

# VASP uses LIBS as a list of folders
prebuildopts += 'unset LIBS && '

buildopts = 'std gam ncl '

parallel = 1

files_to_copy = [(['bin/vasp_std', 'bin/vasp_gam', 'bin/vasp_ncl'], 'bin')]

sanity_check_paths = {
    'files': ['bin/vasp_std', 'bin/vasp_gam', 'bin/vasp_ncl'],
    'dirs': []
}

modluafooter = """
add_property('state','license')
add_property('arch', 'gpu')
"""


moduleclass = 'chem'
