From 5d2c09e19e730783334bcec3112a3f7518fc544d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tiziano=20M=C3=BCller?= Date: Fri, 25 Dec 2020 00:12:34 +0100 Subject: [PATCH] Add libvori and support for libvori (and spglib) in CP2K (#20508) * packages: initial commit of libvori * cp2k: add support for libvori * cp2k: add support for spglib --- .../repos/builtin/packages/cp2k/package.py | 22 +++++++++++++++++++ .../repos/builtin/packages/libvori/package.py | 17 ++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 var/spack/repos/builtin/packages/libvori/package.py diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py index 1a74283b3c..6094a27225 100644 --- a/var/spack/repos/builtin/packages/cp2k/package.py +++ b/var/spack/repos/builtin/packages/cp2k/package.py @@ -47,6 +47,10 @@ class Cp2k(MakefilePackage, CudaPackage): description=('Enable planewave electronic structure' ' calculations via SIRIUS')) variant('cosma', default=False, description='Use COSMA for p?gemm') + variant('libvori', default=False, + description=('Enable support for Voronoi integration' + ' and BQB compression')) + variant('spglib', default=False, description='Enable support for spglib') # override cuda_arch from CudaPackage since we only support one arch # at a time and only specific ones for which we have parameter files @@ -129,6 +133,9 @@ class Cp2k(MakefilePackage, CudaPackage): depends_on('py-numpy', when='@7:+cuda', type='build') depends_on('python@3.6:', when='@7:+cuda', type='build') + depends_on('libvori@201217:', when='@8:+libvori', type='build') + depends_on('spglib', when='+spglib') + # PEXSI, ELPA, COSMA and SIRIUS depend on MPI conflicts('~mpi', '+pexsi') conflicts('~mpi', '+elpa') @@ -137,6 +144,8 @@ class Cp2k(MakefilePackage, CudaPackage): conflicts('+sirius', '@:6.999') # sirius support was introduced in 7+ conflicts('+cosma', '@:7.999') # COSMA support was introduced in 8+ + conflicts('+libvori', '@:7.999') # libvori support was introduced in 8+ + conflicts('~cuda', '+cuda_fft') conflicts('~cuda', '+cuda_blas') @@ -479,6 +488,19 @@ def edit(self, spec, prefix): output=str).split() libs += pkgconf('--libs', 'libxsmmf', output=str).split() + if '+libvori' in spec: + cppflags += ['-D__LIBVORI'] + libvori = spec['libvori'].libs + ldflags += [libvori.search_flags] + libs += libvori + libs += ['-lstdc++'] + + if '+spglib' in spec: + cppflags += ['-D__SPGLIB'] + spglib = spec['spglib'].libs + ldflags += [spglib.search_flags] + libs += spglib + dflags.extend(cppflags) cflags.extend(cppflags) cxxflags.extend(cppflags) diff --git a/var/spack/repos/builtin/packages/libvori/package.py b/var/spack/repos/builtin/packages/libvori/package.py new file mode 100644 index 0000000000..d8e484b85c --- /dev/null +++ b/var/spack/repos/builtin/packages/libvori/package.py @@ -0,0 +1,17 @@ +# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Libvori(CMakePackage): + """Support for Voronoi Integration and lossless BQB compression""" + + homepage = "https://brehm-research.de/voronoi.php" + url = "https://www.cp2k.org/static/downloads/libvori-201217.tar.gz" + + maintainers = ['dev-zero'] + + version('201217', sha256='6ad456ed6ca5d28cadcc0d90eabe8fff5caa77b99f12764323de5e3ae21cddf5')