all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Vincent Legoll <vincent.legoll@gmail.com>
To: 40691@debbugs.gnu.org
Cc: Vincent Legoll <vincent.legoll@gmail.com>
Subject: [bug#40691] [PATCH 3/3] gnu: Add gromacs.
Date: Mon,  4 May 2020 00:32:40 +0200	[thread overview]
Message-ID: <20200503223240.16408-3-vincent.legoll@gmail.com> (raw)
In-Reply-To: <20200503223240.16408-1-vincent.legoll@gmail.com>

* gnu/packages/chemistry.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/chemistry.scm                  | 86 +++++++++++++++++++++
 gnu/packages/patches/gromacs-tinyxml2.patch | 67 ++++++++++++++++
 3 files changed, 154 insertions(+)
 create mode 100644 gnu/packages/patches/gromacs-tinyxml2.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 3c9a10b6bc..827e186501 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1006,6 +1006,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/chemistry.scm b/gnu/packages/chemistry.scm
index 5b21e3309c..42368cb482 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -33,6 +33,7 @@
   #:use-module (gnu packages compression)
   #:use-module (gnu packages documentation)
   #:use-module (gnu packages gl)
+  #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gv)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages pkg-config)
@@ -336,6 +337,91 @@ optionally velocities and the H-matrix.  Coordinates and velocities are
 stored with user-specified precision.")
     (license license:bsd-3)))
 
+(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"))
+              ;; Our version of tinyxml2 is far newer than the bundled one and
+              ;; require fixing `testutils' code. See patch header for more info
+              (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)
+             ;; Still bundled: part of gromacs, source behind registration
+             ;; but free software anyways
+             ;;(delete-file-recursively "src/external/vmd_molfile")
+             ;; Still bundled: threads-based OpenMPI-compatible fallback
+             ;; designed to be bundled like that
+             ;;(delete-file-recursively "src/external/thread_mpi")
+             ;; Unbundling
+             (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/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 openbabel
   (package
     (name "openbabel")
diff --git a/gnu/packages/patches/gromacs-tinyxml2.patch b/gnu/packages/patches/gromacs-tinyxml2.patch
new file mode 100644
index 0000000000..cc7d7459a8
--- /dev/null
+++ b/gnu/packages/patches/gromacs-tinyxml2.patch
@@ -0,0 +1,67 @@
+Unbundling tinyxml2 from gromacs and using our own, which is newer, broke gromacs
+build.
+
+This patch fixes three issues:
+
+- cmake now errors out if using multiple target_link_libraries with mixed styles
+  of signatures.
+
+- Error handling API changed, fix the testutils/refdata_xml.cpp code by using the
+  new API: document.ErrorStr() & tinyxml2::XML_SUCCESS.
+
+Those fixes will be submitted for inclusion to upstream, but may not be suitable
+there as long as they still keep the old version bundled.
+
+First hunk has already been requested for merging. Third is in discussion. Second
+will only be sent if third is OK'ed.
+
+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));
+     }
-- 
2.26.0





  parent reply	other threads:[~2020-05-03 22:34 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-17 22:22 [bug#40691] [PATCH 0/1] gnu: Add gromacs Vincent Legoll
2020-04-17 22:24 ` [bug#40691] [PATCH] " Vincent Legoll
2020-04-17 22:48 ` [bug#40691] gromacs - WIP, submitted Vincent Legoll
2020-04-19 22:19 ` [bug#40691] [PATCH 0/1] gnu: Add gromacs Ludovic Courtès
2020-04-20 22:15   ` [bug#40691] [PATCH v2 1/1] " Vincent Legoll
2020-04-22 15:38     ` Ludovic Courtès
2020-04-23 13:07       ` [bug#40691] [PATCH v3 " Vincent Legoll
2020-04-23 19:52         ` Ludovic Courtès
2020-05-01 22:30           ` Vincent Legoll
2020-05-02 13:35             ` Ludovic Courtès
2020-05-02 13:46           ` [bug#40691] [PATCH v4 0/3] gnu: Add gromacs, tng & lmfit Vincent Legoll
2020-05-03 10:39             ` Ludovic Courtès
2020-05-03 22:31               ` [bug#40691] [PATCH v6 " Vincent Legoll
2020-05-04  8:40                 ` bug#40691: " Ludovic Courtès
2020-05-02 13:48 ` [bug#40691] [PATCH 1/3] gnu: Add tng Vincent Legoll
2020-05-02 13:48   ` [bug#40691] [PATCH 2/3] gnu: Add lmfit Vincent Legoll
2020-05-02 13:48   ` [bug#40691] [PATCH 3/3] gnu: Add gromacs Vincent Legoll
2020-05-02 13:53   ` [bug#40691] [PATCH v4 0/3]: " Vincent Legoll
2020-05-02 16:43 ` [bug#40691] [PATCH 1/3] gnu: Add tng Vincent Legoll
2020-05-02 16:43   ` [bug#40691] [PATCH 2/3] gnu: Add lmfit Vincent Legoll
2020-05-03 10:43     ` Ludovic Courtès
2020-05-02 16:43   ` [bug#40691] [PATCH 3/3] gnu: Add gromacs Vincent Legoll
2020-05-03 10:46     ` Ludovic Courtès
2020-05-03 10:41   ` [bug#40691] [PATCH 1/3] gnu: Add tng Ludovic Courtès
2020-05-03 22:32 ` Vincent Legoll
2020-05-03 22:32   ` [bug#40691] [PATCH 2/3] gnu: Add lmfit Vincent Legoll
2020-05-03 22:32   ` Vincent Legoll [this message]
2020-05-03 22:39     ` [bug#40691] [PATCH 3/3] gnu: Add gromacs Vincent Legoll
2020-05-03 22:39 ` [bug#40691] [PATCH] " Vincent Legoll
2020-05-05 21:27 ` [bug#40691] Upstream patches are being merged Vincent Legoll

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200503223240.16408-3-vincent.legoll@gmail.com \
    --to=vincent.legoll@gmail.com \
    --cc=40691@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.