summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/q-e-sirius/package.py
blob: 3b3739ff1211c7ead55476bc589925d26e584f41 (plain) (blame)
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
# Copyright 2013-2023 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)
# adapted from official quantum espresso package


from spack.package import *


class QESirius(CMakePackage):
    """SIRIUS enabled fork of QuantumESPRESSO."""

    homepage = "https://github.com/electronic-structure/q-e-sirius/"
    url = "https://github.com/electronic-structure/q-e-sirius/archive/v6.5-rc4-sirius.tar.gz"
    git = "https://github.com/electronic-structure/q-e-sirius.git"

    maintainers("simonpintarelli")

    version("develop-ristretto", branch="ristretto", submodules=True)
    version(
        "6.7-rc1-sirius",
        tag="v6.7-rc1-sirius",
        commit="b1c79e30a2f9351316a90ca296f98cffef1f35c3",
        submodules=True,
    )

    variant("mpi", default=True, description="Builds with MPI support")
    variant("openmp", default=True, description="Enables OpenMP support")
    variant("scalapack", default=False, description="Enables SCALAPACK support")
    variant("elpa", default=False, description="Uses ELPA as an eigenvalue solver")
    variant("libxc", default=False, description="Support functionals through libxc")
    variant("hdf5", default=False, description="Enables HDF5 support")
    variant("sirius_apps", default=False, description="Build SIRIUS standalone binaries")

    depends_on("sirius +fortran")
    depends_on("sirius +apps", when="+sirius_apps")
    depends_on("sirius ~apps", when="~sirius_apps")
    depends_on("sirius +openmp", when="+openmp")
    depends_on("sirius@develop", when="@develop")

    depends_on("mpi", when="+mpi")
    depends_on("scalapack", when="+scalapack")
    depends_on("elpa", when="+elpa")
    depends_on("libxc", when="+libxc")
    depends_on("hdf5", when="+hdf5")

    depends_on("git", type="build")
    depends_on("pkgconfig", type="build")

    conflicts("~mpi", when="+scalapack", msg="SCALAPACK requires MPI support")
    conflicts("~scalapack", when="+elpa", msg="ELPA requires SCALAPACK support")

    def cmake_args(self):
        args = [
            "-DQE_ENABLE_SIRIUS=ON",
            "-DQE_ENABLE_CUDA=OFF",
            "-DQE_LAPACK_INTERNAL=OFF",
            "-DQE_ENABLE_DOC=OFF",
            self.define_from_variant("QE_ENABLE_MPI", "mpi"),
            self.define_from_variant("QE_ENABLE_OPENMP", "openmp"),
            self.define_from_variant("QE_ENABLE_ELPA", "elpa"),
            self.define_from_variant("QE_ENABLE_LIBXC", "libxc"),
            self.define_from_variant("QE_ENABLE_HDF5", "hdf5"),
            self.define_from_variant("QE_ENABLE_SCALAPACK", "scalapack"),
        ]

        # Work around spack issue #19970 where spack sets
        # rpaths for MKL just during make, but cmake removes
        # them during make install.
        if "^mkl" in self.spec:
            args.append("-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON")

        return args