gnu: r-biocviews: Update to 1.64.1.
[jackhill/guix/guix.git] / gnu / packages / chemistry.scm
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>
9 ;;;
10 ;;; This file is part of GNU Guix.
11 ;;;
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.
16 ;;;
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.
21 ;;;
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/>.
24
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))
57
58 (define-public avogadrolibs
59 (package
60 (name "avogadrolibs")
61 (version "1.93.0")
62 (source
63 (origin
64 (method git-fetch)
65 (uri (git-reference
66 (url "https://github.com/OpenChemistry/avogadrolibs")
67 (commit version)))
68 (sha256
69 (base32 "1xivga626n5acnmwmym8svl0pdri8hkp59czf04ri2zflnviyh39"))
70 (file-name (git-file-name name version))))
71 (build-system cmake-build-system)
72 (native-inputs
73 (list eigen
74 mmtf-cpp
75 msgpack
76 googletest
77 pkg-config
78 pybind11))
79 (inputs
80 (list glew
81 libarchive
82 libmsym
83 molequeue
84 python
85 spglib
86 qtbase-5))
87 (arguments
88 '(#:configure-flags (list "-DENABLE_TESTING=ON"
89 (string-append "-DSPGLIB_INCLUDE_DIR="
90 (assoc-ref %build-inputs "spglib")
91 "/include"))))
92 (home-page "https://www.openchemistry.org/projects/avogadro2/")
93 (synopsis "Libraries for chemistry, bioinformatics, and related areas")
94 (description
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)))
99
100 (define-public avogadro2
101 (package
102 (name "avogadro2")
103 (version "1.93.0")
104 (source
105 (origin
106 (method git-fetch)
107 (uri (git-reference
108 (url "https://github.com/OpenChemistry/avogadroapp")
109 (commit version)))
110 (sha256
111 (base32
112 "1z3pjlwja778a1dmvx9aqz2hlw5q9g3kqxhm9slz08452600jsv7"))
113 (file-name (git-file-name name version))))
114 (build-system cmake-build-system)
115 (native-inputs
116 (list eigen pkg-config))
117 (inputs
118 (list avogadrolibs hdf5 molequeue qtbase-5))
119 ;; TODO: Enable tests with "-DENABLE_TESTING" configure flag.
120 (arguments
121 '(#:tests? #f))
122 (home-page "https://www.openchemistry.org/projects/avogadro2/")
123 (synopsis "Advanced molecule editor")
124 (description
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)))
130
131 (define-public inchi
132 (package
133 (name "inchi")
134 ;; Update the inchi-doc native input when updating inchi.
135 (version "1.06")
136 (source (origin
137 (method url-fetch)
138 (uri (string-append "https://www.inchi-trust.org/download/"
139 (string-join (string-split version #\.) "")
140 "/INCHI-1-SRC.zip"))
141 (sha256
142 (base32
143 "1zbygqn0443p0gxwr4kx3m1bkqaj8x9hrpch3s41py7jq08f6x28"))
144 (file-name (string-append name "-" version ".zip"))))
145 (build-system gnu-build-system)
146 (arguments
147 '(#:tests? #f ; no check target
148 #:phases
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
154 (lambda _
155 (chdir "../../../INCHI_API/libinchi/gcc")
156 (invoke "make")))
157 (replace 'install
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")))
166 (chdir "../../..")
167 ;; Install binary.
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.
182 (mkdir-p doc)
183 (invoke unzip "-j" "-d" doc inchi-doc)
184 #t))))))
185 (native-inputs
186 `(("unzip" ,unzip)
187 ("inchi-doc"
188 ,(origin
189 (method url-fetch)
190 (uri (string-append "http://www.inchi-trust.org/download/"
191 (string-join (string-split version #\.) "")
192 "/INCHI-1-DOC.zip"))
193 (sha256
194 (base32
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")
199 (description
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
206 "file://LICENCE"
207 "See LICENCE in the distribution."))))
208
209 (define-public libmsym
210 (package
211 (name "libmsym")
212 (version "0.2.3")
213 (source
214 (origin
215 (method git-fetch)
216 (uri (git-reference
217 (url "https://github.com/mcodev31/libmsym")
218 (commit (string-append "v" version))))
219 (sha256
220 (base32
221 "0a9j28irdsr461qpzlc9z1yjyb9kp64fh5zw7ylspc9zn3189qwk"))
222 (file-name (git-file-name name version))))
223 (build-system cmake-build-system)
224 (arguments
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
230 molecules.")
231 (license license:expat)))
232
233 (define-public mmtf-cpp
234 (package
235 (name "mmtf-cpp")
236 (version "1.0.0")
237 (source
238 (origin
239 (method git-fetch)
240 (uri (git-reference
241 (url "https://github.com/rcsb/mmtf-cpp")
242 (commit (string-append "v" version))))
243 (file-name (git-file-name name version))
244 (sha256
245 (base32
246 "17ylramda69plf5w0v5hxbl4ggkdi5s15z55cv0pljl12yvyva8l"))))
247 (build-system cmake-build-system)
248 ;; Tests require the soon-to-be-deprecated version 1 of the catch-framework.
249 (arguments
250 '(#:tests? #f))
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)))
257
258 (define-public molequeue
259 (package
260 (name "molequeue")
261 (version "0.9.0")
262 (source
263 (origin
264 (method url-fetch)
265 (uri (string-append "https://github.com/OpenChemistry/molequeue/"
266 "releases/download/" version "/molequeue-"
267 version ".tar.bz2"))
268 (sha256
269 (base32
270 "1w1fgxzqrb5yxvpmnc3c9ymnvixy0z1nfafkd9whg9zw8nbgl998"))))
271 (build-system cmake-build-system)
272 (inputs
273 (list qtbase-5))
274 (arguments
275 '(#:configure-flags '("-DENABLE_TESTING=ON")
276 #:phases
277 (modify-phases %standard-phases
278 (add-after 'unpack 'patch-tests
279 (lambda _
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.*") ""))
290 #t))
291 (add-before 'check 'set-display
292 (lambda _
293 ;; Make Qt render "offscreen" for the sake of tests.
294 (setenv "QT_QPA_PLATFORM" "offscreen")
295 #t)))))
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)))
305
306 (define-public tng
307 (package
308 (name "tng")
309 (version "1.8.2")
310 (source (origin
311 (method git-fetch)
312 (uri (git-reference
313 (url "https://github.com/gromacs/tng")
314 (commit (string-append "v" version))))
315 (file-name (git-file-name name version))
316 (sha256
317 (base32
318 "1apf2n8nb34z09xarj7k4jgriq283l769sakjmj5aalpbilvai4q"))))
319 (build-system cmake-build-system)
320 (inputs
321 (list zlib))
322 (arguments
323 `(#:phases
324 (modify-phases %standard-phases
325 (add-after 'unpack 'remove-bundled-zlib
326 (lambda _
327 (delete-file-recursively "external")
328 #t))
329 (replace 'check
330 (lambda _
331 (invoke "../build/bin/tests/tng_testing")
332 #t)))))
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)))
340
341 (define-public gromacs
342 (package
343 (name "gromacs")
344 (version "2020.2")
345 (source (origin
346 (method url-fetch)
347 (uri (string-append "http://ftp.gromacs.org/pub/gromacs/gromacs-"
348 version ".tar.gz"))
349 (sha256
350 (base32
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)
356 (arguments
357 `(#:configure-flags
358 (list "-DGMX_DEVELOPER_BUILD=on" ; Needed to run tests
359 ;; Unbundling
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)))
373 #:phases
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")
383 ;; Unbundling
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()"))
397 #t)))))
398 (native-inputs
399 `(("doxygen" ,doxygen)
400 ("googletest-source" ,(package-source googletest))
401 ("graphviz" ,graphviz)
402 ("pkg-config" ,pkg-config)
403 ("python" ,python)
404 ("python-pygments" ,python-pygments)
405 ("python-sphinx" ,python-sphinx)))
406 (inputs
407 (list fftwf
408 `(,hwloc-2 "lib")
409 lmfit
410 openblas
411 perl
412 tinyxml2
413 tng))
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+)))
425
426 (define-public openbabel
427 (package
428 (name "openbabel")
429 (version "3.1.1")
430 (source (origin
431 (method url-fetch)
432 (uri (string-append "https://github.com/openbabel/openbabel/"
433 "releases/download/openbabel-"
434 (string-replace-substring version "." "-")
435 "/openbabel-" version "-source.tar.bz2"))
436 (sha256
437 (base32
438 "0s0f4zib8vshfaywsr5bjjz55jwsg6yiz2qw4i5jm8wysn0q7v56"))))
439 (build-system cmake-build-system)
440 (arguments
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))))
445 #:configure-flags
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"))
453 (native-inputs
454 (list pkg-config))
455 (inputs
456 (list eigen inchi libxml2 zlib))
457 (home-page "http://openbabel.org/wiki/Main_Page")
458 (synopsis "Chemistry data manipulation toolbox")
459 (description
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)))
465
466 (define-public spglib
467 (package
468 (name "spglib")
469 (version "1.16.0")
470 (source
471 (origin
472 (method git-fetch)
473 (uri (git-reference
474 (url "https://github.com/spglib/spglib")
475 (commit (string-append "v" version))))
476 (sha256
477 (base32 "1kzc956m1pnazhz52vspqridlw72wd8x5l3dsilpdxl491aa2nws"))
478 (file-name (git-file-name name version))))
479 (build-system cmake-build-system)
480 (arguments
481 '(#:test-target "check"
482 #:phases
483 (modify-phases %standard-phases
484 (add-after 'unpack 'patch-header-install-dir
485 (lambda _
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
490 ;; expects.
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")))
496 #t)))))
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:
501
502 @enumerate
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
509 @end enumerate")
510 (license license:bsd-3)))
511
512 (define-public python-pymol
513 (package
514 (name "python-pymol")
515 (version "2.5.0")
516 (source
517 (origin
518 (method git-fetch)
519 (uri (git-reference
520 (url "https://github.com/schrodinger/pymol-open-source")
521 (commit (string-append "v" version))))
522 (file-name (git-file-name name version))
523 (sha256
524 (base32 "08zmfgclkbjkqjpq8xs1mphs1i8rpqj76mcw7m2mrhvma5qj1nr5"))))
525 (build-system python-build-system)
526 (arguments
527 '(#:configure-flags
528 (list "--glut" "--testing")
529 #:phases
530 (modify-phases %standard-phases
531 (add-after 'unpack 'make-reproducible
532 (lambda _
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")
541 "/include/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".
545 (replace 'install
546 (lambda* (#:key outputs #:allow-other-keys)
547 (invoke "python" "setup.py" "install"
548 (string-append "--prefix=" (assoc-ref outputs "out"))
549 "--root=/"))))))
550 (inputs
551 (list freetype
552 libpng
553 freeglut
554 glew
555 libxml2
556 mmtf-cpp
557 msgpack
558 python-pyqt
559 glm
560 netcdf))
561 (native-inputs
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)))