Gentoo Archives: gentoo-commits

From: Christoph Junghans <kleiner_otti@×××.de>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-chemistry/gromacs/
Date: Wed, 28 Sep 2011 07:32:29
Message-Id: 447c6e1b7727d7f7a47f7e094de38879301d0ee7.kleiner_otti@gentoo
1 commit: 447c6e1b7727d7f7a47f7e094de38879301d0ee7
2 Author: Christoph Junghans <ottxor <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 28 07:32:11 2011 +0000
4 Commit: Christoph Junghans <kleiner_otti <AT> gmx <DOT> de>
5 CommitDate: Wed Sep 28 07:32:11 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=447c6e1b
7
8 [sci-chemistry/gromacs] added 4.6 live version
9
10 (Portage version: 2.1.10.11/git/Linux i686, signed Manifest commit with key C2000586)
11
12 ---
13 sci-chemistry/gromacs/ChangeLog | 5 +
14 sci-chemistry/gromacs/gromacs-4.6.9999.ebuild | 239 +++++++++++++++++++++++++
15 2 files changed, 244 insertions(+), 0 deletions(-)
16
17 diff --git a/sci-chemistry/gromacs/ChangeLog b/sci-chemistry/gromacs/ChangeLog
18 index b7359bd..537e8c7 100644
19 --- a/sci-chemistry/gromacs/ChangeLog
20 +++ b/sci-chemistry/gromacs/ChangeLog
21 @@ -2,6 +2,11 @@
22 # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
23 # $Header: $
24
25 +*gromacs-4.6.9999 (28 Sep 2011)
26 +
27 + 28 Sep 2011; Christoph Junghans <ottxor@g.o> +gromacs-4.6.9999.ebuild:
28 + Added gromacs-4.6 live version
29 +
30 10 Sep 2011; Christoph Junghans <ottxor@g.o> gromacs-4.5.9999.ebuild,
31 gromacs-9999.ebuild:
32 Migrate to the bash-completion-r1 eclass
33
34 diff --git a/sci-chemistry/gromacs/gromacs-4.6.9999.ebuild b/sci-chemistry/gromacs/gromacs-4.6.9999.ebuild
35 new file mode 100644
36 index 0000000..dab09b1
37 --- /dev/null
38 +++ b/sci-chemistry/gromacs/gromacs-4.6.9999.ebuild
39 @@ -0,0 +1,239 @@
40 +# Copyright 1999-2011 Gentoo Foundation
41 +# Distributed under the terms of the GNU General Public License v2
42 +# $Header: $
43 +
44 +EAPI="4"
45 +
46 +TEST_PV="4.0.4"
47 +MANUAL_PV="4.5.4"
48 +
49 +#to find external blas/lapack
50 +CMAKE_MIN_VERSION="2.8.5-r2"
51 +
52 +inherit bash-completion-r1 cmake-utils eutils fortran-2 multilib toolchain-funcs
53 +
54 +SRC_URI="test? ( ftp://ftp.gromacs.org/pub/tests/gmxtest-${TEST_PV}.tgz )
55 + doc? ( ftp://ftp.gromacs.org/pub/manual/manual-${MANUAL_PV}.pdf -> gromacs-manual-${MANUAL_PV}.pdf )"
56 +
57 +if [ "${PV%9999}" != "${PV}" ]; then
58 + EGIT_REPO_URI="git://git.gromacs.org/gromacs"
59 + EGIT_BRANCH="release-4-6"
60 + inherit git-2
61 +else
62 + SRC_URI="${SRC_URI} ftp://ftp.gromacs.org/pub/${PN}/${P}.tar.gz"
63 +fi
64 +
65 +DESCRIPTION="The ultimate molecular dynamics simulation package"
66 +HOMEPAGE="http://www.gromacs.org/"
67 +
68 +LICENSE="GPL-2"
69 +SLOT="0"
70 +KEYWORDS="~alpha ~amd64 ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
71 +IUSE="X altivec blas doc -double-precision +fftw fkernels gsl lapack
72 +mpi +single-precision sse2 test +threads xml zsh-completion"
73 +REQUIRED_USE="fkernels? ( !threads )"
74 +
75 +CDEPEND="
76 + X? (
77 + x11-libs/libX11
78 + x11-libs/libSM
79 + x11-libs/libICE
80 + )
81 + blas? ( virtual/blas )
82 + fftw? ( sci-libs/fftw:3.0 )
83 + fkernels? ( virtual/fortran )
84 + gsl? ( sci-libs/gsl )
85 + lapack? ( virtual/lapack )
86 + mpi? ( virtual/mpi )
87 + xml? ( dev-libs/libxml2:2 )"
88 +DEPEND="${CDEPEND}
89 + dev-util/pkgconfig"
90 +RDEPEND="${CDEPEND}
91 + app-shells/tcsh"
92 +
93 +RESTRICT="test"
94 +
95 +pkg_setup() {
96 + use fkernels && fortran-2_pkg_setup
97 +}
98 +
99 +src_prepare() {
100 + #add user patches from /etc/portage/patches/sci-chemistry/gromacs
101 + epatch_user
102 +
103 + if use mpi && use threads; then
104 + elog "mdrun uses only threads OR mpi, and gromacs favours the"
105 + elog "use of mpi over threads, so a mpi-version of mdrun will"
106 + elog "be compiled. If you want to run mdrun on shared memory"
107 + elog "machines only, you can safely disable mpi"
108 + fi
109 +
110 + GMX_DIRS=""
111 + use single-precision && GMX_DIRS+=" float"
112 + use double-precision && GMX_DIRS+=" double"
113 + #if neither single-precision nor double-precision is enabled
114 + #build at least default (single)
115 + [ -z "$GMX_DIRS" ] && GMX_DIRS+=" float"
116 +
117 + for x in ${GMX_DIRS}; do
118 + mkdir -p "${WORKDIR}/${P}_${x}" || die
119 + use test && cp -r "${WORKDIR}"/gmxtest "${WORKDIR}/${P}_${x}"
120 + done
121 +}
122 +
123 +src_configure() {
124 + local mycmakeargs_pre=( )
125 + #from gromacs configure
126 + if use fftw; then
127 + mycmakeargs_pre+=("-DGMX_FFT_LIBRARY=fftw3")
128 + else
129 + mycmakeargs_pre+=("-DGMX_FFT_LIBRARY=fftpack")
130 + ewarn "WARNING: The built-in FFTPACK routines are slow."
131 + ewarn "Are you sure you don\'t want to use FFTW?"
132 + ewarn "It is free and much faster..."
133 + fi
134 +
135 + if [[ $(gcc-version) == "4.1" ]]; then
136 + eerror "gcc 4.1 is not supported by gromacs"
137 + eerror "please run test suite"
138 + die
139 + fi
140 +
141 + #note for gentoo-PREFIX on apple: use --enable-apple-64bit
142 +
143 + #note for gentoo-PREFIX on aix, fortran (xlf) is still much faster
144 + if use fkernels; then
145 + ewarn "Fortran kernels are usually not faster than C kernels and assembly"
146 + ewarn "I hope, you know what are you doing..."
147 + fi
148 +
149 + if use double-precision ; then
150 + #from gromacs manual
151 + elog
152 + elog "For most simulations single precision is accurate enough. In some"
153 + elog "cases double precision is required to get reasonable results:"
154 + elog
155 + elog "-normal mode analysis, for the conjugate gradient or l-bfgs minimization"
156 + elog " and the calculation and diagonalization of the Hessian "
157 + elog "-calculation of the constraint force between two large groups of atoms"
158 + elog "-energy conservation: this can only be done without temperature coupling and"
159 + elog " without cutoffs"
160 + elog
161 + fi
162 +
163 + if use mpi ; then
164 + elog "You have enabled mpi, only mdrun will make use of mpi, that is why"
165 + elog "we configure/compile gromacs twice (with and without mpi) and only"
166 + elog "install mdrun with mpi support. In addtion you will get libgmx and"
167 + elog "libmd with and without mpi support."
168 + fi
169 +
170 + #go from slowest to fasterest acceleration
171 + local acce="none"
172 + use fkernels && acce="fortran"
173 + use altivec && acce="altivec"
174 + use ia64 && acce="ia64"
175 + use sse2 && acce="sse"
176 +
177 + mycmakeargs_pre+=(
178 + $(cmake-utils_use X GMX_X11)
179 + $(cmake-utils_use blas GMX_EXTERNAL_BLAS)
180 + $(cmake-utils_use gsl GMX_GSL)
181 + $(cmake-utils_use lapack GMX_EXTERNAL_LAPACK)
182 + $(cmake-utils_use threads GMX_THREADS)
183 + $(cmake-utils_use xml GMX_XML)
184 + -DGMX_DEFAULT_SUFFIX=off
185 + -DGMX_ACCELERATION="$acce"
186 + -DGMXLIB="$(get_libdir)"
187 + )
188 +
189 + for x in ${GMX_DIRS}; do
190 + einfo "Configuring for ${x} precision"
191 + local suffix=""
192 + #if we build single and double - double is suffixed
193 + use double-precision && use single-precision && \
194 + [ "${x}" = "double" ] && suffix="_d"
195 + local p
196 + [ "${x}" = "double" ] && p="-DGMX_DOUBLE=ON" || p="-DGMX_DOUBLE=OFF"
197 + mycmakeargs=( ${mycmakeargs_pre[@]} ${p} -DGMX_MPI=OFF
198 + -DGMX_BINARY_SUFFIX="${suffix}" -DGMX_LIBS_SUFFIX="${suffix}" )
199 + CMAKE_BUILD_DIR="${WORKDIR}/${P}_${x}" cmake-utils_src_configure
200 + use mpi || continue
201 + einfo "Configuring for ${x} precision with mpi"
202 + mycmakeargs=( ${mycmakeargs_pre[@]} ${p} -DGMX_MPI=ON
203 + -DGMX_BINARY_SUFFIX="_mpi${suffix}" -DGMX_LIBS_SUFFIX="_mpi${suffix}" )
204 + CMAKE_BUILD_DIR="${WORKDIR}/${P}_${x}_mpi" cmake-utils_src_configure
205 + done
206 +}
207 +
208 +src_compile() {
209 + for x in ${GMX_DIRS}; do
210 + einfo "Compiling for ${x} precision"
211 + CMAKE_BUILD_DIR="${WORKDIR}/${P}_${x}"\
212 + cmake-utils_src_compile
213 + use mpi || continue
214 + einfo "Compiling for ${x} precision with mpi"
215 + CMAKE_BUILD_DIR="${WORKDIR}/${P}_${x}_mpi"\
216 + cmake-utils_src_compile mdrun
217 + done
218 +}
219 +
220 +src_test() {
221 + for x in ${GMX_DIRS}; do
222 + local oldpath="${PATH}"
223 + export PATH="${WORKDIR}/${P}_${x}/src/kernel:${S}-{x}/src/tools:${PATH}"
224 + cd "${WORKDIR}/${P}_${x}"
225 + emake -j1 tests || die "${x} Precision test failed"
226 + export PATH="${oldpath}"
227 + done
228 +}
229 +
230 +src_install() {
231 + for x in ${GMX_DIRS}; do
232 + CMAKE_BUILD_DIR="${WORKDIR}/${P}_${x}" \
233 + cmake-utils_src_install
234 + use mpi || continue
235 + #cmake-utils_src_install does not support args
236 + #using cmake-utils_src_compile instead
237 + CMAKE_BUILD_DIR="${WORKDIR}/${P}_${x}_mpi" \
238 + cmake-utils_src_make install-mdrun DESTDIR="${D}"
239 + done
240 +
241 + sed -n -e '/^GMXBIN/,/^GMXDATA/p' "${ED}"/usr/bin/GMXRC.bash > "${T}/80gromacs"
242 + echo "VMD_PLUGIN_PATH=${EPREFIX}/usr/$(get_libdir)/vmd/plugins/*/molfile/" >> "${T}/80gromacs"
243 +
244 + doenvd "${T}/80gromacs"
245 + rm -f "${ED}"/usr/bin/GMXRC*
246 +
247 + newbashcomp "${ED}"/usr/bin/completion.bash ${PN}
248 + if use zsh-completion ; then
249 + insinto /usr/share/zsh/site-functions
250 + newins "${ED}"/usr/bin/completion.zsh _${PN}
251 + fi
252 + rm -f "${ED}"/usr/bin/completion.*
253 +
254 + # Fix typos in a couple of files.
255 + sed -e "s:+0f:-f:" -i "${ED}"usr/share/gromacs/tutor/gmxdemo/demo \
256 + || die "Failed to fixup demo script."
257 +
258 + cd "${S}"
259 + dodoc AUTHORS INSTALL* README*
260 + if use doc; then
261 + newdoc "${DISTDIR}/gromacs-manual-${MANUAL_PV}.pdf" "manual-${MANUAL_PV}.pdf"
262 + dohtml -r "${ED}usr/share/gromacs/html/"
263 + fi
264 + rm -rf "${ED}usr/share/gromacs/html/"
265 +}
266 +
267 +pkg_postinst() {
268 + env-update && source /etc/profile
269 + einfo
270 + einfo "Please read and cite:"
271 + einfo "Gromacs 4, J. Chem. Theory Comput. 4, 435 (2008). "
272 + einfo "http://dx.doi.org/10.1021/ct700301q"
273 + einfo
274 + einfo $(g_luck)
275 + einfo "For more Gromacs cool quotes (gcq) add g_luck to your .bashrc"
276 + einfo
277 + elog "Gromacs can use sci-chemistry/vmd to read additional file formats"
278 +}