gnu: Remove ".git" from "https://github/…/….git".
[jackhill/guix/guix.git] / gnu / packages / chemistry.scm
CommitLineData
73114e30
KH
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2018 Konrad Hinsen <konrad.hinsen@fastmail.net>
a49eb85c 3;;; Copyright © 2018 Kei Kebreau <kkebreau@posteo.net>
4ae16f9c 4;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
631249dd 5;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
357328d2 6;;; Copyright © 2020 Björn Höfling <bjoern.hoefling@bjoernhoefling.de>
1c560401 7;;; Copyright © 2020 Vincent Legoll <vincent.legoll@gmail.com>
73114e30
KH
8;;;
9;;; This file is part of GNU Guix.
10;;;
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.
15;;;
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.
20;;;
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/>.
23
24(define-module (gnu packages chemistry)
25 #:use-module (guix packages)
4ae16f9c 26 #:use-module (guix utils)
73114e30
KH
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (guix download)
631249dd 29 #:use-module (guix git-download)
0c468cb5 30 #:use-module (gnu packages)
348edd91 31 #:use-module (gnu packages algebra)
7d01ee66 32 #:use-module (gnu packages boost)
06ed1dba 33 #:use-module (gnu packages check)
a49eb85c 34 #:use-module (gnu packages compression)
7d01ee66
KK
35 #:use-module (gnu packages documentation)
36 #:use-module (gnu packages gl)
06ed1dba 37 #:use-module (gnu packages graphviz)
f250a868
KH
38 #:use-module (gnu packages gv)
39 #:use-module (gnu packages maths)
06ed1dba
VL
40 #:use-module (gnu packages mpi)
41 #:use-module (gnu packages perl)
348edd91 42 #:use-module (gnu packages pkg-config)
73114e30 43 #:use-module (gnu packages python)
44d10b1f 44 #:use-module (gnu packages python-xyz)
7d01ee66 45 #:use-module (gnu packages qt)
06ed1dba 46 #:use-module (gnu packages sphinx)
348edd91
KK
47 #:use-module (gnu packages xml)
48 #:use-module (guix build-system cmake)
a49eb85c 49 #:use-module (guix build-system gnu)
73114e30
KH
50 #:use-module (guix build-system python))
51
7d01ee66
KK
52(define-public avogadro
53 (package
54 (name "avogadro")
55 (version "1.2.0")
631249dd
TGR
56 (source
57 (origin
58 (method git-fetch)
59 (uri (git-reference
b0e7b699 60 (url "https://github.com/cryos/avogadro")
631249dd
TGR
61 (commit version)))
62 (sha256
63 (base32 "0258py3lkba85qhs5ynancinyym61vlp0zaq9yrfs3hhnhpzv9n2"))
64 (file-name (git-file-name name version))
65 (patches
66 (search-patches "avogadro-eigen3-update.patch"
67 "avogadro-python-eigen-lib.patch"
68 "avogadro-boost148.patch"))))
7d01ee66
KK
69 (build-system cmake-build-system)
70 (arguments
4ae16f9c 71 `(#:tests? #f
7d01ee66
KK
72 #:configure-flags
73 (list "-DENABLE_GLSL=ON"
74 (string-append "-DPYTHON_LIBRARIES="
75 (assoc-ref %build-inputs "python")
76 "/lib")
77 (string-append "-DPYTHON_INCLUDE_DIRS="
78 (assoc-ref %build-inputs "python")
4ae16f9c
EF
79 "/include/python"
80 ,(version-major+minor
81 (package-version python))))
7d01ee66
KK
82 #:phases
83 (modify-phases %standard-phases
84 (add-after 'unpack 'patch-python-lib-path
85 (lambda* (#:key outputs #:allow-other-keys)
86 ;; This is necessary to install the Python module in the correct
87 ;; directory.
88 (substitute* "libavogadro/src/python/CMakeLists.txt"
89 (("^EXECUTE_PROCESS.*$") "")
90 (("^.*from sys import stdout.*$") "")
91 (("^.*OUTPUT_VARIABLE.*")
92 (string-append "set(PYTHON_LIB_PATH \""
93 (assoc-ref outputs "out")
4ae16f9c
EF
94 "/lib/python"
95 ,(version-major+minor
96 (package-version python))
97 "/site-packages\")")))
7d01ee66
KK
98 #t))
99 (add-after 'install 'wrap-program
100 (lambda* (#:key inputs outputs #:allow-other-keys)
101 ;; Make sure 'avogadro' runs with the correct PYTHONPATH.
102 (let* ((out (assoc-ref outputs "out")))
103 (setenv "PYTHONPATH"
104 (string-append
105 (assoc-ref outputs "out")
4ae16f9c
EF
106 "/lib/python"
107 ,(version-major+minor
108 (package-version python))
109 "/site-packages:"
7d01ee66
KK
110 (getenv "PYTHONPATH")))
111 (wrap-program (string-append out "/bin/avogadro")
112 `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH")))))
113 #t)))))
114 (native-inputs
115 `(("doxygen" ,doxygen)
116 ("pkg-config" ,pkg-config)))
117 (inputs
118 `(("boost" ,boost)
119 ("eigen" ,eigen)
120 ("glew" ,glew)
121 ("openbabel" ,openbabel)
122 ("python" ,python-2)
123 ("python-numpy" ,python2-numpy)
124 ("python-pyqt" ,python2-pyqt-4)
125 ("python-sip" ,python2-sip)
126 ("qt" ,qt-4)
127 ("zlib" ,zlib)))
128 (home-page "https://avogadro.cc")
129 (synopsis "Advanced molecule editor")
130 (description
131 "Avogadro is an advanced molecule editor and visualizer designed for use
132in computational chemistry, molecular modeling, bioinformatics, materials
133science, and related areas. It offers flexible high quality rendering and a
134powerful plugin architecture.")
135 (license license:gpl2+)))
136
73114e30
KH
137(define-public domainfinder
138 (package
139 (name "domainfinder")
140 (version "2.0.5")
141 (source
142 (origin
143 (method url-fetch)
144 (uri (string-append "https://bitbucket.org/khinsen/"
145 "domainfinder/downloads/DomainFinder-"
146 version ".tar.gz"))
147 (sha256
148 (base32
149 "1z26lsyf7xwnzwjvimmbla7ckipx6p734w7y0jk2a2fzci8fkdcr"))))
150 (build-system python-build-system)
151 (inputs
152 `(("python-mmtk" ,python2-mmtk)))
153 (arguments
154 `(#:python ,python-2
155 ;; No test suite
156 #:tests? #f))
7f489c56 157 (home-page "http://dirac.cnrs-orleans.fr/DomainFinder.html")
73114e30
KH
158 (synopsis "Analysis of dynamical domains in proteins")
159 (description "DomainFinder is an interactive program for the determination
160and characterization of dynamical domains in proteins. It can infer dynamical
161domains by comparing two protein structures, or from normal mode analysis on a
162single structure. The software is currently not actively maintained and works
163only with Python 2 and NumPy < 1.9.")
164 (license license:cecill-c)))
f250a868 165
a49eb85c
KK
166(define-public inchi
167 (package
168 (name "inchi")
169 (version "1.05")
170 (source (origin
171 (method url-fetch)
172 (uri (string-append "http://www.inchi-trust.org/download/"
173 (string-join (string-split version #\.) "")
174 "/INCHI-1-SRC.zip"))
175 (sha256
176 (base32
177 "081pcjx1z5jm23fs1pl2r3bccia0ww8wfkzcjpb7byhn7b513hsa"))
178 (file-name (string-append name "-" version ".zip"))))
179 (build-system gnu-build-system)
180 (arguments
181 '(#:tests? #f ; no check target
182 #:phases
183 (modify-phases %standard-phases
184 (delete 'configure) ; no configure script
185 (add-before 'build 'chdir-to-build-directory
186 (lambda _ (chdir "INCHI_EXE/inchi-1/gcc") #t))
187 (add-after 'build 'build-library
188 (lambda _
189 (chdir "../../../INCHI_API/libinchi/gcc")
190 (invoke "make")))
191 (replace 'install
192 (lambda* (#:key inputs outputs #:allow-other-keys)
193 (let* ((out (assoc-ref outputs "out"))
194 (bin (string-append out "/bin"))
195 (doc (string-append out "/share/doc/inchi"))
196 (include-dir (string-append out "/include/inchi"))
197 (lib (string-append out "/lib/inchi"))
198 (inchi-doc (assoc-ref inputs "inchi-doc"))
199 (unzip (string-append (assoc-ref inputs "unzip")
200 "/bin/unzip")))
201 (chdir "../../..")
202 ;; Install binary.
203 (with-directory-excursion "INCHI_EXE/bin/Linux"
204 (rename-file "inchi-1" "inchi")
205 (install-file "inchi" bin))
206 ;; Install libraries.
207 (with-directory-excursion "INCHI_API/bin/Linux"
208 (for-each (lambda (file)
209 (install-file file lib))
210 (find-files "." "libinchi\\.so\\.1\\.*")))
211 ;; Install header files.
212 (with-directory-excursion "INCHI_BASE/src"
213 (for-each (lambda (file)
214 (install-file file include-dir))
215 (find-files "." "\\.h$")))
216 ;; Install documentation.
217 (mkdir-p doc)
218 (invoke unzip "-j" "-d" doc inchi-doc)
219 #t))))))
220 (native-inputs
221 `(("unzip" ,unzip)
222 ("inchi-doc"
223 ,(origin
224 (method url-fetch)
225 (uri (string-append "http://www.inchi-trust.org/download/"
226 (string-join (string-split version #\.) "")
227 "/INCHI-1-DOC.zip"))
228 (sha256
229 (base32
230 "1id1qb2y4lwsiw91qr2yqpn6kxbwjwhjk0hb2rwk4fxhdqib6da6"))
231 (file-name (string-append name "-" version ".zip"))))))
232 (home-page "https://www.inchi-trust.org")
233 (synopsis "Utility for manipulating machine-readable chemical structures")
234 (description
235 "The @dfn{InChI} (IUPAC International Chemical Identifier) algorithm turns
236chemical structures into machine-readable strings of information. InChIs are
237unique to the compound they describe and can encode absolute stereochemistry
238making chemicals and chemistry machine-readable and discoverable. A simple
239analogy is that InChI is the bar-code for chemistry and chemical structures.")
240 (license (license:non-copyleft
241 "file://LICENCE"
242 "See LICENCE in the distribution."))))
243
f250a868
KH
244(define with-numpy-1.8
245 (package-input-rewriting `((,python2-numpy . ,python2-numpy-1.8))))
246
247(define-public nmoldyn
248 (package
249 (name "nmoldyn")
250 (version "3.0.11")
251 (source
252 (origin
e2293cbb
KH
253 (method git-fetch)
254 (uri (git-reference
255 (url "https://github.com/khinsen/nMOLDYN3")
256 (commit (string-append "v" version))))
257 (file-name (git-file-name name version))
f250a868
KH
258 (sha256
259 (base32
e2293cbb 260 "016h4bqg419p6s7bcx55q5iik91gqmk26hbnfgj2j6zl0j36w51r"))))
f250a868
KH
261 (build-system python-build-system)
262 (inputs
263 `(("python-matplotlib" ,(with-numpy-1.8 python2-matplotlib))
c695fb76
TGR
264 ("python-scientific" ,python2-scientific)
265 ("netcdf" ,netcdf)
f250a868
KH
266 ("gv" ,gv)))
267 (propagated-inputs
268 `(("python-mmtk" ,python2-mmtk)))
269 (arguments
270 `(#:python ,python-2
271 #:tests? #f ; No test suite
272 #:phases
273 (modify-phases %standard-phases
274 (add-before 'build 'create-linux2-directory
275 (lambda _
276 (mkdir-p "nMOLDYN/linux2")))
277 (add-before 'build 'change-PDF-viewer
278 (lambda* (#:key inputs #:allow-other-keys)
279 (substitute* "nMOLDYN/Preferences.py"
280 ;; Set the paths for external executables, substituting
281 ;; gv for acroread.
282 ;; There is also vmd_path, but VMD is not free software
283 ;; and Guix contains currently no free molecular viewer that
284 ;; could be substituted.
285 (("PREFERENCES\\['acroread_path'\\] = ''")
30d0f7fa 286 (format #f "PREFERENCES['acroread_path'] = '~a'"
f250a868
KH
287 (which "gv")))
288 (("PREFERENCES\\['ncdump_path'\\] = ''")
30d0f7fa 289 (format #f "PREFERENCES['ncdump_path'] = '~a'"
f250a868
KH
290 (which "ncdump")))
291 (("PREFERENCES\\['ncgen_path'\\] = ''")
30d0f7fa 292 (format #f "PREFERENCES['ncgen_path'] = '~a'"
f250a868
KH
293 (which "ncgen3")))
294 (("PREFERENCES\\['task_manager_path'\\] = ''")
30d0f7fa 295 (format #f "PREFERENCES['task_manager_path'] = '~a'"
f250a868
KH
296 (which "task_manager")))
297 ;; Show documentation as PDF
298 (("PREFERENCES\\['documentation_style'\\] = 'html'")
299 "PREFERENCES['documentation_style'] = 'pdf'") ))))))
357328d2 300 (home-page "http://dirac.cnrs-orleans.fr/nMOLDYN.html")
f250a868
KH
301 (synopsis "Analysis software for Molecular Dynamics trajectories")
302 (description "nMOLDYN is an interactive analysis program for Molecular Dynamics
303simulations. It is especially designed for the computation and decomposition of
304neutron scattering spectra, but also computes other quantities. The software
305is currently not actively maintained and works only with Python 2 and
306NumPy < 1.9.")
307 (license license:cecill)))
348edd91 308
1c560401
VL
309(define-public tng
310 (package
311 (name "tng")
312 (version "1.8.2")
313 (source (origin
314 (method git-fetch)
315 (uri (git-reference
b0e7b699 316 (url "https://github.com/gromacs/tng")
1c560401
VL
317 (commit (string-append "v" version))))
318 (file-name (git-file-name name version))
319 (sha256
320 (base32
321 "1apf2n8nb34z09xarj7k4jgriq283l769sakjmj5aalpbilvai4q"))))
322 (build-system cmake-build-system)
323 (inputs
324 `(("zlib" ,zlib)))
325 (arguments
326 `(#:phases
327 (modify-phases %standard-phases
328 (add-after 'unpack 'remove-bundled-zlib
329 (lambda _
330 (delete-file-recursively "external")
331 #t))
332 (replace 'check
333 (lambda _
334 (invoke "../build/bin/tests/tng_testing")
335 #t)))))
336 (home-page "https://github.com/gromacs/tng")
337 (synopsis "Trajectory Next Generation binary format manipulation library")
338 (description "TRAJNG (Trajectory next generation) is a program library for
339handling molecular dynamics (MD) trajectories. It can store coordinates, and
340optionally velocities and the H-matrix. Coordinates and velocities are
341stored with user-specified precision.")
342 (license license:bsd-3)))
343
06ed1dba
VL
344(define-public gromacs
345 (package
346 (name "gromacs")
347 (version "2020.2")
348 (source (origin
349 (method url-fetch)
350 (uri (string-append "http://ftp.gromacs.org/pub/gromacs/gromacs-"
351 version ".tar.gz"))
352 (sha256
353 (base32
354 "1wyjgcdl30wy4hy6jvi9lkq53bqs9fgfq6fri52dhnb3c76y8rbl"))
355 ;; Our version of tinyxml2 is far newer than the bundled one and
356 ;; require fixing `testutils' code. See patch header for more info
357 (patches (search-patches "gromacs-tinyxml2.patch"))))
358 (build-system cmake-build-system)
359 (arguments
360 `(#:configure-flags
361 (list "-DGMX_DEVELOPER_BUILD=on" ; Needed to run tests
362 ;; Unbundling
363 "-DGMX_USE_LMFIT=EXTERNAL"
364 "-DGMX_BUILD_OWN_FFTW=off"
365 "-DGMX_EXTERNAL_BLAS=on"
366 "-DGMX_EXTERNAL_LAPACK=on"
367 "-DGMX_EXTERNAL_TNG=on"
368 "-DGMX_EXTERNAL_ZLIB=on"
369 "-DGMX_EXTERNAL_TINYXML2=on"
370 (string-append "-DTinyXML2_DIR="
371 (assoc-ref %build-inputs "tinyxml2"))
372 ;; Workaround for cmake/FindSphinx.cmake version parsing that does
373 ;; not understand the guix-wrapped `sphinx-build --version' answer
374 (string-append "-DSPHINX_EXECUTABLE_VERSION="
375 ,(package-version python-sphinx)))
376 #:phases
377 (modify-phases %standard-phases
378 (add-after 'unpack 'fixes
379 (lambda* (#:key inputs #:allow-other-keys)
380 ;; Still bundled: part of gromacs, source behind registration
381 ;; but free software anyways
382 ;;(delete-file-recursively "src/external/vmd_molfile")
383 ;; Still bundled: threads-based OpenMPI-compatible fallback
384 ;; designed to be bundled like that
385 ;;(delete-file-recursively "src/external/thread_mpi")
386 ;; Unbundling
387 (delete-file-recursively "src/external/lmfit")
388 (delete-file-recursively "src/external/clFFT")
389 (delete-file-recursively "src/external/fftpack")
390 (delete-file-recursively "src/external/build-fftw")
391 (delete-file-recursively "src/external/tng_io")
392 (delete-file-recursively "src/external/tinyxml2")
393 (delete-file-recursively "src/external/googletest")
394 (copy-recursively (assoc-ref inputs "googletest-source")
395 "src/external/googletest")
396 ;; This test warns about the build host hardware, disable
397 (substitute* "src/gromacs/hardware/tests/hardwaretopology.cpp"
398 (("TEST\\(HardwareTopologyTest, HwlocExecute\\)")
399 "void __guix_disabled()"))
400 #t)))))
401 (native-inputs
402 `(("doxygen" ,doxygen)
403 ("googletest-source" ,(package-source googletest))
404 ("graphviz" ,graphviz)
405 ("pkg-config" ,pkg-config)
406 ("python" ,python)
407 ("python-pygments" ,python-pygments)
408 ("python-sphinx" ,python-sphinx)))
409 (inputs
410 `(("fftwf" ,fftwf)
411 ("hwloc" ,hwloc-2 "lib")
412 ("lmfit" ,lmfit)
413 ("openblas" ,openblas)
414 ("perl" ,perl)
415 ("tinyxml2" ,tinyxml2)
416 ("tng" ,tng)))
417 (home-page "http://www.gromacs.org/")
418 (synopsis "Molecular dynamics software package")
419 (description "GROMACS is a versatile package to perform molecular dynamics,
420i.e. simulate the Newtonian equations of motion for systems with hundreds to
421millions of particles. It is primarily designed for biochemical molecules like
422proteins, lipids and nucleic acids that have a lot of complicated bonded
423interactions, but since GROMACS is extremely fast at calculating the nonbonded
424interactions (that usually dominate simulations) many groups are also using it
425for research on non-biological systems, e.g. polymers. GROMACS supports all the
426usual algorithms you expect from a modern molecular dynamics implementation.")
427 (license license:lgpl2.1+)))
428
348edd91
KK
429(define-public openbabel
430 (package
431 (name "openbabel")
432 (version "2.4.1")
433 (source (origin
434 (method url-fetch)
435 (uri (string-append "mirror://sourceforge/" name "/" name "/"
436 version "/" name "-" version ".tar.gz"))
437 (sha256
438 (base32
eb5ece73
KK
439 "1z3d6xm70dpfikhwdnbzc66j2l49vq105ch041wivrfz5ic3ch90"))
440 (patches
441 (search-patches "openbabel-fix-crash-on-nwchem-output.patch"))))
348edd91
KK
442 (build-system cmake-build-system)
443 (arguments
444 `(#:configure-flags
445 (list "-DOPENBABEL_USE_SYSTEM_INCHI=ON"
446 (string-append "-DINCHI_LIBRARY="
447 (assoc-ref %build-inputs "inchi")
448 "/lib/inchi/libinchi.so.1")
449 (string-append "-DINCHI_INCLUDE_DIR="
450 (assoc-ref %build-inputs "inchi") "/include/inchi"))
451 #:test-target "test"))
452 (native-inputs
453 `(("pkg-config" ,pkg-config)))
454 (inputs
455 `(("eigen" ,eigen)
456 ("inchi" ,inchi)
457 ("libxml2" ,libxml2)
458 ("zlib" ,zlib)))
459 (home-page "http://openbabel.org/wiki/Main_Page")
460 (synopsis "Chemistry data manipulation toolbox")
461 (description
462 "Open Babel is a chemical toolbox designed to speak the many languages of
463chemical data. It's a collaborative project allowing anyone to search, convert,
464analyze, or store data from molecular modeling, chemistry, solid-state
465materials, biochemistry, or related areas.")
466 (license license:gpl2)))