summary refs log tree commit diff
path: root/gnu/packages/chemistry.scm
diff options
context:
space:
mode:
authorKei Kebreau <kkebreau@posteo.net>2018-07-18 14:11:16 -0400
committerKei Kebreau <kkebreau@posteo.net>2018-08-25 17:05:30 -0400
commit7d01ee66d46c30152f1a8c855c20042e376d207c (patch)
treeb2c846304c54020a46b1df55717fb5c7ae9b0c58 /gnu/packages/chemistry.scm
parent94e9d750a22e30459732d2ae14d71c5f3acabd91 (diff)
downloadguix-7d01ee66d46c30152f1a8c855c20042e376d207c.tar.gz
gnu: Add avogadro.
* gnu/packages/chemistry.scm (avogadro): New variable.
* gnu/packages/patches/avogadro-boost148.patch,
gnu/packages/patches/avogadro-eigen3-update.patch,
gnu/packages/patches/avogadro-python-eigen-lib.patch: New files.
* gnu/local.mk (dist_patch_DATA): Add them.
Diffstat (limited to 'gnu/packages/chemistry.scm')
-rw-r--r--gnu/packages/chemistry.scm80
1 files changed, 80 insertions, 0 deletions
diff --git a/gnu/packages/chemistry.scm b/gnu/packages/chemistry.scm
index 2d7cb7aad1..03120aaeee 100644
--- a/gnu/packages/chemistry.scm
+++ b/gnu/packages/chemistry.scm
@@ -23,16 +23,96 @@
   #:use-module (guix download)
   #:use-module (gnu packages)
   #:use-module (gnu packages algebra)
+  #:use-module (gnu packages boost)
   #:use-module (gnu packages compression)
+  #:use-module (gnu packages documentation)
+  #:use-module (gnu packages gl)
   #:use-module (gnu packages gv)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages xml)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
   #:use-module (guix build-system python))
 
+(define-public avogadro
+  (package
+    (name "avogadro")
+    (version "1.2.0")
+    (source (origin
+              (method url-fetch)
+              (uri (string-append "https://github.com/cryos/avogadro/archive/"
+                                  version ".tar.gz"))
+              (sha256
+               (base32
+                "02v4h6hi1m7ilv0apdf74a8l1cm6dxnxyqp0rdaidrp3i9pf6lv4"))
+              (file-name (string-append name "-" version ".tar.gz"))
+              (patches
+               (search-patches "avogadro-eigen3-update.patch"
+                               "avogadro-python-eigen-lib.patch"
+                               "avogadro-boost148.patch"))))
+    (build-system cmake-build-system)
+    (arguments
+     '(#:tests? #f
+       #:configure-flags
+       (list "-DENABLE_GLSL=ON"
+             (string-append "-DPYTHON_LIBRARIES="
+                            (assoc-ref %build-inputs "python")
+                            "/lib")
+             (string-append "-DPYTHON_INCLUDE_DIRS="
+                            (assoc-ref %build-inputs "python")
+                            "/include/python2.7"))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'patch-python-lib-path
+           (lambda* (#:key outputs #:allow-other-keys)
+             ;; This is necessary to install the Python module in the correct
+             ;; directory.
+             (substitute* "libavogadro/src/python/CMakeLists.txt"
+               (("^EXECUTE_PROCESS.*$") "")
+               (("^.*from sys import stdout.*$") "")
+               (("^.*OUTPUT_VARIABLE.*")
+                (string-append "set(PYTHON_LIB_PATH \""
+                               (assoc-ref outputs "out")
+                               "/lib/python2.7/site-packages\")")))
+             #t))
+         (add-after 'install 'wrap-program
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             ;; Make sure 'avogadro' runs with the correct PYTHONPATH.
+             (let* ((out (assoc-ref outputs "out")))
+               (setenv "PYTHONPATH"
+                       (string-append
+                        (assoc-ref outputs "out")
+                        "/lib/python2.7/site-packages:"
+                        (getenv "PYTHONPATH")))
+               (wrap-program (string-append out "/bin/avogadro")
+                 `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH")))))
+             #t)))))
+    (native-inputs
+     `(("doxygen" ,doxygen)
+       ("pkg-config" ,pkg-config)))
+    (inputs
+     `(("boost" ,boost)
+       ("eigen" ,eigen)
+       ("glew" ,glew)
+       ("openbabel" ,openbabel)
+       ("python" ,python-2)
+       ("python-numpy" ,python2-numpy)
+       ("python-pyqt" ,python2-pyqt-4)
+       ("python-sip" ,python2-sip)
+       ("qt" ,qt-4)
+       ("zlib" ,zlib)))
+    (home-page "https://avogadro.cc")
+    (synopsis "Advanced molecule editor")
+    (description
+     "Avogadro is an advanced molecule editor and visualizer designed for use
+in computational chemistry, molecular modeling, bioinformatics, materials
+science, and related areas.  It offers flexible high quality rendering and a
+powerful plugin architecture.")
+    (license license:gpl2+)))
+
 (define-public domainfinder
   (package
     (name "domainfinder")