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