Merge pull request #435 from epfl-scitas/packages/espresso

Added package : Quantum Espresso
This commit is contained in:
Todd Gamblin 2016-02-12 09:58:50 -08:00
commit d541a4bd29
3 changed files with 72 additions and 4 deletions

View file

@ -0,0 +1,65 @@
from spack import *
import os
class Espresso(Package):
"""
QE 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 = 'http://www.qe-forge.org/gf/download/frsrelease/204/912/espresso-5.3.0.tar.gz'
version('5.3.0', '6848fcfaeb118587d6be36bd10b7f2c3')
variant('mpi', default=True, description='Build Quantum-ESPRESSO with mpi support')
variant('openmp', default=False, description='Enables openMP support')
variant('scalapack', default=True, description='Enables scalapack support')
variant('elpa', default=True, description='Use elpa as an eigenvalue solver')
depends_on('blas')
depends_on('lapack')
depends_on('mpi', when='+mpi')
depends_on('fftw~mpi', when='~mpi')
depends_on('fftw+mpi', when='+mpi')
depends_on('scalapack', when='+scalapack+mpi') # TODO : + mpi needed to avoid false dependencies installation
def check_variants(self, spec):
error = 'you cannot ask for \'+{variant}\' when \'+mpi\' is not active'
if '+scalapack' in spec and '~mpi' in spec:
raise RuntimeError(error.format(variant='scalapack'))
if '+elpa' in spec and ('~mpi' in spec or '~scalapack' in spec):
raise RuntimeError(error.format(variant='elpa'))
def install(self, spec, prefix):
self.check_variants(spec)
options = ['-prefix=%s' % prefix]
if '+mpi' in spec:
options.append('--enable-parallel')
if '+openmp' in spec:
options.append('--enable-openmp')
if '+scalapack' in spec:
options.append('--with-scalapack=yes')
if '+elpa' in spec:
options.append('--with-elpa=yes')
# Add a list of directories to search
search_list = []
for name, dependency_spec in spec.dependencies.iteritems():
search_list.extend([dependency_spec.prefix.lib,
dependency_spec.prefix.lib64])
search_list = " ".join(search_list)
options.append('LIBDIRS=%s' % search_list)
options.append('F90=%s' % os.environ['FC'])
configure(*options)
make('all')
make('install')

View file

@ -48,10 +48,11 @@ class Mpich(Package):
def setup_dependent_environment(self, module, spec, dep_spec): def setup_dependent_environment(self, module, spec, dep_spec):
"""For dependencies, make mpicc's use spack wrapper.""" """For dependencies, make mpicc's use spack wrapper."""
os.environ['MPICH_CC'] = 'cc' os.environ['MPICH_CC'] = os.environ['CC']
os.environ['MPICH_CXX'] = 'c++' os.environ['MPICH_CXX'] = os.environ['CXX']
os.environ['MPICH_F77'] = 'f77' os.environ['MPICH_F77'] = os.environ['F77']
os.environ['MPICH_F90'] = 'f90' os.environ['MPICH_F90'] = os.environ['FC']
os.environ['MPICH_FC'] = os.environ['FC']
def install(self, spec, prefix): def install(self, spec, prefix):

View file

@ -19,7 +19,9 @@ def install(self, spec, prefix):
with working_dir(prefix.lib): with working_dir(prefix.lib):
symlink('libopenblas.a', 'blas.a') symlink('libopenblas.a', 'blas.a')
symlink('libopenblas.a', 'libblas.a') symlink('libopenblas.a', 'libblas.a')
symlink('libopenblas.so', 'libblas.so')
# Lapack virtual package should provide liblapack.a # Lapack virtual package should provide liblapack.a
with working_dir(prefix.lib): with working_dir(prefix.lib):
symlink('libopenblas.a', 'liblapack.a') symlink('libopenblas.a', 'liblapack.a')
symlink('libopenblas.so', 'liblapack.so')