# JK 2022

name = 'QuantumESPRESSO'
version = '6.7'

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': 'intel', 'version': '2021a'}

import os
if os.environ.get("CLUSTERNAME") in ["KAROLINA"]:
   toolchainopts = {'usempi': True, 'openmp': True,  'optarch': 'march=core-avx2'}
else:
   toolchainopts = {'usempi': True, 'openmp': True}

if os.environ.get("CLUSTERNAME") in ["KAROLINA"]:
   prebuildopts = "echo %(builddir)s && while read i; do echo $i; sed 's|-xHost|-march=core-avx2|g' -i $i; done < <(grep xHost %(builddir)s -R | cut -d ':' -f 1 | sort -u) && "

source_urls = [
    'https://github.com/QEF/q-e/releases/download/qe-%(version)s.0/',
    'https://github.com/dceresoli/qe-gipaw/archive/',
    'https://github.com/wannier-developers/wannier90/archive/'
]
sources = [
    'qe-%(version)s-ReleasePack.tgz',
    {'filename': 'qe-gipaw-%(version)s.tar.gz', 'download_filename': '%(version)sMaX.tar.gz'},
    {'filename': 'wannier90-3.1.0.tar.gz', 'download_filename': 'v3.1.0.tar.gz'},
]
checksums = [
    '8f06ea31ae52ad54e900a2f51afd5c70f78096d9dcf39c86c2b17dccb1ec9c87',  # qe-6.7-ReleasePack.tgz
    '95d2ed2f4d27f044dba171bdf8c1913a67ebc8846ed3463462828f2d414a2a61',  # qe-gipaw-%(version)s.tar.gz
    '40651a9832eb93dec20a8360dd535262c261c34e13c41b6755fa6915c936b254',  # wannier90-3.1.0.tar.gz
]

dependencies = [
    ('HDF5', '1.10.7'),
    ('ELPA', '2021.05.001'),
    ('libxc', '5.1.5'),
]

# 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'
