# IT4Innovations 2022
# JK

name = 'QuantumESPRESSO'
version = '7.1'

homepage = 'https://www.quantum-espresso.org'
description = """Quantum ESPRESSO  is an integrated suite of computer codes
for electronic-structure calculations and materials modeling at the nanoscale.
It is based on density-functional theory, plane waves, and pseudopotentials
(both norm-conserving and ultrasoft).
"""

toolchain = {'name': 'foss', 'version': '2022a'}
import os
if os.environ.get("CLUSTERNAME") in ["KAROLINA"]:
    toolchainopts = {'usempi': True, 'openmp': True,  'optarch': 'march=znver2', 'opt': 'O3'}
else:
    toolchainopts = {'usempi': True, 'openmp': True, 'opt': 'O3'}

source_urls = [
    'https://gitlab.com/QEF/q-e/-/archive/qe-%(version)s',
    'https://github.com/dceresoli/qe-gipaw/releases/download/%(version)s/',
    'https://github.com/wannier-developers/wannier90/archive/'
]
sources = [
    {
        'filename': 'q-e-qe-%(version)s.tar.gz',
        'extract_cmd': 'mkdir -p %(builddir)s/qe-%(version)s && tar xzvf %s --strip-components=1 -C $_',
    },
    'qe-gipaw-%(version)s.tar.gz',
    {'filename': 'wannier90-3.1.0.tar.gz', 'download_filename': 'v3.1.0.tar.gz'},
]
checksums = [
    'd56dea096635808843bd5a9be2dee3d1f60407c01dbeeda03f8256a3bcfc4eb6',  # q-e-qe-7.1.tar.gz
    '486b60f38fad7363f81d346adc69de004692f50c9f6be59eee5152a717ca1513',  # qe-gipaw-7.1.tar.gz
    '40651a9832eb93dec20a8360dd535262c261c34e13c41b6755fa6915c936b254',  # wannier90-3.1.0.tar.gz
]

builddependencies = [('M4', '1.4.19')]

dependencies = [
    ('HDF5', '1.12.2'),
    ('ELPA', '2021.11.001'),
    ('libxc', '5.2.3'),
]

# The third party packages should be installed separately and added as
# dependencies.  The exception is w90, which is force built, and gipaw
# which depends on qe source
buildopts = 'all gwl xspectra couple epw gipaw w90'

# parallel build tends to fail
parallel = 1

moduleclass = 'chem'
