summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/xtb/package.py
blob: b8bab6d0d1707914d153a5caa891ac40ab7cb75d (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
# Copyright 2013-2024 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.package import *


class Xtb(MesonPackage):
    """Semiempirical extended tight binding program package"""

    homepage = "https://xtb-docs.readthedocs.org"
    url = "https://github.com/grimme-lab/xtb/releases/download/v6.6.0/xtb-6.6.0-source.tar.xz"

    maintainers("awvwgk")

    license("LGPL-3.0-only")

    version("6.6.0", sha256="8460113f2678dcb23220af17b734f1221af302f42126bb54e3ae356530933b85")
    version("6.5.1", sha256="0922205cc224fe79e28f3d75be4e10c03efa8f3f666aedec8346fed82b272cad")
    version("6.5.0", sha256="5f780656bf7b440a8e1f753a9a877401a7d497fb3160762f48bdefc8a9914976")

    depends_on("blas")
    depends_on("lapack")
    depends_on("meson@0.57.2:", type="build")
    depends_on("mctc-lib")
    depends_on("pkgconfig", type="build")
    depends_on("tblite", when="+tblite")
    depends_on("test-drive", type="build")

    variant("openmp", default=True, description="Use OpenMP parallelisation")
    variant("tblite", default=True, when="@6.6.0:", description="Use tblite for xTB calculations")

    def meson_args(self):
        lapack = self.spec["lapack"].libs.names[0]
        if lapack.startswith("mkl"):
            lapack = "mkl"
        elif lapack != "openblas":
            lapack = "netlib"

        lapack_opt = "-Dlapack={0}" if self.version >= Version("6.6.0") else "-Dla_backend={0}"

        return [
            lapack_opt.format(lapack),
            "-Dopenmp={0}".format(str("+openmp" in self.spec).lower()),
        ]