From 3016da79fe7d45540442c9bc0e89ae14ab571c86 Mon Sep 17 00:00:00 2001 From: Rocco Meli Date: Mon, 20 Feb 2023 10:14:00 +0100 Subject: Add GNINA and related packages (#35439) --- .../repos/builtin/packages/coordgen/package.py | 32 ++++++++++ var/spack/repos/builtin/packages/gnina/package.py | 69 ++++++++++++++++++++++ .../repos/builtin/packages/libmolgrid/package.py | 40 +++++++++++++ .../repos/builtin/packages/openbabel/package.py | 22 ++++--- var/spack/repos/builtin/packages/rdkit/package.py | 5 ++ 5 files changed, 159 insertions(+), 9 deletions(-) create mode 100644 var/spack/repos/builtin/packages/coordgen/package.py create mode 100644 var/spack/repos/builtin/packages/gnina/package.py create mode 100644 var/spack/repos/builtin/packages/libmolgrid/package.py diff --git a/var/spack/repos/builtin/packages/coordgen/package.py b/var/spack/repos/builtin/packages/coordgen/package.py new file mode 100644 index 0000000000..4796408e4d --- /dev/null +++ b/var/spack/repos/builtin/packages/coordgen/package.py @@ -0,0 +1,32 @@ +# 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 Coordgen(CMakePackage): + """Schrödinger, Inc's 2D coordinate generation""" + + homepage = "https://github.com/schrodinger/coordgenlibs" + url = "https://github.com/schrodinger/coordgenlibs/archive/refs/tags/v3.0.2.tar.gz" + + maintainers("RMeli") + + version("3.0.2", sha256="f67697434f7fec03bca150a6d84ea0e8409f6ec49d5aab43badc5833098ff4e3") + + variant("maeparser", default=True, description="Use MAE parser") + variant("example", default=False, description="Build sample executable") + variant("shared", default=True, description="Build as shared library") + + depends_on("maeparser", when="+maeparser") + depends_on("boost", when="+maeparser") + + def cmake_args(self): + args = [ + self.define_from_variant("COORDGEN_BUILD_EXAMPLE", "example"), + self.define_from_variant("COORDGEN_USE_MAEPARSER", "maeparser"), + self.define_from_variant("COORDGEN_BUILD_SHARED_LIBS", "shared"), + ] + return args diff --git a/var/spack/repos/builtin/packages/gnina/package.py b/var/spack/repos/builtin/packages/gnina/package.py new file mode 100644 index 0000000000..6f6b09aefc --- /dev/null +++ b/var/spack/repos/builtin/packages/gnina/package.py @@ -0,0 +1,69 @@ +# 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 Gnina(CMakePackage, CudaPackage): + """gnina (pronounced NEE-na) is a molecular docking program with integrated support + for scoring and optimizing ligands using convolutional neural networks.""" + + homepage = "https://github.com/gnina/gnina" + url = "https://github.com/gnina/gnina/archive/refs/tags/v1.0.3.tar.gz" + git = "https://github.com/gnina/gnina.git" + + maintainers("RMeli") + + version("1.0.3", sha256="4274429f38293d79c7d22ab08aca91109e327e9ce3f682cd329a8f9c6ef429da") + + _boost = "boost" + "".join( + [ + "+atomic", + "+chrono", + "+date_time", + "+exception", + "+filesystem", + "+graph", + "+iostreams", + "+locale", + "+log", + "+math", + "+python", + "+program_options", + "+random", + "+regex", + "+serialization", + "+signals", + "+system", + "+test", + "+thread", + "+timer", + "+wave", + ] + ) + + depends_on("zlib") + depends_on(_boost) + depends_on("glog") + depends_on("protobuf") + depends_on("hdf5+cxx+hl") + depends_on("openblas~fortran") + + depends_on("libmolgrid") + + depends_on("openbabel@3:~gui~cairo~maeparser~coordgen") + # depends_on("rdkit") + + depends_on("python", type="build") + depends_on("py-numpy", type="build") + depends_on("py-pytest", type="build") + + depends_on("cuda@11") + + def cmake_args(self): + args = [ + "-DBLAS=Open", # Use OpenBLAS instead of Atlas' BLAS + ] + return args diff --git a/var/spack/repos/builtin/packages/libmolgrid/package.py b/var/spack/repos/builtin/packages/libmolgrid/package.py new file mode 100644 index 0000000000..a486a2359a --- /dev/null +++ b/var/spack/repos/builtin/packages/libmolgrid/package.py @@ -0,0 +1,40 @@ +# 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) + +import os + +from spack.package import * + + +class Libmolgrid(CMakePackage): + """libmolgrid is a library to generate tensors from molecular data, with properties + that make its output particularly suited to machine learning.""" + + homepage = "https://gnina.github.io/libmolgrid/" + url = "https://github.com/gnina/libmolgrid/archive/refs/tags/v0.5.2.tar.gz" + + maintainers("RMeli") + + version("0.5.3", sha256="a9f7a62cdeb516bc62a06b324cdd33b095a787df175c6166d74a8d30b6916abb") + version("0.5.2", sha256="e732d13a96c2f374d57a73999119bef700172d392c195c751214aa6ac6680c3a") + + depends_on("zlib") + depends_on("boost +regex +test +program_options +system +filesystem +iostreams +python") + depends_on("openbabel@3:~gui~cairo") + depends_on("cuda@11") + + depends_on("python") + depends_on("py-numpy") + depends_on("py-pytest") + + def cmake_args(self): + ob_incl = os.path.join(self.spec["openbabel"].prefix.include, "openbabel3") + ob_libs = self.spec["openbabel"].libs.joined(";") + + args = [ + "-DOPENBABEL3_INCLUDE_DIR=" + ob_incl, + "-DOPENBABEL3_LIBRARIES=" + ob_libs, + ] + return args diff --git a/var/spack/repos/builtin/packages/openbabel/package.py b/var/spack/repos/builtin/packages/openbabel/package.py index 243c2cd58a..37be524cc8 100644 --- a/var/spack/repos/builtin/packages/openbabel/package.py +++ b/var/spack/repos/builtin/packages/openbabel/package.py @@ -4,7 +4,6 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * -from spack.pkg.builtin.boost import Boost class Openbabel(CMakePackage): @@ -28,6 +27,10 @@ class Openbabel(CMakePackage): variant("python", default=True, description="Build Python bindings") variant("gui", default=True, description="Build with GUI") + variant("cairo", default=True, description="Build with Cairo (PNG output support)") + variant("openmp", default=False, description="Build with OpenMP") + variant("maeparser", default=False, description="Built with MAE parser") + variant("coordgen", default=False, description="Build with Coordgen") extends("python", when="+python") @@ -36,12 +39,9 @@ class Openbabel(CMakePackage): depends_on("pkgconfig", type="build") depends_on("swig@2.0:", type="build", when="+python") - # TODO: replace this with an explicit list of components of Boost, - # for instance depends_on('boost +filesystem') - # See https://github.com/spack/spack/pull/22303 for reference - depends_on(Boost.with_default_variants) - depends_on("cairo") # required to support PNG depiction - depends_on("pango") # custom cairo requires custom pango + depends_on("boost +filesystem +iostreams +test") + depends_on("cairo", when="+cairo") # required to support PNG depiction + depends_on("pango", when="+cairo") # custom cairo requires custom pango depends_on("eigen@3.0:") # required if using the language bindings depends_on("libxml2") # required to read/write CML files, XML formats depends_on("zlib") # required to support reading gzipped files @@ -49,6 +49,9 @@ class Openbabel(CMakePackage): depends_on("libsm") depends_on("uuid") + depends_on("maeparser", when="+maeparser") + depends_on("coordgen", when="+coordgen") + # Needed for Python 3.6 support patch("python-3.6-rtld-global.patch", when="@:2.4.1+python") @@ -71,8 +74,9 @@ class Openbabel(CMakePackage): args.append("-DPYTHON_BINDINGS=OFF") args.append(self.define_from_variant("BUILD_GUI", "gui")) - - args.append("-DWITH_MAEPARSER=OFF") # maeparser is currently broken + args.append(self.define_from_variant("ENABLE_OPENMP", "openmp")) + args.append(self.define_from_variant("WITH_MAEPARSER", "maeparser")) + args.append(self.define_from_variant("WITH_COORDGEN", "coordgen")) return args diff --git a/var/spack/repos/builtin/packages/rdkit/package.py b/var/spack/repos/builtin/packages/rdkit/package.py index 04933e3e76..d7e7daccbe 100644 --- a/var/spack/repos/builtin/packages/rdkit/package.py +++ b/var/spack/repos/builtin/packages/rdkit/package.py @@ -42,14 +42,19 @@ class Rdkit(CMakePackage): version("2020_09_1", sha256="ac105498be52ff77f7e9328c41d0e61a2318cac0789d6efc30f5f50dc78a992c") version("2020_03_6", sha256="a3663295a149aa0307ace6d1995094d0334180bc8f892fa325558a110154272b") + variant("freetype", default=True, description="Build freetype support") + depends_on("python@3:") depends_on("boost@1.53.0: +python +serialization +iostreams +system") depends_on("py-numpy") depends_on("sqlite") + depends_on("freetype", when="@2020_09_1: +freetype") + extends("python") def cmake_args(self): args = ["-DCMAKE_CXX_STANDARD=14", "-DRDK_INSTALL_INTREE=OFF"] + args.append(self.define_from_variant("RDK_BUILD_FREETYPE_SUPPORT", "freetype")) return args -- cgit v1.2.3-60-g2f50