1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
3 ;;; Copyright © 2018, 2021 Kei Kebreau <kkebreau@posteo.net>
4 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
7 ;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
9 ;;; This file is part of GNU Guix.
11 ;;; GNU Guix is free software; you can redistribute it and/or modify it
12 ;;; under the terms of the GNU General Public License as published by
13 ;;; the Free Software Foundation; either version 3 of the License, or (at
14 ;;; your option) any later version.
16 ;;; GNU Guix is distributed in the hope that it will be useful, but
17 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 ;;; GNU General Public License for more details.
21 ;;; You should have received a copy of the GNU General Public License
22 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24 (define-module (gnu packages chemistry)
25 #:use-module (guix packages)
26 #:use-module (guix utils)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix download)
29 #:use-module (guix git-download)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages algebra)
32 #:use-module (gnu packages autotools)
33 #:use-module (gnu packages backup)
34 #:use-module (gnu packages boost)
35 #:use-module (gnu packages check)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages documentation)
38 #:use-module (gnu packages gl)
39 #:use-module (gnu packages graphviz)
40 #:use-module (gnu packages gv)
41 #:use-module (gnu packages maths)
42 #:use-module (gnu packages mpi)
43 #:use-module (gnu packages perl)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages python)
46 #:use-module (gnu packages python-xyz)
47 #:use-module (gnu packages qt)
48 #:use-module (gnu packages serialization)
49 #:use-module (gnu packages sphinx)
50 #:use-module (gnu packages xml)
51 #:use-module (guix build-system cmake)
52 #:use-module (guix build-system gnu)
53 #:use-module (guix build-system python))
55 (define-public avogadrolibs
63 (url "https://github.com/OpenChemistry/avogadrolibs")
66 (base32 "1xivga626n5acnmwmym8svl0pdri8hkp59czf04ri2zflnviyh39"))
67 (file-name (git-file-name name version))))
68 (build-system cmake-build-system)
71 ("mmtf-cpp" ,mmtf-cpp)
73 ("googletest" ,googletest)
74 ("pkg-config" ,pkg-config)
75 ("pybind11" ,pybind11)))
78 ("libarchive" ,libarchive)
80 ("molequeue" ,molequeue)
85 '(#:configure-flags (list "-DENABLE_TESTING=ON"
86 (string-append "-DSPGLIB_INCLUDE_DIR="
87 (assoc-ref %build-inputs "spglib")
89 (home-page "https://www.openchemistry.org/projects/avogadro2/")
90 (synopsis "Libraries for chemistry, bioinformatics, and related areas")
92 "Avogadro libraries provide 3D rendering, visualization, analysis and data
93 processing useful in computational chemistry, molecular modeling,
94 bioinformatics, materials science, and related areas.")
95 (license license:bsd-3)))
97 (define-public avogadro2
105 (url "https://github.com/OpenChemistry/avogadroapp")
109 "1z3pjlwja778a1dmvx9aqz2hlw5q9g3kqxhm9slz08452600jsv7"))
110 (file-name (git-file-name name version))))
111 (build-system cmake-build-system)
114 ("pkg-config" ,pkg-config)))
116 `(("avogadrolibs" ,avogadrolibs)
118 ("molequeue" ,molequeue)
120 ;; TODO: Enable tests with "-DENABLE_TESTING" configure flag.
123 (home-page "https://www.openchemistry.org/projects/avogadro2/")
124 (synopsis "Advanced molecule editor")
126 "Avogadro 2 is an advanced molecule editor and visualizer designed for use
127 in computational chemistry, molecular modeling, bioinformatics, materials
128 science, and related areas. It offers flexible high quality rendering and a
129 powerful plugin architecture.")
130 (license license:bsd-3)))
132 (define-public domainfinder
134 (name "domainfinder")
139 (uri (string-append "https://bitbucket.org/khinsen/"
140 "domainfinder/downloads/DomainFinder-"
144 "1z26lsyf7xwnzwjvimmbla7ckipx6p734w7y0jk2a2fzci8fkdcr"))))
145 (build-system python-build-system)
147 `(("python-mmtk" ,python2-mmtk)))
152 (home-page "http://dirac.cnrs-orleans.fr/DomainFinder.html")
153 (synopsis "Analysis of dynamical domains in proteins")
154 (description "DomainFinder is an interactive program for the determination
155 and characterization of dynamical domains in proteins. It can infer dynamical
156 domains by comparing two protein structures, or from normal mode analysis on a
157 single structure. The software is currently not actively maintained and works
158 only with Python 2 and NumPy < 1.9.")
159 (license license:cecill-c)))
164 ;; Update the inchi-doc native input when updating inchi.
168 (uri (string-append "https://www.inchi-trust.org/download/"
169 (string-join (string-split version #\.) "")
173 "1zbygqn0443p0gxwr4kx3m1bkqaj8x9hrpch3s41py7jq08f6x28"))
174 (file-name (string-append name "-" version ".zip"))))
175 (build-system gnu-build-system)
177 '(#:tests? #f ; no check target
179 (modify-phases %standard-phases
180 (delete 'configure) ; no configure script
181 (add-before 'build 'chdir-to-build-directory
182 (lambda _ (chdir "INCHI_EXE/inchi-1/gcc") #t))
183 (add-after 'build 'build-library
185 (chdir "../../../INCHI_API/libinchi/gcc")
188 (lambda* (#:key inputs outputs #:allow-other-keys)
189 (let* ((out (assoc-ref outputs "out"))
190 (bin (string-append out "/bin"))
191 (doc (string-append out "/share/doc/inchi"))
192 (include-dir (string-append out "/include/inchi"))
193 (lib (string-append out "/lib/inchi"))
194 (inchi-doc (assoc-ref inputs "inchi-doc"))
195 (unzip (string-append (assoc-ref inputs "unzip")
199 (with-directory-excursion "INCHI_EXE/bin/Linux"
200 (rename-file "inchi-1" "inchi")
201 (install-file "inchi" bin))
202 ;; Install libraries.
203 (with-directory-excursion "INCHI_API/bin/Linux"
204 (for-each (lambda (file)
205 (install-file file lib))
206 (find-files "." "libinchi\\.so\\.1\\.*")))
207 ;; Install header files.
208 (with-directory-excursion "INCHI_BASE/src"
209 (for-each (lambda (file)
210 (install-file file include-dir))
211 (find-files "." "\\.h$")))
212 ;; Install documentation.
214 (invoke unzip "-j" "-d" doc inchi-doc)
221 (uri (string-append "http://www.inchi-trust.org/download/"
222 (string-join (string-split version #\.) "")
226 "1kyda09i9p89xfq90ninwi7w13k1w3ljpl4gqdhpfhi5g8fgxx7f"))
227 (file-name (string-append name "-" version ".zip"))))))
228 (home-page "https://www.inchi-trust.org")
229 (synopsis "Utility for manipulating machine-readable chemical structures")
231 "The @dfn{InChI} (IUPAC International Chemical Identifier) algorithm turns
232 chemical structures into machine-readable strings of information. InChIs are
233 unique to the compound they describe and can encode absolute stereochemistry
234 making chemicals and chemistry machine-readable and discoverable. A simple
235 analogy is that InChI is the bar-code for chemistry and chemical structures.")
236 (license (license:non-copyleft
238 "See LICENCE in the distribution."))))
240 (define-public libmsym
248 (url "https://github.com/mcodev31/libmsym")
249 (commit (string-append "v" version))))
252 "0a9j28irdsr461qpzlc9z1yjyb9kp64fh5zw7ylspc9zn3189qwk"))
253 (file-name (git-file-name name version))))
254 (build-system cmake-build-system)
256 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
257 #:tests? #f)) ; no check target
258 (home-page "https://github.com/mcodev31/libmsym")
259 (synopsis "C library dealing with point group symmetry in molecules")
260 (description "libmsym is a C library dealing with point group symmetry in
262 (license license:expat)))
264 (define-public mmtf-cpp
272 (url "https://github.com/rcsb/mmtf-cpp")
273 (commit (string-append "v" version))))
274 (file-name (git-file-name name version))
277 "17ylramda69plf5w0v5hxbl4ggkdi5s15z55cv0pljl12yvyva8l"))))
278 (build-system cmake-build-system)
279 ;; Tests require the soon-to-be-deprecated version 1 of the catch-framework.
282 (home-page "https://mmtf.rcsb.org/")
283 (synopsis "C++ API for the Macromolecular Transmission Format")
284 (description "This package is a library for the
285 @acronym{MMTF,macromolecular transmission format}, a binary encoding of
286 biological structures.")
287 (license license:expat)))
289 (define-public molequeue
296 (uri (string-append "https://github.com/OpenChemistry/molequeue/"
297 "releases/download/" version "/molequeue-"
301 "1w1fgxzqrb5yxvpmnc3c9ymnvixy0z1nfafkd9whg9zw8nbgl998"))))
302 (build-system cmake-build-system)
304 `(("qtbase" ,qtbase)))
306 '(#:configure-flags '("-DENABLE_TESTING=ON")
308 (modify-phases %standard-phases
309 (add-after 'unpack 'patch-tests
311 ;; TODO: Fix/enable the failing message and clientserver tests.
312 ;; In the message test, the floating-point value "5.36893473232" on
313 ;; line 165 of molequeue/app/testing/messagetest.cpp should
314 ;; (apparently) be truncated, but it is not.
315 (substitute* "molequeue/app/testing/messagetest.cpp"
316 (("5\\.36893473232") "5.36893"))
317 ;; It is unclear why the clientserver test fails, so it is
318 ;; completely disabled.
319 (substitute* "molequeue/app/testing/CMakeLists.txt"
320 ((".*clientserver.*") ""))
322 (add-before 'check 'set-display
324 ;; Make Qt render "offscreen" for the sake of tests.
325 (setenv "QT_QPA_PLATFORM" "offscreen")
327 (home-page "https://www.openchemistry.org/projects/molequeue/")
328 (synopsis "Application for coordinating computational jobs")
329 (description "MoleQueue is a system-tray resident desktop application for
330 abstracting, managing, and coordinating the execution of tasks both locally and
331 on remote computational resources. Users can set up local and remote queues
332 that describe where the task will be executed. Each queue can have programs,
333 with templates to facilitate the execution of the program. Input files can be
334 staged, and output files collected using a standard interface.")
335 (license license:bsd-3)))
337 (define with-numpy-1.8
338 (package-input-rewriting `((,python2-numpy . ,python2-numpy-1.8))))
340 (define-public nmoldyn
348 (url "https://github.com/khinsen/nMOLDYN3")
349 (commit (string-append "v" version))))
350 (file-name (git-file-name name version))
353 "016h4bqg419p6s7bcx55q5iik91gqmk26hbnfgj2j6zl0j36w51r"))))
354 (build-system python-build-system)
356 `(("python-matplotlib" ,(with-numpy-1.8 python2-matplotlib))
357 ("python-scientific" ,python2-scientific)
361 `(("python-mmtk" ,python2-mmtk)))
364 #:tests? #f ; No test suite
366 (modify-phases %standard-phases
367 (add-before 'build 'create-linux2-directory
369 (mkdir-p "nMOLDYN/linux2")))
370 (add-before 'build 'change-PDF-viewer
371 (lambda* (#:key inputs #:allow-other-keys)
372 (substitute* "nMOLDYN/Preferences.py"
373 ;; Set the paths for external executables, substituting
375 ;; There is also vmd_path, but VMD is not free software
376 ;; and Guix contains currently no free molecular viewer that
377 ;; could be substituted.
378 (("PREFERENCES\\['acroread_path'\\] = ''")
379 (format #f "PREFERENCES['acroread_path'] = '~a'"
381 (("PREFERENCES\\['ncdump_path'\\] = ''")
382 (format #f "PREFERENCES['ncdump_path'] = '~a'"
384 (("PREFERENCES\\['ncgen_path'\\] = ''")
385 (format #f "PREFERENCES['ncgen_path'] = '~a'"
387 (("PREFERENCES\\['task_manager_path'\\] = ''")
388 (format #f "PREFERENCES['task_manager_path'] = '~a'"
389 (which "task_manager")))
390 ;; Show documentation as PDF
391 (("PREFERENCES\\['documentation_style'\\] = 'html'")
392 "PREFERENCES['documentation_style'] = 'pdf'") ))))))
393 (home-page "http://dirac.cnrs-orleans.fr/nMOLDYN.html")
394 (synopsis "Analysis software for Molecular Dynamics trajectories")
395 (description "nMOLDYN is an interactive analysis program for Molecular Dynamics
396 simulations. It is especially designed for the computation and decomposition of
397 neutron scattering spectra, but also computes other quantities. The software
398 is currently not actively maintained and works only with Python 2 and
400 (license license:cecill)))
409 (url "https://github.com/gromacs/tng")
410 (commit (string-append "v" version))))
411 (file-name (git-file-name name version))
414 "1apf2n8nb34z09xarj7k4jgriq283l769sakjmj5aalpbilvai4q"))))
415 (build-system cmake-build-system)
420 (modify-phases %standard-phases
421 (add-after 'unpack 'remove-bundled-zlib
423 (delete-file-recursively "external")
427 (invoke "../build/bin/tests/tng_testing")
429 (home-page "https://github.com/gromacs/tng")
430 (synopsis "Trajectory Next Generation binary format manipulation library")
431 (description "TRAJNG (Trajectory next generation) is a program library for
432 handling molecular dynamics (MD) trajectories. It can store coordinates, and
433 optionally velocities and the H-matrix. Coordinates and velocities are
434 stored with user-specified precision.")
435 (license license:bsd-3)))
437 (define-public gromacs
443 (uri (string-append "http://ftp.gromacs.org/pub/gromacs/gromacs-"
447 "1wyjgcdl30wy4hy6jvi9lkq53bqs9fgfq6fri52dhnb3c76y8rbl"))
448 ;; Our version of tinyxml2 is far newer than the bundled one and
449 ;; require fixing `testutils' code. See patch header for more info
450 (patches (search-patches "gromacs-tinyxml2.patch"))))
451 (build-system cmake-build-system)
454 (list "-DGMX_DEVELOPER_BUILD=on" ; Needed to run tests
456 "-DGMX_USE_LMFIT=EXTERNAL"
457 "-DGMX_BUILD_OWN_FFTW=off"
458 "-DGMX_EXTERNAL_BLAS=on"
459 "-DGMX_EXTERNAL_LAPACK=on"
460 "-DGMX_EXTERNAL_TNG=on"
461 "-DGMX_EXTERNAL_ZLIB=on"
462 "-DGMX_EXTERNAL_TINYXML2=on"
463 (string-append "-DTinyXML2_DIR="
464 (assoc-ref %build-inputs "tinyxml2"))
465 ;; Workaround for cmake/FindSphinx.cmake version parsing that does
466 ;; not understand the guix-wrapped `sphinx-build --version' answer
467 (string-append "-DSPHINX_EXECUTABLE_VERSION="
468 ,(package-version python-sphinx)))
470 (modify-phases %standard-phases
471 (add-after 'unpack 'fixes
472 (lambda* (#:key inputs #:allow-other-keys)
473 ;; Still bundled: part of gromacs, source behind registration
474 ;; but free software anyways
475 ;;(delete-file-recursively "src/external/vmd_molfile")
476 ;; Still bundled: threads-based OpenMPI-compatible fallback
477 ;; designed to be bundled like that
478 ;;(delete-file-recursively "src/external/thread_mpi")
480 (delete-file-recursively "src/external/lmfit")
481 (delete-file-recursively "src/external/clFFT")
482 (delete-file-recursively "src/external/fftpack")
483 (delete-file-recursively "src/external/build-fftw")
484 (delete-file-recursively "src/external/tng_io")
485 (delete-file-recursively "src/external/tinyxml2")
486 (delete-file-recursively "src/external/googletest")
487 (copy-recursively (assoc-ref inputs "googletest-source")
488 "src/external/googletest")
489 ;; This test warns about the build host hardware, disable
490 (substitute* "src/gromacs/hardware/tests/hardwaretopology.cpp"
491 (("TEST\\(HardwareTopologyTest, HwlocExecute\\)")
492 "void __guix_disabled()"))
495 `(("doxygen" ,doxygen)
496 ("googletest-source" ,(package-source googletest))
497 ("graphviz" ,graphviz)
498 ("pkg-config" ,pkg-config)
500 ("python-pygments" ,python-pygments)
501 ("python-sphinx" ,python-sphinx)))
504 ("hwloc" ,hwloc-2 "lib")
506 ("openblas" ,openblas)
508 ("tinyxml2" ,tinyxml2)
510 (home-page "http://www.gromacs.org/")
511 (synopsis "Molecular dynamics software package")
512 (description "GROMACS is a versatile package to perform molecular dynamics,
513 i.e. simulate the Newtonian equations of motion for systems with hundreds to
514 millions of particles. It is primarily designed for biochemical molecules like
515 proteins, lipids and nucleic acids that have a lot of complicated bonded
516 interactions, but since GROMACS is extremely fast at calculating the nonbonded
517 interactions (that usually dominate simulations) many groups are also using it
518 for research on non-biological systems, e.g. polymers. GROMACS supports all the
519 usual algorithms you expect from a modern molecular dynamics implementation.")
520 (license license:lgpl2.1+)))
522 (define-public openbabel
528 (uri (string-append "https://github.com/openbabel/openbabel/"
529 "releases/download/openbabel-"
530 (string-replace-substring version "." "-")
531 "/openbabel-" version "-source.tar.bz2"))
534 "0s0f4zib8vshfaywsr5bjjz55jwsg6yiz2qw4i5jm8wysn0q7v56"))))
535 (build-system cmake-build-system)
537 `(;; FIXME: Disable tests on i686 to work around
538 ;; https://github.com/openbabel/openbabel/issues/2041.
539 #:tests? ,(or (%current-target-system)
540 (not (string=? "i686-linux" (%current-system))))
542 (list "-DOPENBABEL_USE_SYSTEM_INCHI=ON"
543 (string-append "-DINCHI_LIBRARY="
544 (assoc-ref %build-inputs "inchi")
545 "/lib/inchi/libinchi.so.1")
546 (string-append "-DINCHI_INCLUDE_DIR="
547 (assoc-ref %build-inputs "inchi") "/include/inchi"))
548 #:test-target "test"))
550 `(("pkg-config" ,pkg-config)))
556 (home-page "http://openbabel.org/wiki/Main_Page")
557 (synopsis "Chemistry data manipulation toolbox")
559 "Open Babel is a chemical toolbox designed to speak the many languages of
560 chemical data. It's a collaborative project allowing anyone to search, convert,
561 analyze, or store data from molecular modeling, chemistry, solid-state
562 materials, biochemistry, or related areas.")
563 (license license:gpl2)))
565 (define-public spglib
573 (url "https://github.com/spglib/spglib")
574 (commit (string-append "v" version))))
576 (base32 "1kzc956m1pnazhz52vspqridlw72wd8x5l3dsilpdxl491aa2nws"))
577 (file-name (git-file-name name version))))
578 (build-system cmake-build-system)
580 '(#:test-target "check"
582 (modify-phases %standard-phases
583 (add-after 'unpack 'patch-header-install-dir
585 ;; As of the writing of this package, CMake and GNU build systems
586 ;; install the header to two different location. This patch makes
587 ;; the CMake build system's choice of header directory compatible
588 ;; with the GNU build system's choice and with what avogadrolibs
590 ;; See https://github.com/spglib/spglib/issues/75 and the relevant
591 ;; part of https://github.com/OpenChemistry/avogadroapp/issues/97.
592 (substitute* "CMakeLists.txt"
593 (("\\$\\{CMAKE_INSTALL_INCLUDEDIR\\}" include-dir)
594 (string-append include-dir "/spglib")))
596 (home-page "https://spglib.github.io/spglib/index.html")
597 (synopsis "Library for crystal symmetry search")
598 (description "Spglib is a library for finding and handling crystal
599 symmetries written in C. Spglib can be used to:
602 @item Find symmetry operations
603 @item Identify space-group type
604 @item Wyckoff position assignment
605 @item Refine crystal structure
606 @item Find a primitive cell
607 @item Search irreducible k-points
609 (license license:bsd-3)))