From 528a8359ff2692504d580d6fdb7b7d50d923b61a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dani=20Beltr=C3=A1n?= <daniel.beltran@irbbarcelona.org>
Date: Fri, 9 Jun 2023 17:34:16 +0200
Subject: [PATCH] add/update spack packages for several BioBBs and their
 dependencies

---
 packages/acpype/.gitkeep                     |  0
 packages/acpype/package.py                   | 21 ++++++
 packages/ambertools/.gitkeep                 |  0
 packages/ambertools/package.py               | 79 ++++++++++++++++++++
 packages/biobb-analysis/.gitkeep             |  0
 packages/biobb-analysis/package.py           | 21 ++++++
 packages/biobb-chemistry/.gitkeep            |  0
 packages/biobb-chemistry/package.py          | 22 ++++++
 packages/biobb-common/package.py             | 16 ++--
 packages/biobb-gromacs/package.py            | 17 +----
 packages/biobb-io/.gitkeep                   |  0
 packages/biobb-io/package.py                 | 16 ++++
 packages/biobb-model/.gitkeep                |  0
 packages/biobb-model/package.py              | 17 +++++
 packages/biobb-structure-checking/.gitkeep   |  0
 packages/biobb-structure-checking/package.py | 20 +++++
 packages/biobb-structure-utils/.gitkeep      |  0
 packages/biobb-structure-utils/package.py    | 17 +++++
 packages/nglview/.gitkeep                    |  0
 packages/nglview/package.py                  | 23 ++++++
 packages/simpletraj/.gitkeep                 |  0
 packages/simpletraj/package.py               | 19 +++++
 spack.yaml                                   | 12 ++-
 23 files changed, 274 insertions(+), 26 deletions(-)
 create mode 100644 packages/acpype/.gitkeep
 create mode 100644 packages/acpype/package.py
 create mode 100644 packages/ambertools/.gitkeep
 create mode 100644 packages/ambertools/package.py
 create mode 100644 packages/biobb-analysis/.gitkeep
 create mode 100644 packages/biobb-analysis/package.py
 create mode 100644 packages/biobb-chemistry/.gitkeep
 create mode 100644 packages/biobb-chemistry/package.py
 create mode 100644 packages/biobb-io/.gitkeep
 create mode 100644 packages/biobb-io/package.py
 create mode 100644 packages/biobb-model/.gitkeep
 create mode 100644 packages/biobb-model/package.py
 create mode 100644 packages/biobb-structure-checking/.gitkeep
 create mode 100644 packages/biobb-structure-checking/package.py
 create mode 100644 packages/biobb-structure-utils/.gitkeep
 create mode 100644 packages/biobb-structure-utils/package.py
 create mode 100644 packages/nglview/.gitkeep
 create mode 100644 packages/nglview/package.py
 create mode 100644 packages/simpletraj/.gitkeep
 create mode 100644 packages/simpletraj/package.py

diff --git a/packages/acpype/.gitkeep b/packages/acpype/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/acpype/package.py b/packages/acpype/package.py
new file mode 100644
index 00000000..5b52b2d7
--- /dev/null
+++ b/packages/acpype/package.py
@@ -0,0 +1,21 @@
+from spack import *
+
+class Acpype(PythonPackage):
+    """A tool based in Python to use Antechamber to generate topologies for chemical 
+    compounds and to interface with others python applications like CCPN and ARIA"""
+
+    # Homepage and download url
+    homepage = "https://github.com/alanwilter/acpype"
+    git = 'https://github.com/alanwilter/acpype.git'
+
+    # Set the gitlab accounts of this package maintainers
+    maintainers = ['dbeltran']
+
+    # Versions
+    version('2022.7.21', branch='master')
+
+    # Dependencies
+    depends_on('python@3.8:', type=('build', 'run'))
+    depends_on('ambertools')
+    depends_on('openbabel')
+    depends_on('py-poetry-core')
diff --git a/packages/ambertools/.gitkeep b/packages/ambertools/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/ambertools/package.py b/packages/ambertools/package.py
new file mode 100644
index 00000000..8f479cf5
--- /dev/null
+++ b/packages/ambertools/package.py
@@ -0,0 +1,79 @@
+from spack import *
+
+class Ambertools (CMakePackage):
+    """AmberTools is a free, useful standalone package and a prerequisite for installing Amber itself.
+    The AmberTools suite is free of charge, and its components are mostly released under the GNU General Public License (GPL).
+    A few components are included that are in the public domain or which have other, open-source, licenses.
+    The libsander and libpbsa libraries use the LGPL license."""
+
+    # Set the homepage and download url
+    homepage = "https://ambermd.org/AmberTools.php"
+    url      = "https://ambermd.org/downloads/AmberTools22jlmrcc.tar.bz2"
+
+    # Set the gitlab accounts of this package maintainers
+    maintainers = ['dbeltran', 'elmath']
+
+    version('22jlmrcc', sha256='1571d4e0f7d45b2a71dce5999fa875aea8c90ee219eb218d7916bf30ea229121')
+
+    # Dependencies
+    depends_on("flex",                      type="build") # This is necessary for sure (experimentally tested)
+    depends_on("bison",                     type="build") # This is necessary for sure (experimentally tested)
+    depends_on("tcsh",                      type="build")
+    depends_on("zlib",                      type=("build", "run"))
+    depends_on("bzip2",                     type=("build", "run"))
+    depends_on("blas",                      type=("build", "run"))
+    depends_on("lapack",                    type=("build", "run"))
+    depends_on("arpack-ng",                 type=("build", "run"))
+    depends_on("netcdf-c",                  type=("build", "run"))
+    depends_on("netcdf-fortran",            type=("build", "run"))
+    depends_on("fftw",                      type=("build", "run"))
+    depends_on("readline",                  type=("build", "run"))
+    depends_on("netlib-xblas~plain_blas",   type=("build", "run"))
+    # specific variants needed for boost - from the build log "Could NOT find Boost (missing: thread system program_options iostreams regex timer chrono filesystem graph)"
+    depends_on("boost+thread+system+program_options+iostreams+regex+timer+chrono+filesystem+graph", type=("build", "run"))
+
+    # Python dependencies
+    # WARNING: If a python 3.8 version is already installed in spack then the '+tkinter' variant makes spack ignore the version
+    # WARNING: Spack may try to install the preferred python version (i.e. python 3.10.8)
+    # WARNING: The soultion is uninstall python and reinstall with this variant
+    depends_on('python@3.8: +tkinter',      type=('build', 'run'))
+    depends_on("py-numpy",                  type=("build", "run"))
+    depends_on("py-matplotlib",             type=("build", "run"))
+    depends_on("py-scipy",                  type=("build", "run"))
+
+    def cmake_args(self):
+        # Translated from ambertools build/run_cmake script
+        # We also add the TRUST_SYSTEM_LIBS argument that is mentioned in the ambertools CMake guide
+        #   https://ambermd.org/pmwiki/pmwiki.php/Main/CMake-Guide-to-Options
+        args = [
+            self.define("COMPILER", "GNU"),
+            self.define("MPI", False),
+            self.define("CUDA", False),
+            self.define("INSTALL_TESTS", True),
+            self.define("DOWNLOAD_MINICONDA", False),
+            self.define("TRUST_SYSTEM_LIBS", True),
+            # This is to avoid the x11 (X11_Xext_LIB) error
+            # It is equivalent to the '-noX11' flag accoridng to the docs:
+            # https://ambermd.org/pmwiki/pmwiki.php/Main/CMake-Common-Options
+            self.define("BUILD_GUI", False)
+        ]
+        return args
+
+    def setup_run_environment(self, env):
+        env.set("AMBER_PREFIX", self.prefix)
+        env.set("AMBERHOME", self.prefix)
+
+    def setup_build_environment(self, env):
+        env.set("AMBER_PREFIX", self.prefix)
+        env.set("AMBERHOME", self.prefix)
+
+    @run_after('install')
+    @on_package_attributes(run_tests=True)
+    def check_install(self):
+        make("test.serial")
+
+    # temporarily copy netcdf.h header file to netcdf-fortran/include to pass the Ambertools cmake check (quickest fix, will probably cause problems, needs to change)
+    @run_before("cmake")
+    def fix_check(self):
+        cp = Executable("cp")
+        cp(self.spec["netcdf-c"].headers.directories[0]+"/netcdf.h", self.spec["netcdf-fortran"].headers.directories[0])
diff --git a/packages/biobb-analysis/.gitkeep b/packages/biobb-analysis/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/biobb-analysis/package.py b/packages/biobb-analysis/package.py
new file mode 100644
index 00000000..68b45f4e
--- /dev/null
+++ b/packages/biobb-analysis/package.py
@@ -0,0 +1,21 @@
+from spack import *
+
+class BiobbAnalysis(PythonPackage):
+    """Biobb_analysis is the Biobb module collection to perform analysis 
+    of molecular dynamics simulations"""
+
+    # Homepage and download url
+    homepage = "https://github.com/bioexcel/biobb_analysis"
+    git = 'https://github.com/bioexcel/biobb_analysis.git'
+
+    # Set the gitlab accounts of this package maintainers
+    maintainers = ['dbeltran']
+
+    # Versions
+    version('4.0.1', branch='master')
+
+    # Dependencies
+    depends_on('python@3.8:', type=('build', 'run'))
+    depends_on('biobb-common')
+    depends_on('gromacs')
+    depends_on('ambertools')
diff --git a/packages/biobb-chemistry/.gitkeep b/packages/biobb-chemistry/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/biobb-chemistry/package.py b/packages/biobb-chemistry/package.py
new file mode 100644
index 00000000..323ec740
--- /dev/null
+++ b/packages/biobb-chemistry/package.py
@@ -0,0 +1,22 @@
+from spack import *
+
+class BiobbChemistry(PythonPackage):
+    """Biobb_chemistry is the Biobb module collection to perform chemistry 
+    over molecular dynamics simulations."""
+
+    # Homepage and download url
+    homepage = "https://github.com/bioexcel/biobb_chemistry"
+    git = 'https://github.com/bioexcel/biobb_chemistry.git'
+
+    # Set the gitlab accounts of this package maintainers
+    maintainers = ['dbeltran']
+
+    # Versions
+    version('4.0.0', branch='master')
+
+    # Dependencies
+    depends_on('python@3.8:', type=('build', 'run'))
+    depends_on('biobb-common')
+    depends_on('openbabel')
+    depends_on('ambertools')
+    depends_on('acpype')
diff --git a/packages/biobb-common/package.py b/packages/biobb-common/package.py
index 6a5aa81f..f9996ae5 100644
--- a/packages/biobb-common/package.py
+++ b/packages/biobb-common/package.py
@@ -1,9 +1,3 @@
-# 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 import *
 
 class BiobbCommon(PythonPackage):
@@ -11,17 +5,17 @@ class BiobbCommon(PythonPackage):
 
     # Homepage and download url
     homepage = "https://github.com/bioexcel/biobb_common"
-    url      = "https://github.com/bioexcel/biobb_common/archive/refs/tags/v3.8.1.tar.gz"
+    git = 'https://github.com/bioexcel/biobb_common.git'
 
+    # Set the gitlab accounts of this package maintainers
     maintainers = ['dbeltran']
 
     # Versions
-    version('3.8.1', sha256='b6c939c1445ea2f8282e491e0414cc15f4934466ca24ecd77e24cef2e7df49e4')
+    version('4.0.0', branch='master')
 
     # Dependencies
-    depends_on('python@3.8:')
-    depends_on('py-setuptools', type=('build'))
+    depends_on('py-setuptools')
+    depends_on('python@3.8:', type=('build', 'run'))
     depends_on('py-pyyaml', type=('build', 'run'))
     depends_on('py-requests', type=('build', 'run'))
     depends_on('py-biopython@1.78:1.80', type=('build', 'run'))
-
diff --git a/packages/biobb-gromacs/package.py b/packages/biobb-gromacs/package.py
index c99d49af..5e7341bd 100644
--- a/packages/biobb-gromacs/package.py
+++ b/packages/biobb-gromacs/package.py
@@ -1,9 +1,3 @@
-# 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 import *
 
 class BiobbGromacs(PythonPackage):
@@ -12,15 +6,12 @@ class BiobbGromacs(PythonPackage):
 
     # Homepage and download url
     homepage = "https://github.com/bioexcel/biobb_gromacs"
-    url      = "https://github.com/bioexcel/biobb_gromacs/archive/refs/tags/v3.8.1.tar.gz"
-
-    maintainers = ['dbeltran']
+    git = 'https://github.com/bioexcel/biobb_gromacs.git'
 
     # Versions
-    version('3.8.1', sha256='6da49b691b14a8bcf7ffca08c898fe9affd258ca2f8c7be4981df840a6907efa')
+    version('4.0.0', branch='master')
 
     # Dependencies
-    depends_on('python@3.8:')
-    depends_on('py-setuptools', type=('build'))
-    depends_on('biobb-common@3.8.1', type=('build', 'run'), when='@3.8.1')
+    depends_on('python@3.8:', type=('build', 'run'))
+    depends_on('biobb-common')
     depends_on('gromacs')
diff --git a/packages/biobb-io/.gitkeep b/packages/biobb-io/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/biobb-io/package.py b/packages/biobb-io/package.py
new file mode 100644
index 00000000..1b6f1a44
--- /dev/null
+++ b/packages/biobb-io/package.py
@@ -0,0 +1,16 @@
+from spack import *
+
+class BiobbIo(PythonPackage):
+    """Biobb_io is the Biobb module collection to fetch data to be
+    consumed by the rest of the Biobb building blocks"""
+
+    # Homepage and download url
+    homepage = "https://github.com/bioexcel/biobb_io"
+    git = 'https://github.com/bioexcel/biobb_io.git'
+
+    # Versions
+    version('4.0.0', branch='master')
+
+    # Dependencies
+    depends_on('biobb-common')
+    depends_on('python@3.8:', type=('build', 'run'))
diff --git a/packages/biobb-model/.gitkeep b/packages/biobb-model/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/biobb-model/package.py b/packages/biobb-model/package.py
new file mode 100644
index 00000000..999ce8fa
--- /dev/null
+++ b/packages/biobb-model/package.py
@@ -0,0 +1,17 @@
+from spack import *
+
+class BiobbModel(PythonPackage):
+    """Biobb_model is the Biobb module collection to check and model 3d structures,
+    create mutations or reconstruct missing atoms"""
+
+    # Homepage and download url
+    homepage = "https://github.com/bioexcel/biobb_model"
+    git = 'https://github.com/bioexcel/biobb_model.git'
+
+    # Versions
+    version('4.0.0', branch='master')
+
+    # Dependencies
+    depends_on('python@3.8:', type=('build', 'run'))
+    depends_on('biobb-common')
+    depends_on('biobb-structure-checking')
diff --git a/packages/biobb-structure-checking/.gitkeep b/packages/biobb-structure-checking/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/biobb-structure-checking/package.py b/packages/biobb-structure-checking/package.py
new file mode 100644
index 00000000..4719d65f
--- /dev/null
+++ b/packages/biobb-structure-checking/package.py
@@ -0,0 +1,20 @@
+from spack import *
+
+class BiobbStructureChecking(PythonPackage):
+    """Biobb_structure_checking performs a checking of the quality of a 
+    3D structure intended to facilitate the setup of molecular dynamics 
+    simulation of protein or nucleic acids systems"""
+
+    # Homepage and download url
+    homepage = "https://github.com/bioexcel/biobb_structure_checking"
+    git = 'https://github.com/bioexcel/biobb_structure_checking.git'
+
+    # Versions
+    version('3.12.1', branch='master')
+
+    # Dependencies
+    depends_on('py-setuptools')
+    depends_on('python@3.8:', type=('build', 'run'))
+    depends_on('py-psutil', type=('build', 'run'))
+    depends_on('py-numpy', type=('build', 'run'))
+    depends_on('py-biopython@1.78:1.80', type=('build', 'run'))
diff --git a/packages/biobb-structure-utils/.gitkeep b/packages/biobb-structure-utils/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/biobb-structure-utils/package.py b/packages/biobb-structure-utils/package.py
new file mode 100644
index 00000000..b9ed8b57
--- /dev/null
+++ b/packages/biobb-structure-utils/package.py
@@ -0,0 +1,17 @@
+from spack import *
+
+class BiobbStructureUtils(PythonPackage):
+    """Biobb_structure_utils is the Biobb module collection to modify 
+    or extract information from a PDB structure file."""
+
+    # Homepage and download url
+    homepage = "https://github.com/bioexcel/biobb_structure_utils"
+    git = 'https://github.com/bioexcel/biobb_structure_utils.git'
+
+    # Versions
+    version('4.0.0', branch='master')
+
+    # Dependencies
+    depends_on('python@3.8:', type=('build', 'run'))
+    depends_on('biobb-common')
+    depends_on('biobb-structure-checking')
diff --git a/packages/nglview/.gitkeep b/packages/nglview/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/nglview/package.py b/packages/nglview/package.py
new file mode 100644
index 00000000..fda73565
--- /dev/null
+++ b/packages/nglview/package.py
@@ -0,0 +1,23 @@
+from spack import *
+
+class Nglview(PythonPackage):
+    """An IPython/Jupyter widget to interactively view molecular structures and trajectories. 
+    Utilizes the embeddable NGL Viewer for rendering."""
+
+    # Homepage and download url
+    homepage = "https://github.com/nglviewer/nglview"
+    git = 'https://github.com/nglviewer/nglview.git'
+
+    # Set the gitlab accounts of this package maintainers
+    maintainers = ['dbeltran']
+
+    # Versions
+    version('3.0.4', branch='master')
+
+    # Dependencies
+    depends_on('python@3.8:', type=('build', 'run'))
+    depends_on('py-setuptools')
+    depends_on('py-jupyter-packaging')
+    depends_on('py-versioneer')
+    depends_on('py-numpy', type=('run'))
+    depends_on('py-ipywidgets', type=('run'))
\ No newline at end of file
diff --git a/packages/simpletraj/.gitkeep b/packages/simpletraj/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/packages/simpletraj/package.py b/packages/simpletraj/package.py
new file mode 100644
index 00000000..373665bf
--- /dev/null
+++ b/packages/simpletraj/package.py
@@ -0,0 +1,19 @@
+from spack import *
+
+class Simpletraj(PythonPackage):
+    """Lightweight coordinate-only trajectory reader based on code from GROMACS, MDAnalysis and VMD."""
+
+    # Homepage and download url
+    homepage = "https://github.com/arose/simpletraj"
+    git = 'https://github.com/arose/simpletraj.git'
+
+    # Set the gitlab accounts of this package maintainers
+    maintainers = ['dbeltran']
+
+    # Versions
+    version('0.3', branch='master')
+
+    # Dependencies
+    depends_on('python@3.8:', type=('build', 'run'))
+    depends_on('py-setuptools')
+    depends_on('py-numpy')
diff --git a/spack.yaml b/spack.yaml
index 08ff558d..37239726 100644
--- a/spack.yaml
+++ b/spack.yaml
@@ -49,8 +49,16 @@ spack:
     - py-snudda@1.4.0
     - py-pyunicore@0.14.1
     - py-neuror@1.4.2
-    - biobb-common@3.8.1
-    - biobb-gromacs@3.8.1
+    - biobb-analysis@4.0.1
+    - biobb-chemistry@4.0.0
+    - biobb-common@4.0.0
+    - biobb-gromacs@4.0.0
+    - biobb-io@4.0.0
+    - biobb-model@4.0.0
+    - biobb-structure-checking@3.12.1
+    - biobb-structure-utils@4.0.0
+    - nglview@3.0.4
+    - simpletraj@0.3
     - apbs@3.4.0
     - py-pdb2pqr@3.5.2
     - sda@7.3.3d
-- 
GitLab