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