summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbecker33 <becker33@llnl.gov>2016-08-09 09:14:33 -0700
committerGitHub <noreply@github.com>2016-08-09 09:14:33 -0700
commitfb9f6fe9b5de47ed59e5d3f3faf27dab69d56ed9 (patch)
tree6b3814951501770d94c4431a487ddf14b4ee1384
parent2b94d7cf8eb97e7dd08ea26da0d3481dd36927d5 (diff)
parent38dcd6bce95f0167f6e22d65f3a8ff982059df15 (diff)
downloadspack-fb9f6fe9b5de47ed59e5d3f3faf27dab69d56ed9.tar.gz
spack-fb9f6fe9b5de47ed59e5d3f3faf27dab69d56ed9.tar.bz2
spack-fb9f6fe9b5de47ed59e5d3f3faf27dab69d56ed9.tar.xz
spack-fb9f6fe9b5de47ed59e5d3f3faf27dab69d56ed9.zip
Merge pull request #1473 from epfl-scitas/packages/plumed_dependents
plumed : added dependents (gromacs, cp2k)
-rw-r--r--var/spack/repos/builtin/packages/cp2k/package.py51
-rw-r--r--var/spack/repos/builtin/packages/gromacs/package.py33
-rw-r--r--var/spack/repos/builtin/packages/plumed/package.py28
3 files changed, 83 insertions, 29 deletions
diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py
index 8fdd1e0ca3..5f59286323 100644
--- a/var/spack/repos/builtin/packages/cp2k/package.py
+++ b/var/spack/repos/builtin/packages/cp2k/package.py
@@ -40,6 +40,7 @@ class Cp2k(Package):
version('3.0', 'c05bc47335f68597a310b1ed75601d35')
variant('mpi', default=True, description='Enable MPI support')
+ variant('plumed', default=False, description='Enable PLUMED support')
depends_on('python') # Build dependency
@@ -49,6 +50,8 @@ class Cp2k(Package):
depends_on('mpi', when='+mpi')
depends_on('scalapack', when='+mpi')
+ depends_on('plumed+shared+mpi', when='+plumed+mpi')
+ depends_on('plumed+shared~mpi', when='+plumed~mpi')
# TODO : add dependency on libint
# TODO : add dependency on libsmm, libxsmm
@@ -56,7 +59,6 @@ class Cp2k(Package):
# TODO : add dependency on CUDA
# TODO : add dependency on PEXSI
# TODO : add dependency on QUIP
- # TODO : add dependency on plumed
# TODO : add dependency on libwannier90
parallel = False
@@ -70,22 +72,6 @@ class Cp2k(Package):
# Write the custom makefile
with open(makefile, 'w') as mkf:
- mkf.write('CC = {0.compiler.cc}\n'.format(self))
- if '%intel' in self.spec:
- # CPP is a commented command in Intel arch of CP2K
- # This is the hack through which cp2k developers avoid doing :
- #
- # ${CPP} <file>.F > <file>.f90
- #
- # and use `-fpp` instead
- mkf.write('CPP = # {0.compiler.cc} -P\n'.format(self))
- mkf.write('AR = xiar -r\n')
- else:
- mkf.write('CPP = {0.compiler.cc} -E\n'.format(self))
- mkf.write('AR = ar -r\n')
- fc = self.compiler.fc if '~mpi' in spec else self.spec['mpi'].mpifc
- mkf.write('FC = {0}\n'.format(fc))
- mkf.write('LD = {0}\n'.format(fc))
# Optimization flags
optflags = {
'gcc': ['-O2',
@@ -110,6 +96,37 @@ class Cp2k(Package):
])
ldflags = ['-L' + spec['fftw'].prefix.lib]
libs = []
+ if '+plumed' in self.spec:
+ # Include Plumed.inc in the Makefile
+ mkf.write('include {0}\n'.format(
+ join_path(self.spec['plumed'].prefix.lib,
+ 'plumed',
+ 'src',
+ 'lib',
+ 'Plumed.inc')
+ ))
+ # Add required macro
+ cppflags.extend(['-D__PLUMED2'])
+ libs.extend([
+ join_path(self.spec['plumed'].prefix.lib, 'libplumed.so')
+ ])
+
+ mkf.write('CC = {0.compiler.cc}\n'.format(self))
+ if '%intel' in self.spec:
+ # CPP is a commented command in Intel arch of CP2K
+ # This is the hack through which cp2k developers avoid doing :
+ #
+ # ${CPP} <file>.F > <file>.f90
+ #
+ # and use `-fpp` instead
+ mkf.write('CPP = # {0.compiler.cc} -P\n'.format(self))
+ mkf.write('AR = xiar -r\n')
+ else:
+ mkf.write('CPP = {0.compiler.cc} -E\n'.format(self))
+ mkf.write('AR = ar -r\n')
+ fc = self.compiler.fc if '~mpi' in spec else self.spec['mpi'].mpifc
+ mkf.write('FC = {0}\n'.format(fc))
+ mkf.write('LD = {0}\n'.format(fc))
# Intel
if '%intel' in self.spec:
cppflags.extend([
diff --git a/var/spack/repos/builtin/packages/gromacs/package.py b/var/spack/repos/builtin/packages/gromacs/package.py
index 55eacc8d38..607927fe8b 100644
--- a/var/spack/repos/builtin/packages/gromacs/package.py
+++ b/var/spack/repos/builtin/packages/gromacs/package.py
@@ -22,19 +22,21 @@
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
+
from spack import *
class Gromacs(Package):
- """
- GROMACS (GROningen MAchine for Chemical Simulations) is a molecular dynamics package primarily designed for
- simulations of proteins, lipids and nucleic acids. It was originally developed in the Biophysical Chemistry
- department of University of Groningen, and is now maintained by contributors in universities and research centers
- across the world.
-
- GROMACS is one of the fastest and most popular software packages available and can run on CPUs as well as GPUs.
- It is free, open source released under the GNU General Public License. Starting from version 4.6, GROMACS is
- released under the GNU Lesser General Public License.
+ """GROMACS (GROningen MAchine for Chemical Simulations) is a molecular
+ dynamics package primarily designed for simulations of proteins, lipids
+ and nucleic acids. It was originally developed in the Biophysical
+ Chemistry department of University of Groningen, and is now maintained
+ by contributors in universities and research centers across the world.
+
+ GROMACS is one of the fastest and most popular software packages
+ available and can run on CPUs as well as GPUs. It is free, open source
+ released under the GNU General Public License. Starting from version 4.6,
+ GROMACS is released under the GNU Lesser General Public License.
"""
homepage = 'http://www.gromacs.org'
@@ -43,17 +45,24 @@ class Gromacs(Package):
version('5.1.2', '614d0be372f1a6f1f36382b7a6fcab98')
variant('mpi', default=True, description='Activate MPI support')
- variant('shared', default=True, description='Enables the build of shared libraries')
+ variant('shared', default=True,
+ description='Enables the build of shared libraries')
variant('debug', default=False, description='Enables debug mode')
- variant('double', default=False, description='Produces a double precision version of the executables')
+ variant('double', default=False, description='Produces a double precision version of the executables') # NOQA: ignore=E501
+ variant('plumed', default=False, description='Enable PLUMED support')
depends_on('mpi', when='+mpi')
-
+ depends_on('plumed+mpi', when='+plumed+mpi')
+ depends_on('plumed~mpi', when='+plumed~mpi')
depends_on('fftw')
depends_on('cmake', type='build')
# TODO : add GPU support
+ def patch(self):
+ if '+plumed' in self.spec:
+ self.spec['plumed'].package.apply_patch(self)
+
def install(self, spec, prefix):
options = []
diff --git a/var/spack/repos/builtin/packages/plumed/package.py b/var/spack/repos/builtin/packages/plumed/package.py
index 32571455eb..abb03e0770 100644
--- a/var/spack/repos/builtin/packages/plumed/package.py
+++ b/var/spack/repos/builtin/packages/plumed/package.py
@@ -22,6 +22,7 @@
# 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 subprocess
from spack import *
@@ -55,6 +56,33 @@ class Plumed(Package):
depends_on('mpi', when='+mpi')
depends_on('gsl', when='+gsl')
+ # Dictionary mapping PLUMED versions to the patches it provides
+ # interactively
+ plumed_patches = {
+ '2.2.3': {
+ 'amber-14': '1',
+ 'gromacs-4.5.7': '2',
+ 'gromacs-4.6.7': '3',
+ 'gromacs-5.0.7': '4',
+ 'gromacs-5.1.2': '5',
+ 'lammps-6Apr13': '6',
+ 'namd-2.8': '7',
+ 'namd-2.9': '8',
+ 'espresso-5.0.2': '9'
+ }
+ }
+
+ def apply_patch(self, other):
+ plumed = subprocess.Popen(
+ [join_path(self.spec.prefix.bin, 'plumed'), 'patch', '-p'],
+ stdin=subprocess.PIPE
+ )
+ opts = Plumed.plumed_patches[str(self.version)]
+ search = '{0.name}-{0.version}'.format(other)
+ choice = opts[search] + '\n'
+ plumed.stdin.write(choice)
+ plumed.wait()
+
def setup_dependent_package(self, module, ext_spec):
# Make plumed visible from dependent packages
module.plumed = Executable(join_path(self.spec.prefix.bin, 'plumed'))