LAMMPS updates (#44977)
* lammps: add new versions * lammps: add directories for plugins * lammps-example-plugin: new package Example illustrating how to install a LAMMPS plugin, based on the example part of the LAMMPS distribution.
This commit is contained in:
parent
4c378840e3
commit
d8fe628a95
@ -0,0 +1,71 @@
|
||||
# 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)
|
||||
|
||||
import datetime as dt
|
||||
|
||||
from spack.package import *
|
||||
from spack.pkg.builtin.lammps import Lammps
|
||||
|
||||
|
||||
class LammpsExamplePlugin(CMakePackage):
|
||||
"""LAMMPS Example Plugin"""
|
||||
|
||||
homepage = "https://www.lammps.org/"
|
||||
url = "https://github.com/lammps/lammps/archive/patch_1Sep2017.tar.gz"
|
||||
git = "https://github.com/lammps/lammps.git"
|
||||
|
||||
maintainers("rbberger")
|
||||
|
||||
license("GPL-2.0-only")
|
||||
|
||||
# rules for new versions and deprecation
|
||||
# * new stable versions should be added to stable_versions set
|
||||
# * a stable version that has updates and any of its outdated update releases should be
|
||||
# marked deprecated=True
|
||||
# * patch releases older than a stable release should be marked deprecated=True
|
||||
version("develop", branch="develop")
|
||||
version("20240627", sha256="2174a99d266279823a8c57629ee1c21ec357816aefd85f964d9f859fe9222aa5")
|
||||
version("20240417", sha256="158b288725c251fd8b30dbcf61749e0d6a042807da92af865a7d3c413efdd8ea")
|
||||
version(
|
||||
"20240207.1", sha256="3ba62c2a1ed463fceedf313a1c3ea2997994aa102379a8d35b525ea424f56776"
|
||||
)
|
||||
version(
|
||||
"20240207",
|
||||
sha256="d518f32de4eb2681f2543be63926411e72072dd7d67c1670c090b5baabed98ac",
|
||||
deprecated=True,
|
||||
)
|
||||
version("20231121", sha256="704d8a990874a425bcdfe0245faf13d712231ba23f014a3ebc27bc14398856f1")
|
||||
version(
|
||||
"20230802.3",
|
||||
sha256="6666e28cb90d3ff01cbbda6c81bdb85cf436bbb41604a87f2ab2fa559caa8510",
|
||||
preferred=True,
|
||||
)
|
||||
|
||||
def url_for_version(self, version):
|
||||
split_ver = str(version).split(".")
|
||||
vdate = dt.datetime.strptime(split_ver[0], "%Y%m%d")
|
||||
if len(split_ver) < 2:
|
||||
update = ""
|
||||
else:
|
||||
update = "_update{0}".format(split_ver[1])
|
||||
|
||||
return "https://github.com/lammps/lammps/archive/{0}_{1}{2}.tar.gz".format(
|
||||
"stable" if str(version) in Lammps.stable_versions else "patch",
|
||||
vdate.strftime("%d%b%Y").lstrip("0"),
|
||||
update,
|
||||
)
|
||||
|
||||
depends_on("lammps+plugin+lib")
|
||||
|
||||
root_cmakelists_dir = "examples/plugins"
|
||||
|
||||
def patch(self):
|
||||
with open("examples/plugins/CMakeLists.txt", "a") as f:
|
||||
print("include(GNUInstallDirs)", file=f)
|
||||
print(
|
||||
"install(TARGETS morse2plugin nve2plugin helloplugin zero2plugin morse2plugin"
|
||||
"LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/lammps/plugins)",
|
||||
file=f,
|
||||
)
|
@ -29,6 +29,8 @@ class Lammps(CMakePackage, CudaPackage, ROCmPackage, PythonExtension):
|
||||
# marked deprecated=True
|
||||
# * patch releases older than a stable release should be marked deprecated=True
|
||||
version("develop", branch="develop")
|
||||
version("20240627", sha256="2174a99d266279823a8c57629ee1c21ec357816aefd85f964d9f859fe9222aa5")
|
||||
version("20240417", sha256="158b288725c251fd8b30dbcf61749e0d6a042807da92af865a7d3c413efdd8ea")
|
||||
version(
|
||||
"20240207.1", sha256="3ba62c2a1ed463fceedf313a1c3ea2997994aa102379a8d35b525ea424f56776"
|
||||
)
|
||||
@ -461,6 +463,7 @@ def url_for_version(self, version):
|
||||
"ml-pod": {"when": "@20221222:"},
|
||||
"ml-rann": {"when": "@20210702:"},
|
||||
"ml-snap": {"when": "@20210702:"},
|
||||
"ml-uf3": {"when": "@20240627:"},
|
||||
"mliap": {"when": "@20200630:20210527"},
|
||||
"mofff": {"when": "@20210702:"},
|
||||
"molecule": {"default": True},
|
||||
@ -630,6 +633,8 @@ def url_for_version(self, version):
|
||||
depends_on("kokkos+deprecated_code+shared@3.0.00", when="@20200303+kokkos")
|
||||
depends_on("kokkos+shared@3.1:", when="@20200505:+kokkos")
|
||||
depends_on("kokkos@3.7.01:", when="@20230208: +kokkos")
|
||||
depends_on("kokkos@4.3.00:", when="@20240417: +kokkos")
|
||||
depends_on("kokkos@4.3.01:", when="@20240627: +kokkos")
|
||||
depends_on("adios2", when="+user-adios")
|
||||
depends_on("adios2", when="+adios")
|
||||
depends_on("plumed", when="+user-plumed")
|
||||
@ -892,6 +897,14 @@ def setup_run_environment(self, env):
|
||||
else:
|
||||
env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib)
|
||||
env.prepend_path("LD_LIBRARY_PATH", self.prefix.lib64)
|
||||
if "+plugin" in self.spec:
|
||||
env.prepend_path("LAMMPS_PLUGIN_PATH", self.prefix.lib.lammps.plugins)
|
||||
env.prepend_path("LAMMPS_PLUGIN_PATH", self.prefix.lib64.lammps.plugins)
|
||||
|
||||
@run_after("install")
|
||||
def make_plugins_directories(self):
|
||||
os.makedirs(self.prefix.lib.lammps.plugins, exist_ok=True)
|
||||
os.makedirs(self.prefix.lib64.lammps.plugins, exist_ok=True)
|
||||
|
||||
@run_after("install")
|
||||
def install_python(self):
|
||||
|
Loading…
Reference in New Issue
Block a user