1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
|
##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/spack/spack
# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
import glob
import os.path
from spack import *
class QuantumEspresso(Package):
"""Quantum-ESPRESSO is an integrated suite of Open-Source computer codes
for electronic-structure calculations and materials modeling at the
nanoscale. It is based on density-functional theory, plane waves, and
pseudopotentials.
"""
homepage = 'http://quantum-espresso.org'
url = 'https://github.com/QEF/q-e/archive/qe-5.3.tar.gz'
version(
'6.2.0',
'972176a58d16ae8cf0c9a308479e2b97',
url='https://github.com/QEF/q-e/archive/qe-6.2.0.tar.gz'
)
version(
'6.1.0',
'3fe861dcb5f6ec3d15f802319d5d801b',
url='https://github.com/QEF/q-e/archive/qe-6.1.0.tar.gz'
)
version(
'5.4.0',
'085f7e4de0952e266957bbc79563c54e',
url='https://github.com/QEF/q-e/archive/qe-5.4.tar.gz'
)
version(
'5.3.0',
'be3f8778e302cffb89258a5f936a7592',
url='https://github.com/QEF/q-e/archive/qe-5.3.tar.gz'
)
variant('mpi', default=True, description='Builds with mpi support')
variant('openmp', default=False, description='Enables openMP support')
variant('scalapack', default=True, description='Enables scalapack support')
variant('elpa', default=True, description='Uses elpa as an eigenvalue solver')
# Support for HDF5 has been added starting in version 6.1.0 and is
# still experimental, therefore we default to False for the variant
variant('hdf5', default=False, description='Builds with HDF5 support')
depends_on('blas')
depends_on('lapack')
depends_on('mpi', when='+mpi')
depends_on('scalapack', when='+scalapack+mpi')
depends_on('fftw+mpi', when='+mpi')
depends_on('fftw~mpi', when='~mpi')
depends_on('elpa+openmp', when='+elpa+openmp')
depends_on('elpa~openmp', when='+elpa~openmp')
depends_on('hdf5', when='+hdf5')
patch('dspev_drv_elpa.patch', when='@6.1+elpa ^elpa@2016.05.004')
patch('dspev_drv_elpa.patch', when='@6.1+elpa ^elpa@2016.05.003')
# We can't ask for scalapack or elpa if we don't want MPI
conflicts(
'+scalapack',
when='~mpi',
msg='scalapack is a parallel library and needs MPI support'
)
conflicts(
'+elpa',
when='~mpi',
msg='elpa is a parallel library and needs MPI support'
)
# Elpa is formally supported by @:5.4.0, but QE configure searches
# for it in the wrong folders (or tries to download it within
# the build directory). Instead of patching Elpa to provide the
# folder QE expects as a link, we issue a conflict here.
conflicts('+elpa', when='@:5.4.0')
conflicts('+hdf5', when='@:5.4.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
options = ['-prefix={0}'.format(prefix_path)]
if '+mpi' in spec:
options.append('--enable-parallel=yes')
else:
options.append('--enable-parallel=no')
if '+openmp' in spec:
options.append('--enable-openmp')
if '+scalapack' in spec:
scalapack_option = 'intel' if '^intel-mkl' in spec else 'yes'
options.append('--with-scalapack={0}'.format(scalapack_option))
if '+elpa' in spec:
# Spec for elpa
elpa = spec['elpa']
# Find where the Fortran module resides
elpa_module = find(elpa.prefix, 'elpa.mod')
# Compute the include directory from there: versions
# of espresso prior to 6.1 requires -I in front of the directory
elpa_include = '' if '@6.1:' in spec else '-I'
elpa_include += os.path.dirname(elpa_module[0])
options.extend([
'--with-elpa-include={0}'.format(elpa_include),
'--with-elpa-lib={0}'.format(elpa.libs[0])
])
if '+hdf5' in spec:
options.append('--with-hdf5={0}'.format(spec['hdf5'].prefix))
# Add a list of directories to search
search_list = []
for dependency_spec in spec.dependencies():
search_list.extend([
dependency_spec.prefix.lib,
dependency_spec.prefix.lib64
])
search_list = " ".join(search_list)
options.extend([
'LIBDIRS={0}'.format(search_list),
'F90={0}'.format(env['SPACK_FC']),
'CC={0}'.format(env['SPACK_CC'])
])
configure(*options)
make('all')
if 'platform=darwin' in spec:
mkdirp(prefix.bin)
for filename in glob.glob("bin/*.x"):
install(filename, prefix.bin)
else:
make('install')
|