summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNichols A. Romero <naromero77@users.noreply.github.com>2020-05-03 15:53:01 -0500
committerGitHub <noreply@github.com>2020-05-03 14:53:01 -0600
commit860c54335dab3c766b2f692e77941b7dce28ab8e (patch)
treea08dd70c70894502077e720930604e2e1874ad53
parentcaad59e7c7a45cb550d1451ed04108c0e37c1cbd (diff)
downloadspack-860c54335dab3c766b2f692e77941b7dce28ab8e.tar.gz
spack-860c54335dab3c766b2f692e77941b7dce28ab8e.tar.bz2
spack-860c54335dab3c766b2f692e77941b7dce28ab8e.tar.xz
spack-860c54335dab3c766b2f692e77941b7dce28ab8e.zip
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>
-rw-r--r--var/spack/repos/builtin/packages/quantum-espresso/package.py89
1 files changed, 74 insertions, 15 deletions
diff --git a/var/spack/repos/builtin/packages/quantum-espresso/package.py b/var/spack/repos/builtin/packages/quantum-espresso/package.py
index 52fb46c784..59f5c33f3d 100644
--- a/var/spack/repos/builtin/packages/quantum-espresso/package.py
+++ b/var/spack/repos/builtin/packages/quantum-espresso/package.py
@@ -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
-
- # QE upstream patches
+ # PATCHES SECTION
+ # THIRD-PARTY PATCHES
+ # NOTE: *SOME* third-party patches will require deactivation of
+ # upstream patches using `~patch` variant
+
+ # 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 @@ class QuantumEspresso(Package):
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 @@ class QuantumEspresso(Package):
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: