QE-to-QMCPACK wave function converter relocation + some bug fixes (#16422)

* Revise description of patch variant.

* Add qmcpack variant. Apply QE-to-QMCPACK wave function converter patch.

* Clean-up, document, and re-organize.

* ELPA patches did not nead when=`+patch` variant.

* Need to be more precise here with QE version numbers.

* satisfies seems to be necessary here in order to get correct behaviour.

* Buglet with zlib link line.

* Update var/spack/repos/builtin/packages/quantum-espresso/package.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Update var/spack/repos/builtin/packages/quantum-espresso/package.py

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>

* Fix for QE-to-QMCPACK wave function converter w.r.t. QE 6.3. Also adjust comments to reflect changes in code.

Co-authored-by: Adam J. Stewart <ajstewart426@gmail.com>
This commit is contained in:
Nichols A. Romero 2020-05-03 15:53:01 -05:00 committed by GitHub
parent caad59e7c7
commit 860c54335d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -51,12 +51,17 @@ class QuantumEspresso(Package):
variant('epw', default=False,
description='Builds Electron-phonon Wannier executable')
# Apply internal patches by default. May need to be set to to False
# for 3rd party dependency patching
desc = 'Apply internal patches. May need to be set to False for'
desc = desc + ' dependency patching'
# Apply upstream patches by default. Variant useful for 3rd party
# patches which are incompatible with upstream patches
desc = 'Apply recommended upstream patches. May need to be set '
desc = desc + 'to False for third party patches or plugins'
variant('patch', default=True, description=desc)
# QMCPACK converter patch
# https://github.com/QMCPACK/qmcpack/tree/develop/external_codes/quantum_espresso
variant('qmcpack', default=False,
description='Build QE-to-QMCPACK wave function converter')
# Dependencies
depends_on('blas')
depends_on('lapack')
@ -68,14 +73,11 @@ class QuantumEspresso(Package):
# Versions of HDF5 prior to 1.8.16 lead to QE runtime errors
depends_on('hdf5@1.8.16:+fortran+hl+mpi', when='hdf5=parallel')
depends_on('hdf5@1.8.16:+fortran+hl~mpi', when='hdf5=serial')
depends_on('hdf5', when='+qmcpack')
# TODO: enable building EPW when ~mpi
depends_on('mpi', when='+epw')
patch('dspev_drv_elpa.patch', when='@6.1.0:+patch+elpa ^elpa@2016.05.004')
patch('dspev_drv_elpa.patch', when='@6.1.0:+patch+elpa ^elpa@2016.05.003')
# Conflicts
# CONFLICTS SECTION
# Omitted for now due to concretizer bug
# MKL with 64-bit integers not supported.
# conflicts(
@ -126,6 +128,27 @@ class QuantumEspresso(Package):
# folder QE expects as a link, we issue a conflict here.
conflicts('+elpa', when='@:5.4.0')
# Some QMCPACK converters only without internal patches. HDF5
# is a hard requirement. Need to do two HDF5 cases explicitly
# since Spack lacks support for expressing NOT operation.
conflicts(
'@6.4+patch',
when='+qmcpack',
msg='QE-to-QMCPACK wave function converter requires '
'deactivatation of upstream patches'
)
conflicts(
'hdf5=serial',
when='+qmcpack',
msg='QE-to-QMCPACK wave function converter only '
'supported with parallel HDF5'
)
conflicts(
'hdf5=none',
when='+qmcpack',
msg='QE-to-QMCPACK wave function converter requires HDF5'
)
# The first version of Q-E to feature integrated EPW is 6.0.0,
# as per http://epw.org.uk/Main/DownloadAndInstall .
# Complain if trying to install a version older than this.
@ -147,11 +170,33 @@ class QuantumEspresso(Package):
conflicts('+epw', when='^openmpi@1.10.7%pgi@17.0:17.12',
msg='PGI+OpenMPI version combo incompatible with EPW')
# Spurious problems running in parallel the Makefile
# generated by the configure
parallel = False
# PATCHES SECTION
# THIRD-PARTY PATCHES
# NOTE: *SOME* third-party patches will require deactivation of
# upstream patches using `~patch` variant
# QE upstream patches
# QMCPACK converter patches for QE 6.4.1, 6.4, and 6.3
conflicts('@:6.2,6.5:', when='+qmcpack',
msg='QMCPACK converter NOT available for this version of QE')
# 6.4.1
patch_url = 'https://raw.githubusercontent.com/QMCPACK/qmcpack/develop/external_codes/quantum_espresso/add_pw2qmcpack_to_qe-6.4.1.diff'
patch_checksum = '57cb1b06ee2653a87c3acc0dd4f09032fcf6ce6b8cbb9677ae9ceeb6a78f85e2'
patch(patch_url, sha256=patch_checksum, when='@6.4.1+qmcpack')
# 6.4
patch_url = 'https://raw.githubusercontent.com/QMCPACK/qmcpack/develop/external_codes/quantum_espresso/add_pw2qmcpack_to_qe-6.4.diff'
patch_checksum = 'ef08f5089951be902f0854a4dbddaa7b01f08924cdb27decfade6bef0e2b8994'
patch(patch_url, sha256=patch_checksum, when='@6.4:6.4.0+qmcpack')
# 6.3
patch_url = 'https://raw.githubusercontent.com/QMCPACK/qmcpack/develop/external_codes/quantum_espresso/add_pw2qmcpack_to_qe-6.3.diff'
patch_checksum = '2ee346e24926479f5e96f8dc47812173a8847a58354bbc32cf2114af7a521c13'
patch(patch_url, sha256=patch_checksum, when='@6.3+qmcpack')
# ELPA
patch('dspev_drv_elpa.patch', when='@6.1.0:+elpa ^elpa@2016.05.004')
patch('dspev_drv_elpa.patch', when='@6.1.0:+elpa ^elpa@2016.05.003')
# QE UPSTREAM PATCHES
# QE 6.3 requires multiple patches to fix MKL detection
# There may still be problems on Mac with MKL detection
patch('https://gitlab.com/QEF/q-e/commit/0796e1b7c55c9361ecb6515a0979280e78865e36.diff',
@ -170,6 +215,10 @@ class QuantumEspresso(Package):
sha256='b1aa3179ee1c069964fb9c21f3b832aebeae54947ce8d3cc1a74e7b154c3c10f',
when='+patch@6.4.1:6.5.0')
# Spurious problems running in parallel the Makefile
# generated by the configure
parallel = False
def install(self, spec, prefix):
prefix_path = prefix.bin if '@:5.4.0' in spec else prefix
@ -268,7 +317,7 @@ def install(self, spec, prefix):
if spec.variants['hdf5'].value != 'none':
options.append('--with-hdf5={0}'.format(spec['hdf5'].prefix))
if '@6.4.1' or '@6.5' in spec:
if spec.satisfies('@6.4.1,6.5'):
options.extend([
'--with-hdf5-include={0}'.format(
spec['hdf5'].headers.directories[0]
@ -280,6 +329,16 @@ def install(self, spec, prefix):
configure(*options)
# Filter file must be applied after configure executes
# QE 6.4.0 to QE 6.4 have `-L` missing in front of zlib library
if spec.variants['hdf5'].value != 'none':
if spec.satisfies('@6.1.0:6.4.0'):
make_inc = join_path(self.stage.source_path, 'make.inc')
zlib_libs = spec['zlib'].prefix.lib + ' -lz'
filter_file(
zlib_libs, format(spec['zlib'].libs.ld_flags), make_inc
)
if '+epw' in spec:
make('all', 'epw')
else: