diff mbox series

[bug#40691,3/3] gnu: Add gromacs.

Message ID 20200502164325.2028-3-vincent.legoll@gmail.com
State Accepted
Headers show
Series [bug#40691,1/3] gnu: Add tng. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch success View Laminar job

Commit Message

Vincent Legoll May 2, 2020, 4:43 p.m. UTC
* gnu/packages/bioinformatics.scm (gromacs): New variable.
* gnu/packages/patches/gromacs-tinyxml2.patch: New file...
* gnu/local.mk (dist_patch_DATA): ...add it here.
---
 gnu/local.mk                                |  1 +
 gnu/packages/bioinformatics.scm             | 84 +++++++++++++++++++++
 gnu/packages/patches/gromacs-tinyxml2.patch | 50 ++++++++++++
 3 files changed, 135 insertions(+)
 create mode 100644 gnu/packages/patches/gromacs-tinyxml2.patch

Comments

Ludovic Courtès May 3, 2020, 10:46 a.m. UTC | #1
Vincent Legoll <vincent.legoll@gmail.com> skribis:

> * gnu/packages/bioinformatics.scm (gromacs): New variable.
> * gnu/packages/patches/gromacs-tinyxml2.patch: New file...
> * gnu/local.mk (dist_patch_DATA): ...add it here.

I wonder if chemistry.scm would be more appropriate, WDYT?

> --- /dev/null
> +++ b/gnu/packages/patches/gromacs-tinyxml2.patch
> @@ -0,0 +1,50 @@

Could you add one or two sentences at the top of the file explaining
what it does and what its upstream status is?  It’s not obvious why the
reference data needs to be adjusted as a consequence of unbundling
tinyxml2.

That’s it!

Could you send updated patches?  I’ll be happy to commit them.  :-)

Thank you for all the work!

Ludo’.
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 812253b192..70e8879284 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1004,6 +1004,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/gpsbabel-qstring.patch     		\
   %D%/packages/patches/grantlee-merge-theme-dirs.patch		\
   %D%/packages/patches/grep-timing-sensitive-test.patch		\
+  %D%/packages/patches/gromacs-tinyxml2.patch			\
   %D%/packages/patches/groovy-add-exceptionutilsgenerator.patch	\
   %D%/packages/patches/grub-efi-fat-serial-number.patch		\
   %D%/packages/patches/gsl-test-i686.patch			\
diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 1e3e145500..13d9c16c10 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -80,6 +80,7 @@ 
   #:use-module (gnu packages golang)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages graph)
+  #:use-module (gnu packages graphviz)
   #:use-module (gnu packages groff)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages guile)
@@ -845,6 +846,89 @@  minimization and curve fitting.  It is mature code, based on decades-old
 algorithms from the FORTRAN library MINPACK.")
     (license license:bsd-2)))
 
+(define-public gromacs
+  (package
+    (name "gromacs")
+    (version "2020.2")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "http://ftp.gromacs.org/pub/gromacs/gromacs-"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "1wyjgcdl30wy4hy6jvi9lkq53bqs9fgfq6fri52dhnb3c76y8rbl"))
+              (patches (search-patches "gromacs-tinyxml2.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     `(#:configure-flags
+       (list "-DGMX_DEVELOPER_BUILD=on" ; Needed to run tests
+             ; Unbundling
+             "-DGMX_USE_LMFIT=EXTERNAL"
+             "-DGMX_BUILD_OWN_FFTW=off"
+             "-DGMX_EXTERNAL_BLAS=on"
+             "-DGMX_EXTERNAL_LAPACK=on"
+             "-DGMX_EXTERNAL_TNG=on"
+             "-DGMX_EXTERNAL_ZLIB=on"
+             "-DGMX_EXTERNAL_TINYXML2=on"
+             (string-append "-DTinyXML2_DIR="
+                            (assoc-ref %build-inputs "tinyxml2"))
+             ;; Workaround for cmake/FindSphinx.cmake version parsing that does
+             ;; not understand the guix-wrapped `sphinx-build --version' answer
+             (string-append "-DSPHINX_EXECUTABLE_VERSION="
+                            ,(package-version python-sphinx)))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fixes
+           (lambda* (#:key inputs #:allow-other-keys)
+             ; The following has been submitted upstream
+             (substitute* "src/testutils/CMakeLists.txt"
+               (("target_link_libraries\\(testutils \\$")
+                "target_link_libraries(testutils PRIVATE $"))
+             ; Unbundling
+;             (delete-file-recursively "src/external/vmd_molfile")
+             (delete-file-recursively "src/external/lmfit")
+             (delete-file-recursively "src/external/clFFT")
+             (delete-file-recursively "src/external/fftpack")
+             (delete-file-recursively "src/external/build-fftw")
+;             (delete-file-recursively "src/external/thread_mpi")
+             (delete-file-recursively "src/external/tng_io")
+             (delete-file-recursively "src/external/tinyxml2")
+             (delete-file-recursively "src/external/googletest")
+             (copy-recursively (assoc-ref inputs "googletest-source")
+                               "src/external/googletest")
+             ;; This test warns about the build host hardware, disable
+             (substitute* "src/gromacs/hardware/tests/hardwaretopology.cpp"
+               (("TEST\\(HardwareTopologyTest, HwlocExecute\\)")
+                "void __guix_disabled()"))
+             #t)))))
+    (native-inputs
+     `(("doxygen" ,doxygen)
+       ("googletest-source" ,(package-source googletest))
+       ("graphviz" ,graphviz)
+       ("pkg-config" ,pkg-config)
+       ("python" ,python)
+       ("python-pygments" ,python-pygments)
+       ("python-sphinx" ,python-sphinx)))
+    (inputs
+     `(("fftwf" ,fftwf)
+       ("hwloc" ,hwloc-2 "lib")
+       ("lmfit" ,lmfit)
+       ("openblas" ,openblas)
+       ("perl" ,perl)
+       ("tinyxml2" ,tinyxml2)
+       ("tng" ,tng)))
+    (home-page "http://www.gromacs.org/")
+    (synopsis "Molecular dynamics software package")
+    (description "GROMACS is a versatile package to perform molecular dynamics,
+i.e. simulate the Newtonian equations of motion for systems with hundreds to
+millions of particles.  It is primarily designed for biochemical molecules like
+proteins, lipids and nucleic acids that have a lot of complicated bonded
+interactions, but since GROMACS is extremely fast at calculating the nonbonded
+interactions (that usually dominate simulations) many groups are also using it
+for research on non-biological systems, e.g. polymers.  GROMACS supports all the
+usual algorithms you expect from a modern molecular dynamics implementation.")
+    (license license:lgpl2.1+)))
+
 (define-public python-pybedtools
   (package
     (name "python-pybedtools")
diff --git a/gnu/packages/patches/gromacs-tinyxml2.patch b/gnu/packages/patches/gromacs-tinyxml2.patch
new file mode 100644
index 0000000000..3dace595d2
--- /dev/null
+++ b/gnu/packages/patches/gromacs-tinyxml2.patch
@@ -0,0 +1,50 @@ 
+diff -ruN gromacs-2020.2/src/testutils/CMakeLists.txt gromacs-2020.2-fixed/src/testutils/CMakeLists.txt
+--- gromacs-2020.2/src/testutils/CMakeLists.txt 2020-04-30 18:33:44.000000000 +0200
++++ gromacs-2020.2-fixed/src/testutils/CMakeLists.txt   2020-05-01 22:52:16.356000000 +0200
+@@ -73,7 +73,7 @@
+ 
+ if(HAVE_TINYXML2)
+     include_directories(SYSTEM ${TinyXML2_INCLUDE_DIR})
+-    target_link_libraries(testutils ${TinyXML2_LIBRARIES})
++    target_link_libraries(testutils PRIVATE ${TinyXML2_LIBRARIES})
+ else()
+     include_directories(BEFORE SYSTEM "../external/tinyxml2")
+ endif()
+diff -ruN gromacs-2020.2/src/testutils/refdata_xml.cpp gromacs-2020.2-fixed/src/testutils/refdata_xml.cpp
+--- gromacs-2020.2/src/testutils/refdata_xml.cpp        2020-04-30 18:33:44.000000000 +0200
++++ gromacs-2020.2-fixed/src/testutils/refdata_xml.cpp  2020-05-01 23:17:09.556000000 +0200
+@@ -206,21 +206,12 @@
+     document.LoadFile(path.c_str());
+     if (document.Error())
+     {
+-        const char* errorStr1 = document.GetErrorStr1();
+-        const char* errorStr2 = document.GetErrorStr2();
++        const char* errorStr = document.ErrorStr();
+         std::string errorString("Error was ");
+-        if (errorStr1)
+-        {
+-            errorString += errorStr1;
+-        }
+-        if (errorStr2)
+-        {
+-            errorString += errorStr2;
+-        }
+-        if (!errorStr1 && !errorStr2)
+-        {
++        if (errorStr)
++            errorString += errorStr;
++        else
+             errorString += "not specified.";
+-        }
+         GMX_THROW(TestException("Reference data not parsed successfully: " + path + "\n."
+                                 + errorString + "\n"));
+     }
+@@ -371,7 +362,7 @@
+     XMLElementPtr rootElement = createRootElement(&document);
+     createChildElements(rootElement, rootEntry);
+ 
+-    if (document.SaveFile(path.c_str()) != tinyxml2::XML_NO_ERROR)
++    if (document.SaveFile(path.c_str()) != tinyxml2::XML_SUCCESS)
+     {
+         GMX_THROW(TestException("Reference data saving failed in " + path));
+     }