summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/changa/package.py
blob: 25a54bf7fe2f319a84a99a98503714e9cab70ffc (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
# 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)

from spack.package import *


class Changa(AutotoolsPackage):
    """ChaNGa (Charm N-body GrAvity solver) is a code to perform collisionless
    N-body simulations. It can perform cosmological simulations with periodic
    boundary conditions in comoving coordinates or simulations of isolated
    stellar systems. It also can include hydrodynamics using the Smooth
    Particle Hydrodynamics (SPH) technique. It uses a Barnes-Hut tree to
    calculate gravity, with hexadecapole expansion of nodes and
    Ewald summation for periodic forces. Timestepping is done with a leapfrog
    integrator with individual timesteps for each particle."""

    homepage = "https://faculty.washington.edu/trq/hpcc/tools/changa.html"
    url = "https://github.com/N-BodyShop/changa/archive/v3.4.tar.gz"
    git = "https://github.com/N-BodyShop/changa.git"

    version("master", branch="master")
    version("3.4", sha256="c2bceb6ac00025dfd704bb6960bc17c6df7c746872185845d1e75f47e6ce2a94")
    patch("fix_configure_path.patch")

    resource(
        name="utility",
        url="https://github.com/N-BodyShop/utility/archive/v3.4.tar.gz",
        sha256="19f9f09023ce9d642e848a36948788fb29cd7deb8e9346cdaac4c945f1416667",
        placement="utility",
    )

    depends_on("charmpp build-target=ChaNGa")

    def configure_args(self):
        args = []
        args.append("STRUCT_DIR={0}/utility/structures".format(self.stage.source_path))
        return args

    def install(self, spec, prefix):
        with working_dir(self.build_directory):
            mkdirp(prefix.bin)
            install("ChaNGa", prefix.bin)
            install("charmrun", prefix.bin)