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>
8 ;;; Copyright © 2021 Ricardo Wurmus <rekado@elephly.net>
10 ;;; This file is part of GNU Guix.
12 ;;; GNU Guix is free software; you can redistribute it and/or modify it
13 ;;; under the terms of the GNU General Public License as published by
14 ;;; the Free Software Foundation; either version 3 of the License, or (at
15 ;;; your option) any later version.
17 ;;; GNU Guix is distributed in the hope that it will be useful, but
18 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;;; GNU General Public License for more details.
22 ;;; You should have received a copy of the GNU General Public License
23 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
25 (define-module (gnu packages chemistry)
26 #:use-module (guix packages)
27 #:use-module (guix utils)
28 #:use-module ((guix licenses) #:prefix license:)
29 #:use-module (guix download)
30 #:use-module (guix git-download)
31 #:use-module (gnu packages)
32 #:use-module (gnu packages algebra)
33 #:use-module (gnu packages autotools)
34 #:use-module (gnu packages backup)
35 #:use-module (gnu packages boost)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages documentation)
39 #:use-module (gnu packages fontutils)
40 #:use-module (gnu packages gl)
41 #:use-module (gnu packages graphviz)
42 #:use-module (gnu packages gv)
43 #:use-module (gnu packages image)
44 #:use-module (gnu packages maths)
45 #:use-module (gnu packages mpi)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages python)
49 #:use-module (gnu packages python-xyz)
50 #:use-module (gnu packages qt)
51 #:use-module (gnu packages serialization)
52 #:use-module (gnu packages sphinx)
53 #:use-module (gnu packages xml)
54 #:use-module (guix build-system cmake)
55 #:use-module (guix build-system gnu)
56 #:use-module (guix build-system python))
58 (define-public avogadrolibs
66 (url "https://github.com/OpenChemistry/avogadrolibs")
69 (base32 "1xivga626n5acnmwmym8svl0pdri8hkp59czf04ri2zflnviyh39"))
70 (file-name (git-file-name name version))))
71 (build-system cmake-build-system)
88 '(#:configure-flags (list "-DENABLE_TESTING=ON"
89 (string-append "-DSPGLIB_INCLUDE_DIR="
90 (assoc-ref %build-inputs "spglib")
92 (home-page "https://www.openchemistry.org/projects/avogadro2/")
93 (synopsis "Libraries for chemistry, bioinformatics, and related areas")
95 "Avogadro libraries provide 3D rendering, visualization, analysis and data
96 processing useful in computational chemistry, molecular modeling,
97 bioinformatics, materials science, and related areas.")
98 (license license:bsd-3)))
100 (define-public avogadro2
108 (url "https://github.com/OpenChemistry/avogadroapp")
112 "1z3pjlwja778a1dmvx9aqz2hlw5q9g3kqxhm9slz08452600jsv7"))
113 (file-name (git-file-name name version))))
114 (build-system cmake-build-system)
116 (list eigen pkg-config))
118 (list avogadrolibs hdf5 molequeue qtbase-5))
119 ;; TODO: Enable tests with "-DENABLE_TESTING" configure flag.
122 (home-page "https://www.openchemistry.org/projects/avogadro2/")
123 (synopsis "Advanced molecule editor")
125 "Avogadro 2 is an advanced molecule editor and visualizer designed for use
126 in computational chemistry, molecular modeling, bioinformatics, materials
127 science, and related areas. It offers flexible high quality rendering and a
128 powerful plugin architecture.")
129 (license license:bsd-3)))
134 ;; Update the inchi-doc native input when updating inchi.
138 (uri (string-append "https://www.inchi-trust.org/download/"
139 (string-join (string-split version #\.) "")
143 "1zbygqn0443p0gxwr4kx3m1bkqaj8x9hrpch3s41py7jq08f6x28"))
144 (file-name (string-append name "-" version ".zip"))))
145 (build-system gnu-build-system)
147 '(#:tests? #f ; no check target
149 (modify-phases %standard-phases
150 (delete 'configure) ; no configure script
151 (add-before 'build 'chdir-to-build-directory
152 (lambda _ (chdir "INCHI_EXE/inchi-1/gcc") #t))
153 (add-after 'build 'build-library
155 (chdir "../../../INCHI_API/libinchi/gcc")
158 (lambda* (#:key inputs outputs #:allow-other-keys)
159 (let* ((out (assoc-ref outputs "out"))
160 (bin (string-append out "/bin"))
161 (doc (string-append out "/share/doc/inchi"))
162 (include-dir (string-append out "/include/inchi"))
163 (lib (string-append out "/lib/inchi"))
164 (inchi-doc (assoc-ref inputs "inchi-doc"))
165 (unzip (search-input-file inputs "/bin/unzip")))
168 (with-directory-excursion "INCHI_EXE/bin/Linux"
169 (rename-file "inchi-1" "inchi")
170 (install-file "inchi" bin))
171 ;; Install libraries.
172 (with-directory-excursion "INCHI_API/bin/Linux"
173 (for-each (lambda (file)
174 (install-file file lib))
175 (find-files "." "libinchi\\.so\\.1\\.*")))
176 ;; Install header files.
177 (with-directory-excursion "INCHI_BASE/src"
178 (for-each (lambda (file)
179 (install-file file include-dir))
180 (find-files "." "\\.h$")))
181 ;; Install documentation.
183 (invoke unzip "-j" "-d" doc inchi-doc)
190 (uri (string-append "http://www.inchi-trust.org/download/"
191 (string-join (string-split version #\.) "")
195 "1kyda09i9p89xfq90ninwi7w13k1w3ljpl4gqdhpfhi5g8fgxx7f"))
196 (file-name (string-append name "-" version ".zip"))))))
197 (home-page "https://www.inchi-trust.org")
198 (synopsis "Utility for manipulating machine-readable chemical structures")
200 "The @dfn{InChI} (IUPAC International Chemical Identifier) algorithm turns
201 chemical structures into machine-readable strings of information. InChIs are
202 unique to the compound they describe and can encode absolute stereochemistry
203 making chemicals and chemistry machine-readable and discoverable. A simple
204 analogy is that InChI is the bar-code for chemistry and chemical structures.")
205 (license (license:non-copyleft
207 "See LICENCE in the distribution."))))
209 (define-public libmsym
217 (url "https://github.com/mcodev31/libmsym")
218 (commit (string-append "v" version))))
221 "0a9j28irdsr461qpzlc9z1yjyb9kp64fh5zw7ylspc9zn3189qwk"))
222 (file-name (git-file-name name version))))
223 (build-system cmake-build-system)
225 '(#:configure-flags '("-DBUILD_SHARED_LIBS=ON")
226 #:tests? #f)) ; no check target
227 (home-page "https://github.com/mcodev31/libmsym")
228 (synopsis "C library dealing with point group symmetry in molecules")
229 (description "libmsym is a C library dealing with point group symmetry in
231 (license license:expat)))
233 (define-public mmtf-cpp
241 (url "https://github.com/rcsb/mmtf-cpp")
242 (commit (string-append "v" version))))
243 (file-name (git-file-name name version))
246 "17ylramda69plf5w0v5hxbl4ggkdi5s15z55cv0pljl12yvyva8l"))))
247 (build-system cmake-build-system)
248 ;; Tests require the soon-to-be-deprecated version 1 of the catch-framework.
251 (home-page "https://mmtf.rcsb.org/")
252 (synopsis "C++ API for the Macromolecular Transmission Format")
253 (description "This package is a library for the
254 @acronym{MMTF,macromolecular transmission format}, a binary encoding of
255 biological structures.")
256 (license license:expat)))
258 (define-public molequeue
265 (uri (string-append "https://github.com/OpenChemistry/molequeue/"
266 "releases/download/" version "/molequeue-"
270 "1w1fgxzqrb5yxvpmnc3c9ymnvixy0z1nfafkd9whg9zw8nbgl998"))))
271 (build-system cmake-build-system)
275 '(#:configure-flags '("-DENABLE_TESTING=ON")
277 (modify-phases %standard-phases
278 (add-after 'unpack 'patch-tests
280 ;; TODO: Fix/enable the failing message and clientserver tests.
281 ;; In the message test, the floating-point value "5.36893473232" on
282 ;; line 165 of molequeue/app/testing/messagetest.cpp should
283 ;; (apparently) be truncated, but it is not.
284 (substitute* "molequeue/app/testing/messagetest.cpp"
285 (("5\\.36893473232") "5.36893"))
286 ;; It is unclear why the clientserver test fails, so it is
287 ;; completely disabled.
288 (substitute* "molequeue/app/testing/CMakeLists.txt"
289 ((".*clientserver.*") ""))
291 (add-before 'check 'set-display
293 ;; Make Qt render "offscreen" for the sake of tests.
294 (setenv "QT_QPA_PLATFORM" "offscreen")
296 (home-page "https://www.openchemistry.org/projects/molequeue/")
297 (synopsis "Application for coordinating computational jobs")
298 (description "MoleQueue is a system-tray resident desktop application for
299 abstracting, managing, and coordinating the execution of tasks both locally and
300 on remote computational resources. Users can set up local and remote queues
301 that describe where the task will be executed. Each queue can have programs,
302 with templates to facilitate the execution of the program. Input files can be
303 staged, and output files collected using a standard interface.")
304 (license license:bsd-3)))
313 (url "https://github.com/gromacs/tng")
314 (commit (string-append "v" version))))
315 (file-name (git-file-name name version))
318 "1apf2n8nb34z09xarj7k4jgriq283l769sakjmj5aalpbilvai4q"))))
319 (build-system cmake-build-system)
324 (modify-phases %standard-phases
325 (add-after 'unpack 'remove-bundled-zlib
327 (delete-file-recursively "external")
331 (invoke "../build/bin/tests/tng_testing")
333 (home-page "https://github.com/gromacs/tng")
334 (synopsis "Trajectory Next Generation binary format manipulation library")
335 (description "TRAJNG (Trajectory next generation) is a program library for
336 handling molecular dynamics (MD) trajectories. It can store coordinates, and
337 optionally velocities and the H-matrix. Coordinates and velocities are
338 stored with user-specified precision.")
339 (license license:bsd-3)))
341 (define-public gromacs
347 (uri (string-append "http://ftp.gromacs.org/pub/gromacs/gromacs-"
351 "1wyjgcdl30wy4hy6jvi9lkq53bqs9fgfq6fri52dhnb3c76y8rbl"))
352 ;; Our version of tinyxml2 is far newer than the bundled one and
353 ;; require fixing `testutils' code. See patch header for more info
354 (patches (search-patches "gromacs-tinyxml2.patch"))))
355 (build-system cmake-build-system)
358 (list "-DGMX_DEVELOPER_BUILD=on" ; Needed to run tests
360 "-DGMX_USE_LMFIT=EXTERNAL"
361 "-DGMX_BUILD_OWN_FFTW=off"
362 "-DGMX_EXTERNAL_BLAS=on"
363 "-DGMX_EXTERNAL_LAPACK=on"
364 "-DGMX_EXTERNAL_TNG=on"
365 "-DGMX_EXTERNAL_ZLIB=on"
366 "-DGMX_EXTERNAL_TINYXML2=on"
367 (string-append "-DTinyXML2_DIR="
368 (assoc-ref %build-inputs "tinyxml2"))
369 ;; Workaround for cmake/FindSphinx.cmake version parsing that does
370 ;; not understand the guix-wrapped `sphinx-build --version' answer
371 (string-append "-DSPHINX_EXECUTABLE_VERSION="
372 ,(package-version python-sphinx)))
374 (modify-phases %standard-phases
375 (add-after 'unpack 'fixes
376 (lambda* (#:key inputs #:allow-other-keys)
377 ;; Still bundled: part of gromacs, source behind registration
378 ;; but free software anyways
379 ;;(delete-file-recursively "src/external/vmd_molfile")
380 ;; Still bundled: threads-based OpenMPI-compatible fallback
381 ;; designed to be bundled like that
382 ;;(delete-file-recursively "src/external/thread_mpi")
384 (delete-file-recursively "src/external/lmfit")
385 (delete-file-recursively "src/external/clFFT")
386 (delete-file-recursively "src/external/fftpack")
387 (delete-file-recursively "src/external/build-fftw")
388 (delete-file-recursively "src/external/tng_io")
389 (delete-file-recursively "src/external/tinyxml2")
390 (delete-file-recursively "src/external/googletest")
391 (copy-recursively (assoc-ref inputs "googletest-source")
392 "src/external/googletest")
393 ;; This test warns about the build host hardware, disable
394 (substitute* "src/gromacs/hardware/tests/hardwaretopology.cpp"
395 (("TEST\\(HardwareTopologyTest, HwlocExecute\\)")
396 "void __guix_disabled()"))
399 `(("doxygen" ,doxygen)
400 ("googletest-source" ,(package-source googletest))
401 ("graphviz" ,graphviz)
402 ("pkg-config" ,pkg-config)
404 ("python-pygments" ,python-pygments)
405 ("python-sphinx" ,python-sphinx)))
414 (home-page "http://www.gromacs.org/")
415 (synopsis "Molecular dynamics software package")
416 (description "GROMACS is a versatile package to perform molecular dynamics,
417 i.e. simulate the Newtonian equations of motion for systems with hundreds to
418 millions of particles. It is primarily designed for biochemical molecules like
419 proteins, lipids and nucleic acids that have a lot of complicated bonded
420 interactions, but since GROMACS is extremely fast at calculating the nonbonded
421 interactions (that usually dominate simulations) many groups are also using it
422 for research on non-biological systems, e.g. polymers. GROMACS supports all the
423 usual algorithms you expect from a modern molecular dynamics implementation.")
424 (license license:lgpl2.1+)))
426 (define-public openbabel
432 (uri (string-append "https://github.com/openbabel/openbabel/"
433 "releases/download/openbabel-"
434 (string-replace-substring version "." "-")
435 "/openbabel-" version "-source.tar.bz2"))
438 "0s0f4zib8vshfaywsr5bjjz55jwsg6yiz2qw4i5jm8wysn0q7v56"))))
439 (build-system cmake-build-system)
441 `(;; FIXME: Disable tests on i686 to work around
442 ;; https://github.com/openbabel/openbabel/issues/2041.
443 #:tests? ,(or (%current-target-system)
444 (not (string=? "i686-linux" (%current-system))))
446 (list "-DOPENBABEL_USE_SYSTEM_INCHI=ON"
447 (string-append "-DINCHI_LIBRARY="
448 (assoc-ref %build-inputs "inchi")
449 "/lib/inchi/libinchi.so.1")
450 (string-append "-DINCHI_INCLUDE_DIR="
451 (assoc-ref %build-inputs "inchi") "/include/inchi"))
452 #:test-target "test"))
456 (list eigen inchi libxml2 zlib))
457 (home-page "http://openbabel.org/wiki/Main_Page")
458 (synopsis "Chemistry data manipulation toolbox")
460 "Open Babel is a chemical toolbox designed to speak the many languages of
461 chemical data. It's a collaborative project allowing anyone to search, convert,
462 analyze, or store data from molecular modeling, chemistry, solid-state
463 materials, biochemistry, or related areas.")
464 (license license:gpl2)))
466 (define-public spglib
474 (url "https://github.com/spglib/spglib")
475 (commit (string-append "v" version))))
477 (base32 "1kzc956m1pnazhz52vspqridlw72wd8x5l3dsilpdxl491aa2nws"))
478 (file-name (git-file-name name version))))
479 (build-system cmake-build-system)
481 '(#:test-target "check"
483 (modify-phases %standard-phases
484 (add-after 'unpack 'patch-header-install-dir
486 ;; As of the writing of this package, CMake and GNU build systems
487 ;; install the header to two different location. This patch makes
488 ;; the CMake build system's choice of header directory compatible
489 ;; with the GNU build system's choice and with what avogadrolibs
491 ;; See https://github.com/spglib/spglib/issues/75 and the relevant
492 ;; part of https://github.com/OpenChemistry/avogadroapp/issues/97.
493 (substitute* "CMakeLists.txt"
494 (("\\$\\{CMAKE_INSTALL_INCLUDEDIR\\}" include-dir)
495 (string-append include-dir "/spglib")))
497 (home-page "https://spglib.github.io/spglib/index.html")
498 (synopsis "Library for crystal symmetry search")
499 (description "Spglib is a library for finding and handling crystal
500 symmetries written in C. Spglib can be used to:
503 @item Find symmetry operations
504 @item Identify space-group type
505 @item Wyckoff position assignment
506 @item Refine crystal structure
507 @item Find a primitive cell
508 @item Search irreducible k-points
510 (license license:bsd-3)))
512 (define-public python-pymol
514 (name "python-pymol")
520 (url "https://github.com/schrodinger/pymol-open-source")
521 (commit (string-append "v" version))))
522 (file-name (git-file-name name version))
524 (base32 "08zmfgclkbjkqjpq8xs1mphs1i8rpqj76mcw7m2mrhvma5qj1nr5"))))
525 (build-system python-build-system)
528 (list "--glut" "--testing")
530 (modify-phases %standard-phases
531 (add-after 'unpack 'make-reproducible
533 (substitute* "create_shadertext.py"
534 (("time\\.time\\(\\)") "0"))))
535 (add-after 'unpack 'add-include-directories
536 (lambda* (#:key inputs #:allow-other-keys)
537 (setenv "CPLUS_INCLUDE_PATH"
538 (string-append (assoc-ref inputs "freetype")
539 "/include/freetype2:"
540 (assoc-ref inputs "libxml2")
542 (getenv "CPLUS_INCLUDE_PATH")))))
543 ;; The setup.py script does not support one of the Python build
544 ;; system's default flags, "--single-version-externally-managed".
546 (lambda* (#:key outputs #:allow-other-keys)
547 (invoke "python" "setup.py" "install"
548 (string-append "--prefix=" (assoc-ref outputs "out"))
562 (list catch2 python-setuptools))
563 (home-page "https://pymol.org")
564 (synopsis "Molecular visualization system")
565 (description "PyMOL is a capable molecular viewer and renderer. It can be
566 used to prepare publication-quality figures, to share interactive results with
567 your colleagues, or to generate pre-rendered animations.")
568 (license license:bsd-3)))