gnu: Add cl-ana.statistical-learning.
[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 Kei Kebreau <kkebreau@posteo.net>
4 ;;; Copyright © 2018 Efraim Flashner <efraim@flashner.co.il>
5 ;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages chemistry)
23 #:use-module (guix packages)
24 #:use-module (guix utils)
25 #:use-module ((guix licenses) #:prefix license:)
26 #:use-module (guix download)
27 #:use-module (guix git-download)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages algebra)
30 #:use-module (gnu packages boost)
31 #:use-module (gnu packages compression)
32 #:use-module (gnu packages documentation)
33 #:use-module (gnu packages gl)
34 #:use-module (gnu packages gv)
35 #:use-module (gnu packages maths)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages python)
38 #:use-module (gnu packages python-xyz)
39 #:use-module (gnu packages qt)
40 #:use-module (gnu packages xml)
41 #:use-module (guix build-system cmake)
42 #:use-module (guix build-system gnu)
43 #:use-module (guix build-system python))
44
45 (define-public avogadro
46 (package
47 (name "avogadro")
48 (version "1.2.0")
49 (source
50 (origin
51 (method git-fetch)
52 (uri (git-reference
53 (url "https://github.com/cryos/avogadro.git")
54 (commit version)))
55 (sha256
56 (base32 "0258py3lkba85qhs5ynancinyym61vlp0zaq9yrfs3hhnhpzv9n2"))
57 (file-name (git-file-name name version))
58 (patches
59 (search-patches "avogadro-eigen3-update.patch"
60 "avogadro-python-eigen-lib.patch"
61 "avogadro-boost148.patch"))))
62 (build-system cmake-build-system)
63 (arguments
64 `(#:tests? #f
65 #:configure-flags
66 (list "-DENABLE_GLSL=ON"
67 (string-append "-DPYTHON_LIBRARIES="
68 (assoc-ref %build-inputs "python")
69 "/lib")
70 (string-append "-DPYTHON_INCLUDE_DIRS="
71 (assoc-ref %build-inputs "python")
72 "/include/python"
73 ,(version-major+minor
74 (package-version python))))
75 #:phases
76 (modify-phases %standard-phases
77 (add-after 'unpack 'patch-python-lib-path
78 (lambda* (#:key outputs #:allow-other-keys)
79 ;; This is necessary to install the Python module in the correct
80 ;; directory.
81 (substitute* "libavogadro/src/python/CMakeLists.txt"
82 (("^EXECUTE_PROCESS.*$") "")
83 (("^.*from sys import stdout.*$") "")
84 (("^.*OUTPUT_VARIABLE.*")
85 (string-append "set(PYTHON_LIB_PATH \""
86 (assoc-ref outputs "out")
87 "/lib/python"
88 ,(version-major+minor
89 (package-version python))
90 "/site-packages\")")))
91 #t))
92 (add-after 'install 'wrap-program
93 (lambda* (#:key inputs outputs #:allow-other-keys)
94 ;; Make sure 'avogadro' runs with the correct PYTHONPATH.
95 (let* ((out (assoc-ref outputs "out")))
96 (setenv "PYTHONPATH"
97 (string-append
98 (assoc-ref outputs "out")
99 "/lib/python"
100 ,(version-major+minor
101 (package-version python))
102 "/site-packages:"
103 (getenv "PYTHONPATH")))
104 (wrap-program (string-append out "/bin/avogadro")
105 `("PYTHONPATH" ":" prefix (,(getenv "PYTHONPATH")))))
106 #t)))))
107 (native-inputs
108 `(("doxygen" ,doxygen)
109 ("pkg-config" ,pkg-config)))
110 (inputs
111 `(("boost" ,boost)
112 ("eigen" ,eigen)
113 ("glew" ,glew)
114 ("openbabel" ,openbabel)
115 ("python" ,python-2)
116 ("python-numpy" ,python2-numpy)
117 ("python-pyqt" ,python2-pyqt-4)
118 ("python-sip" ,python2-sip)
119 ("qt" ,qt-4)
120 ("zlib" ,zlib)))
121 (home-page "https://avogadro.cc")
122 (synopsis "Advanced molecule editor")
123 (description
124 "Avogadro is an advanced molecule editor and visualizer designed for use
125 in computational chemistry, molecular modeling, bioinformatics, materials
126 science, and related areas. It offers flexible high quality rendering and a
127 powerful plugin architecture.")
128 (license license:gpl2+)))
129
130 (define-public domainfinder
131 (package
132 (name "domainfinder")
133 (version "2.0.5")
134 (source
135 (origin
136 (method url-fetch)
137 (uri (string-append "https://bitbucket.org/khinsen/"
138 "domainfinder/downloads/DomainFinder-"
139 version ".tar.gz"))
140 (sha256
141 (base32
142 "1z26lsyf7xwnzwjvimmbla7ckipx6p734w7y0jk2a2fzci8fkdcr"))))
143 (build-system python-build-system)
144 (inputs
145 `(("python-mmtk" ,python2-mmtk)))
146 (arguments
147 `(#:python ,python-2
148 ;; No test suite
149 #:tests? #f))
150 (home-page "http://dirac.cnrs-orleans.fr/DomainFinder")
151 (synopsis "Analysis of dynamical domains in proteins")
152 (description "DomainFinder is an interactive program for the determination
153 and characterization of dynamical domains in proteins. It can infer dynamical
154 domains by comparing two protein structures, or from normal mode analysis on a
155 single structure. The software is currently not actively maintained and works
156 only with Python 2 and NumPy < 1.9.")
157 (license license:cecill-c)))
158
159 (define-public inchi
160 (package
161 (name "inchi")
162 (version "1.05")
163 (source (origin
164 (method url-fetch)
165 (uri (string-append "http://www.inchi-trust.org/download/"
166 (string-join (string-split version #\.) "")
167 "/INCHI-1-SRC.zip"))
168 (sha256
169 (base32
170 "081pcjx1z5jm23fs1pl2r3bccia0ww8wfkzcjpb7byhn7b513hsa"))
171 (file-name (string-append name "-" version ".zip"))))
172 (build-system gnu-build-system)
173 (arguments
174 '(#:tests? #f ; no check target
175 #:phases
176 (modify-phases %standard-phases
177 (delete 'configure) ; no configure script
178 (add-before 'build 'chdir-to-build-directory
179 (lambda _ (chdir "INCHI_EXE/inchi-1/gcc") #t))
180 (add-after 'build 'build-library
181 (lambda _
182 (chdir "../../../INCHI_API/libinchi/gcc")
183 (invoke "make")))
184 (replace 'install
185 (lambda* (#:key inputs outputs #:allow-other-keys)
186 (let* ((out (assoc-ref outputs "out"))
187 (bin (string-append out "/bin"))
188 (doc (string-append out "/share/doc/inchi"))
189 (include-dir (string-append out "/include/inchi"))
190 (lib (string-append out "/lib/inchi"))
191 (inchi-doc (assoc-ref inputs "inchi-doc"))
192 (unzip (string-append (assoc-ref inputs "unzip")
193 "/bin/unzip")))
194 (chdir "../../..")
195 ;; Install binary.
196 (with-directory-excursion "INCHI_EXE/bin/Linux"
197 (rename-file "inchi-1" "inchi")
198 (install-file "inchi" bin))
199 ;; Install libraries.
200 (with-directory-excursion "INCHI_API/bin/Linux"
201 (for-each (lambda (file)
202 (install-file file lib))
203 (find-files "." "libinchi\\.so\\.1\\.*")))
204 ;; Install header files.
205 (with-directory-excursion "INCHI_BASE/src"
206 (for-each (lambda (file)
207 (install-file file include-dir))
208 (find-files "." "\\.h$")))
209 ;; Install documentation.
210 (mkdir-p doc)
211 (invoke unzip "-j" "-d" doc inchi-doc)
212 #t))))))
213 (native-inputs
214 `(("unzip" ,unzip)
215 ("inchi-doc"
216 ,(origin
217 (method url-fetch)
218 (uri (string-append "http://www.inchi-trust.org/download/"
219 (string-join (string-split version #\.) "")
220 "/INCHI-1-DOC.zip"))
221 (sha256
222 (base32
223 "1id1qb2y4lwsiw91qr2yqpn6kxbwjwhjk0hb2rwk4fxhdqib6da6"))
224 (file-name (string-append name "-" version ".zip"))))))
225 (home-page "https://www.inchi-trust.org")
226 (synopsis "Utility for manipulating machine-readable chemical structures")
227 (description
228 "The @dfn{InChI} (IUPAC International Chemical Identifier) algorithm turns
229 chemical structures into machine-readable strings of information. InChIs are
230 unique to the compound they describe and can encode absolute stereochemistry
231 making chemicals and chemistry machine-readable and discoverable. A simple
232 analogy is that InChI is the bar-code for chemistry and chemical structures.")
233 (license (license:non-copyleft
234 "file://LICENCE"
235 "See LICENCE in the distribution."))))
236
237 (define with-numpy-1.8
238 (package-input-rewriting `((,python2-numpy . ,python2-numpy-1.8))))
239
240 (define-public nmoldyn
241 (package
242 (name "nmoldyn")
243 (version "3.0.11")
244 (source
245 (origin
246 (method git-fetch)
247 (uri (git-reference
248 (url "https://github.com/khinsen/nMOLDYN3")
249 (commit (string-append "v" version))))
250 (file-name (git-file-name name version))
251 (sha256
252 (base32
253 "016h4bqg419p6s7bcx55q5iik91gqmk26hbnfgj2j6zl0j36w51r"))))
254 (build-system python-build-system)
255 (inputs
256 `(("python-matplotlib" ,(with-numpy-1.8 python2-matplotlib))
257 ("python-scientific" ,python2-scientific)
258 ("netcdf" ,netcdf)
259 ("gv" ,gv)))
260 (propagated-inputs
261 `(("python-mmtk" ,python2-mmtk)))
262 (arguments
263 `(#:python ,python-2
264 #:tests? #f ; No test suite
265 #:phases
266 (modify-phases %standard-phases
267 (add-before 'build 'create-linux2-directory
268 (lambda _
269 (mkdir-p "nMOLDYN/linux2")))
270 (add-before 'build 'change-PDF-viewer
271 (lambda* (#:key inputs #:allow-other-keys)
272 (substitute* "nMOLDYN/Preferences.py"
273 ;; Set the paths for external executables, substituting
274 ;; gv for acroread.
275 ;; There is also vmd_path, but VMD is not free software
276 ;; and Guix contains currently no free molecular viewer that
277 ;; could be substituted.
278 (("PREFERENCES\\['acroread_path'\\] = ''")
279 (format "PREFERENCES['acroread_path'] = '~a'"
280 (which "gv")))
281 (("PREFERENCES\\['ncdump_path'\\] = ''")
282 (format "PREFERENCES['ncdump_path'] = '~a'"
283 (which "ncdump")))
284 (("PREFERENCES\\['ncgen_path'\\] = ''")
285 (format "PREFERENCES['ncgen_path'] = '~a'"
286 (which "ncgen3")))
287 (("PREFERENCES\\['task_manager_path'\\] = ''")
288 (format "PREFERENCES['task_manager_path'] = '~a'"
289 (which "task_manager")))
290 ;; Show documentation as PDF
291 (("PREFERENCES\\['documentation_style'\\] = 'html'")
292 "PREFERENCES['documentation_style'] = 'pdf'") ))))))
293 (home-page "http://dirac.cnrs-orleans.fr/nMOLDYN/")
294 (synopsis "Analysis software for Molecular Dynamics trajectories")
295 (description "nMOLDYN is an interactive analysis program for Molecular Dynamics
296 simulations. It is especially designed for the computation and decomposition of
297 neutron scattering spectra, but also computes other quantities. The software
298 is currently not actively maintained and works only with Python 2 and
299 NumPy < 1.9.")
300 (license license:cecill)))
301
302 (define-public openbabel
303 (package
304 (name "openbabel")
305 (version "2.4.1")
306 (source (origin
307 (method url-fetch)
308 (uri (string-append "mirror://sourceforge/" name "/" name "/"
309 version "/" name "-" version ".tar.gz"))
310 (sha256
311 (base32
312 "1z3d6xm70dpfikhwdnbzc66j2l49vq105ch041wivrfz5ic3ch90"))
313 (patches
314 (search-patches "openbabel-fix-crash-on-nwchem-output.patch"))))
315 (build-system cmake-build-system)
316 (arguments
317 `(#:configure-flags
318 (list "-DOPENBABEL_USE_SYSTEM_INCHI=ON"
319 (string-append "-DINCHI_LIBRARY="
320 (assoc-ref %build-inputs "inchi")
321 "/lib/inchi/libinchi.so.1")
322 (string-append "-DINCHI_INCLUDE_DIR="
323 (assoc-ref %build-inputs "inchi") "/include/inchi"))
324 #:test-target "test"))
325 (native-inputs
326 `(("pkg-config" ,pkg-config)))
327 (inputs
328 `(("eigen" ,eigen)
329 ("inchi" ,inchi)
330 ("libxml2" ,libxml2)
331 ("zlib" ,zlib)))
332 (home-page "http://openbabel.org/wiki/Main_Page")
333 (synopsis "Chemistry data manipulation toolbox")
334 (description
335 "Open Babel is a chemical toolbox designed to speak the many languages of
336 chemical data. It's a collaborative project allowing anyone to search, convert,
337 analyze, or store data from molecular modeling, chemistry, solid-state
338 materials, biochemistry, or related areas.")
339 (license license:gpl2)))