Gentoo Archives: gentoo-commits

From: Reinis Danne <rei4dan@×××××.com>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/sci:master commit in: sci-chemistry/ambertools/files/, sci-chemistry/ambertools/
Date: Sat, 03 Mar 2012 21:07:07
Message-Id: 1330808084.8ce9886cd5e61b892ee7e1087c09013e310a15ea.rei4dan@gentoo
1 commit: 8ce9886cd5e61b892ee7e1087c09013e310a15ea
2 Author: Reinis Danne <rei4dan <AT> gmail <DOT> com>
3 AuthorDate: Sat Mar 3 20:54:44 2012 +0000
4 Commit: Reinis Danne <rei4dan <AT> gmail <DOT> com>
5 CommitDate: Sat Mar 3 20:54:44 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/sci.git;a=commit;h=8ce9886c
7
8 sci-chemistry/ambertools: Add bugfixes 22-27
9
10 ---
11 sci-chemistry/ambertools/ChangeLog | 8 +-
12 sci-chemistry/ambertools/ambertools-1.5-r3.ebuild | 157 +
13 .../files/ambertools-1.5-bugfix_22-27.patch | 3343 ++++++++++++++++++++
14 3 files changed, 3507 insertions(+), 1 deletions(-)
15
16 diff --git a/sci-chemistry/ambertools/ChangeLog b/sci-chemistry/ambertools/ChangeLog
17 index 50f0545..0945272 100644
18 --- a/sci-chemistry/ambertools/ChangeLog
19 +++ b/sci-chemistry/ambertools/ChangeLog
20 @@ -1,7 +1,13 @@
21 # ChangeLog for sci-chemistry/ambertools
22 -# Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2
23 +# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2
24 # $Header: /var/cvsroot/gentoo-x86/sci-chemistry/ambertools/ChangeLog,v 1.2 2011/08/02 14:42:37 alexxy Exp $
25
26 +*ambertools-1.5-r3 (03 Mar 2012)
27 +
28 + 03 Mar 2012; Reinis Danne <rei4dan@×××××.com> +ambertools-1.5-r3.ebuild,
29 + +files/ambertools-1.5-bugfix_22-27.patch:
30 + Add bugfixes 22-27.
31 +
32 26 Oct 2011; Reinis Danne <rei4dan@×××××.com>
33 files/ambertools-1.5-gentoo2.patch:
34 Fix possible buffer overflow.
35
36 diff --git a/sci-chemistry/ambertools/ambertools-1.5-r3.ebuild b/sci-chemistry/ambertools/ambertools-1.5-r3.ebuild
37 new file mode 100644
38 index 0000000..bebf36c
39 --- /dev/null
40 +++ b/sci-chemistry/ambertools/ambertools-1.5-r3.ebuild
41 @@ -0,0 +1,157 @@
42 +# Copyright 1999-2012 Gentoo Foundation
43 +# Distributed under the terms of the GNU General Public License v2
44 +# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/ambertools/ambertools-1.5-r1.ebuild,v 1.2 2011/08/02 14:42:37 alexxy Exp $
45 +
46 +EAPI=4
47 +
48 +inherit eutils fortran-2 toolchain-funcs
49 +
50 +DESCRIPTION="A suite for carrying out complete molecular mechanics investigations"
51 +HOMEPAGE="http://ambermd.org/#AmberTools"
52 +SRC_URI="
53 + AmberTools-${PV}.tar.bz2"
54 +
55 +LICENSE="GPL-2"
56 +SLOT="0"
57 +KEYWORDS="~amd64 ~x86 ~amd64-linux"
58 +IUSE="openmp X"
59 +
60 +RESTRICT="fetch"
61 +
62 +RDEPEND="
63 + virtual/cblas
64 + virtual/lapack
65 + sci-libs/clapack
66 + sci-libs/arpack
67 + sci-libs/cifparse-obj
68 + sci-chemistry/mopac7
69 + sci-libs/netcdf
70 + sci-libs/fftw:2.1
71 + sci-chemistry/reduce
72 + virtual/fortran"
73 +DEPEND="${RDEPEND}
74 + dev-util/byacc
75 + dev-libs/libf2c
76 + sys-devel/ucpp"
77 +S="${WORKDIR}/amber11"
78 +
79 +pkg_nofetch() {
80 + einfo "Go to ${HOMEPAGE} and get ${A}"
81 + einfo "Place it in ${DISTDIR}"
82 +}
83 +
84 +pkg_setup() {
85 + fortran-2_pkg_setup
86 + if use openmp; then
87 + tc-has-openmp || \
88 + die "Please select an openmp capable compiler like gcc[openmp]"
89 + fi
90 + AMBERHOME="${S}"
91 +}
92 +
93 +src_prepare() {
94 + epatch \
95 + "${FILESDIR}/${P}-bugfix_1-21.patch" \
96 + "${FILESDIR}/${P}-bugfix_22-27.patch" \
97 + "${FILESDIR}/${P}-gentoo2.patch"
98 + cd "${S}"/AmberTools/src
99 + rm -r \
100 + arpack \
101 + blas \
102 + byacc \
103 + lapack \
104 + fftw-2.1.5 \
105 + fftw-3.2.2 \
106 + c9x-complex \
107 + cifparse \
108 + netcdf \
109 + pnetcdf \
110 + reduce \
111 + ucpp-1.3 \
112 + || die
113 +}
114 +
115 +src_configure() {
116 + cd "${S}"/AmberTools/src
117 + sed -e "s:\\\\\$(LIBDIR)/arpack.a:-larpack:g" \
118 + -e "s:\\\\\$(LIBDIR)/lapack.a:$(pkg-config lapack --libs) -lclapack:g" \
119 + -e "s:\\\\\$(LIBDIR)/blas.a:$(pkg-config blas cblas --libs):g" \
120 + -e "s:\\\\\$(LIBDIR)/libdrfftw.a:${EPREFIX}/usr/$(get_libdir)/libdrfftw.a:g" \
121 + -e "s:\\\\\$(LIBDIR)/libdfftw.a:${EPREFIX}/usr/$(get_libdir)/libdrfftw.a:g" \
122 + -e "s:GENTOO_CFLAGS:${CFLAGS} -DBINTRAJ :g" \
123 + -e "s:GENTOO_CXXFLAGS:${CXXFLAGS}:g" \
124 + -e "s:GENTOO_FFLAGS:${FFLAGS}:g" \
125 + -e "s:GENTOO_LDFLAGS:${LDFLAGS}:g" \
126 + -e "s:fc=g77:fc=$(tc-getFC):g" \
127 + -e "s:\$netcdflib:$(pkg-config netcdf --libs):g" \
128 + -e "s:NETCDF=\$netcdf:NETCDF=netcdf.mod:g" \
129 + -i configure || die
130 + sed -e "s:arsecond_:arscnd_:g" \
131 + -i sff/time.c \
132 + -i sff/sff.h \
133 + -i sff/sff.c || die
134 + sed -e "s:\$(NAB):\$(NAB) -lrfftw:g" \
135 + -i nss/Makefile || die
136 +
137 + local myconf
138 +
139 + use X || myconf="${myconf} -noX11"
140 +
141 + use openmp && myconf="${myconf} -openmp"
142 +
143 + ./configure \
144 + ${myconf} \
145 + -nobintraj \
146 + -nomdgx \
147 + -nomtkpp \
148 + -nopython \
149 + -nosleap \
150 + gnu
151 +}
152 +
153 +src_compile() {
154 + cd "${S}"/AmberTools/src
155 + emake || die
156 +}
157 +
158 +src_test() {
159 + cd "${S}"/AmberTools/test
160 + make test || die
161 +}
162 +
163 +src_install() {
164 + rm -r bin/chemistry bin/MMPBSA_mods
165 + rm bin/ante-MMPBSA.py bin/extractFrcmod.py
166 +
167 + for x in bin/*
168 + do dobin ${x} || die
169 + done
170 +
171 + dobin AmberTools/src/antechamber/mopac.sh
172 + sed -e "s:\$AMBERHOME/bin/mopac:mopac7:g" \
173 + -i "${ED}/usr/bin/mopac.sh" || die
174 +
175 + # Make symlinks untill binpath for amber will be fixed
176 + dodir /usr/share/${PN}/bin
177 + cd "${ED}/usr/bin"
178 + for x in *
179 + do dosym /usr/bin/${x} /usr/share/${PN}/bin/${x}
180 + done
181 + cd "${S}"
182 +
183 + dodoc doc/AmberTools.pdf doc/leap_pg.pdf
184 + dolib.a lib/*
185 + insinto /usr/include/${PN}
186 + doins include/*
187 + insinto /usr/share/${PN}
188 + doins -r dat
189 + cd AmberTools
190 + doins -r benchmarks
191 + doins -r examples
192 + doins -r test
193 +
194 + cat >> "${T}"/99ambertools <<- EOF
195 + AMBERHOME="${EPREFIX}/usr/share/ambertools"
196 + EOF
197 + doenvd "${T}"/99ambertools
198 +}
199
200 diff --git a/sci-chemistry/ambertools/files/ambertools-1.5-bugfix_22-27.patch b/sci-chemistry/ambertools/files/ambertools-1.5-bugfix_22-27.patch
201 new file mode 100644
202 index 0000000..6df705c
203 --- /dev/null
204 +++ b/sci-chemistry/ambertools/files/ambertools-1.5-bugfix_22-27.patch
205 @@ -0,0 +1,3343 @@
206 +diff -urN amber11.orig/AmberTools/examples/mtkpp/MCPB/run.MCPB.csh amber11/AmberTools/examples/mtkpp/MCPB/run.MCPB.csh
207 +--- amber11.orig/AmberTools/examples/mtkpp/MCPB/run.MCPB.csh 2011-04-14 15:30:12.000000000 +0300
208 ++++ amber11/AmberTools/examples/mtkpp/MCPB/run.MCPB.csh 2012-03-03 20:03:01.387032575 +0200
209 +@@ -2,111 +2,10 @@
210 + echo " "
211 + echo " MTK++ MCPB example "
212 + echo " "
213 +-
214 +-# Clean up
215 +-rm -rf 1AMP_OH.README
216 +-rm -rf *.bcl
217 +-rm -rf createLibraries.sh createRespAdditions.sh getCharges.sh
218 +-rm -rf *.pdb
219 +-rm -rf *.log
220 +-
221 +-cp data/*.pdb .
222 +-cp data/*.bcl .
223 +-cp data/*.log .
224 +-cp data/*.fchk .
225 +-
226 +-echo "Generating scripts "
227 +-sh genMetalFF.sh -n 1AMP_OH
228 +-
229 +-cp data/1AMP.pdb .
230 +-cp data/1AMP_OH_fixed.pdb .
231 +-cp data/1AMP_OH_sidechain.bcl .
232 +-cp data/1AMP_OH_addStdMol.bcl .
233 +-cp data/1AMP_OH_large.bcl .
234 +-cp data/1AMP_OH_large_mk.log .
235 +-
236 +-cp data/1AMP_OH_sidechain_fc_md.log .
237 +-cp data/1AMP_OH_sidechain_opt_md.fchk .
238 +-cp data/1AMP_OH_sidechain_opt_md.log .
239 +-
240 +-echo "Adding Hydrogens to pdb file "
241 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_addHs.bcl \
242 +- -l 1AMP_OH_addHs.bcl.log || goto error
243 +-
244 +-echo "Creating Model 1"
245 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_sidechain.bcl \
246 +- -l 1AMP_OH_sidechain.bcl.log || goto error
247 +-
248 +-echo "Adding standard molecule to library "
249 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_addStdMol.bcl \
250 +- -l 1AMP_OH_addStdMol.bcl.log || goto error
251 +-
252 +-echo "Creating Model 2 "
253 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_large.bcl \
254 +- -l 1AMP_OH_large.bcl.log || goto error
255 +-
256 +-echo "Creating RESP files 0 "
257 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_large_mk0.bcl \
258 +- -l 1AMP_OH_large_mk0.bcl.log || goto error
259 +-mv 1AMP_OH_large_respAdds 1AMP_OH_large_respAdds0 || goto error
260 +-
261 +-echo "Creating RESP files 1 "
262 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_large_mk1.bcl \
263 +- -l 1AMP_OH_large_mk1.bcl.log || goto error
264 +-mv 1AMP_OH_large_respAdds 1AMP_OH_large_respAdds1 || goto error
265 +-
266 +-echo "Creating RESP files 2 "
267 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_large_mk2.bcl \
268 +- -l 1AMP_OH_large_mk2.bcl.log || goto error
269 +-mv 1AMP_OH_large_respAdds 1AMP_OH_large_respAdds2 || goto error
270 +-
271 +-echo "Creating RESP files 3 "
272 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_large_mk3.bcl \
273 +- -l 1AMP_OH_large_mk3.bcl.log || goto error
274 +-mv 1AMP_OH_large_respAdds 1AMP_OH_large_respAdds3 || goto error
275 +-
276 +-echo "Determining charges "
277 +-sh ./getCharges.sh 0 || goto error
278 +-sh ./getCharges.sh 1 || goto error
279 +-sh ./getCharges.sh 2 || goto error
280 +-sh ./getCharges.sh 3 || goto error
281 +-
282 +-echo "Creating library files "
283 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_large_chg0.bcl \
284 +- -l 1AMP_OH_large_chg0.bcl.log || goto error
285 +-
286 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_large_chg1.bcl \
287 +- -l 1AMP_OH_large_chg1.bcl.log || goto error
288 +-
289 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_large_chg2.bcl \
290 +- -l 1AMP_OH_large_chg2.bcl.log || goto error
291 +-
292 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_large_chg3.bcl \
293 +- -l 1AMP_OH_large_chg3.bcl.log || goto error
294 +-
295 +-echo "Determining Seminario force constants "
296 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_sidechain_fc_sem.bcl \
297 +- -l 1AMP_OH_sidechain_fc_sem.bcl.log || goto error
298 +-
299 +-echo "Determining Traditional force constants "
300 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_sidechain_fc_md.bcl \
301 +- -l 1AMP_OH_sidechain_fc_md.bcl.log || goto error
302 +-
303 +-echo "Exporting Seminario library to AMBER format "
304 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_toAmberFormats_sem.bcl \
305 +- -l 1AMP_OH_toAmberFormats_sem.bcl.log || goto error
306 +-
307 +-echo "Exporting Traditional library to AMBER format "
308 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_toAmberFormats_md.bcl \
309 +- -l 1AMP_OH_toAmberFormats_md.bcl.log || goto error
310 +-
311 +-echo "Reading protonated file and updating residue names "
312 +-$AMBERHOME/bin/MCPB -i 1AMP_OH_resNames.bcl \
313 +- -l 1AMP_OH_resNames.bcl.log || goto error
314 +-
315 +-echo No errors detected
316 ++echo " "
317 ++echo " This example has been removed due to incompatibility with"
318 ++echo " the current minor revision of MTK++. An updated MCPB example"
319 ++echo " is planned for a future release."
320 ++echo " "
321 + exit(0)
322 +
323 +-error:
324 +-echo Problem: check log files and try again
325 +-exit(1)
326 +diff -urN amber11.orig/AmberTools/examples/mtkpp/stats/pca1/run.stats.csh amber11/AmberTools/examples/mtkpp/stats/pca1/run.stats.csh
327 +--- amber11.orig/AmberTools/examples/mtkpp/stats/pca1/run.stats.csh 2011-04-14 15:30:12.000000000 +0300
328 ++++ amber11/AmberTools/examples/mtkpp/stats/pca1/run.stats.csh 2012-03-03 20:03:01.387032575 +0200
329 +@@ -3,12 +3,12 @@
330 + echo " MTK++ stats example"
331 + echo " "
332 +
333 +-../$AMBERHOME/bin/stats -i pca.stats \
334 +- -l pca.stats.log || goto error
335 ++$AMBERHOME/bin/stats -i pca.stats \
336 ++ -l pca.stats.log || goto error
337 +
338 + echo No errors detected
339 + exit(0)
340 +
341 + error:
342 + echo Problem: check .out and try again
343 +-exit(1)
344 +\ Nav jaunu rindu faila beigās
345 ++exit(1)
346 +diff -urN amber11.orig/AmberTools/src/configure amber11/AmberTools/src/configure
347 +--- amber11.orig/AmberTools/src/configure 2012-03-03 22:42:38.558776473 +0200
348 ++++ amber11/AmberTools/src/configure 2012-03-03 20:02:57.727033628 +0200
349 +@@ -61,6 +61,9 @@
350 + -debug Compile with debug symbols
351 + -noopt Disable all compiler optimisations (sometimes needed if
352 + debug symbols are requested)
353 ++ -nopatch Do NOT run \$AMBERHOME/AT15_Amber11.py after configure writes
354 ++ the config.h file, even if Amber11 is found in the directory.
355 ++ This flag has no effect if Amber11 is not present.
356 +
357 + Rarely used/tested NAB options:
358 + -scalapack Use ScaLAPACK for linear algebra. Do not use in
359 +@@ -165,6 +168,7 @@
360 + debug='no'
361 + optimise='yes'
362 + is_mac='no'
363 ++nopatch='no'
364 +
365 + #------------------------------------------------------------------------------
366 + # Architecture specific:
367 +@@ -216,6 +220,7 @@
368 + -nomtkpp) mtkpp='';;
369 + -debug) debug='yes';;
370 + -noopt) optimise='no';;
371 ++ -nopatch) nopatch='yes';;
372 + -help) usage;;
373 + --help) usage;;
374 + -h) usage;;
375 +@@ -2144,7 +2149,7 @@
376 + fi
377 +
378 + # For AmberTools 1.5 + Amber 11, print a message about running AT15_Amber11.py
379 +-if [ -d ../../src/sander ]; then
380 ++if [ -d ../../src/sander -a "$nopatch" = 'yes' ]; then
381 + echo ""
382 + echo " NOTE: after installing AmberTools, if you want to compile"
383 + echo " Amber11 using AmberTools 1.5, you must run the "
384 +@@ -2155,5 +2160,14 @@
385 + echo " script will modify your Amber11 files.)"
386 + fi
387 +
388 ++if [ -d ../../src/sander -a "$nopatch" = 'no' ]; then
389 ++ echo ""
390 ++ echo " Running \$AMBERHOME/AT15_Amber11.py to patch config.h for building Amber 11."
391 ++ echo " Check Amber11_Conversion.log for details of what was done. Running this script"
392 ++ echo " a second time has no effect (positive or negative)"
393 ++ echo ""
394 ++ ../../AT15_Amber11.py > Amber11_Conversion.log 2>&1
395 ++fi
396 ++
397 + exit
398 +
399 +diff -urN amber11.orig/AmberTools/src/cpptraj/src/AmberRestart.cpp amber11/AmberTools/src/cpptraj/src/AmberRestart.cpp
400 +--- amber11.orig/AmberTools/src/cpptraj/src/AmberRestart.cpp 2012-03-03 22:42:00.557775196 +0200
401 ++++ amber11/AmberTools/src/cpptraj/src/AmberRestart.cpp 2012-03-03 20:03:06.928030979 +0200
402 +@@ -53,7 +53,7 @@
403 + mprintf("Error: AmberRestart::open(): Reading restart atoms/time.\n");
404 + return 1;
405 + }
406 +- nread=sscanf(buffer,"%5i%15lE%15lE",&restartAtoms,&restartTime,&restartTemp);
407 ++ nread=sscanf(buffer,"%i %lE %lE",&restartAtoms,&restartTime,&restartTemp);
408 + if (nread<1) {
409 + mprintf("Error: AmberRestart::open(): Getting restart atoms/time.\n");
410 + return 1;
411 +diff -urN amber11.orig/AmberTools/src/cpptraj/src/main.cpp amber11/AmberTools/src/cpptraj/src/main.cpp
412 +--- amber11.orig/AmberTools/src/cpptraj/src/main.cpp 2012-03-03 22:42:47.132776753 +0200
413 ++++ amber11/AmberTools/src/cpptraj/src/main.cpp 2012-03-03 20:03:06.928030979 +0200
414 +@@ -6,7 +6,7 @@
415 + #include "PtrajMpi.h"
416 + #include "CpptrajStdio.h"
417 + #ifndef CPPTRAJ_VERSION_STRING
418 +-#define CPPTRAJ_VERSION_STRING "V1.1.1"
419 ++#define CPPTRAJ_VERSION_STRING "V1.1.2"
420 + #endif
421 +
422 + void Usage(char *programName) {
423 +diff -urN amber11.orig/AmberTools/src/mmpbsa_py/MMPBSA_mods/amberoutputs.py amber11/AmberTools/src/mmpbsa_py/MMPBSA_mods/amberoutputs.py
424 +--- amber11.orig/AmberTools/src/mmpbsa_py/MMPBSA_mods/amberoutputs.py 2011-04-14 15:30:17.000000000 +0300
425 ++++ amber11/AmberTools/src/mmpbsa_py/MMPBSA_mods/amberoutputs.py 2012-03-03 20:03:11.481029669 +0200
426 +@@ -2315,7 +2315,7 @@
427 + return math.sqrt(abs(_stdev(self.com_data[0]) ** 2 + _stdev(self.rec_data[0]) ** 2 + _stdev(self.lig_data[0]) ** 2))
428 +
429 + sum = sum2 = 0
430 +- for i in range(len(self.com_data)):
431 ++ for i in range(len(self.com_data[0])):
432 + sum += self.com_data[0][i] - self.rec_data[0][i] - self.lig_data[0][i]
433 + sum2 += (self.com_data[0][i] - self.rec_data[0][i] - self.lig_data[0][i]) ** 2
434 +
435 +diff -urN amber11.orig/AmberTools/src/mtkpp/configure amber11/AmberTools/src/mtkpp/configure
436 +--- amber11.orig/AmberTools/src/mtkpp/configure 2011-04-14 15:30:18.000000000 +0300
437 ++++ amber11/AmberTools/src/mtkpp/configure 2012-03-03 20:03:01.397032571 +0200
438 +@@ -788,7 +788,6 @@
439 + with_gnu_ld
440 + with_sysroot
441 + enable_libtool_lock
442 +-with_gnu_ld
443 + with_mkl_dir
444 + with_mkl_libs
445 + with_boost
446 +@@ -811,22 +810,9 @@
447 + CCC
448 + CC
449 + CFLAGS
450 +-LDFLAGS
451 +-LIBS
452 +-CPPFLAGS
453 + CPP
454 +-CPPFLAGS
455 + CXXCPP
456 +-CPPFLAGS
457 +-XMKMF
458 +-CXX
459 +-LDFLAGS
460 +-LIBS
461 +-CPPFLAGS
462 +-CCC
463 +-CC
464 +-LDFLAGS
465 +-LIBS'
466 ++XMKMF'
467 +
468 +
469 + # Initialize some variables set by options.
470 +@@ -16665,7 +16651,7 @@
471 + *) platform=UNKNOWN
472 + is_unknown=yes
473 + echo 'ERROR: this platform is not supported at this time!'
474 +- exit 1 ;;
475 ++ exit ;;
476 + esac
477 + if test "$is_darwin" = "yes"; then
478 + IS_DARWIN_TRUE=
479 +@@ -17838,8 +17824,8 @@
480 + $as_echo "#define HAVE_ZLIB 1" >>confdefs.h
481 +
482 + CFLAGS=$CFLAGS" -DHAVE_ZLIB"
483 +- CXXFLAGS=$CXXFLAGS" -DHAVE_ZLIB -DHAVE_ZLIB"
484 +- defines_string=$defines_string" -DHAVE_ZLIB -DHAVE_ZLIB"
485 ++ CXXFLAGS=$CXXFLAGS" -DHAVE_ZLIB"
486 ++ defines_string=$defines_string" -DHAVE_ZLIB"
487 + FLIBS=$FLIBS" -lz"
488 + else
489 +
490 +diff -urN amber11.orig/AmberTools/src/mtkpp/configure.in amber11/AmberTools/src/mtkpp/configure.in
491 +--- amber11.orig/AmberTools/src/mtkpp/configure.in 2011-04-14 15:30:18.000000000 +0300
492 ++++ amber11/AmberTools/src/mtkpp/configure.in 2012-03-03 20:03:01.400032571 +0200
493 +@@ -383,7 +383,7 @@
494 + *) platform=UNKNOWN
495 + is_unknown=yes
496 + echo 'ERROR: this platform is not supported at this time!'
497 +- exit 1 ;;
498 ++ exit ;;
499 + esac
500 + AM_CONDITIONAL(IS_DARWIN, test "$is_darwin" = "yes")
501 + AM_CONDITIONAL(IS_LINUX, test "$is_linux" = "yes")
502 +@@ -457,8 +457,8 @@
503 + if test $ac_have_zlibh = yes; then
504 + AC_DEFINE(HAVE_ZLIB, 1, [Define to 1 if ZLIB is available.])
505 + CFLAGS=$CFLAGS" -DHAVE_ZLIB"
506 +- CXXFLAGS=$CXXFLAGS" -DHAVE_ZLIB -DHAVE_ZLIB"
507 +- defines_string=$defines_string" -DHAVE_ZLIB -DHAVE_ZLIB"
508 ++ CXXFLAGS=$CXXFLAGS" -DHAVE_ZLIB"
509 ++ defines_string=$defines_string" -DHAVE_ZLIB"
510 + FLIBS=$FLIBS" -lz"
511 + else
512 + AC_DEFINE(HAVE_ZLIB, 0, [Define to 0 if ZLIB is unavailable.])
513 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Minimizers/Makefile.am amber11/AmberTools/src/mtkpp/src/Minimizers/Makefile.am
514 +--- amber11.orig/AmberTools/src/mtkpp/src/Minimizers/Makefile.am 2011-04-14 15:30:18.000000000 +0300
515 ++++ amber11/AmberTools/src/mtkpp/src/Minimizers/Makefile.am 2012-03-03 20:03:01.400032571 +0200
516 +@@ -1,4 +1,4 @@
517 +-DIAGNOSTICS_LD=-L$(top_builddir)/src/Diagnostics/$(SRCDIR)
518 ++DIAGNOSTICS_LD=-L$(abs_top_builddir)/src/Diagnostics/$(SRCDIR)
519 + DIAGNOSTICS_LIB=-lDiagnostics
520 + INCLUDES = -I$(srcdir)/..
521 +
522 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Minimizers/Makefile.in amber11/AmberTools/src/mtkpp/src/Minimizers/Makefile.in
523 +--- amber11.orig/AmberTools/src/mtkpp/src/Minimizers/Makefile.in 2011-04-14 15:30:18.000000000 +0300
524 ++++ amber11/AmberTools/src/mtkpp/src/Minimizers/Makefile.in 2012-03-03 20:03:01.401032571 +0200
525 +@@ -239,7 +239,7 @@
526 + top_builddir = @top_builddir@
527 + top_srcdir = @top_srcdir@
528 + xerces_path = @xerces_path@
529 +-DIAGNOSTICS_LD = -L$(top_builddir)/src/Diagnostics/$(SRCDIR)
530 ++DIAGNOSTICS_LD = -L$(abs_top_builddir)/src/Diagnostics/$(SRCDIR)
531 + DIAGNOSTICS_LIB = -lDiagnostics
532 + INCLUDES = -I$(srcdir)/..
533 + lib_LTLIBRARIES = libMinimizers.la
534 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/MM/Makefile.am amber11/AmberTools/src/mtkpp/src/MM/Makefile.am
535 +--- amber11.orig/AmberTools/src/mtkpp/src/MM/Makefile.am 2011-04-14 15:30:18.000000000 +0300
536 ++++ amber11/AmberTools/src/mtkpp/src/MM/Makefile.am 2012-03-03 20:03:01.400032571 +0200
537 +@@ -1,6 +1,6 @@
538 +-DIAGNOSTICS_LD=-L$(top_builddir)/src/Diagnostics/$(SRCDIR)
539 ++DIAGNOSTICS_LD=-L$(abs_top_builddir)/src/Diagnostics/$(SRCDIR)
540 + DIAGNOSTICS_LIB=-lDiagnostics
541 +-LOG_LD=-L$(top_builddir)/src/Log/$(SRCDIR)
542 ++LOG_LD=-L$(abs_top_builddir)/src/Log/$(SRCDIR)
543 + LOG_LIB=-lLog
544 +
545 + INCLUDES = -I@boost_inc@ -I$(srcdir)/..
546 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/MM/Makefile.in amber11/AmberTools/src/mtkpp/src/MM/Makefile.in
547 +--- amber11.orig/AmberTools/src/mtkpp/src/MM/Makefile.in 2011-04-14 15:30:18.000000000 +0300
548 ++++ amber11/AmberTools/src/mtkpp/src/MM/Makefile.in 2012-03-03 20:03:01.400032571 +0200
549 +@@ -241,9 +241,9 @@
550 + top_builddir = @top_builddir@
551 + top_srcdir = @top_srcdir@
552 + xerces_path = @xerces_path@
553 +-DIAGNOSTICS_LD = -L$(top_builddir)/src/Diagnostics/$(SRCDIR)
554 ++DIAGNOSTICS_LD = -L$(abs_top_builddir)/src/Diagnostics/$(SRCDIR)
555 + DIAGNOSTICS_LIB = -lDiagnostics
556 +-LOG_LD = -L$(top_builddir)/src/Log/$(SRCDIR)
557 ++LOG_LD = -L$(abs_top_builddir)/src/Log/$(SRCDIR)
558 + LOG_LIB = -lLog
559 + INCLUDES = -I@boost_inc@ -I$(srcdir)/..
560 + lib_LTLIBRARIES = libMM.la
561 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Molecule/atomType.h amber11/AmberTools/src/mtkpp/src/Molecule/atomType.h
562 +--- amber11.orig/AmberTools/src/mtkpp/src/Molecule/atomType.h 2011-04-14 15:30:18.000000000 +0300
563 ++++ amber11/AmberTools/src/mtkpp/src/Molecule/atomType.h 2012-03-03 20:03:01.402032570 +0200
564 +@@ -74,6 +74,9 @@
565 +
566 + //!
567 + double evalue;
568 ++
569 ++ //! Atomic polarizability in A**3
570 ++ double atomPolarizability;
571 + };
572 +
573 + // ============================================================
574 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Molecule/collection.cpp amber11/AmberTools/src/mtkpp/src/Molecule/collection.cpp
575 +--- amber11.orig/AmberTools/src/mtkpp/src/Molecule/collection.cpp 2011-04-14 15:30:18.000000000 +0300
576 ++++ amber11/AmberTools/src/mtkpp/src/Molecule/collection.cpp 2012-03-03 20:03:01.403032569 +0200
577 +@@ -484,6 +484,11 @@
578 + for (moleculeIterator m = this->itsMoleculeList.begin();
579 + m != this->itsMoleculeList.end(); m++) {
580 + pMolecule = *m;
581 ++
582 ++ if (pMolecule->getName() == "Reference") {
583 ++ continue;
584 ++ }
585 ++
586 + std::vector<submolecule*> subMolList = pMolecule->getSubMoleculeList();
587 + for (sMolIterator c = subMolList.begin(); c != subMolList.end(); c++) {
588 + pSubMolecule = *c;
589 +@@ -3408,7 +3413,10 @@
590 + }
591 + errMessage += metalAtom->getParent()->getName() + "@|"
592 + + metalAtom->getName() + "|-"
593 +- + primShellAtoms[e]->getParent()->getName() + "@|"
594 ++ + primShellAtoms[e]->getParent()->getName()
595 ++ + i2s(primShellAtoms[e]->getParent()->getSubMolId())
596 ++ + primShellAtoms[e]->getParent()->getiCode()
597 ++ + "@|"
598 + + primShellAtoms[e]->getName() + "| dist = " + d2s(localBond->size) +"\n";
599 +
600 + // Angles
601 +@@ -3488,7 +3496,8 @@
602 + std::vector<stdGroup*> stdGrpList = this->pStdLibrary->getStdGroupList();
603 +
604 + for (unsigned int i = 0; i < stdGrpList.size(); i++) {
605 +-//std::cout << i << " " << stdGrpList.size() << " " << stdGrpList[i]->getName() << " " << stdGrpList[i]->hasStdMolecule() << std::endl;
606 ++//std::cout << "\n\ncollection::assignMetalParameters " << i << " " << stdGrpList.size() << " " << stdGrpList[i]->getName() << " "
607 ++// << stdGrpList[i]->hasStdMolecule() << std::endl;
608 + if (stdGrpList[i]->hasStdMolecule()) {
609 + //std::cout << "stdgroup name: " << stdGrpList[i]->getName() << std::endl;
610 + //stdGroup* pStdGroup = stdGrpList[i];
611 +@@ -3515,6 +3524,7 @@
612 +
613 + // create new molecule
614 + molecule* pNewMolecule = this->addMolecule();
615 ++ std::vector<atom*> atomList;
616 +
617 + // copy residues
618 + std::vector<metalCenter*> metCens = itsMetalGroups[j]->getMetalCenters();
619 +@@ -3536,6 +3546,10 @@
620 + addedResidues.push_back(primShellAtoms[l]->getParent());
621 + submolecule* pNewSubmolecule = pNewMolecule->addSubMolecule();
622 + pNewSubmolecule->copy(primShellAtoms[l]->getParent());
623 ++ std::vector<atom*> atomListTmp = primShellAtoms[l]->getParent()->getAtomList();
624 ++ for (unsigned int i = 0 ; i < atomListTmp.size(); i++) {
625 ++ atomList.push_back(atomListTmp[i]);
626 ++ }
627 + /*
628 + std::cout << "Primary Shell " << primShellAtoms[l]->getParent()->getName() << " "
629 + << primShellAtoms[l]->getParent()->getSubMolId() << " "
630 +@@ -3556,6 +3570,11 @@
631 + addedResidues.push_back(secShellAtoms[l]->getParent());
632 + submolecule* pNewSubmolecule = pNewMolecule->addSubMolecule();
633 + pNewSubmolecule->copy(secShellAtoms[l]->getParent());
634 ++
635 ++ std::vector<atom*> atomListTmp = secShellAtoms[l]->getParent()->getAtomList();
636 ++ for (unsigned int i = 0 ; i < atomListTmp.size(); i++) {
637 ++ atomList.push_back(atomListTmp[i]);
638 ++ }
639 + /*
640 + std::cout << "Secondary Shell " << secShellAtoms[l]->getParent()->getName() << " "
641 + << secShellAtoms[l]->getParent()->getSubMolId()
642 +@@ -3573,6 +3592,12 @@
643 + addedResidues.push_back(metalAtom->getParent());
644 + submolecule* pNewSubmolecule = pNewMolecule->addSubMolecule();
645 + pNewSubmolecule->copy(metalAtom->getParent());
646 ++
647 ++ std::vector<atom*> atomListTmp = metalAtom->getParent()->getAtomList();
648 ++ for (unsigned int i = 0 ; i < atomListTmp.size(); i++) {
649 ++ atomList.push_back(atomListTmp[i]);
650 ++ }
651 ++
652 + /*
653 + std::cout << "Metal Atom " << metalAtom->getParent()->getName() << " "
654 + << metalAtom->getParent()->getSubMolId()
655 +@@ -3582,7 +3607,7 @@
656 + }
657 + }
658 +
659 +-//std::cout << " \n\n NEW MOLECULE \n";
660 ++//std::cout << "NEW MOLECULE \n";
661 +
662 + // Copy bonds
663 + if (pNewMolecule) {
664 +@@ -3646,16 +3671,26 @@
665 + }
666 + }
667 + }
668 ++
669 ++//std::cout << " After copy " << std::endl;
670 ++
671 + int nAtomsA = pStdMolecule->getNumAtoms();
672 + int nAtomsB = pNewMolecule->getNumAtoms();
673 ++
674 ++ int nBondsA = pStdMolecule->getNumBonds();
675 ++ int nBondsB = pNewMolecule->getNumBonds();
676 ++
677 + int nHeavyAtomsA = pStdMolecule->getNumHeavyAtoms();
678 + int nHeavyAtomsB = pNewMolecule->getNumHeavyAtoms();
679 +
680 ++//std::cout << "CHECK " << nAtomsA << " " << nAtomsB << " " << nBondsA << " " << nBondsB << "\n";
681 + int w = 0;
682 + if (nAtomsA != nAtomsB) w++;
683 + int h = 0;
684 + if (nHeavyAtomsA != nHeavyAtomsB) h++;
685 +
686 ++//std::cout << " w = " << w << " h = " << h << std::endl;
687 ++
688 + if (w or h) {
689 + std::string eMes = " " + stdGrpList[i]->getName() + " is not a match \n";
690 + eMes += " std mol nAtoms: " + i2s(nAtomsA) +
691 +@@ -3671,8 +3706,17 @@
692 + // Determine corresponences between two molecules
693 + std::vector<std::vector<int> > correspondenceMatrices;
694 + //int cor = 0;
695 ++//std::cout << " superimpose " << std::endl;
696 + superimpose* pSuperImpose = new superimpose();
697 +- int f = pSuperImpose->initializeCorrespondences(pStdMolecule, pNewMolecule, 3, correspondenceMatrices);
698 ++ int f = 0;
699 ++ try {
700 ++ f = pSuperImpose->initializeCorrespondences(pStdMolecule, pNewMolecule, 3, correspondenceMatrices);
701 ++ }
702 ++ catch (...) {
703 ++ f = 1;
704 ++ }
705 ++
706 ++//std::cout << " after superimpose " << std::endl;
707 +
708 + if (f != 0) {
709 + std::string eMes = " Error initializing correspondences\n " + stdGrpList[i]->getName() + " is not a match \n";
710 +@@ -3689,6 +3733,8 @@
711 + pNewMolecule->getCoordinates(CoordsB);
712 + int cor = 0;
713 +
714 ++//std::cout << " f = 0 " << std::endl;
715 ++
716 + double dRMSD = pSuperImpose->rmsd(pStdMolecule, CoordsB, correspondenceMatrices, cor);
717 + std::string eMes = " " + stdGrpList[i]->getName() + " is a match with rmsd of " + d2s(dRMSD) + "\n";
718 + MTKpp::errorLogger.throwError("collection::assignMetalParameters", eMes, INFO);
719 +@@ -3703,38 +3749,52 @@
720 + for (int t = 0; t < nHeavyAtoms; t++) {
721 + for (int t2 = 0; t2 < nHeavyAtoms; t2++) {
722 + if (correspondenceMatrices[cor][t*nHeavyAtoms+t2]) {
723 +-//std::cout << t+1 << ":" << t2+1 << "; |";
724 +-
725 + atom* pA1 = molHeavyAtoms1[t];
726 + atom* pA2 = molHeavyAtoms2[t2];
727 +
728 + if (pA1 and pA2) {
729 +-//atom* collection::getAtom(int number, bool atomIndex, bool fileId, bool atomColIndex)
730 +-
731 ++ // getAtom(int number, bool atomIndex, bool fileId, bool atomColIndex)
732 + atom* pOrgAtom = this->getAtom(pA2->getFileID(), 0, 1, 0);
733 +-/*
734 +-std::cout << pA1->getName() << "|" << pA2->getName() << "|" << pOrgAtom->getName() << " "
735 +- << pA1->getParent()->getName() << "|" << pA2->getParent()->getName() << "|" << pOrgAtom->getParent()->getName() << " |"
736 +- << pA1->getFileID() << "|" << pA2->getFileID() << "|" << pOrgAtom->getFileID() << "|"
737 +- << pA1->getColIndex() << "|" << pA2->getColIndex() << "|" << pOrgAtom->getColIndex()
738 +- << " |\n";
739 +-*/
740 +- pOrgAtom->getParent()->setName(pA1->getParent()->getName());
741 ++ // atom* pOrgAtom = this->getAtom(pA2->getColIndex(), 0, 0, 1);
742 ++
743 ++
744 ++//std::cout << pA1->getName() << "|" << pA2->getName() << "|" << pOrgAtom->getName() << " "
745 ++// << pA1->getParent()->getName() << "|" << pA2->getParent()->getName() << "|" << pOrgAtom->getParent()->getName() << " |"
746 ++// << pA1->getFileID() << "|" << pA2->getFileID() << "|" << pOrgAtom->getFileID() << "|"
747 ++// << pA1->getColIndex() << "|" << pA2->getColIndex() << "|" << pOrgAtom->getColIndex()
748 ++// << " |\n";
749 ++
750 ++ //pOrgAtom->getParent()->setName(pA1->getParent()->getName());
751 ++
752 ++ for (unsigned int i = 0 ; i < atomList.size(); i++) {
753 ++ if (atomList[i]->getFileID() == pA2->getFileID()) {
754 ++ //std::cout << "setting " << atomList[i]->getParent()->getName() << " to "
755 ++ // << pA1->getParent()->getName() << "\n";
756 ++ atomList[i]->getParent()->setName(pA1->getParent()->getName());
757 ++ }
758 + }
759 ++//std::cout << pOrgAtom->getParent() << " " << pOrgAtom->getParent()->getName() << " "
760 ++//<< pA2->getFileID()
761 ++// << " " << pOrgAtom->getParent()->getColIndex() << "\n";
762 + }
763 + }
764 + }
765 + }
766 ++
767 ++ }
768 + }
769 + }
770 + }
771 ++
772 + // delete new molecule
773 ++ if (pNewMolecule) {
774 + this->delMolecule(pNewMolecule);
775 + }
776 + }
777 + }
778 + }
779 + }
780 ++ }
781 +
782 + ///////////////////////////////////////////////////////////////////////////////
783 + ///////////////////////////////////////////////////////////////////////////////
784 +@@ -4377,6 +4437,7 @@
785 + }
786 + std::cout << " TOTAL CHARGE = " << localTotalCharge << std::endl;
787 + */
788 ++
789 + }
790 +
791 + // ============================================================
792 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Molecule/hydrophobize.cpp amber11/AmberTools/src/mtkpp/src/Molecule/hydrophobize.cpp
793 +--- amber11.orig/AmberTools/src/mtkpp/src/Molecule/hydrophobize.cpp 2011-04-14 15:30:18.000000000 +0300
794 ++++ amber11/AmberTools/src/mtkpp/src/Molecule/hydrophobize.cpp 2012-03-03 20:03:01.404032569 +0200
795 +@@ -315,7 +315,7 @@
796 + if (!vertices[i]->isVisited()) {
797 + graph* subGraph = new graph();
798 +
799 +- std::cout << "\n " << vertices[i]->getIndex() << " ";
800 ++// std::cout << "\n " << vertices[i]->getIndex() << " ";
801 + molGraph->dfs(vertices[i]);
802 +
803 + for (unsigned int j = 0; j < vertices.size(); j++) {
804 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Molecule/Makefile.am amber11/AmberTools/src/mtkpp/src/Molecule/Makefile.am
805 +--- amber11.orig/AmberTools/src/mtkpp/src/Molecule/Makefile.am 2011-04-14 15:30:18.000000000 +0300
806 ++++ amber11/AmberTools/src/mtkpp/src/Molecule/Makefile.am 2012-03-03 20:03:01.401032571 +0200
807 +@@ -1,8 +1,8 @@
808 +-DIAGNOSTICS_LD=-L$(top_builddir)/src/Diagnostics/$(SRCDIR)
809 ++DIAGNOSTICS_LD=-L$(abs_top_builddir)/src/Diagnostics/$(SRCDIR)
810 + DIAGNOSTICS_LIB=-lDiagnostics
811 +-GRAPH_LD=-L$(top_builddir)/src/Graph/$(SRCDIR)
812 ++GRAPH_LD=-L$(abs_top_builddir)/src/Graph/$(SRCDIR)
813 + GRAPH_LIB=-lGraph
814 +-LOG_LD=-L$(top_builddir)/src/Log/$(SRCDIR)
815 ++LOG_LD=-L$(abs_top_builddir)/src/Log/$(SRCDIR)
816 + LOG_LIB=-lLog
817 +
818 + INCLUDES = -I@boost_inc@ -I$(srcdir)/.. -I$(top_srcdir)/src/eigen3b2
819 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Molecule/Makefile.in amber11/AmberTools/src/mtkpp/src/Molecule/Makefile.in
820 +--- amber11.orig/AmberTools/src/mtkpp/src/Molecule/Makefile.in 2011-04-14 15:30:18.000000000 +0300
821 ++++ amber11/AmberTools/src/mtkpp/src/Molecule/Makefile.in 2012-03-03 20:03:01.401032571 +0200
822 +@@ -248,11 +248,11 @@
823 + top_builddir = @top_builddir@
824 + top_srcdir = @top_srcdir@
825 + xerces_path = @xerces_path@
826 +-DIAGNOSTICS_LD = -L$(top_builddir)/src/Diagnostics/$(SRCDIR)
827 ++DIAGNOSTICS_LD = -L$(abs_top_builddir)/src/Diagnostics/$(SRCDIR)
828 + DIAGNOSTICS_LIB = -lDiagnostics
829 +-GRAPH_LD = -L$(top_builddir)/src/Graph/$(SRCDIR)
830 ++GRAPH_LD = -L$(abs_top_builddir)/src/Graph/$(SRCDIR)
831 + GRAPH_LIB = -lGraph
832 +-LOG_LD = -L$(top_builddir)/src/Log/$(SRCDIR)
833 ++LOG_LD = -L$(abs_top_builddir)/src/Log/$(SRCDIR)
834 + LOG_LIB = -lLog
835 + INCLUDES = -I@boost_inc@ -I$(srcdir)/.. -I$(top_srcdir)/src/eigen3b2
836 + lib_LTLIBRARIES = libMolecule.la
837 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Molecule/parameters.cpp amber11/AmberTools/src/mtkpp/src/Molecule/parameters.cpp
838 +--- amber11.orig/AmberTools/src/mtkpp/src/Molecule/parameters.cpp 2011-04-14 15:30:18.000000000 +0300
839 ++++ amber11/AmberTools/src/mtkpp/src/Molecule/parameters.cpp 2012-03-03 20:03:01.404032569 +0200
840 +@@ -145,6 +145,7 @@
841 + pAtomType->description = "";
842 + pAtomType->rvalue = 0.0;
843 + pAtomType->evalue = 0.0;
844 ++ pAtomType->atomPolarizability = 0.0;
845 + pAtomType->groupName = "";
846 + pAtomType->optimize = false;
847 + this->itsTypeList.push_back(pAtomType);
848 +@@ -184,6 +185,7 @@
849 + pAtomType->description = a->description;
850 + pAtomType->rvalue = a->rvalue;
851 + pAtomType->evalue = a->evalue;
852 ++ pAtomType->atomPolarizability = a->atomPolarizability;
853 + pAtomType->groupName = g;
854 + pAtomType->optimize = a->optimize;
855 +
856 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Molecule/parameters.h amber11/AmberTools/src/mtkpp/src/Molecule/parameters.h
857 +--- amber11.orig/AmberTools/src/mtkpp/src/Molecule/parameters.h 2011-04-14 15:30:18.000000000 +0300
858 ++++ amber11/AmberTools/src/mtkpp/src/Molecule/parameters.h 2012-03-03 20:03:01.405032569 +0200
859 +@@ -76,6 +76,9 @@
860 + //! Well Depth
861 + double evalue;
862 +
863 ++ //! Atomic polarizability in A**3
864 ++ double atomPolarizability;
865 ++
866 + //! group name
867 + std::string groupName;
868 +
869 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Molecule/stdFrag.cpp amber11/AmberTools/src/mtkpp/src/Molecule/stdFrag.cpp
870 +--- amber11.orig/AmberTools/src/mtkpp/src/Molecule/stdFrag.cpp 2011-04-14 15:30:18.000000000 +0300
871 ++++ amber11/AmberTools/src/mtkpp/src/Molecule/stdFrag.cpp 2012-03-03 20:03:01.405032569 +0200
872 +@@ -305,7 +305,8 @@
873 + this->itsSymbol = symbol;
874 + }
875 + else {
876 +- std::cout << " Length of Fragment Symbol = " << symbol.size()
877 ++ std::cout << " Length of Fragment Symbol (" << symbol
878 ++ << ") = " << symbol.size()
879 + << " --> Must be 3." << std::endl;
880 + }
881 + }
882 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Molecule/stdGroup.cpp amber11/AmberTools/src/mtkpp/src/Molecule/stdGroup.cpp
883 +--- amber11.orig/AmberTools/src/mtkpp/src/Molecule/stdGroup.cpp 2011-04-14 15:30:18.000000000 +0300
884 ++++ amber11/AmberTools/src/mtkpp/src/Molecule/stdGroup.cpp 2012-03-03 20:03:01.406032569 +0200
885 +@@ -35,6 +35,7 @@
886 + #include "stdLibrary.h"
887 +
888 + #include "molecule.h"
889 ++#include "submolecule.h"
890 +
891 + namespace MTKpp
892 + {
893 +@@ -258,5 +259,24 @@
894 + }
895 + }
896 +
897 ++// ============================================================
898 ++// Function : getCharge()
899 ++// ------------------------------------------------------------
900 ++//
901 ++// ============================================================
902 ++double stdGroup::getCharge()
903 ++{
904 ++ double d = 0.0;
905 ++ if (pMolecule) {
906 ++ std::vector<submolecule*> sList = this->pMolecule->getSubMoleculeList();
907 ++ for (unsigned int p = 0; p < sList.size(); p++) {
908 ++ this->pStdFrag = this->getStdFrag(sList[p]->getName());
909 ++ d += this->pStdFrag->getCharge();
910 ++ //std::cout << this->pStdFrag->getSymbol() << " " << this->pStdFrag->getCharge() << std::endl;
911 ++ }
912 ++ }
913 ++ return d;
914 ++}
915 ++
916 + } // MTKpp namespace
917 +
918 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Molecule/stdGroup.h amber11/AmberTools/src/mtkpp/src/Molecule/stdGroup.h
919 +--- amber11.orig/AmberTools/src/mtkpp/src/Molecule/stdGroup.h 2011-04-14 15:30:18.000000000 +0300
920 ++++ amber11/AmberTools/src/mtkpp/src/Molecule/stdGroup.h 2012-03-03 20:03:01.406032569 +0200
921 +@@ -160,6 +160,12 @@
922 + */
923 + molecule* getStdMolecule();
924 +
925 ++ /*!
926 ++ \brief Get getCharge
927 ++ \return molecule charge
928 ++ */
929 ++ double getCharge();
930 ++
931 + protected:
932 + //! stdLibrary pointer
933 + stdLibrary* pParent;
934 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Parsers/frcmodParser.cpp amber11/AmberTools/src/mtkpp/src/Parsers/frcmodParser.cpp
935 +--- amber11.orig/AmberTools/src/mtkpp/src/Parsers/frcmodParser.cpp 2011-04-14 15:30:18.000000000 +0300
936 ++++ amber11/AmberTools/src/mtkpp/src/Parsers/frcmodParser.cpp 2012-03-03 20:03:01.407032569 +0200
937 +@@ -98,6 +98,7 @@
938 + while (ifrcmod) {
939 + std::string buffer(80,'*');
940 + getline(ifrcmod,fileline);
941 ++//std::cout << "|" << fileline << "|" << std::endl;
942 + bMASS = false;
943 + bBOND = false;
944 + bANGLE = false;
945 +@@ -105,118 +106,311 @@
946 + bIMPROPER = false;
947 + bNONBON = false;
948 +
949 ++ if ( (fileline.size() > 0) and (stripString(fileline, " ") != "") ) {
950 ++ std::vector<std::string> splitstring;
951 ++ splitString(fileline, " ", splitstring, 0);
952 ++
953 ++ if (splitstring[0] == "MASS") bMASS = true;
954 ++ if (splitstring[0] == "BOND") bBOND = true;
955 ++ if (splitstring[0] == "ANGL" or splitstring[0] == "ANGLE") bANGLE = true;
956 ++ if (splitstring[0] == "DIHE" or splitstring[0] == "DIHEDRAL") bDIHE = true;
957 ++ if (splitstring[0] == "IMPROP" or splitstring[0] == "IMPROPER") bIMPROPER = true;
958 ++ if (splitstring[0] == "NONB" or splitstring[0] == "NONBON") bNONBON = true;
959 ++ }
960 ++/*
961 ++ try {
962 + if (fileline.substr(0,4) == "MASS") bMASS = true;
963 ++ }
964 ++ catch (std::out_of_range) {
965 ++ std::cout << " out_of_range MAS " << std::endl;
966 ++ }
967 ++
968 ++ try {
969 + if (fileline.substr(0,4) == "BOND") bBOND = true;
970 ++ }
971 ++ catch (std::out_of_range) {
972 ++ std::cout << " out_of_range BOND " << std::endl;
973 ++ }
974 ++
975 ++ try {
976 + if (fileline.substr(0,5) == "ANGLE") bANGLE = true;
977 ++ }
978 ++ catch (std::out_of_range) {
979 ++ std::cout << " out_of_range ANG" << std::endl;
980 ++ }
981 ++
982 ++ try {
983 + if (fileline.substr(0,4) == "DIHE") bDIHE = true;
984 ++ }
985 ++ catch (std::out_of_range) {
986 ++ std::cout << " out_of_range DIHE " << std::endl;
987 ++ }
988 ++
989 ++ try {
990 + if (fileline.substr(0,8) == "IMPROPER") bIMPROPER = true;
991 ++ }
992 ++ catch (std::out_of_range) {
993 ++ std::cout << " out_of_range IMP " << std::endl;
994 ++ }
995 ++
996 ++ try {
997 + if (fileline.substr(0,6) == "NONBON") bNONBON = true;
998 ++ }
999 ++ catch (std::out_of_range) {
1000 ++ std::cout << " out_of_range NONB" << std::endl;
1001 ++ }
1002 ++*/
1003 +
1004 + if (bMASS) {
1005 + getline(ifrcmod,fileline);
1006 +- while (fileline != "") {
1007 ++ while (stripString(fileline, " ") != "") {
1008 ++ //while (GetAlphaChar(fileline, 0) != "0") {
1009 ++ std::vector<std::string> splitLine;
1010 ++ splitString(fileline, " ", splitLine, 0);
1011 ++ if (splitLine.size() >= 2) {
1012 ++ for (unsigned int i = 0; i < 2; i++) {
1013 ++ splitLine[i] = stripString(splitLine[i], " ");
1014 ++ }
1015 + pAtomType = pParameters->addAtomType();
1016 ++ pAtomType->name = splitLine[0];
1017 + pAtomType->groupName = this->groupName;
1018 +- pAtomType->mass = strtod(fileline.substr(3,5).c_str(), 0);
1019 ++ pAtomType->mass = string2Double(splitLine[1]); //strtod(fileline.substr(3,5).c_str(), 0);
1020 ++
1021 ++ if (splitLine.size() > 2) {
1022 ++ char *end;
1023 ++ double ret_double = strtod(splitLine[2].c_str(), &end);
1024 ++ if (!*end) {
1025 ++ pAtomType->atomPolarizability = ret_double;
1026 ++ }
1027 ++//std::cout << splitLine[2] << " " << ret_double << std::endl;
1028 ++ }
1029 ++
1030 + getline(ifrcmod,fileline);
1031 + }
1032 + }
1033 ++ }
1034 +
1035 + if (bBOND) {
1036 + getline(ifrcmod,fileline);
1037 +- while (fileline != "") {
1038 +- std::string atomNames = fileline.substr(0,5);
1039 ++ //while (fileline != "") {
1040 ++ while (stripString(fileline, " ") != "") {
1041 ++ //std::string atomNames = fileline.substr(0,5);
1042 + std::vector<std::string> splitLine;
1043 +- splitString(atomNames, "-", splitLine, 0);
1044 +- if (splitLine.size() == 2) {
1045 +- for (unsigned int i = 0; i < 2; i++) {
1046 +- splitLine[i] = stripString(splitLine[i]," ");
1047 +- }
1048 ++ splitString(fileline, "-", splitLine, 0);
1049 ++
1050 ++ std::vector<std::string> splitLine2;
1051 ++ splitString(splitLine[1], " ", splitLine2, 0);
1052 ++
1053 ++ //if (splitLine.size() == 2) {
1054 ++ //for (unsigned int i = 0; i < 2; i++) {
1055 ++ // splitLine[i] = stripString(splitLine[i]," ");
1056 ++ //}
1057 + pBondParam = pParameters->addBondParam();
1058 + pBondParam->groupName = this->groupName;
1059 +- pBondParam->atomType1 = std::string(splitLine[0]);
1060 +- pBondParam->atomType2 = std::string(splitLine[1]);
1061 +- pBondParam->keq = strtod(fileline.substr(7,5).c_str(), 0);
1062 +- pBondParam->req = strtod(fileline.substr(16,5).c_str(), 0);
1063 ++ pBondParam->atomType1 = stripString(splitLine[0], " ");
1064 ++ pBondParam->atomType2 = stripString(splitLine2[0], " ");
1065 ++//std::cout << "|" << pBondParam->atomType1 << "|" << pBondParam->atomType2 << "|" << std::endl;
1066 ++ pBondParam->keq = string2Double(splitLine2[1]);
1067 ++ pBondParam->req = string2Double(splitLine2[2]);
1068 ++
1069 ++// pBondParam->keq = strtod(fileline.substr(7,5).c_str(), 0);
1070 ++// pBondParam->req = strtod(fileline.substr(16,5).c_str(), 0);
1071 ++
1072 ++//std::cout << "\n " << fileline << std::endl;
1073 ++//std::cout << " BOND " << pBondParam->atomType1 << " " << pBondParam->atomType2 << " " << pBondParam->keq << " " << pBondParam->req << std::endl;
1074 ++//std::cout << " BOND " << fileline.substr(7,5) << " " << fileline.substr(16,5) <<std::endl;
1075 ++
1076 + getline(ifrcmod,fileline);
1077 +- }
1078 ++ //}
1079 + }
1080 + }
1081 +
1082 + if (bANGLE) {
1083 + getline(ifrcmod,fileline);
1084 +- while (fileline != "") {
1085 +- std::string atomNames = fileline.substr(0,8);
1086 ++ //while (fileline != "") {
1087 ++ while (stripString(fileline, " ") != "") {
1088 ++// std::string atomNames = fileline.substr(0,8);
1089 ++
1090 + std::vector<std::string> splitLine;
1091 +- splitString(atomNames, "-", splitLine, 0);
1092 +- if (splitLine.size() == 3) {
1093 +- for (unsigned int i = 0; i < 3; i++) {
1094 +- splitLine[i] = stripString(splitLine[i]," ");
1095 +- }
1096 ++ splitString(fileline, "-", splitLine, 0);
1097 ++
1098 ++ std::vector<std::string> splitLine2;
1099 ++ splitString(splitLine[2], " ", splitLine2, 0);
1100 ++
1101 ++ //std::vector<std::string> splitLine;
1102 ++ //splitString(atomNames, "-", splitLine, 0);
1103 ++
1104 ++ //std::vector<std::string> splitLine2;
1105 ++ //splitString(fileline, " ", splitLine2, 0);
1106 ++
1107 ++ //if (splitLine.size() == 3) {
1108 ++ //for (unsigned int i = 0; i < 3; i++) {
1109 ++ // splitLine[i] = stripString(splitLine[i]," ");
1110 ++ //}
1111 + pAngleParam = pParameters->addAngleParam();
1112 + pAngleParam->groupName = this->groupName;
1113 +- pAngleParam->atomType1 = std::string(splitLine[0]);
1114 +- pAngleParam->atomType2 = std::string(splitLine[1]);
1115 +- pAngleParam->atomType3 = std::string(splitLine[2]);
1116 +- pAngleParam->keq = strtod(fileline.substr(11,7).c_str(), 0);
1117 +- pAngleParam->req = strtod(fileline.substr(20,8).c_str(), 0) * DEG2RAD;
1118 ++ pAngleParam->atomType1 = stripString(splitLine[0], " ");
1119 ++ pAngleParam->atomType2 = stripString(splitLine[1], " ");
1120 ++ pAngleParam->atomType3 = stripString(splitLine2[0], " ");
1121 ++//std::cout << "|" << pAngleParam->atomType1 << "|" << pAngleParam->atomType2 << "|" << pAngleParam->atomType3 << "|" << std::endl;
1122 ++
1123 ++ pAngleParam->keq = string2Double(splitLine2[1]);
1124 ++ pAngleParam->req = string2Double(splitLine2[2]) * DEG2RAD;
1125 ++
1126 ++ //pAngleParam->keq = strtod(fileline.substr(11,7).c_str(), 0);
1127 ++ //pAngleParam->req = strtod(fileline.substr(20,8).c_str(), 0) * DEG2RAD;
1128 ++
1129 ++//std::cout << "\n " << fileline << std::endl;
1130 ++//std::cout << " ANGLE " << pAngleParam->atomType1 << " " << pAngleParam->atomType2 << " " << pAngleParam->atomType3 << " " << pAngleParam->keq << " " << string2Double(splitLine2[2]) << std::endl;
1131 ++
1132 + getline(ifrcmod,fileline);
1133 +- }
1134 ++ //}
1135 + }
1136 + }
1137 +
1138 + if (bDIHE) {
1139 + getline(ifrcmod,fileline);
1140 +- while (fileline != "") {
1141 +- std::string atomNames = fileline.substr(0,11);
1142 ++ //while (fileline != "") {
1143 ++ while (stripString(fileline, " ") != "") {
1144 ++
1145 ++//std::cout << "\n " << fileline << std::endl;
1146 ++
1147 ++//std::cout << fileline.substr(0,12) << std::endl;
1148 ++
1149 ++// snip = str.substr(0,12);
1150 ++//(3) erase the substring of 0..where str.erase(0,where);
1151 ++
1152 ++ std::string atTypes = fileline.substr(0,12);
1153 + std::vector<std::string> splitLine;
1154 +- splitString(atomNames, "-", splitLine, 0);
1155 +- if (splitLine.size() == 4) {
1156 +- for (unsigned int i = 0; i < 4; i++) {
1157 +- splitLine[i] = stripString(splitLine[i]," ");
1158 +- }
1159 ++ splitString(atTypes, "-", splitLine, 0);
1160 ++
1161 ++/*for (unsigned int i = 0; i < splitLine.size(); i++) {
1162 ++ std::cout << splitLine[i] << std::endl;
1163 ++}*/
1164 ++
1165 ++ fileline.erase(0,12);
1166 ++
1167 ++ std::vector<std::string> splitLine2;
1168 ++ splitString(fileline, " ", splitLine2, 0);
1169 ++/*
1170 ++for (unsigned int i = 0; i < splitLine2.size(); i++) {
1171 ++ std::cout << splitLine2[i] << std::endl;
1172 ++}*/
1173 ++
1174 ++ //std::string atomNames = fileline.substr(0,11);
1175 ++ //std::vector<std::string> splitLine;
1176 ++ //splitString(atomNames, "-", splitLine, 0);
1177 ++
1178 ++ //if (splitLine.size() == 4) {
1179 ++ //for (unsigned int i = 0; i < 4; i++) {
1180 ++ //splitLine[i] = stripString(splitLine[i], " ");
1181 ++ //}
1182 + pTorsionParam = pParameters->addTorsionParam();
1183 + pTorsionParam->groupName = this->groupName;
1184 +- pTorsionParam->atomType1 = std::string(splitLine[0]);
1185 +- pTorsionParam->atomType2 = std::string(splitLine[1]);
1186 +- pTorsionParam->atomType3 = std::string(splitLine[2]);
1187 +- pTorsionParam->atomType4 = std::string(splitLine[3]);
1188 +- pTorsionParam->npth = atoi(fileline.substr(11,4).c_str());
1189 +- pTorsionParam->Vn = strtod(fileline.substr(18,8).c_str(), 0);
1190 +- pTorsionParam->gamma = strtod(fileline.substr(31,8).c_str(), 0) * DEG2RAD;
1191 +- pTorsionParam->Nt = strtod(fileline.substr(42,12).c_str(), 0);
1192 ++ pTorsionParam->atomType1 = stripString(splitLine[0], " ");
1193 ++ pTorsionParam->atomType2 = stripString(splitLine[1], " ");
1194 ++ pTorsionParam->atomType3 = stripString(splitLine[2], " ");
1195 ++ pTorsionParam->atomType4 = stripString(splitLine[3], " ");
1196 ++
1197 ++ pTorsionParam->npth = string2Int(splitLine2[0]);
1198 ++ pTorsionParam->Vn = string2Double(splitLine2[1]);
1199 ++ pTorsionParam->gamma = string2Double(splitLine2[2]) * DEG2RAD;
1200 ++ pTorsionParam->Nt = string2Double(splitLine2[3]);
1201 ++
1202 ++ //pTorsionParam->npth = atoi(fileline.substr(11,4).c_str());
1203 ++ //pTorsionParam->Vn = strtod(fileline.substr(18,8).c_str(), 0);
1204 ++ //pTorsionParam->gamma = strtod(fileline.substr(31,8).c_str(), 0) * DEG2RAD;
1205 ++ //pTorsionParam->Nt = strtod(fileline.substr(42,12).c_str(), 0);
1206 ++
1207 ++//std::cout << " DIHE " << pTorsionParam->atomType1 << " " << pTorsionParam->atomType2 << " " << pTorsionParam->atomType3 << " " << pTorsionParam->atomType4 << " " << pTorsionParam->npth << " " << pTorsionParam->Vn << " " << string2Double(splitLine2[2]) << " " << pTorsionParam->Nt << std::endl;
1208 ++
1209 + getline(ifrcmod,fileline);
1210 +- }
1211 ++//std::cout << " DIHE LINE: " << fileline << std::endl;
1212 ++ //}
1213 + }
1214 + }
1215 +
1216 + if (bIMPROPER) {
1217 + getline(ifrcmod,fileline);
1218 +- while (fileline != "") {
1219 +- std::string atomNames = fileline.substr(0,11);
1220 ++ //while (fileline != "") {
1221 ++ while (stripString(fileline, " ") != "") {
1222 ++
1223 ++ std::string atTypes = fileline.substr(0,12);
1224 + std::vector<std::string> splitLine;
1225 +- splitString(atomNames, "-", splitLine, 0);
1226 +- if (splitLine.size() == 4) {
1227 +- for (unsigned int i = 0; i < 4; i++) {
1228 +- splitLine[i] = stripString(splitLine[i]," ");
1229 +- }
1230 ++ splitString(atTypes, "-", splitLine, 0);
1231 ++
1232 ++ fileline.erase(0,12);
1233 ++
1234 ++ std::vector<std::string> splitLine2;
1235 ++ splitString(fileline, " ", splitLine2, 0);
1236 ++
1237 ++// std::vector<std::string> splitLine;
1238 ++// splitString(fileline, "-", splitLine, 0);
1239 ++
1240 ++// std::vector<std::string> splitLine2;
1241 ++// splitString(splitLine[3], " ", splitLine2, 0);
1242 ++
1243 ++ //std::string atomNames = fileline.substr(0,11);
1244 ++ //std::vector<std::string> splitLine;
1245 ++ //splitString(atomNames, "-", splitLine, 0);
1246 ++ //if (splitLine.size() == 4) {
1247 ++ //for (unsigned int i = 0; i < 4; i++) {
1248 ++ //splitLine[i] = stripString(splitLine[i]," ");
1249 ++ //}
1250 + pImproperParam = pParameters->addImproperParam();
1251 + pImproperParam->groupName = this->groupName;
1252 +- pImproperParam->atomType1 = std::string(splitLine[0]);
1253 +- pImproperParam->atomType2 = std::string(splitLine[1]);
1254 +- pImproperParam->atomType3 = std::string(splitLine[2]);
1255 +- pImproperParam->atomType4 = std::string(splitLine[3]);
1256 +- pImproperParam->Vn = strtod(fileline.substr(18,8).c_str(), 0);
1257 +- pImproperParam->gamma = strtod(fileline.substr(31,8).c_str(), 0) * DEG2RAD;
1258 +- pImproperParam->Nt = strtod(fileline.substr(42,12).c_str(), 0);
1259 ++ pImproperParam->atomType1 = stripString(splitLine[0], " ");
1260 ++ pImproperParam->atomType2 = stripString(splitLine[1], " ");
1261 ++ pImproperParam->atomType3 = stripString(splitLine[2], " ");
1262 ++ pImproperParam->atomType4 = stripString(splitLine[3], " ");
1263 ++
1264 ++ pImproperParam->Vn = string2Double(splitLine2[0]);
1265 ++ pImproperParam->gamma = string2Double(splitLine2[1]) * DEG2RAD;
1266 ++ pImproperParam->Nt = string2Double(splitLine2[2]);
1267 ++
1268 ++ //pImproperParam->Vn = strtod(fileline.substr(18,8).c_str(), 0);
1269 ++ //pImproperParam->gamma = strtod(fileline.substr(31,8).c_str(), 0) * DEG2RAD;
1270 ++ //pImproperParam->Nt = strtod(fileline.substr(42,12).c_str(), 0);
1271 ++
1272 ++//std::cout << "\n " << fileline << std::endl;
1273 ++//std::cout << " IMPR " << pImproperParam->atomType1 << " " << pImproperParam->atomType2 << " " << pImproperParam->atomType3 << " " << pImproperParam->atomType4 << " " << pImproperParam->Vn << " " << string2Double(splitLine2[1]) << " " << pImproperParam->Nt << std::endl;
1274 ++
1275 + getline(ifrcmod,fileline);
1276 +- }
1277 ++ //}
1278 + }
1279 + }
1280 + if (bNONBON) {
1281 ++ getline(ifrcmod,fileline);
1282 ++//std::cout << fileline << std::endl;
1283 ++ //while (fileline != "") {
1284 ++ while (stripString(fileline, " ") != "") {
1285 ++ std::vector<std::string> splitLine;
1286 ++ splitString(fileline, " ", splitLine, 0);
1287 ++ if (splitLine.size() >= 3) {
1288 ++ for (unsigned int i = 0; i < 3; i++) {
1289 ++ splitLine[i] = stripString(splitLine[i], " ");
1290 ++ }
1291 ++//std::cout << " |" << splitLine[0] << "|" << std::endl;
1292 ++
1293 ++//std::cout << "\n " << fileline << std::endl;
1294 ++
1295 ++ pAtomType = pParameters->getAtomType(stripString(splitLine[0], " "));
1296 ++ if (pAtomType) {
1297 ++ pAtomType->rvalue = string2Double(splitLine[1]);
1298 ++ pAtomType->evalue = string2Double(splitLine[2]);
1299 +
1300 ++//std::cout << pAtomType->name << " " << pAtomType->rvalue << " " << pAtomType->evalue << std::endl;
1301 ++
1302 ++ }
1303 ++ else {
1304 ++ std::cout << " Can't find atom type " << std::endl;
1305 ++ }
1306 ++ getline(ifrcmod,fileline);
1307 ++ }
1308 ++ }
1309 + }
1310 + }
1311 ++
1312 + ifrcmod.close();
1313 + }
1314 +
1315 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Parsers/gaussianParser.cpp amber11/AmberTools/src/mtkpp/src/Parsers/gaussianParser.cpp
1316 +--- amber11.orig/AmberTools/src/mtkpp/src/Parsers/gaussianParser.cpp 2011-04-14 15:30:18.000000000 +0300
1317 ++++ amber11/AmberTools/src/mtkpp/src/Parsers/gaussianParser.cpp 2012-03-03 20:03:01.408032569 +0200
1318 +@@ -84,7 +84,7 @@
1319 +
1320 + this->bMem = 0;
1321 +
1322 +- this->bnProc = 0;
1323 ++ this->bNProc = 0;
1324 +
1325 + this->bWriteInternalCoords = true;
1326 + this->bWriteCartCoords = false;
1327 +@@ -168,7 +168,7 @@
1328 + while (igau) {
1329 + getline(igau,fileline);
1330 +
1331 +- if (containsSubStr(fileline, "modredundant")) {
1332 ++ if (containsSubStr(fileline, "ModRedundant")) {
1333 + bModRedundant = true;
1334 + }
1335 + if (fileline.substr(0,59) == " Redundant internal coordinates taken from checkpoint file:") {
1336 +@@ -626,6 +626,7 @@
1337 + void gaussianParser::Write(const std::string &gaussfile, molecule* pMolecule,
1338 + std::vector< vector3d > &coordinates)
1339 + {
1340 ++ std::string routecard;
1341 + std::ofstream ogauss;
1342 + ogauss.open(gaussfile.c_str());
1343 +
1344 +@@ -643,52 +644,64 @@
1345 + return;
1346 + }
1347 +
1348 +- ogauss << "$rungauss" << std::endl;
1349 ++ ogauss << "$RunGauss" << std::endl;
1350 +
1351 + if (bChkPt) {
1352 +- ogauss << "%chk=" << this->itsChkPtFile << std::endl;
1353 ++ ogauss << "%Chk=" << this->itsChkPtFile << std::endl;
1354 + }
1355 + if (bMem) {
1356 +- ogauss << "%mem=" << this->itsMem << std::endl;
1357 ++ ogauss << "%Mem=" << this->itsMem << std::endl;
1358 + }
1359 +- if (bnProc) {
1360 +- ogauss << "%nproc=" << this->itsnProc << std::endl;
1361 ++ if (bNProc) {
1362 ++ ogauss << "%NProcShared=" << this->itsNProc << std::endl;
1363 + }
1364 +
1365 +- ogauss << "#" << this->itsVerbosity << " " << this->itsTheory << "/" << this->itsBasisSet << " ";
1366 ++ routecard = "#" + this->itsVerbosity + " " + this->itsTheory + "/" + this->itsBasisSet;
1367 +
1368 + if (!itsCommandOptions.empty()) {
1369 + for (mapIterator p = itsCommandOptions.begin(); p != itsCommandOptions.end(); p++) {
1370 + std::string c = p->first;
1371 + std::vector<std::string> o = p->second;
1372 ++ std::string opts = "";
1373 + if (o.size() == 1) {
1374 +- if ( p->second[0] == "NONE") {
1375 +- ogauss << p->first << " ";
1376 +- }
1377 +- else {
1378 +- ogauss << p->first << "=" << p->second[0] << " ";
1379 ++ if ( p->second[0] != "NONE") {
1380 ++ opts = "=" + p->second[0];
1381 + }
1382 + }
1383 + else {
1384 +- ogauss << p->first << "(";
1385 ++ opts = "(";
1386 + for (unsigned int i = 0; i < o.size(); i++) {
1387 +- if (i == o.size()-1) {
1388 +- ogauss << o[i];
1389 ++ opts = opts + o[i];
1390 ++ if (i != o.size()-1) {
1391 ++ opts = opts + ",";
1392 + }
1393 +- else {
1394 +- ogauss << o[i] << ",";
1395 + }
1396 ++ opts = opts + ")";
1397 + }
1398 +- ogauss << ")" << " ";
1399 ++
1400 ++ if (routecard.length() + c.length() + opts.length() < 72) {
1401 ++ routecard = routecard + " " + c + opts;
1402 ++ } else {
1403 ++ if (routecard.length() != 0) {
1404 ++ ogauss << routecard << std::endl;
1405 ++ }
1406 ++ routecard = c + opts;
1407 + }
1408 + }
1409 + }
1410 + for (unsigned int i = 0; i < this->iops.size(); i++) {
1411 +- ogauss << this->iops[i] << " ";
1412 ++ if (routecard.length() + this->iops[i].length() < 72) {
1413 ++ routecard = routecard + " " + this->iops[i];
1414 ++ } else {
1415 ++ if (routecard.length() != 0) {
1416 ++ ogauss << routecard << std::endl;
1417 ++ }
1418 ++ routecard = this->iops[i];
1419 ++ }
1420 + }
1421 +
1422 + // Flush command block and follow with a blank line
1423 +- ogauss << "\n" << std::endl;
1424 ++ ogauss << routecard << "\n" << std::endl;
1425 +
1426 + // Write name (if required) and follow with a blank line
1427 + if (bWriteMoleculeName) {
1428 +@@ -740,11 +753,11 @@
1429 + ogauss << std::endl;
1430 + }
1431 +
1432 +- std::vector<std::string> optOptions = this->getCommandOption("opt");
1433 ++ std::vector<std::string> optOptions = this->getCommandOption("Opt");
1434 + if (optOptions.size() > 0) {
1435 + bool bMD = 0;
1436 + for (unsigned int x = 0; x < optOptions.size(); x++) {
1437 +- if (optOptions[x] == "modredundant") {
1438 ++ if (optOptions[x] == "ModRedundant") {
1439 + bMD = 1;
1440 + }
1441 + }
1442 +@@ -766,13 +779,13 @@
1443 + }
1444 + }
1445 +
1446 +- if (this->itsBasisSet.substr(0,3) == "GEN") {
1447 ++ if (this->itsBasisSet.substr(0,3) == "Gen") {
1448 + std::ifstream iBSFile;
1449 + iBSFile.open(this->itsBasisSetFile.c_str());
1450 +
1451 + if (!iBSFile) {
1452 + std::cout << "\nERROR!"
1453 +- << "\nBasis set \"GEN\" requires a custom file."
1454 ++ << "\nBasis set \"Gen\" requires a custom file."
1455 + << "\nFile \"" << this->itsBasisSetFile << "\" is missing or unreadable."
1456 + << "\nPlease choose another file. For instructions, consult your program's"
1457 + << "\ndocumentation."
1458 +@@ -789,13 +802,13 @@
1459 + }
1460 +
1461 + // +BPR
1462 +- if (this->getCommandOption("pseudo").size() > 0) {
1463 ++ if (this->getCommandOption("Pseudo").size() > 0) {
1464 + std::ifstream iPseudoFile;
1465 + iPseudoFile.open(this->itsPseudoPotentialFile.c_str());
1466 +
1467 + if (!iPseudoFile) {
1468 + std::cout << "\nERROR!"
1469 +- << "\npseudo=read or pseudo=cards requires a custom file."
1470 ++ << "\nPseudo=Read or Pseudo=Cards requires a custom file."
1471 + << "\nFile \"" << this->itsPseudoPotentialFile << "\" is missing or unreadable."
1472 + << "\nPlease choose another file. For instructions, consult your program's"
1473 + << "\ndocumentation."
1474 +@@ -812,7 +825,7 @@
1475 + }
1476 + // -BPR
1477 +
1478 +- if (this->getCommandOption("pop").size() > 0) {
1479 ++ if (this->getCommandOption("Pop").size() > 0) {
1480 + if (!itsMKRadii.empty()) {
1481 + for (dMapIterator p = itsMKRadii.begin(); p != itsMKRadii.end(); p++) {
1482 + ogauss << p->first << "=" << p->second << "\n";
1483 +@@ -1037,14 +1050,14 @@
1484 + }
1485 +
1486 + // ============================================================
1487 +-// Function : setnProc
1488 ++ // Function : setNProc
1489 + // ------------------------------------------------------------
1490 + //
1491 + // ============================================================
1492 +-void gaussianParser::setnProc(const std::string &n)
1493 ++ void gaussianParser::setNProc(const std::string &n)
1494 + {
1495 +- this->bnProc = 1;
1496 +- this->itsnProc = n;
1497 ++ this->bNProc = 1;
1498 ++ this->itsNProc = n;
1499 + }
1500 +
1501 + // ============================================================
1502 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Parsers/gaussianParser.h amber11/AmberTools/src/mtkpp/src/Parsers/gaussianParser.h
1503 +--- amber11.orig/AmberTools/src/mtkpp/src/Parsers/gaussianParser.h 2011-04-14 15:30:18.000000000 +0300
1504 ++++ amber11/AmberTools/src/mtkpp/src/Parsers/gaussianParser.h 2012-03-03 20:03:01.408032569 +0200
1505 +@@ -196,9 +196,9 @@
1506 +
1507 + /*!
1508 + \brief Set number of processors to use
1509 +- \param n nprocs
1510 ++ \param n number of processors
1511 + */
1512 +- void setnProc(const std::string &n);
1513 ++ void setNProc(const std::string &n);
1514 +
1515 + /*!
1516 + \brief Set level of theory
1517 +@@ -354,10 +354,10 @@
1518 + bool bMem;
1519 +
1520 + //! number of processors
1521 +- std::string itsnProc;
1522 ++ std::string itsNProc;
1523 +
1524 +- //! Turn on mem
1525 +- bool bnProc;
1526 ++ //! Turn on number of processors
1527 ++ bool bNProc;
1528 +
1529 + //! Use internal or cartesian coordinates
1530 + bool bWriteInternalCoords;
1531 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Parsers/Makefile.am amber11/AmberTools/src/mtkpp/src/Parsers/Makefile.am
1532 +--- amber11.orig/AmberTools/src/mtkpp/src/Parsers/Makefile.am 2011-04-14 15:30:18.000000000 +0300
1533 ++++ amber11/AmberTools/src/mtkpp/src/Parsers/Makefile.am 2012-03-03 20:03:01.406032569 +0200
1534 +@@ -1,15 +1,15 @@
1535 +-DIAGNOSTICS_LD=-L$(top_builddir)/src/Diagnostics/$(SRCDIR)
1536 ++DIAGNOSTICS_LD=-L$(abs_top_builddir)/src/Diagnostics/$(SRCDIR)
1537 + DIAGNOSTICS_LIB=-lDiagnostics
1538 +-MOLECULE_LD=-L$(top_builddir)/src/Molecule/$(SRCDIR)
1539 ++MOLECULE_LD=-L$(abs_top_builddir)/src/Molecule/$(SRCDIR)
1540 + MOLECULE_LIB=-lMolecule
1541 +-GA_LD=-L$(top_builddir)/src/GA/$(SRCDIR)
1542 ++GA_LD=-L$(abs_top_builddir)/src/GA/$(SRCDIR)
1543 + GA_LIB=-lGA
1544 +-LOG_LD=-L$(top_builddir)/src/Log/$(SRCDIR)
1545 ++LOG_LD=-L$(abs_top_builddir)/src/Log/$(SRCDIR)
1546 + LOG_LIB=-lLog
1547 +-STATS_LD=-L$(top_builddir)/src/Statistics/$(SRCDIR)
1548 ++STATS_LD=-L$(abs_top_builddir)/src/Statistics/$(SRCDIR)
1549 + STATS_LIB=-lStatistics
1550 +
1551 +-TINYXML_LD=-L$(top_builddir)/src/tinyxml/$(SRCDIR)
1552 ++TINYXML_LD=-L$(abs_top_builddir)/src/tinyxml/$(SRCDIR)
1553 + TINYXML_LIB=-ltinyxml
1554 +
1555 + if USE_XERCES
1556 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Parsers/Makefile.in amber11/AmberTools/src/mtkpp/src/Parsers/Makefile.in
1557 +--- amber11.orig/AmberTools/src/mtkpp/src/Parsers/Makefile.in 2011-04-14 15:30:18.000000000 +0300
1558 ++++ amber11/AmberTools/src/mtkpp/src/Parsers/Makefile.in 2012-03-03 20:03:01.407032569 +0200
1559 +@@ -267,17 +267,17 @@
1560 + top_builddir = @top_builddir@
1561 + top_srcdir = @top_srcdir@
1562 + xerces_path = @xerces_path@
1563 +-DIAGNOSTICS_LD = -L$(top_builddir)/src/Diagnostics/$(SRCDIR)
1564 ++DIAGNOSTICS_LD = -L$(abs_top_builddir)/src/Diagnostics/$(SRCDIR)
1565 + DIAGNOSTICS_LIB = -lDiagnostics
1566 +-MOLECULE_LD = -L$(top_builddir)/src/Molecule/$(SRCDIR)
1567 ++MOLECULE_LD = -L$(abs_top_builddir)/src/Molecule/$(SRCDIR)
1568 + MOLECULE_LIB = -lMolecule
1569 +-GA_LD = -L$(top_builddir)/src/GA/$(SRCDIR)
1570 ++GA_LD = -L$(abs_top_builddir)/src/GA/$(SRCDIR)
1571 + GA_LIB = -lGA
1572 +-LOG_LD = -L$(top_builddir)/src/Log/$(SRCDIR)
1573 ++LOG_LD = -L$(abs_top_builddir)/src/Log/$(SRCDIR)
1574 + LOG_LIB = -lLog
1575 +-STATS_LD = -L$(top_builddir)/src/Statistics/$(SRCDIR)
1576 ++STATS_LD = -L$(abs_top_builddir)/src/Statistics/$(SRCDIR)
1577 + STATS_LIB = -lStatistics
1578 +-TINYXML_LD = -L$(top_builddir)/src/tinyxml/$(SRCDIR)
1579 ++TINYXML_LD = -L$(abs_top_builddir)/src/tinyxml/$(SRCDIR)
1580 + TINYXML_LIB = -ltinyxml
1581 + @USE_XERCES_TRUE@XERCES_LD = -L@xerces_path@/lib/
1582 + @USE_XERCES_TRUE@XERCES_LIB = -lxerces-c
1583 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Parsers/mtkppParser.cpp amber11/AmberTools/src/mtkpp/src/Parsers/mtkppParser.cpp
1584 +--- amber11.orig/AmberTools/src/mtkpp/src/Parsers/mtkppParser.cpp 2011-04-14 15:30:18.000000000 +0300
1585 ++++ amber11/AmberTools/src/mtkpp/src/Parsers/mtkppParser.cpp 2012-03-03 20:03:01.409032568 +0200
1586 +@@ -1769,6 +1769,15 @@
1587 + atomElem->SetAttribute("type", int2String(pAtom->getType()));
1588 + atomElem->SetAttribute("formalCharge", int2String(pAtom->getFormalCharge()));
1589 +
1590 ++ // Coordinates
1591 ++ TiXmlElement* coordElem = new TiXmlElement("coord");
1592 ++ atomElem->LinkEndChild(coordElem);
1593 ++
1594 ++ coordElem->SetAttribute("x", double2String(pAtom->getX()));
1595 ++ coordElem->SetAttribute("y", double2String(pAtom->getY()));
1596 ++ coordElem->SetAttribute("z", double2String(pAtom->getZ()));
1597 ++
1598 ++ // Properties
1599 + std::map<std::string, double> atomDMap = pAtom->getPropertyMap();
1600 + std::map<std::string, int> atomIMap = pAtom->getIntPropertyMap();
1601 +
1602 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Parsers/paramParser.cpp amber11/AmberTools/src/mtkpp/src/Parsers/paramParser.cpp
1603 +--- amber11.orig/AmberTools/src/mtkpp/src/Parsers/paramParser.cpp 2011-04-14 15:30:18.000000000 +0300
1604 ++++ amber11/AmberTools/src/mtkpp/src/Parsers/paramParser.cpp 2012-03-03 20:03:01.410032567 +0200
1605 +@@ -144,6 +144,10 @@
1606 + pAtomType->evalue = string2Double(element->Attribute("potentialWellDepth"));
1607 + }
1608 +
1609 ++ if (element->Attribute("atomPolarizability")) {
1610 ++ pAtomType->atomPolarizability = string2Double(element->Attribute("atomPolarizability"));
1611 ++ }
1612 ++
1613 + if (element->Attribute("element")) {
1614 + pAtomType->element = element->Attribute("element");
1615 + }
1616 +@@ -1808,6 +1812,7 @@
1617 + entry->SetAttribute("mass" , double2String(pAtomType->mass).c_str());
1618 + entry->SetAttribute("vdwRadius" , double2String(pAtomType->rvalue).c_str());
1619 + entry->SetAttribute("potentialWellDepth" , double2String(pAtomType->evalue).c_str());
1620 ++ entry->SetAttribute("atomPolarizability" , double2String(pAtomType->atomPolarizability).c_str());
1621 + entry->SetAttribute("element" , pAtomType->element);
1622 + entry->SetAttribute("hybridization" , pAtomType->hybridization);
1623 + entry->SetAttribute("groupName" , pAtomType->groupName);
1624 +@@ -2035,6 +2040,7 @@
1625 + typeElem->setAttribute(X("mass"), X(double2String(pAtomType->mass).c_str()));
1626 + typeElem->setAttribute(X("vdwRadius"), X(double2String(pAtomType->rvalue).c_str()));
1627 + typeElem->setAttribute(X("potentialWellDepth"), X(double2String(pAtomType->evalue).c_str()));
1628 ++ typeElem->setAttribute(X("atomPolarizability"), X(double2String(pAtomType->atomPolarizability).c_str()));
1629 + typeElem->setAttribute(X("element"), X(pAtomType->element.c_str()));
1630 + typeElem->setAttribute(X("hybridization"), X(pAtomType->hybridization.c_str()));
1631 + typeElem->setAttribute(X("groupName"), X(pAtomType->groupName.c_str()));
1632 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Parsers/pdbParser.cpp amber11/AmberTools/src/mtkpp/src/Parsers/pdbParser.cpp
1633 +--- amber11.orig/AmberTools/src/mtkpp/src/Parsers/pdbParser.cpp 2011-04-14 15:30:18.000000000 +0300
1634 ++++ amber11/AmberTools/src/mtkpp/src/Parsers/pdbParser.cpp 2012-03-03 20:03:01.410032567 +0200
1635 +@@ -840,6 +840,7 @@
1636 + for (atomIterator a = atomList.begin(); a != atomList.end(); a++) {
1637 + pAtom = *a;
1638 + pSubMolecule = pAtom->getParent();
1639 ++ //std::cout << pSubMolecule->getColIndex() << std::endl;
1640 + char temp[100];
1641 +
1642 + char tmp_element[3];
1643 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Parsers/prepParser.cpp amber11/AmberTools/src/mtkpp/src/Parsers/prepParser.cpp
1644 +--- amber11.orig/AmberTools/src/mtkpp/src/Parsers/prepParser.cpp 2011-04-14 15:30:18.000000000 +0300
1645 ++++ amber11/AmberTools/src/mtkpp/src/Parsers/prepParser.cpp 2012-03-03 20:03:01.411032567 +0200
1646 +@@ -66,71 +66,106 @@
1647 + prepParser::~prepParser() {}
1648 +
1649 + // =========================================================
1650 +-// Function : Read
1651 +-// ---------------------------------------------------------
1652 +-// parsers a prep file
1653 +-// ---------------------------------------------------------
1654 +-// Format :
1655 +-// =========================================================
1656 +-void prepParser::Read(const std::string &prepfile, stdGroup* pStdGroup)
1657 +-{
1658 +- std::string errorMessage = " Reading " + prepfile + " " +
1659 +- pStdGroup->getName() + " ... implement ";
1660 +- errorLogger.throwError("prepParser", errorMessage, 1);
1661 +-}
1662 +-
1663 +-// =========================================================
1664 +-// Function : Read
1665 ++// Function : openFile
1666 + // ---------------------------------------------------------
1667 +-// parsers a prep file
1668 ++// open a prep file
1669 + // ---------------------------------------------------------
1670 + // Format :
1671 + // =========================================================
1672 +-void prepParser::Read(const std::string &prepfile, stdFrag* pStdFrag)
1673 ++int prepParser::openFile(const std::string &prepfile)
1674 + {
1675 +- errorLogger.throwError("prepParser", "Read", INFO);
1676 +-
1677 +- std::ifstream iprep;
1678 + iprep.open(prepfile.c_str());
1679 +
1680 ++ //std::cout << "\n\n prepParser::openFile " << prepfile << std::endl;
1681 + if (!iprep) {
1682 + setError(1);
1683 + std::string errorMessage = " Error, Can't Find " + prepfile;
1684 + setErrorMessage(errorMessage);
1685 + errorLogger.throwError("prepParser::Read", errorMessage, 1);
1686 +- return;
1687 ++ return 1;
1688 + }
1689 +
1690 + std::string fileline;
1691 +- std::string title;
1692 +- std::string atom;
1693 +- std::string buffer(80,'*');
1694 +
1695 + // SKIP FIRST TWO LINES
1696 + getline(iprep,fileline);
1697 + getline(iprep,fileline);
1698 ++
1699 ++ return 0;
1700 ++}
1701 ++
1702 ++// =========================================================
1703 ++// Function : read fragment header section
1704 ++// ---------------------------------------------------------
1705 ++//
1706 ++// ---------------------------------------------------------
1707 ++// Format :
1708 ++// =========================================================
1709 ++int prepParser::readHeader(std::string &name, std::string &symbol, double &charge)
1710 ++{
1711 ++ std::string fileline;
1712 ++
1713 + getline(iprep,fileline);
1714 +- //std::string name = stripString(fileline," ");
1715 +- //pStdFrag->setName(fileline);
1716 ++ if (stripString(fileline, " ") == "STOP") return 1;
1717 ++
1718 ++ name = stripString(fileline," ");
1719 ++
1720 ++ // blank line
1721 + getline(iprep,fileline);
1722 ++
1723 ++ // symbol
1724 + getline(iprep,fileline);
1725 + std::vector<std::string> splitLine;
1726 + splitString(fileline, " ", splitLine, 0);
1727 +- pStdFrag->setSymbol(splitLine[0]);
1728 ++ symbol = splitLine[0];
1729 ++
1730 ++ //
1731 + getline(iprep,fileline);
1732 ++
1733 ++ // charge
1734 + getline(iprep,fileline);
1735 +- //pStdFrag->setCharge(splitLine[0]);
1736 ++ charge = string2Double(stripString(fileline, " "));
1737 ++
1738 ++ return 0;
1739 ++}
1740 ++
1741 ++// =========================================================
1742 ++// Function : read fragment main section
1743 ++// ---------------------------------------------------------
1744 ++//
1745 ++// ---------------------------------------------------------
1746 ++// Format :
1747 ++// =========================================================
1748 ++void prepParser::readFragment(stdFrag* pStdFrag)
1749 ++{
1750 ++ std::string fileline;
1751 ++
1752 ++ std::vector<stdBond*> todos;
1753 +
1754 + while (iprep) {
1755 + getline(iprep,fileline);
1756 +- if (fileline == "") break;
1757 ++
1758 ++ std::string filelineTest = stripString(fileline, " ");
1759 ++ if (filelineTest == "") break;
1760 ++
1761 ++//std::cout << "|" << fileline << "|" << std::endl;
1762 +
1763 + std::vector<std::string> splitstring;
1764 + splitString(fileline, " ", splitstring, 0);
1765 + if (atoi(splitstring[0].c_str()) > 3) {
1766 + stdAtom* pStdAtom = pStdFrag->addStdAtom();
1767 + int atIndex = atoi(splitstring[0].c_str()) - 3;
1768 +- std::string atomName = fileline.substr(6,4);
1769 ++
1770 ++////////
1771 ++ //std::string atomName = fileline.substr(6,4);
1772 ++ std::string atomName = splitstring[1];
1773 ++ if (atomName.size() == 1) atomName = " " + atomName + " ";
1774 ++ else if (atomName.size() == 2) atomName = " " + atomName + " ";
1775 ++ else if (atomName.size() == 3) atomName = " " + atomName;
1776 ++
1777 ++//std::cout << "|" << atomName << "|" << std::endl;
1778 ++/////////
1779 ++
1780 + std::string atomType = splitstring[2];
1781 + std::string atomChain = splitstring[3];
1782 +
1783 +@@ -170,32 +205,54 @@
1784 + pStdBond->atom1 = pStdAtom->index;
1785 + pStdBond->atom2 = pStdAtom->bond12;
1786 + pStdBond->type = 1;
1787 ++
1788 + if (pStdAtom->atSymbol == "H") {
1789 + if (pStdAtom->bond12 > 0) {
1790 + stdAtom* pStdBondedAtom = pStdFrag->getStdAtom(pStdAtom->bond12);
1791 ++
1792 ++ if (pStdBondedAtom) {
1793 + std::string bondedAtomSymbol = pStdBondedAtom->atSymbol;
1794 + if (bondedAtomSymbol == "N" or bondedAtomSymbol == "O" or bondedAtomSymbol == "S") {
1795 + pStdBond->kind = 1;
1796 + }
1797 + }
1798 ++ else {
1799 ++ todos.push_back(pStdBond);
1800 ++ }
1801 ++ }
1802 + }
1803 + else {
1804 + pStdBond->kind = 0;
1805 + }
1806 ++
1807 + pStdBond->topology = 2;
1808 + pStdBond->stereo = 0;
1809 + pStdBond->length = pStdAtom->bondLength;
1810 + }
1811 + }
1812 +
1813 ++ for (unsigned int x = 0; x < todos.size(); x++) {
1814 ++ stdAtom* pStdBondedAtom1 = pStdFrag->getStdAtom(todos[x]->atom1);
1815 ++ stdAtom* pStdBondedAtom2 = pStdFrag->getStdAtom(todos[x]->atom2);
1816 ++ if (pStdBondedAtom1 and pStdBondedAtom2) {
1817 ++ std::string bondedAtomSymbol = pStdBondedAtom2->atSymbol;
1818 ++ if (bondedAtomSymbol == "N" or bondedAtomSymbol == "O" or bondedAtomSymbol == "S") {
1819 ++ todos[x]->kind = 1;
1820 ++ }
1821 ++ }
1822 ++ }
1823 ++
1824 + // Read charge, alias, loop, and improper data
1825 + while (iprep) {
1826 + getline(iprep,fileline);
1827 ++//std::cout << "!" << fileline << "!" << std::endl;
1828 + if (fileline != "") {
1829 + if (fileline.substr(0,6) == "CHARGE") {
1830 + while (iprep) {
1831 + getline(iprep,fileline);
1832 +- if (fileline == "") break;
1833 ++
1834 ++ std::string filelineTest = stripString(fileline, " ");
1835 ++ if (filelineTest == "") break;
1836 + }
1837 + }
1838 + else if (fileline.substr(0,5) == "ALIAS") {
1839 +@@ -252,7 +309,7 @@
1840 + else {
1841 + std::string errorMessage = " ALIAS Tag Error ... exiting ";
1842 + errorLogger.throwError("prepParser::Read", errorMessage, 1);
1843 +- //exit(0);
1844 ++
1845 + std::stringstream ss;
1846 + ss << "prepParser::Read"<< errorMessage;
1847 + throw MTKException(ss.str());
1848 +@@ -263,11 +320,20 @@
1849 + else if (fileline.substr(0,4) == "LOOP") {
1850 + while (iprep) {
1851 + getline(iprep,fileline);
1852 +- if (fileline == "") break;
1853 ++
1854 ++ std::string filelineTest = stripString(fileline, " ");
1855 ++ if (filelineTest == "") break;
1856 ++
1857 ++ //if (fileline == "") break;
1858 +
1859 + std::vector<std::string> atomNames;
1860 + splitString(fileline, " ", atomNames, 0);
1861 +-
1862 ++/*
1863 ++for (unsigned int x = 0; x <atomNames.size();x++){
1864 ++ std::cout << atomNames[x] <<std::endl;
1865 ++}
1866 ++pStdFrag->print();
1867 ++*/
1868 + std::vector< std::vector<std::string> > possibleNames;
1869 + for (int d = 0; d < 2; d++) {
1870 + int atNameSize = atomNames[d].size();
1871 +@@ -315,17 +381,22 @@
1872 + else {
1873 + std::string errorMessage = " LOOP Tag Error ... exiting ";
1874 + errorLogger.throwError("prepParser::Read", errorMessage, 1);
1875 +- //exit(0);
1876 +-
1877 + std::stringstream ss;
1878 + ss << "prepParser::Read"<< errorMessage;
1879 + throw MTKException(ss.str());
1880 + }
1881 + }
1882 + }
1883 ++ else if (fileline.substr(0,4) == "DONE") {
1884 ++ break;
1885 ++ }
1886 + else if (fileline.substr(0,8) == "IMPROPER") {
1887 + while (iprep) {
1888 + getline(iprep,fileline);
1889 ++
1890 ++ std::string filelineTest = stripString(fileline, " ");
1891 ++ if (filelineTest == "") break;
1892 ++
1893 + if (fileline == "") break;
1894 +
1895 + std::vector<std::string> atomNames;
1896 +@@ -424,7 +495,6 @@
1897 + else {
1898 + std::string errorMessage = " IMPROPER Tag Error ... exiting ";
1899 + errorLogger.throwError("prepParser::Read", errorMessage, 1);
1900 +- //exit(0);
1901 +
1902 + std::stringstream ss;
1903 + ss << "prepParser::Read" << errorMessage;
1904 +@@ -642,8 +712,112 @@
1905 + }
1906 + // QBio end
1907 + }
1908 +-
1909 + errorLogger.throwError("prepParser::Read", eMessage, INFO);
1910 ++}
1911 ++
1912 ++// =========================================================
1913 ++// Function : Read
1914 ++// ---------------------------------------------------------
1915 ++// parsers a prep file
1916 ++// ---------------------------------------------------------
1917 ++// Format :
1918 ++// =========================================================
1919 ++void prepParser::Read(const std::string &prepfile, stdGroup* pStdGroup)
1920 ++{
1921 ++ int r = openFile(prepfile);
1922 ++ if (r == 1) return;
1923 ++
1924 ++ while(iprep) {
1925 ++ std::string name = "";
1926 ++ std::string symbol = "";
1927 ++ double charge = 0.0;
1928 ++ int h = readHeader(name, symbol, charge);
1929 ++ if (h == 1) break;
1930 ++
1931 ++ stdFrag* pStdFrag = pStdGroup->addStdFrag();
1932 ++ if (!pStdFrag) {
1933 ++ setError(1);
1934 ++ std::string errorMessage = " Error creating fragment ";
1935 ++ setErrorMessage(errorMessage);
1936 ++ errorLogger.throwError("prepParser::Read", errorMessage, 1);
1937 ++ return;
1938 ++ }
1939 ++
1940 ++ if (symbol.size() == 1) symbol = symbol + " ";
1941 ++ if (symbol.size() == 2) symbol = symbol + " ";
1942 ++ if (symbol.size() > 3) symbol = symbol.substr(1,3);
1943 ++
1944 ++ pStdFrag->setSymbol(symbol); // 3L code
1945 ++ //pStdFrag->setCode("P2XML"+name); // 8L code
1946 ++ pStdFrag->setName(name); // long name
1947 ++ pStdFrag->setType("m"); // fragment type
1948 ++
1949 ++ //std::cout << " prepParser::Read " << name << " charge " << charge << " symbol " << symbol << std::endl;
1950 ++ readFragment(pStdFrag);
1951 ++ }
1952 ++
1953 ++ iprep.close();
1954 ++
1955 ++ return;
1956 ++}
1957 ++
1958 ++// =========================================================
1959 ++// Function : Read
1960 ++// ---------------------------------------------------------
1961 ++// parsers a prep file
1962 ++// ---------------------------------------------------------
1963 ++// Format :
1964 ++// =========================================================
1965 ++void prepParser::Read(const std::string &prepfile, stdFrag* pStdFrag)
1966 ++{
1967 ++ errorLogger.throwError("prepParser", "Read", INFO);
1968 ++/*
1969 ++ std::ifstream iprep;
1970 ++ iprep.open(prepfile.c_str());
1971 ++
1972 ++ if (!iprep) {
1973 ++ setError(1);
1974 ++ std::string errorMessage = " Error, Can't Find " + prepfile;
1975 ++ setErrorMessage(errorMessage);
1976 ++ errorLogger.throwError("prepParser::Read", errorMessage, 1);
1977 ++ return;
1978 ++ }
1979 ++*/
1980 ++
1981 ++ int r = openFile(prepfile);
1982 ++ if (r == 1) return;
1983 ++
1984 ++ std::string fileline;
1985 ++ std::string title;
1986 ++ std::string atom;
1987 ++ //std::string buffer(80,'*');
1988 ++
1989 ++ // SKIP FIRST TWO LINES
1990 ++ //getline(iprep,fileline);
1991 ++ //getline(iprep,fileline);
1992 ++
1993 ++/*
1994 ++ getline(iprep,fileline);
1995 ++ //std::string name = stripString(fileline," ");
1996 ++ //pStdFrag->setName(fileline);
1997 ++ getline(iprep,fileline);
1998 ++ getline(iprep,fileline);
1999 ++ std::vector<std::string> splitLine;
2000 ++ splitString(fileline, " ", splitLine, 0);
2001 ++ pStdFrag->setSymbol(splitLine[0]);
2002 ++ getline(iprep,fileline);
2003 ++ getline(iprep,fileline);
2004 ++ //pStdFrag->setCharge(splitLine[0]);
2005 ++*/
2006 ++
2007 ++ std::string name = "";
2008 ++ std::string symbol = "";
2009 ++ double charge = 0.0;
2010 ++ readHeader(name, symbol, charge);
2011 ++
2012 ++ pStdFrag->setSymbol(symbol);
2013 ++
2014 ++ readFragment(pStdFrag);
2015 +
2016 + iprep.close();
2017 + }
2018 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Parsers/prepParser.h amber11/AmberTools/src/mtkpp/src/Parsers/prepParser.h
2019 +--- amber11.orig/AmberTools/src/mtkpp/src/Parsers/prepParser.h 2011-04-14 15:30:18.000000000 +0300
2020 ++++ amber11/AmberTools/src/mtkpp/src/Parsers/prepParser.h 2012-03-03 20:03:01.411032567 +0200
2021 +@@ -89,6 +89,25 @@
2022 + ~prepParser();
2023 +
2024 + /*!
2025 ++ \brief open prep file
2026 ++ \param i input file
2027 ++ */
2028 ++ int openFile(const std::string &i);
2029 ++
2030 ++ /*!
2031 ++ \brief read fragment header section
2032 ++ \param name fragment name
2033 ++ \param symbol fragment symbol
2034 ++ \param charge fragment charge
2035 ++ */
2036 ++ int readHeader(std::string &name, std::string &symbol, double &charge);
2037 ++
2038 ++ /*!
2039 ++ \brief read fragment main section
2040 ++ */
2041 ++ void readFragment(stdFrag* pStdFrag);
2042 ++
2043 ++ /*!
2044 + \brief Read prep file
2045 + \param i input file
2046 + \param g stdGroup pointer
2047 +@@ -127,6 +146,9 @@
2048 +
2049 + //! atom pointer
2050 + atom* pAtom;
2051 ++
2052 ++ //! file handler
2053 ++ std::ifstream iprep;
2054 + };
2055 +
2056 + } // MTKpp namespace
2057 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Parsers/stdLibParser.cpp amber11/AmberTools/src/mtkpp/src/Parsers/stdLibParser.cpp
2058 +--- amber11.orig/AmberTools/src/mtkpp/src/Parsers/stdLibParser.cpp 2011-04-14 15:30:18.000000000 +0300
2059 ++++ amber11/AmberTools/src/mtkpp/src/Parsers/stdLibParser.cpp 2012-03-03 20:03:01.412032567 +0200
2060 +@@ -3280,7 +3280,7 @@
2061 + // ------------------------------------------------------------
2062 + // Write xml files using tinyxml
2063 + // ------------------------------------------------------------
2064 +-void stdLibParser::Write(std::string fileName)
2065 ++void stdLibParser::Write(std::string fileName) // TinyXML
2066 + {
2067 + std::string errMessage = " Writing " + fileName;
2068 + errorLogger.throwError("stdLibParser", errMessage, INFO);
2069 +@@ -3512,6 +3512,7 @@
2070 + TiXmlElement* impElem = new TiXmlElement("improper");
2071 + frag->LinkEndChild(impElem);
2072 +
2073 ++ /*
2074 + if (improperList[k]->atom1 == -1) {
2075 + impElem->SetAttribute("Atom1", "p1");
2076 + }
2077 +@@ -3520,7 +3521,8 @@
2078 + }
2079 + else {
2080 + impElem->SetAttribute("Atom1", int2String(improperList[k]->atom1));
2081 +- }
2082 ++ }*/
2083 ++ impElem->SetAttribute("Atom1", int2String(improperList[k]->atom1));
2084 + impElem->SetAttribute("Atom2", int2String(improperList[k]->atom2));
2085 + impElem->SetAttribute("Atom3", int2String(improperList[k]->atom3));
2086 + impElem->SetAttribute("Atom4", int2String(improperList[k]->atom4));
2087 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Statistics/Makefile.am amber11/AmberTools/src/mtkpp/src/Statistics/Makefile.am
2088 +--- amber11.orig/AmberTools/src/mtkpp/src/Statistics/Makefile.am 2011-04-14 15:30:18.000000000 +0300
2089 ++++ amber11/AmberTools/src/mtkpp/src/Statistics/Makefile.am 2012-03-03 20:03:01.413032567 +0200
2090 +@@ -1,4 +1,4 @@
2091 +-DIAGNOSTICS_LD=-L$(top_builddir)/src/Diagnostics/$(SRCDIR)
2092 ++DIAGNOSTICS_LD=-L$(abs_top_builddir)/src/Diagnostics/$(SRCDIR)
2093 + DIAGNOSTICS_LIB=-lDiagnostics
2094 +
2095 + INCLUDES = -I@boost_inc@ -I$(srcdir)/.. -I$(top_srcdir)/src/eigen3b2
2096 +diff -urN amber11.orig/AmberTools/src/mtkpp/src/Statistics/Makefile.in amber11/AmberTools/src/mtkpp/src/Statistics/Makefile.in
2097 +--- amber11.orig/AmberTools/src/mtkpp/src/Statistics/Makefile.in 2011-04-14 15:30:18.000000000 +0300
2098 ++++ amber11/AmberTools/src/mtkpp/src/Statistics/Makefile.in 2012-03-03 20:03:01.413032567 +0200
2099 +@@ -241,7 +241,7 @@
2100 + top_builddir = @top_builddir@
2101 + top_srcdir = @top_srcdir@
2102 + xerces_path = @xerces_path@
2103 +-DIAGNOSTICS_LD = -L$(top_builddir)/src/Diagnostics/$(SRCDIR)
2104 ++DIAGNOSTICS_LD = -L$(abs_top_builddir)/src/Diagnostics/$(SRCDIR)
2105 + DIAGNOSTICS_LIB = -lDiagnostics
2106 + INCLUDES = -I@boost_inc@ -I$(srcdir)/.. -I$(top_srcdir)/src/eigen3b2
2107 + lib_LTLIBRARIES = libStatistics.la
2108 +diff -urN amber11.orig/AmberTools/src/mtkpp/tests/Makefile.am amber11/AmberTools/src/mtkpp/tests/Makefile.am
2109 +--- amber11.orig/AmberTools/src/mtkpp/tests/Makefile.am 2011-04-14 15:30:19.000000000 +0300
2110 ++++ amber11/AmberTools/src/mtkpp/tests/Makefile.am 2012-03-03 20:03:01.414032567 +0200
2111 +@@ -42,25 +42,25 @@
2112 + LAPACK_LIB=-llapack -lblas -lg2c
2113 + endif
2114 +
2115 +-MOLECULE_LD=-L$(top_builddir)/src/Molecule
2116 ++MOLECULE_LD=-L$(abs_top_builddir)/src/Molecule
2117 + MOLECULE_LIB=-lMolecule
2118 +-DIAGNOSTICS_LD=-L$(top_builddir)/src/Diagnostics
2119 ++DIAGNOSTICS_LD=-L$(abs_top_builddir)/src/Diagnostics
2120 + DIAGNOSTICS_LIB=-lDiagnostics
2121 +-LOG_LD=-L$(top_builddir)/src/Log
2122 ++LOG_LD=-L$(abs_top_builddir)/src/Log
2123 + LOG_LIB=-lLog
2124 +-GRAPH_LD=-L$(top_builddir)/src/Graph
2125 ++GRAPH_LD=-L$(abs_top_builddir)/src/Graph
2126 + GRAPH_LIB=-lGraph
2127 +-GA_LD=-L$(top_builddir)/src/GA
2128 ++GA_LD=-L$(abs_top_builddir)/src/GA
2129 + GA_LIB=-lGA
2130 +-MM_LD=-L$(top_builddir)/src/MM
2131 ++MM_LD=-L$(abs_top_builddir)/src/MM
2132 + MM_LIB=-lMM
2133 +-MINIMIZERS_LD=-L$(top_builddir)/src/Minimizers
2134 ++MINIMIZERS_LD=-L$(abs_top_builddir)/src/Minimizers
2135 + MINIMIZERS_LIB=-lMinimizers
2136 +-PARSERS_LD=-L$(top_builddir)/src/Parsers
2137 ++PARSERS_LD=-L$(abs_top_builddir)/src/Parsers
2138 + PARSERS_LIB=-lParsers
2139 +-STATS_LD=-L$(top_builddir)/src/Statistics
2140 ++STATS_LD=-L$(abs_top_builddir)/src/Statistics
2141 + STATS_LIB=-lStatistics
2142 +-TINYXML_LD=-L$(top_builddir)/src/tinyxml
2143 ++TINYXML_LD=-L$(abs_top_builddir)/src/tinyxml
2144 + TINYXML_LIB=-ltinyxml
2145 +
2146 + # INCLUDES = -I@boost_inc@ -I@xerces_path@/include -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_srcdir)/src/tinyxml -I$(top_srcdir)/src/Parsers -I$(top_srcdir)/src/Molecule -I$(top_srcdir)/src/Statistics -I$(top_srcdir)/src/Utils $(tmpQT_INCPATH)
2147 +diff -urN amber11.orig/AmberTools/src/mtkpp/tests/Makefile.in amber11/AmberTools/src/mtkpp/tests/Makefile.in
2148 +--- amber11.orig/AmberTools/src/mtkpp/tests/Makefile.in 2011-04-14 15:30:19.000000000 +0300
2149 ++++ amber11/AmberTools/src/mtkpp/tests/Makefile.in 2012-03-03 20:03:01.414032567 +0200
2150 +@@ -303,25 +303,25 @@
2151 + @USE_QT_TRUE@tmpQT_LIBS = $(QT_LIBS)
2152 + @IS_LINUX_TRUE@LAPACK_LD = -L/usr/lib64
2153 + @IS_LINUX_TRUE@LAPACK_LIB = -llapack -lblas -lg2c
2154 +-MOLECULE_LD = -L$(top_builddir)/src/Molecule
2155 ++MOLECULE_LD = -L$(abs_top_builddir)/src/Molecule
2156 + MOLECULE_LIB = -lMolecule
2157 +-DIAGNOSTICS_LD = -L$(top_builddir)/src/Diagnostics
2158 ++DIAGNOSTICS_LD = -L$(abs_top_builddir)/src/Diagnostics
2159 + DIAGNOSTICS_LIB = -lDiagnostics
2160 +-LOG_LD = -L$(top_builddir)/src/Log
2161 ++LOG_LD = -L$(abs_top_builddir)/src/Log
2162 + LOG_LIB = -lLog
2163 +-GRAPH_LD = -L$(top_builddir)/src/Graph
2164 ++GRAPH_LD = -L$(abs_top_builddir)/src/Graph
2165 + GRAPH_LIB = -lGraph
2166 +-GA_LD = -L$(top_builddir)/src/GA
2167 ++GA_LD = -L$(abs_top_builddir)/src/GA
2168 + GA_LIB = -lGA
2169 +-MM_LD = -L$(top_builddir)/src/MM
2170 ++MM_LD = -L$(abs_top_builddir)/src/MM
2171 + MM_LIB = -lMM
2172 +-MINIMIZERS_LD = -L$(top_builddir)/src/Minimizers
2173 ++MINIMIZERS_LD = -L$(abs_top_builddir)/src/Minimizers
2174 + MINIMIZERS_LIB = -lMinimizers
2175 +-PARSERS_LD = -L$(top_builddir)/src/Parsers
2176 ++PARSERS_LD = -L$(abs_top_builddir)/src/Parsers
2177 + PARSERS_LIB = -lParsers
2178 +-STATS_LD = -L$(top_builddir)/src/Statistics
2179 ++STATS_LD = -L$(abs_top_builddir)/src/Statistics
2180 + STATS_LIB = -lStatistics
2181 +-TINYXML_LD = -L$(top_builddir)/src/tinyxml
2182 ++TINYXML_LD = -L$(abs_top_builddir)/src/tinyxml
2183 + TINYXML_LIB = -ltinyxml
2184 +
2185 + # INCLUDES = -I@boost_inc@ -I@xerces_path@/include -I$(top_srcdir)/src -I$(top_srcdir)/include -I$(top_srcdir)/src/tinyxml -I$(top_srcdir)/src/Parsers -I$(top_srcdir)/src/Molecule -I$(top_srcdir)/src/Statistics -I$(top_srcdir)/src/Utils $(tmpQT_INCPATH)
2186 +diff -urN amber11.orig/AmberTools/src/mtkpp/tools/Makefile.am amber11/AmberTools/src/mtkpp/tools/Makefile.am
2187 +--- amber11.orig/AmberTools/src/mtkpp/tools/Makefile.am 2011-04-14 15:30:19.000000000 +0300
2188 ++++ amber11/AmberTools/src/mtkpp/tools/Makefile.am 2012-03-03 20:03:01.417032565 +0200
2189 +@@ -25,7 +25,7 @@
2190 + tmpQT_LIBS = $(QT_LIBS)
2191 + endif
2192 +
2193 +-DIAGNOSTICS_LD = -L$(top_builddir)/src/Diagnostics
2194 ++DIAGNOSTICS_LD = -L$(abs_top_builddir)/src/Diagnostics
2195 + DIAGNOSTICS_LIB = -lDiagnostics
2196 + MOLECULE_LD = -L$(top_builddir)/src/Molecule
2197 + MOLECULE_LIB = -lMolecule
2198 +diff -urN amber11.orig/AmberTools/src/mtkpp/tools/Makefile.in amber11/AmberTools/src/mtkpp/tools/Makefile.in
2199 +--- amber11.orig/AmberTools/src/mtkpp/tools/Makefile.in 2011-04-14 15:30:19.000000000 +0300
2200 ++++ amber11/AmberTools/src/mtkpp/tools/Makefile.in 2012-03-03 20:03:01.417032565 +0200
2201 +@@ -392,7 +392,7 @@
2202 + @USE_XERCES_TRUE@XERCES_LIB = -lxerces-c
2203 + @USE_QT_TRUE@tmpQT_INCPATH = $(QT_INCPATH)
2204 + @USE_QT_TRUE@tmpQT_LIBS = $(QT_LIBS)
2205 +-DIAGNOSTICS_LD = -L$(top_builddir)/src/Diagnostics
2206 ++DIAGNOSTICS_LD = -L$(abs_top_builddir)/src/Diagnostics
2207 + DIAGNOSTICS_LIB = -lDiagnostics
2208 + MOLECULE_LD = -L$(top_builddir)/src/Molecule
2209 + MOLECULE_LIB = -lMolecule
2210 +diff -urN amber11.orig/AmberTools/src/mtkpp/tools/MCPB.cpp amber11/AmberTools/src/mtkpp/tools/MCPB.cpp
2211 +--- amber11.orig/AmberTools/src/mtkpp/tools/MCPB.cpp 2011-04-14 15:30:19.000000000 +0300
2212 ++++ amber11/AmberTools/src/mtkpp/tools/MCPB.cpp 2012-03-03 20:03:01.416032566 +0200
2213 +@@ -67,6 +67,7 @@
2214 + #include "Parsers/mtkppParser.h"
2215 + #include "Parsers/dMParser.h"
2216 + #include "Parsers/commLineOptions.h"
2217 ++#include "Parsers/StringManip.h"
2218 +
2219 + // - Log
2220 + #include "Log/errorHandler.h"
2221 +@@ -84,6 +85,12 @@
2222 +
2223 + using namespace MTKpp;
2224 +
2225 ++std::string getEnvVar(std::string const& key)
2226 ++{
2227 ++ char const* val = getenv(key.c_str());
2228 ++ return val == NULL ? std::string() : std::string(val);
2229 ++}
2230 ++
2231 + void printFunctionList()
2232 + {
2233 + std::string functionList = "\n MCPB Functions:\n";
2234 +@@ -181,32 +188,32 @@
2235 + functionList += " Find all metal centers in the collection\n";
2236 + functionList += " syntax: findMetalCenters\n";
2237 + functionList += "\n";
2238 +- functionList += " g03Charges\n";
2239 ++ functionList += " gaussianCharges\n";
2240 + functionList += " Generate a Gaussian input file for partial-charge computation\n";
2241 + functionList += " Optional: set the Gaussian job file name\n";
2242 +- functionList += " syntax: g03Charges //cuCYM4 cuCYM4.com\n";
2243 ++ functionList += " syntax: gaussianCharges //cuCYM4 cuCYM4.com\n";
2244 + functionList += "\n";
2245 +- functionList += " g03Mem\n";
2246 +- functionList += " Set amount of memory requested for g03\n";
2247 +- functionList += " syntax: g03Mem 3600MB\n";
2248 ++ functionList += " gaussianMem\n";
2249 ++ functionList += " Set amount of memory requested for Gaussian\n";
2250 ++ functionList += " syntax: gaussianMem 3600MB\n";
2251 + functionList += "\n";
2252 +- functionList += " g03MoldenFormat\n";
2253 ++ functionList += " gaussianMoldenFormat\n";
2254 + functionList += " Request Gaussian log files formatted for viewing in Molden\n";
2255 +- functionList += " (adds the GFINPUT and IOP(6/7=3) keywords)\n";
2256 +- functionList += " syntax: g03MoldenFormat\n";
2257 ++ functionList += " (adds the GFInput and IOp(6/7=3) keywords)\n";
2258 ++ functionList += " syntax: gaussianMoldenFormat\n";
2259 + functionList += "\n";
2260 +- functionList += " g03nProc\n";
2261 +- functionList += " Set number of processors requested for g03\n";
2262 +- functionList += " syntax: g03nProc 2\n";
2263 ++ functionList += " gaussianNProc\n";
2264 ++ functionList += " Set number of processors requested for Gaussian\n";
2265 ++ functionList += " syntax: gaussianNProc 2\n";
2266 + functionList += "\n";
2267 +- functionList += " g03OptAndFC\n";
2268 ++ functionList += " gaussianOptAndFC\n";
2269 + functionList += " Generate Gaussian input files for optimisation and force constants\n";
2270 + functionList += " Optional: set the Gaussian job file name\n";
2271 +- functionList += " syntax: g03OptAndFC //cuCYM4 cuCYM4.com\n";
2272 ++ functionList += " syntax: gaussianOptAndFC //cuCYM4 cuCYM4.com\n";
2273 + functionList += "\n";
2274 +- functionList += " g03Verbosity\n";
2275 ++ functionList += " gaussianVerbosity\n";
2276 + functionList += " Set the verbosity of Gaussian output ([T]erse, [N]ormal, [P]rolix)\n";
2277 +- functionList += " syntax: g03Verbosity [T|N|P]\n";
2278 ++ functionList += " syntax: gaussianVerbosity [T|N|P]\n";
2279 + functionList += "\n";
2280 + functionList += " levelOfTheory\n";
2281 + functionList += " Set Gaussian Theory Level\n";
2282 +@@ -256,9 +263,9 @@
2283 + functionList += " Read Formatted Checkpoint file\n";
2284 + functionList += " syntax: readFormattedChkPtFile file.fchk\n";
2285 + functionList += "\n";
2286 +- functionList += " readG03Output\n";
2287 +- functionList += " Read G03 Output\n";
2288 +- functionList += " syntax: readG03Output cuCYM4.log\n";
2289 ++ functionList += " readGaussianOutput\n";
2290 ++ functionList += " Read Gaussian Output\n";
2291 ++ functionList += " syntax: readGaussianOutput cuCYM4.log\n";
2292 + functionList += "\n";
2293 + functionList += " readMolZmatMapping\n";
2294 + functionList += " Read Molecule <--> Z-Matrix mapping file\n";
2295 +@@ -470,7 +477,7 @@
2296 + else {
2297 + printHeader(std::cout, prog_name, authors);
2298 + clo->printUsage();
2299 +- std::cout << " Please provide a MCPB file " << std::endl;
2300 ++ std::cout << " Please provide an MCPB file " << std::endl;
2301 + return 0;
2302 + }
2303 +
2304 +@@ -515,7 +522,9 @@
2305 + std::string errorMessage = "";
2306 +
2307 + std::vector<std::vector<std::string> > inputFileContents;
2308 ++
2309 + int failure = readInputFile(inputFile, inputFileContents);
2310 ++
2311 + if (failure) {
2312 + printHeader(std::cout, prog_name, authors);
2313 + clo->printUsage();
2314 +@@ -660,7 +669,7 @@
2315 + std::vector<std::vector<std::string> > sourceInputFileContents;
2316 + failure = readInputFile(cur[1], sourceInputFileContents);
2317 + if (failure) {
2318 +- errorMessage = " Error Reading File " + cur[1];
2319 ++ errorMessage = " Error reading file " + cur[1];
2320 + MTKpp::errorLogger.throwError("MCPB::source", errorMessage, 1);
2321 + exit(1);
2322 + }
2323 +@@ -668,7 +677,7 @@
2324 + sourceInputFileContents.end());
2325 + }
2326 + else {
2327 +- errorMessage = " Error Reading File " + cur[1];
2328 ++ errorMessage = " Error reading file " + cur[1];
2329 + MTKpp::errorLogger.throwError("MCPB::source", errorMessage, 1);
2330 + exit(1);
2331 + }
2332 +@@ -742,6 +751,20 @@
2333 + \endcode
2334 + */
2335 + if ((inputFileContents[i].size() == 3)) {
2336 ++ //std::cout << "SET COMMAND " << inputFileContents[i][2] << std::endl;
2337 ++ if (inputFileContents[i][2].compare(0,1,"$") == 0) {
2338 ++ std::string envVariable = "";
2339 ++ std::string tVar = inputFileContents[i][2];
2340 ++ envVariable = getEnvVar(tVar.substr(1,tVar.size()-1));
2341 ++ if (envVariable == "") {
2342 ++ std::cout << " Environment variable " << tVar.substr(1,tVar.size()-1)
2343 ++ << " is unset " << std::endl;
2344 ++ exit(1);
2345 ++ }
2346 ++ //std::cout << "Environment variable = " << envVariable << std::endl;
2347 ++ inputFileContents[i][2] = envVariable;
2348 ++ }
2349 ++
2350 + variableMap[inputFileContents[i][1]] = inputFileContents[i][2];
2351 + for (unsigned int j = i+1; j < inputFileContents.size(); j++) {
2352 + bool bReplaced = false;
2353 +@@ -813,6 +836,115 @@
2354 + }
2355 + }
2356 +
2357 ++ else if (inputFileContents[i][0] == "printGroupCharge") {
2358 ++ /*!
2359 ++ @ingroup MCPB_commands
2360 ++ \code
2361 ++ Function: printFrag
2362 ++
2363 ++ Description: Print fragment details
2364 ++
2365 ++ syntax: printGroupCharge Zn-CCCC
2366 ++
2367 ++ \endcode
2368 ++ */
2369 ++ if ((inputFileContents[i].size() != 2) or (!pCollection)) {
2370 ++ MTKpp::errorLogger.throwError("MCPB::printGroupCharge", " Incorrect use of printGroupCharge ... exiting", MTK_ERROR);
2371 ++ exit(1);
2372 ++ }
2373 ++ else {
2374 ++ stdLibrary* pStdLibrary = pCollection->getStdLibrary();
2375 ++ if (pStdLibrary) {
2376 ++ stdGroup* pStdGroup = pStdLibrary->getStdGroup(inputFileContents[i][1]);
2377 ++ std::cout << " Group " << pStdGroup->getName() << "\n";
2378 ++ if (pStdGroup) {
2379 ++ molecule* pM = pStdGroup->getStdMolecule();
2380 ++ if (pM) {
2381 ++ double groupCharge = 0.0;
2382 ++ std::vector<submolecule*> pSM = pM->getSubMoleculeList();
2383 ++ //std::cout << " Number of submolecules = " << pSM.size() << "\n";
2384 ++ for (unsigned int x = 0; x < pSM.size(); x++) {
2385 ++ stdFrag* pSF = pStdGroup->getStdFrag(pSM[x]->getName());
2386 ++ if (pSF) {
2387 ++ std::cout << " " << pSF->getSymbol() << "\n";
2388 ++ double fCharge = 0.0;
2389 ++ std::vector<atom*> pA = pSM[x]->getAtomList();
2390 ++ for (unsigned int y = 0; y < pA.size(); y++) {
2391 ++ stdAtom* pSA = pA[y]->getStdAtom();
2392 ++ if (pSA) {
2393 ++ fCharge += pSA->atmCharge;
2394 ++ std::cout << " |" << pSA->identity << "| " << pSA->atmCharge << "\n";
2395 ++ }
2396 ++ else {
2397 ++ std::cout << " Error find std atom " << std::endl;
2398 ++ exit(1);
2399 ++ }
2400 ++ }
2401 ++ groupCharge += fCharge;
2402 ++ std::cout << " Total Fragment Charge " << pSF->getCharge() << "\n";
2403 ++ }
2404 ++ }
2405 ++ /*std::vector<stdFrag*> pL = pStdGroup->getStdFragList();
2406 ++ for (unsigned int x = 0; x < pL.size(); x++) {
2407 ++ std::cout << " Fragment " << pL[x]->getSymbol() << "\n";
2408 ++ std::vector<stdAtom*> pL2 = pL[x]->getStdAtomList();
2409 ++ double fCharge = 0.0;
2410 ++ for (unsigned int y = 0; y < pL2.size(); y++) {
2411 ++ fCharge += pL2[y]->atmCharge;
2412 ++ std::cout << " Atom " << pL2[y]->identity << " " << pL2[y]->atmCharge << "\n";
2413 ++ }
2414 ++ groupCharge += fCharge;
2415 ++ //groupCharge += pL[x]->getCharge();
2416 ++ std::cout << " Fragment Charge " << pL[x]->getCharge() << "\n";
2417 ++ }
2418 ++ */
2419 ++
2420 ++ std::cout << " Total Charge = " << groupCharge << "\n" << std::endl;
2421 ++ }
2422 ++ }
2423 ++ }
2424 ++ }
2425 ++ }
2426 ++
2427 ++ else if (inputFileContents[i][0] == "printFrag") {
2428 ++ /*!
2429 ++ @ingroup MCPB_commands
2430 ++ \code
2431 ++ Function: printFrag
2432 ++
2433 ++ Description: Print fragment details
2434 ++
2435 ++ syntax: printFrag Zn-CCCC CY1
2436 ++
2437 ++ \endcode
2438 ++ */
2439 ++ if ((inputFileContents[i].size() != 3) or (!pCollection)) {
2440 ++ MTKpp::errorLogger.throwError("MCPB::printFrag", " Incorrect use of printFrag ... exiting", MTK_ERROR);
2441 ++ exit(1);
2442 ++ }
2443 ++ else {
2444 ++ stdLibrary* pStdLibrary = pCollection->getStdLibrary();
2445 ++ if (pStdLibrary) {
2446 ++ stdGroup* pStdGroup = pStdLibrary->getStdGroup(inputFileContents[i][1]);
2447 ++
2448 ++ double groupCharge = 0.0;
2449 ++ std::vector<stdFrag*> pL = pStdGroup->getStdFragList();
2450 ++ for (unsigned int x = 0; x < pL.size(); x++) {
2451 ++ groupCharge += pL[x]->getCharge();
2452 ++
2453 ++ }
2454 ++ std::cout << " Group " << inputFileContents[i][1] << " charge = "
2455 ++ << groupCharge << std::endl;
2456 ++
2457 ++ stdFrag* pStdFrag = pStdGroup->getStdFrag(inputFileContents[i][2]);
2458 ++ if (pStdFrag) {
2459 ++ std::cout << " Fragment " << inputFileContents[i][2] << " charge = "
2460 ++ << pStdFrag->getCharge() << std::endl;
2461 ++ }
2462 ++ }
2463 ++ }
2464 ++ }
2465 ++
2466 + else if (inputFileContents[i][0] == "readPdb") {
2467 + /*!
2468 + @ingroup MCPB_commands
2469 +@@ -2227,7 +2359,8 @@
2470 + double resCharge = 0.0;
2471 + for (unsigned int y = 0; y < residueAtoms.size(); y++) {
2472 + stdAtom* pLStdAtom = residueAtoms[y]->getStdAtom();
2473 +- std::cout << " " << residueAtoms[y]->getName() << " " << residueAtoms[y]->getFileID()
2474 ++ std::cout << " "
2475 ++ << residueAtoms[y]->getName() << " " << residueAtoms[y]->getFileID()
2476 + << " " << residueAtoms[y]->getType() << " " << residueAtoms[y]->getValence()
2477 + << " " << residueAtoms[y]->getHybridization() << " ";
2478 + if (pLStdAtom) {
2479 +@@ -2437,6 +2570,11 @@
2480 + molecule* selMol = pSel->getMol();
2481 + pPdbParser->Write(inputFileContents[i][2], selMol);
2482 + }
2483 ++ else {
2484 ++ MTKpp::errorLogger.throwError("MCPB::writePdb",
2485 ++ " Error molecule was not selected ... exiting ", MTK_ERROR);
2486 ++ exit(1);
2487 ++ }
2488 + }
2489 + }
2490 +
2491 +@@ -2674,7 +2812,6 @@
2492 +
2493 + syntax: basisSet GEN bs.txt
2494 + syntax: basisSet GEN.6D.7F bs.txt
2495 +- syntax: basisSet GENECP bs.txt pseudo.txt
2496 + \endcode
2497 + */
2498 + if (inputFileContents[i].size() == 2) {
2499 +@@ -2685,6 +2822,11 @@
2500 + pGParser->setBasisSet(inputFileContents[i][1]);
2501 + pGParser->setBasisSetFile(inputFileContents[i][2]);
2502 + }
2503 ++ else {
2504 ++ MTKpp::errorLogger.throwError("MCPB::basisSet",
2505 ++ " Incorrect use ... exiting ", MTK_ERROR);
2506 ++ exit(1);
2507 ++ }
2508 + }
2509 +
2510 + else if (inputFileContents[i][0] == "pseudoPotentials") {
2511 +@@ -2698,8 +2840,15 @@
2512 + syntax: pseudoPotential pseudo.txt
2513 + \endcode
2514 + */
2515 +- pGParser->addCommandOption("pseudo","read");
2516 ++ if (inputFileContents[i].size() == 2) {
2517 ++ pGParser->addCommandOption("Pseudo","Read");
2518 + pGParser->setPseudoPotentialFile(inputFileContents[i][1]);
2519 ++ } else {
2520 ++ MTKpp::errorLogger.throwError("MCPB::pseudoPotentials",
2521 ++ " Incorrect use ... exiting ", MTK_ERROR);
2522 ++ exit(1);
2523 ++ }
2524 ++
2525 + }
2526 +
2527 + else if (inputFileContents[i][0] == "modRedundant") {
2528 +@@ -2713,8 +2862,14 @@
2529 + syntax: modRedundant modred.txt
2530 + \endcode
2531 + */
2532 +- pGParser->addCommandOption("opt","modredundant");
2533 ++ if (inputFileContents[i].size() == 2) {
2534 ++ pGParser->addCommandOption("Opt","ModRedundant");
2535 + pGParser->setModRedundantFile(inputFileContents[i][1]);
2536 ++ } else {
2537 ++ MTKpp::errorLogger.throwError("MCPB::modRedundant",
2538 ++ " Incorrect use ... exiting ", MTK_ERROR);
2539 ++ exit(1);
2540 ++ }
2541 + }
2542 +
2543 + else if (inputFileContents[i][0] == "clusterCharge") {
2544 +@@ -2728,7 +2883,13 @@
2545 + syntax: clusterCharge cuCYM4 -3
2546 + \endcode
2547 + */
2548 ++ if (inputFileContents[i].size() == 3) {
2549 + pGParser->setCharge(atoi(inputFileContents[i][2].c_str()));
2550 ++ } else {
2551 ++ MTKpp::errorLogger.throwError("MCPB::clusterCharge",
2552 ++ " Incorrect use ... exiting ", MTK_ERROR);
2553 ++ exit(1);
2554 ++ }
2555 + }
2556 +
2557 + else if (inputFileContents[i][0] == "clusterSpin") {
2558 +@@ -2742,76 +2903,94 @@
2559 + syntax: clusterSpin 0
2560 + \endcode
2561 + */
2562 ++ if (inputFileContents[i].size() == 2) {
2563 + pGParser->setMultiplicity(atoi(inputFileContents[i][1].c_str()));
2564 ++ } else {
2565 ++ MTKpp::errorLogger.throwError("MCPB::clusterSpin",
2566 ++ " Incorrect use ... exiting ", MTK_ERROR);
2567 ++ exit(1);
2568 ++ }
2569 + }
2570 +
2571 +- else if (inputFileContents[i][0] == "g03MoldenFormat") {
2572 ++ else if (inputFileContents[i][0] == "gaussianMoldenFormat") {
2573 + /*!
2574 + @ingroup MCPB_commands
2575 + \code
2576 +- Function: g03MoldenFormat
2577 ++ Function: gaussianMoldenFormat
2578 +
2579 + Description: Use Molden formatted output in log file. Print out
2580 + details of the basis set and the molecular orbitals.
2581 +
2582 +- syntax: g03MoldenFormat (bare word)
2583 ++ syntax: gaussianMoldenFormat (bare word)
2584 + \endcode
2585 + */
2586 +- pGParser->addCommandOption("gfinput");
2587 +- pGParser->addIop("iop(6/7=3)");
2588 ++ pGParser->addCommandOption("GFInput");
2589 ++ pGParser->addIop("IOp(6/7=3)");
2590 + }
2591 +
2592 +- else if (inputFileContents[i][0] == "g03Verbosity") {
2593 ++ else if (inputFileContents[i][0] == "gaussianVerbosity") {
2594 + if (inputFileContents[i].size() == 2) {
2595 + pGParser->setVerbosity(inputFileContents[i][1]);
2596 ++ } else {
2597 ++ MTKpp::errorLogger.throwError("MCPB::gaussianVerbosity",
2598 ++ " Incorrect use ... exiting ", MTK_ERROR);
2599 ++ exit(1);
2600 + }
2601 + }
2602 +
2603 +- else if (inputFileContents[i][0] == "g03Mem") {
2604 ++ else if (inputFileContents[i][0] == "gaussianMem") {
2605 + /*!
2606 + @ingroup MCPB_commands
2607 + \code
2608 +- Function: g03Mem
2609 ++ Function: gaussianMem
2610 +
2611 +- Description: Set amount of memory requested for g03
2612 ++ Description: Set amount of memory requested for Gaussian
2613 +
2614 +- syntax: g03Mem 3600MB
2615 ++ syntax: gaussianMem 3600MB
2616 + \endcode
2617 + */
2618 + if (inputFileContents[i].size() == 2) {
2619 + pGParser->setMem(inputFileContents[i][1]);
2620 ++ } else {
2621 ++ MTKpp::errorLogger.throwError("MCPB::gaussianMem",
2622 ++ " Incorrect use ... exiting ", MTK_ERROR);
2623 ++ exit(1);
2624 + }
2625 + }
2626 +
2627 +- else if (inputFileContents[i][0] == "g03nProc") {
2628 ++ else if (inputFileContents[i][0] == "gaussianNProc") {
2629 + /*!
2630 + @ingroup MCPB_commands
2631 + \code
2632 +- Function: g03nProc
2633 ++ Function: gaussianNProc
2634 +
2635 +- Description: Set number of processors requested for g03
2636 ++ Description: Set number of processors requested for Gaussian
2637 +
2638 +- syntax: g03nProc 2
2639 ++ syntax: gaussianNProc 2
2640 + \endcode
2641 + */
2642 + if (inputFileContents[i].size() == 2) {
2643 +- pGParser->setnProc(inputFileContents[i][1]);
2644 ++ pGParser->setNProc(inputFileContents[i][1]);
2645 ++ } else {
2646 ++ MTKpp::errorLogger.throwError("MCPB::gaussianNProc",
2647 ++ " Incorrect use ... exiting ", MTK_ERROR);
2648 ++ exit(1);
2649 + }
2650 + }
2651 +
2652 +- else if (inputFileContents[i][0] == "g03OptAndFC") {
2653 ++ else if (inputFileContents[i][0] == "gaussianOptAndFC") {
2654 + /*!
2655 + @ingroup MCPB_commands
2656 + \code
2657 +- Function: g03OptAndFC
2658 ++ Function: gaussianOptAndFC
2659 +
2660 + Description: Set Gaussian input name
2661 +
2662 +- syntax: g03OptAndFC //cuCYM4 cuCYM4.com
2663 ++ syntax: gaussianOptAndFC //cuCYM4 cuCYM4.com
2664 + \endcode
2665 + */
2666 + if ((inputFileContents[i].size() != 3) or (!pCollection)) {
2667 +- MTKpp::errorLogger.throwError("MCPB::g03OptAndFC",
2668 ++ MTKpp::errorLogger.throwError("MCPB::gaussianOptAndFC",
2669 + " Incorrect use ... exiting ", MTK_ERROR);
2670 + exit(1);
2671 + }
2672 +@@ -2819,7 +2998,7 @@
2673 + selection* pSel = new selection(pCollection);
2674 + failure = pSel->parse(inputFileContents[i][1]);
2675 + if (failure) {
2676 +- MTKpp::errorLogger.throwError("MCPB::g03OptAndFC",
2677 ++ MTKpp::errorLogger.throwError("MCPB::gaussianOptAndFC",
2678 + " Error in selection parsing ... exiting ", MTK_ERROR);
2679 + exit(1);
2680 + }
2681 +@@ -2833,17 +3012,17 @@
2682 + pGParser->setCartesian(1);
2683 + pGParser->setWriteMoleculeName(1);
2684 + pGParser->setWriteChargeAndMult(1);
2685 +- pGParser->addCommandOption("integral(Grid=UltraFine)");
2686 ++ pGParser->addCommandOption("Integral", "(Grid=UltraFine)");
2687 +
2688 +- std::vector<std::string> optOptions = pGParser->getCommandOption("opt");
2689 ++ std::vector<std::string> optOptions = pGParser->getCommandOption("Opt");
2690 + if (optOptions.size() == 0) {
2691 +- pGParser->addCommandOption("opt");
2692 ++ pGParser->addCommandOption("Opt");
2693 + }
2694 +
2695 +- pGParser->addCommandOption("scf", "xqc");
2696 +- pGParser->addCommandOption("geom", "PrintInputOrient");
2697 ++ pGParser->addCommandOption("SCF", "XQC");
2698 ++ pGParser->addCommandOption("Geom", "PrintInputOrient");
2699 + pGParser->Write(fileNameBase+"_opt.com", pSelMol);
2700 +- pGParser->removeCommandOption("opt");
2701 ++ pGParser->removeCommandOption("Opt");
2702 +
2703 + // k's
2704 + // Do not write coordinates, name, charge or multiplicity,
2705 +@@ -2851,40 +3030,40 @@
2706 + pGParser->setNoCoords();
2707 + pGParser->setWriteMoleculeName(0);
2708 + pGParser->setWriteChargeAndMult(0);
2709 +- pGParser->addCommandOption("freq", "noraman");
2710 +- pGParser->addCommandOption("geom", "allcheckpoint");
2711 +- pGParser->addCommandOption("guess", "read");
2712 +- pGParser->addIop("iop(7/33=1)");
2713 ++ pGParser->addCommandOption("Freq", "NoRaman");
2714 ++ pGParser->addCommandOption("Geom", "AllCheckpoint");
2715 ++ pGParser->addCommandOption("Guess", "Read");
2716 ++ pGParser->addIop("IOp(7/33=1)");
2717 + pGParser->Write(fileNameBase+"_fc.com", pSelMol);
2718 + pGParser->clearIop();
2719 +
2720 + /*
2721 + // optimization
2722 +- pGParser->addCommandOption("opt", "z-matrix");
2723 ++ pGParser->addCommandOption("Opt", "Z-Matrix");
2724 + pGParser->generateZMatrix(pSelMol);
2725 + // [molecule index] = zmatrix index;
2726 + pGParser->writeMappingFile(fileNameBase+"_zmat.map");
2727 +- pGParser->addCommandOption("geom", "PrintInputOrient");
2728 ++ pGParser->addCommandOption("Geom", "PrintInputOrient");
2729 + pGParser->Write(fileNameBase+"_opt.com", pSelMol);
2730 +- pGParser->removeCommandOption("opt");
2731 ++ pGParser->removeCommandOption("Opt");
2732 + */
2733 + }
2734 + }
2735 + }
2736 +
2737 +- else if (inputFileContents[i][0] == "g03Charges") {
2738 ++ else if (inputFileContents[i][0] == "gaussianCharges") {
2739 + /*!
2740 + @ingroup MCPB_commands
2741 + \code
2742 +- Function: g03Charges
2743 ++ Function: gaussianCharges
2744 +
2745 + Description: Set Gaussian input name
2746 +
2747 +- syntax: g03Charges //cuCYM4 cuCYM4.com
2748 ++ syntax: gaussianCharges //cuCYM4 cuCYM4.com
2749 + \endcode
2750 + */
2751 + if ((inputFileContents[i].size() != 3) or (!pCollection)) {
2752 +- MTKpp::errorLogger.throwError("MCPB::g03Charges",
2753 ++ MTKpp::errorLogger.throwError("MCPB::gaussianCharges",
2754 + " Incorrect use ... exiting ", MTK_ERROR);
2755 + exit(1);
2756 + }
2757 +@@ -2892,7 +3071,7 @@
2758 + selection* pSel = new selection(pCollection);
2759 + failure = pSel->parse(inputFileContents[i][1]);
2760 + if (failure) {
2761 +- MTKpp::errorLogger.throwError("MCPB::g03Charges",
2762 ++ MTKpp::errorLogger.throwError("MCPB::gaussianCharges",
2763 + " Error in selection parsing ... exiting ", MTK_ERROR);
2764 + exit(1);
2765 + }
2766 +@@ -2907,14 +3086,14 @@
2767 +
2768 + // q's
2769 + std::vector<std::string> popOptions;
2770 +- popOptions.push_back("mk");
2771 +- popOptions.push_back("readradii");
2772 +- pGParser->addCommandOption("pop", popOptions);
2773 +- pGParser->removeCommandOption("freq");
2774 +- pGParser->addIop("iop(6/33=2)");
2775 ++ popOptions.push_back("MK");
2776 ++ popOptions.push_back("ReadRadii");
2777 ++ pGParser->addCommandOption("Pop", popOptions);
2778 ++ pGParser->removeCommandOption("Freq");
2779 ++ pGParser->addIop("IOp(6/33=2)");
2780 +
2781 +- pGParser->addCommandOption("integral(Grid=UltraFine)");
2782 +- pGParser->addCommandOption("scf", "xqc");
2783 ++ pGParser->addCommandOption("Integral", "(Grid=UltraFine)");
2784 ++ pGParser->addCommandOption("SCF", "XQC");
2785 +
2786 + pGParser->Write(fileNameBase+"_mk.com", pSelMol);
2787 +
2788 +@@ -3053,7 +3232,8 @@
2789 + result = find(bbb.begin(), bbb.end(), dd);
2790 +
2791 + if (result != bbb.end()) {
2792 +- freezingAtoms += "\n BBB " + submols[s]->getName() + " " + int2String(submols[s]->getSubMolId()) + " " + dd;
2793 ++ freezingAtoms += "\n BBB " + submols[s]->getName() + " "
2794 ++ + int2String(submols[s]->getSubMolId()) + " " + dd;
2795 + sprintf(temp,"%5d%10.5f", 1, pStdAtom_a->atmCharge);
2796 + orespAdd << temp << std::endl;
2797 + sprintf(temp,"%5d%5d", 1, subAtoms[a]->getIndex());
2798 +@@ -3071,7 +3251,6 @@
2799 + MTKpp::errorLogger.throwError("MCPB::respgenAdditions",
2800 + freezingAtoms, INFO);
2801 + }
2802 +-
2803 + orespAdd << "\n" << std::endl;
2804 + orespAdd.close();
2805 + }
2806 +@@ -3099,22 +3278,22 @@
2807 + }
2808 + }
2809 +
2810 +- else if (inputFileContents[i][0] == "readG03Output") {
2811 ++ else if (inputFileContents[i][0] == "readGaussianOutput") {
2812 + /*!
2813 + @ingroup MCPB_commands
2814 + \code
2815 +- Function: readG03Output
2816 ++ Function: readGaussianOutput
2817 +
2818 +- Description: Read G03 Output
2819 ++ Description: Read Gaussian Output
2820 +
2821 +- syntax: readG03Output cuCYM4.log
2822 ++ syntax: readGaussianOutput cuCYM4.log
2823 + \endcode
2824 + */
2825 + if ((inputFileContents[i].size() == 2) or (pGParser)) {
2826 + pGParser->Read(inputFileContents[i][1], pSheet);
2827 + }
2828 + else {
2829 +- MTKpp::errorLogger.throwError("MCPB::readG03Output",
2830 ++ MTKpp::errorLogger.throwError("MCPB::readGaussianOutput",
2831 + " Incorrect use ... exiting ", MTK_ERROR);
2832 + exit(1);
2833 + }
2834 +@@ -3481,8 +3660,8 @@
2835 + pGParser->setCartesian(0);
2836 + pGParser->setWriteMoleculeName(1);
2837 + pGParser->setWriteChargeAndMult(1);
2838 +- pGParser->addCommandOption("freq", "noraman");
2839 +- pGParser->addIop("iop(7/33=1)");
2840 ++ pGParser->addCommandOption("Freq", "NoRaman");
2841 ++ pGParser->addIop("IOp(7/33=1)");
2842 + pGParser->Write(inputFileContents[i][2], pSelMol);
2843 + pGParser->writeMappingFile(inputFileContents[i][2]+".map");
2844 + }
2845 +@@ -3826,6 +4005,7 @@
2846 + if (pStdFrag) {
2847 + bool doIt = pStdGroup->hasStdFrag(pStdFrag->getSymbol());
2848 + if (doIt) {
2849 ++ //std::cout << " " << pStdFrag->getSymbol() << "\n";
2850 + //submolecule* pStdSubmol = pStdMolecule->addSubMolecule();
2851 + //pStdSubmol->copy(submolList[t]);
2852 + std::vector<atom*> lAtomList = submolList[t]->getAtomList();
2853 +@@ -3834,7 +4014,8 @@
2854 + if (pStdAtom) {
2855 + //std::cout << " |" << lAtomList[r]->getName() << "| " << lAtomList[r]->getZcharge() << "\n";
2856 + pStdAtom->atmCharge = lAtomList[r]->getZcharge();
2857 +- groupCharge += lAtomList[r]->getZcharge();
2858 ++ //groupCharge += lAtomList[r]->getZcharge();
2859 ++ groupCharge += pStdAtom->atmCharge;
2860 + }
2861 + }
2862 + }
2863 +@@ -3861,11 +4042,398 @@
2864 + */
2865 + }
2866 + updateRespChargesMessage += " Charge: " + double2String(groupCharge, 2);
2867 ++ //std::cout << " Group charge = " << double2String(groupCharge, 2) << "\n";
2868 + MTKpp::errorLogger.throwError("MCPB::updateRespCharges",
2869 + updateRespChargesMessage, INFO);
2870 + }
2871 + }
2872 +
2873 ++ else if (inputFileContents[i][0] == "respgen") {
2874 ++ /*!
2875 ++ @ingroup MCPB_commands
2876 ++ \code
2877 ++ Function: respgen
2878 ++
2879 ++ Description: Create resp1 and resp2 files (recreates functionality of respgen)
2880 ++
2881 ++ syntax: respgen /COL/MOL Group fileName
2882 ++ \endcode
2883 ++ */
2884 ++
2885 ++ if ((inputFileContents[i].size() != 4) or (!pCollection)) {
2886 ++ MTKpp::errorLogger.throwError("MCPB::respgen",
2887 ++ " Incorrect use ... exiting ", MTK_ERROR);
2888 ++ exit(1);
2889 ++ }
2890 ++ else {
2891 ++ selection* pSel = new selection(pCollection);
2892 ++ failure = pSel->parse(inputFileContents[i][1]);
2893 ++ if (failure) {
2894 ++ MTKpp::errorLogger.throwError("MCPB::respgen",
2895 ++ " Error in selection parsing ... exiting ", MTK_ERROR);
2896 ++ exit(1);
2897 ++ }
2898 ++
2899 ++ stdLibrary* pStdLibrary = pCollection->getStdLibrary();
2900 ++ stdGroup* pStdGroup = 0;
2901 ++ if (pStdLibrary) {
2902 ++ pStdGroup = pStdLibrary->getStdGroup(inputFileContents[i][2]);
2903 ++ if (!pStdGroup) {
2904 ++ MTKpp::errorLogger.throwError("MCPB::respgen",
2905 ++ " Can't find stdGroup ... exiting ", MTK_ERROR);
2906 ++ exit(1);
2907 ++ }
2908 ++ }
2909 ++ else {
2910 ++ MTKpp::errorLogger.throwError("MCPB::respgen",
2911 ++ " Error in selection parsing ... exiting ", MTK_ERROR);
2912 ++ }
2913 ++
2914 ++ if (pSel->getSelectionType() == 1) {
2915 ++ molecule* pSelMol = pSel->getMol();
2916 ++ if (!pSelMol) {
2917 ++ std::cout << " Error in respgen selection \n";
2918 ++ exit(1);
2919 ++ }
2920 ++
2921 ++ std::vector<std::string>::iterator result;
2922 ++
2923 ++ acParser* pAcParser = new acParser();
2924 ++ pAcParser->Write(inputFileContents[i][3]+".ac", pCollection);
2925 ++ delete pAcParser;
2926 ++
2927 ++ std::string bb0FileResp1 = inputFileContents[i][3] + "_bb0.resp1";
2928 ++ std::string bb0FileResp2 = inputFileContents[i][3] + "_bb0.resp2";
2929 ++ std::ofstream obb0FileResp1;
2930 ++ std::ofstream obb0FileResp2;
2931 ++ obb0FileResp1.open(bb0FileResp1.c_str());
2932 ++ obb0FileResp2.open(bb0FileResp2.c_str());
2933 ++
2934 ++ std::string bb1FileResp1 = inputFileContents[i][3] + "_bb1.resp1";
2935 ++ std::string bb1FileResp2 = inputFileContents[i][3] + "_bb1.resp2";
2936 ++ std::ofstream obb1FileResp1;
2937 ++ std::ofstream obb1FileResp2;
2938 ++ obb1FileResp1.open(bb1FileResp1.c_str());
2939 ++ obb1FileResp2.open(bb1FileResp2.c_str());
2940 ++
2941 ++ std::string bb2FileResp1 = inputFileContents[i][3] + "_bb2.resp1";
2942 ++ std::string bb2FileResp2 = inputFileContents[i][3] + "_bb2.resp2";
2943 ++ std::ofstream obb2FileResp1;
2944 ++ std::ofstream obb2FileResp2;
2945 ++ obb2FileResp1.open(bb2FileResp1.c_str());
2946 ++ obb2FileResp2.open(bb2FileResp2.c_str());
2947 ++
2948 ++ std::string bb3FileResp1 = inputFileContents[i][3] + "_bb3.resp1";
2949 ++ std::string bb3FileResp2 = inputFileContents[i][3] + "_bb3.resp2";
2950 ++ std::ofstream obb3FileResp1;
2951 ++ std::ofstream obb3FileResp2;
2952 ++ obb3FileResp1.open(bb3FileResp1.c_str());
2953 ++ obb3FileResp2.open(bb3FileResp2.c_str());
2954 ++
2955 ++ if (!obb0FileResp1 or !obb0FileResp2 or !obb1FileResp1 or !obb1FileResp2 or
2956 ++ !obb2FileResp1 or !obb2FileResp2 or !obb3FileResp1 or !obb3FileResp2) {
2957 ++ MTKpp::errorLogger.throwError("MCPB::respgen",
2958 ++ " Unable to open RESP files ... exiting ", MTK_ERROR);
2959 ++ exit(1);
2960 ++ }
2961 ++
2962 ++ std::vector<molecule*> molList = pCollection->getMoleculeList();
2963 ++
2964 ++ std::string terminalFrags = "";
2965 ++ char temp[100];
2966 ++ bool bFirst = true;
2967 ++ for (unsigned int m = 0; m < molList.size(); m++) {
2968 ++ molecule* pMol = molList[m];
2969 ++ std::vector<submolecule*> submols = pMol->getSubMoleculeList();
2970 ++ for (unsigned int s = 0; s < submols.size(); s++) {
2971 ++ if (submols[s]->hasStdFrag()) {
2972 ++ stdFrag* pStdFrag = submols[s]->getStdFrag();
2973 ++ if (pStdFrag->getParent()->getName() != inputFileContents[i][2]) {
2974 ++ if (bFirst) {
2975 ++ sprintf(temp,"%5d%10.5f\n", pStdFrag->numStdAtoms(), 0.0);
2976 ++ bFirst = false;
2977 ++ }
2978 ++ else {
2979 ++ sprintf(temp,"\n%5d%10.5f\n", pStdFrag->numStdAtoms(), 0.0);
2980 ++ }
2981 ++
2982 ++ terminalFrags += std::string(temp);
2983 ++ std::vector<atom*> atomList = submols[s]->getAtomList();
2984 ++ char temp2[80];
2985 ++ int counter = 0;
2986 ++ for (unsigned int a = 0; a < atomList.size(); a++) {
2987 ++ if (counter > 7) { // was 6
2988 ++ terminalFrags += "\n";
2989 ++ counter = 0;
2990 ++ }
2991 ++ sprintf(temp2,"%5d%5d", 1, atomList[a]->getIndex());
2992 ++ terminalFrags += std::string(temp2);
2993 ++ counter++;
2994 ++ }
2995 ++ //terminalFrags += "\n";
2996 ++ }
2997 ++ }
2998 ++ }
2999 ++ }
3000 ++ //std::cout << terminalFrags << std::endl;
3001 ++
3002 ++ std::string bb0 = terminalFrags + "\n";
3003 ++ std::string bb1 = terminalFrags + "\n";
3004 ++ std::string bb2 = terminalFrags + "\n";
3005 ++ std::string bb3 = terminalFrags + "\n";
3006 ++
3007 ++ int lInd = 0;
3008 ++ for (unsigned int m = 0; m < molList.size(); m++) {
3009 ++ molecule* pMol = molList[m];
3010 ++
3011 ++ if (pMol->getName() == "Reference") continue;
3012 ++
3013 ++ std::vector<submolecule*> submols = pMol->getSubMoleculeList();
3014 ++ for (unsigned int s = 0; s < submols.size(); s++) {
3015 ++ if (submols[s]->hasStdFrag()) {
3016 ++ stdFrag* pStdFrag = submols[s]->getStdFrag();
3017 ++ //std::cout << " respgen " << pStdFrag->getParent()->getName() << " " << inputFileContents[i][2] << " \n ";
3018 ++ if (pStdFrag->getParent()->getName() != inputFileContents[i][2]) continue;
3019 ++ std::vector<atom*> subAtoms = submols[s]->getAtomList();
3020 ++ for (unsigned int a = 0; a < subAtoms.size(); a++) {
3021 ++ stdAtom* pStdAtom_a = subAtoms[a]->getStdAtom();
3022 ++ lInd++;
3023 ++ // iBB == 1
3024 ++ if (pStdAtom_a) {
3025 ++ std::string dd = pStdAtom_a->identity + ":" + pStdAtom_a->type;
3026 ++
3027 ++ //result = find(bb_heavy.begin(), bb_heavy.end(), subAtoms[a]->getName());
3028 ++ //result = find(bb_heavy.begin(), bb_heavy.end(), pStdAtom_a->identity);
3029 ++ result = find(bb_heavy.begin(), bb_heavy.end(), dd);
3030 ++
3031 ++ if (result != bb_heavy.end()) {
3032 ++ sprintf(temp,"%5d%10.5f\n", 1, pStdAtom_a->atmCharge);
3033 ++ //freezingAtoms += "\n BB Heavy " + submols[s]->getName() + " " + int2String(submols[s]->getSubMolId()) + " " + dd;
3034 ++ //std::cout << "\n BB Heavy " + submols[s]->getName() + " " + int2String(submols[s]->getSubMolId()) + " " + dd;
3035 ++ //std::cout << dd << " " << subAtoms[a]->getName() << " ---> " << subAtoms[a]->getStdAtom()->type << std::endl;
3036 ++ //orespAdd << temp << std::endl;
3037 ++ bb1 += std::string(temp);
3038 ++ sprintf(temp,"%5d%5d\n", 1, subAtoms[a]->getIndex());
3039 ++ //orespAdd << temp << std::endl;
3040 ++ bb1 += std::string(temp);
3041 ++ }
3042 ++
3043 ++ // iBB == 2
3044 ++ dd = pStdAtom_a->identity + ":" + pStdAtom_a->type;
3045 ++
3046 ++ //result = find(bb.begin(), bb.end(), subAtoms[a]->getName());
3047 ++ result = find(bb.begin(), bb.end(), dd);
3048 ++
3049 ++ if (result != bb.end()) {
3050 ++ //freezingAtoms += "\n BB " + submols[s]->getName() + " " + int2String(submols[s]->getSubMolId()) + " " + dd;
3051 ++ sprintf(temp,"%5d%10.5f\n", 1, pStdAtom_a->atmCharge);
3052 ++ //orespAdd << temp << std::endl;
3053 ++ bb2 += std::string(temp);
3054 ++ sprintf(temp,"%5d%5d\n", 1, subAtoms[a]->getIndex());
3055 ++ //orespAdd << temp << std::endl;
3056 ++ bb2 += std::string(temp);
3057 ++ }
3058 ++ // iBB == 3
3059 ++ dd = pStdAtom_a->identity + ":" + pStdAtom_a->type;
3060 ++
3061 ++ //result = find(bbb.begin(), bbb.end(), subAtoms[a]->getName());
3062 ++ result = find(bbb.begin(), bbb.end(), dd);
3063 ++
3064 ++ if (result != bbb.end()) {
3065 ++ //freezingAtoms += "\n BBB " + submols[s]->getName() + " "
3066 ++ // + int2String(submols[s]->getSubMolId()) + " " + dd;
3067 ++ sprintf(temp,"%5d%10.5f\n", 1, pStdAtom_a->atmCharge);
3068 ++ bb3 += std::string(temp);
3069 ++ //orespAdd << temp << std::endl;
3070 ++ sprintf(temp,"%5d%5d\n", 1, subAtoms[a]->getIndex());
3071 ++ bb3 += std::string(temp);
3072 ++ //orespAdd << temp << std::endl;
3073 ++ }
3074 ++ }
3075 ++ else {
3076 ++ MTKpp::errorLogger.throwError("MCPB::respgen",
3077 ++ " Unknown option ... exiting ", MTK_ERROR);
3078 ++ }
3079 ++ }
3080 ++ }
3081 ++ }
3082 ++ }
3083 ++
3084 ++ std::string resp1 = "";
3085 ++ resp1 += "Resp charges for organic molecule\n";
3086 ++ resp1 += "\n";
3087 ++ resp1 += " &cntrl\n";
3088 ++ resp1 += "\n";
3089 ++ resp1 += " nmol = 1,\n";
3090 ++ resp1 += " ihfree = 1,\n";
3091 ++ resp1 += " ioutopt = 1,\n";
3092 ++ resp1 += "\n";
3093 ++ resp1 += " &end\n";
3094 ++ resp1 += " 1.0\n";
3095 ++ resp1 += "Resp charges for organic molecule\n";
3096 ++
3097 ++ //std::cout << pStdGroup->getCharge() << " " << pSelMol->getNumAtoms() << std::endl;
3098 ++ sprintf(temp,"%5d%5d\n", int(pStdGroup->getCharge()), pSelMol->getNumAtoms());
3099 ++ resp1 += std::string(temp);
3100 ++
3101 ++ std::vector<submolecule*> sList = pSelMol->getSubMoleculeList();
3102 ++ typedef std::map<std::string, int>::iterator mapIterator;
3103 ++
3104 ++ std::map<std::string, int> lMap;
3105 ++ int ind = 0;
3106 ++ for (unsigned int p = 0; p < sList.size(); p++) {
3107 ++ std::vector<atom*> aList = sList[p]->getAtomList();
3108 ++ for (unsigned int a = 0; a < aList.size(); a++) {
3109 ++ if (!aList[a]->getStdAtom()) {
3110 ++ std::cout << " Error ... exiting()\n";
3111 ++ exit(1);
3112 ++ }
3113 ++ int elNum = aList[a]->getAtomicNum();
3114 ++ std::string key = "";
3115 ++ if (elNum == 1) {
3116 ++ std::vector<atom*> hBondedAtoms = aList[a]->getBondedAtoms();
3117 ++ if (hBondedAtoms.size() == 1) {
3118 ++ key = aList[a]->getParent()->getName() + ":" + hBondedAtoms[0]->getName() + ":" + aList[a]->getStdAtom()->type;
3119 ++ }
3120 ++ else {
3121 ++ key = aList[a]->getParent()->getName() + ":" + aList[a]->getStdAtom()->type;
3122 ++ }
3123 ++ }
3124 ++ else {
3125 ++ key = aList[a]->getParent()->getName() + ":" + aList[a]->getName();
3126 ++ }
3127 ++
3128 ++ mapIterator mi = lMap.find(key);
3129 ++
3130 ++ int fg = 0;
3131 ++ if (mi != lMap.end()){
3132 ++ fg = lMap[key]+1;
3133 ++ }
3134 ++ else {
3135 ++ lMap[key] = ind;
3136 ++ }
3137 ++ //sprintf(temp,"%4d %-11s%5d%5d\n", ind+1, key.c_str(), aList[a]->getAtomicNum(), fg);
3138 ++ sprintf(temp,"%5d%5d\n", aList[a]->getAtomicNum(), fg);
3139 ++ resp1 += std::string(temp);
3140 ++ ind++;
3141 ++ }
3142 ++ }
3143 ++
3144 ++ std::string resp2 = "";
3145 ++
3146 ++ resp2 += "Resp charges for organic molecule\n";
3147 ++ resp2 += "\n";
3148 ++ resp2 += " &cntrl\n";
3149 ++ resp2 += "\n";
3150 ++ resp2 += " nmol = 1,\n";
3151 ++ resp2 += " ihfree = 1,\n";
3152 ++ resp2 += " ioutopt = 1,\n";
3153 ++ resp2 += " iqopt = 2,\n";
3154 ++ resp2 += " qwt = 0.001,\n";
3155 ++ resp2 += "\n";
3156 ++ resp2 += " &end\n";
3157 ++ resp2 += " 1.0\n";
3158 ++ resp2 += "Resp charges for organic molecule\n";
3159 ++
3160 ++ sprintf(temp,"%5d%5d\n", int(pStdGroup->getCharge()), pSelMol->getNumAtoms());
3161 ++ resp2 += std::string(temp);
3162 ++
3163 ++ ind = 0;
3164 ++ std::map<std::string, int> lMap2;
3165 ++
3166 ++ for (unsigned int p = 0; p < sList.size(); p++) {
3167 ++ std::vector<atom*> aList = sList[p]->getAtomList();
3168 ++ for (unsigned int a = 0; a < aList.size(); a++) {
3169 ++
3170 ++ if (!aList[a]->getStdAtom()) {
3171 ++ std::cout << " Error ... exiting()\n";
3172 ++ exit(1);
3173 ++ }
3174 ++ int elNum = aList[a]->getAtomicNum();
3175 ++ std::string key = "";
3176 ++ if (elNum == 1) {
3177 ++ std::vector<atom*> hBondedAtoms = aList[a]->getBondedAtoms();
3178 ++ if (hBondedAtoms.size() == 1) {
3179 ++ key = aList[a]->getParent()->getName() + ":" + hBondedAtoms[0]->getName() + ":" +
3180 ++ aList[a]->getStdAtom()->type;
3181 ++ }
3182 ++ else {
3183 ++ key = aList[a]->getParent()->getName() + ":" + aList[a]->getStdAtom()->type;
3184 ++ }
3185 ++ }
3186 ++ else {
3187 ++ key = aList[a]->getParent()->getName() + ":" + aList[a]->getName();
3188 ++ }
3189 ++
3190 ++ mapIterator mi = lMap2.find(key);
3191 ++
3192 ++ int fg = 0;
3193 ++ if (mi != lMap2.end()){
3194 ++ fg = lMap2[key]+1;
3195 ++ }
3196 ++ else {
3197 ++ lMap2[key] = ind;
3198 ++ }
3199 ++ std::string atName = aList[a]->getName();
3200 ++ std::string atType = aList[a]->getStdAtom()->type;
3201 ++ int atNum = aList[a]->getAtomicNum();
3202 ++
3203 ++ if (atName == " CH3" or atName == " CB " or containsSubStr(key, " CB :H1") or
3204 ++ containsSubStr(key, " CB :HC") or
3205 ++ containsSubStr(key, " CH3:HC") or containsSubStr(key, " CH3:H1") or
3206 ++ containsSubStr(key, "GLY: CA ")) {// or (atNum > 16)) {
3207 ++ //if (atName == " CH3" or atName == " CB " or atType == "H1" or atType == "HC") {
3208 ++ //sprintf(temp,"%4d %-11s%5d%5d\n", ind+1, key.c_str(), aList[a]->getAtomicNum(), fg);
3209 ++ sprintf(temp,"%5d%5d\n", aList[a]->getAtomicNum(), fg);
3210 ++ }
3211 ++ else {
3212 ++ //sprintf(temp,"%4d %-11s%5d%5d\n", ind+1, key.c_str(), aList[a]->getAtomicNum(), -99);
3213 ++ sprintf(temp,"%5d%5d\n", aList[a]->getAtomicNum(), -99);
3214 ++ }
3215 ++ resp2 += std::string(temp);
3216 ++
3217 ++ ind++;
3218 ++ }
3219 ++ }
3220 ++
3221 ++ std::string twoBlankLine = "\n\n";
3222 ++ bb0 += twoBlankLine;
3223 ++ bb1 += twoBlankLine;
3224 ++ bb2 += twoBlankLine;
3225 ++ bb3 += twoBlankLine;
3226 ++
3227 ++ obb0FileResp1 << resp1;
3228 ++ obb0FileResp1 << bb0;
3229 ++ obb0FileResp2 << resp2;
3230 ++ obb0FileResp2 << bb0;
3231 ++
3232 ++ obb1FileResp1 << resp1;
3233 ++ obb1FileResp1 << bb1;
3234 ++ obb1FileResp2 << resp2;
3235 ++ obb1FileResp2 << bb1;
3236 ++
3237 ++ obb2FileResp1 << resp1;
3238 ++ obb2FileResp1 << bb2;
3239 ++ obb2FileResp2 << resp2;
3240 ++ obb2FileResp2 << bb2;
3241 ++
3242 ++ obb3FileResp1 << resp1;
3243 ++ obb3FileResp1 << bb3;
3244 ++ obb3FileResp2 << resp2;
3245 ++ obb3FileResp2 << bb3;
3246 ++
3247 ++ obb0FileResp1.close();
3248 ++ obb0FileResp2.close();
3249 ++ obb1FileResp1.close();
3250 ++ obb1FileResp2.close();
3251 ++ obb2FileResp1.close();
3252 ++ obb2FileResp2.close();
3253 ++ obb3FileResp1.close();
3254 ++ obb3FileResp2.close();
3255 ++ }
3256 ++ }
3257 ++ }
3258 ++
3259 + else if (inputFileContents[i][0] == "addStdMol") {
3260 + /*!
3261 + @ingroup MCPB_commands
3262 +@@ -4496,63 +5064,63 @@
3263 + table<double>* nmodeEVectors = pSheet->getTable("NMode EigenVectors");
3264 + ublas::matrix<double> &nmodeEVectorsMatrixT = nmodeEVectors->getMatrix();
3265 +
3266 +- table<double>* g03EValues = pSheet->getTable("Gaussian EigenValues");
3267 +- ublas::matrix<double> &g03EValuesMatrix = g03EValues->getMatrix();
3268 ++ table<double>* gaussianEValues = pSheet->getTable("Gaussian EigenValues");
3269 ++ ublas::matrix<double> &gaussianEValuesMatrix = gaussianEValues->getMatrix();
3270 +
3271 +- table<double>* g03EVectors = pSheet->getTable("Gaussian EigenVectors");
3272 +- ublas::matrix<double> &g03EVectorsMatrixT = g03EVectors->getMatrix();
3273 ++ table<double>* gaussianEVectors = pSheet->getTable("Gaussian EigenVectors");
3274 ++ ublas::matrix<double> &gaussianEVectorsMatrixT = gaussianEVectors->getMatrix();
3275 +
3276 + int nRowsNMode = nmodeEValues->getNumRows();
3277 +- int nRowsG03 = g03EValues->getNumRows();
3278 ++ int nRowsGaussian = gaussianEValues->getNumRows();
3279 +
3280 + int nColsNMode = nmodeEVectors->getNumColumns();
3281 +- int nColsG03 = g03EVectors->getNumColumns();
3282 ++ int nColsGaussian = gaussianEVectors->getNumColumns();
3283 +
3284 +- if (nRowsNMode != nRowsG03 and nColsNMode != nColsG03) {
3285 ++ if (nRowsNMode != nRowsGaussian and nColsNMode != nColsGaussian) {
3286 + std::cout << " PROBLEM " << std::endl;
3287 + }
3288 + else {
3289 + std::cout << " EIGENVALUES " << std::endl;
3290 + for (int z = 0; z < nRowsNMode; z++) {
3291 +- std::cout << nmodeEValuesMatrix(z, 0) << " " << g03EValuesMatrix(z, 0) << std::endl;
3292 ++ std::cout << nmodeEValuesMatrix(z, 0) << " " << gaussianEValuesMatrix(z, 0) << std::endl;
3293 + }
3294 +
3295 + //std::cout << " NMODE " << std::endl;
3296 + //nmodeEVectors->printMatrix();
3297 +
3298 +- //std::cout << " G03 " << std::endl;
3299 +- //g03EVectors->printMatrix();
3300 ++ //std::cout << " Gaussian " << std::endl;
3301 ++ //gaussianEVectors->printMatrix();
3302 + //std::cout << " \n\n " << std::endl;
3303 +
3304 + // Normalize Eigenvector matrices
3305 + for (int zi = 0; zi < nRowsNMode; zi++) {
3306 + double normNMode = 0.0;
3307 +- double normG03 = 0.0;
3308 ++ double normGaussian = 0.0;
3309 + for (int zk = 0; zk < nColsNMode; zk++) {
3310 + normNMode += (nmodeEVectorsMatrixT(zi, zk) * nmodeEVectorsMatrixT(zi, zk));
3311 +- normG03 += (g03EVectorsMatrixT(zi, zk) * g03EVectorsMatrixT(zi, zk));
3312 ++ normGaussian += (gaussianEVectorsMatrixT(zi, zk) * gaussianEVectorsMatrixT(zi, zk));
3313 + }
3314 + normNMode = sqrt(normNMode);
3315 +- normG03 = sqrt(normG03);
3316 ++ normGaussian = sqrt(normGaussian);
3317 + for (int zk = 0; zk < nColsNMode; zk++) {
3318 +- //std::cout << g03EVectorsMatrixT(zi, zk) << " " << normG03 << " "
3319 +- // << g03EVectorsMatrixT(zi, zk) / normG03 << " ";
3320 ++ //std::cout << gaussianEVectorsMatrixT(zi, zk) << " " << normGaussian << " "
3321 ++ // << gaussianEVectorsMatrixT(zi, zk) / normGaussian << " ";
3322 + double newValue1 = nmodeEVectorsMatrixT(zi, zk) / normNMode;
3323 +- double newValue2 = g03EVectorsMatrixT(zi, zk) / normG03;
3324 ++ double newValue2 = gaussianEVectorsMatrixT(zi, zk) / normGaussian;
3325 + nmodeEVectors->setCellValue(zi, zk, newValue1);
3326 +- g03EVectors->setCellValue(zi, zk, newValue2);
3327 +- //std::cout << g03EVectors->getCellValue(zi, zk) << std::endl;
3328 ++ gaussianEVectors->setCellValue(zi, zk, newValue2);
3329 ++ //std::cout << gaussianEVectors->getCellValue(zi, zk) << std::endl;
3330 + }
3331 + }
3332 +
3333 + ublas::matrix<double> &nmodeEVectorsMatrix = nmodeEVectors->getMatrix();
3334 +- ublas::matrix<double> &g03EVectorsMatrix = g03EVectors->getMatrix();
3335 ++ ublas::matrix<double> &gaussianEVectorsMatrix = gaussianEVectors->getMatrix();
3336 +
3337 + //std::cout << " NMODE " << std::endl;
3338 + //nmodeEVectors->printMatrix();
3339 +
3340 +- //std::cout << " G03 " << std::endl;
3341 +- //g03EVectors->printMatrix();
3342 ++ //std::cout << " Gaussian " << std::endl;
3343 ++ //gaussianEVectors->printMatrix();
3344 + //std::cout << " \n\n " << std::endl;
3345 +
3346 + // dot product
3347 +@@ -4563,12 +5131,12 @@
3348 + double eN2 = 0.0;
3349 + double dff = 0.0;
3350 + for (int zi = 0; zi < nRowsNMode; zi++) { // NMode
3351 +- for (int zj = 0; zj < nRowsNMode; zj++) { // G03
3352 ++ for (int zj = 0; zj < nRowsNMode; zj++) { // Gaussian
3353 + for (int zk = 0; zk < nColsNMode; zk++) { // Loop over coordinates in Eigenvector
3354 +- //std::cout << nmodeEVectorsMatrix(zi, zk) << " " << g03EVectorsMatrix(zj, zk) << " ";
3355 ++ //std::cout << nmodeEVectorsMatrix(zi, zk) << " " << gaussianEVectorsMatrix(zj, zk) << " ";
3356 + eN += (nmodeEVectorsMatrix(zi, zk) * nmodeEVectorsMatrix(zi, zk));
3357 +- eN2 += (g03EVectorsMatrix(zj, zk) * g03EVectorsMatrix(zj, zk));
3358 +- dotProduct += (nmodeEVectorsMatrix(zi, zk) * g03EVectorsMatrix(zj, zk));
3359 ++ eN2 += (gaussianEVectorsMatrix(zj, zk) * gaussianEVectorsMatrix(zj, zk));
3360 ++ dotProduct += (nmodeEVectorsMatrix(zi, zk) * gaussianEVectorsMatrix(zj, zk));
3361 + }
3362 + //std::cout << " eN = " << sqrt(eN) << " eN2 = " << sqrt(eN2) << " ";
3363 + std::cout << zi << " - " << zj << " " << dotProduct << " " << dotProductMax << std::endl;
3364 +@@ -4582,11 +5150,11 @@
3365 + }
3366 + dotProduct = 0.0;
3367 + }
3368 +- double dffL = nmodeEValuesMatrix(zi, 0) - g03EValuesMatrix(dotProductMaxIndex, 0);
3369 ++ double dffL = nmodeEValuesMatrix(zi, 0) - gaussianEValuesMatrix(dotProductMaxIndex, 0);
3370 + dffL *= dffL;
3371 + std::cout << " nmode index = " << zi << " BestMatch = " << dotProductMaxIndex
3372 + << " => dotProduct =" << dotProductMax << " EVALUES: "
3373 +- << " " << nmodeEValuesMatrix(zi, 0) << " " << g03EValuesMatrix(dotProductMaxIndex, 0) << " "
3374 ++ << " " << nmodeEValuesMatrix(zi, 0) << " " << gaussianEValuesMatrix(dotProductMaxIndex, 0) << " "
3375 + << dffL
3376 + << std::endl;
3377 +
3378 +@@ -4617,7 +5185,7 @@
3379 + }
3380 +
3381 + else {
3382 +- std::string unknownCommand = " Unknown command " + inputFileContents[i][0];
3383 ++ std::string unknownCommand = " Unknown command: \"" + inputFileContents[i][0] + "\"";
3384 + MTKpp::errorLogger.throwError("MCPB", unknownCommand, MTK_ERROR);
3385 + }
3386 + }
3387 +@@ -4628,4 +5196,3 @@
3388 + delete pSheet;
3389 + return 0;
3390 + }
3391 +-
3392 +diff -urN amber11.orig/AmberTools/src/mtkpp/tools/prep2xml.cpp amber11/AmberTools/src/mtkpp/tools/prep2xml.cpp
3393 +--- amber11.orig/AmberTools/src/mtkpp/tools/prep2xml.cpp 2011-04-14 15:30:19.000000000 +0300
3394 ++++ amber11/AmberTools/src/mtkpp/tools/prep2xml.cpp 2012-03-03 20:03:01.418032565 +0200
3395 +@@ -86,6 +86,7 @@
3396 + clo->addUsage( " -a log file " );
3397 + clo->addUsage( " -l hybridize name \n" );
3398 + clo->addUsage( " flags: " );
3399 ++ clo->addUsage( " -c convert only " );
3400 + clo->addUsage( " -h help \n" );
3401 +
3402 + // 4. SET THE OPTION STRINGS/CHARACTERS
3403 +@@ -97,6 +98,7 @@
3404 + clo->setOption( "hyb", 'l' );
3405 + clo->setOption( "log", 'a' );
3406 +
3407 ++ clo->setFlag ( "convert", 'c' );
3408 + clo->setFlag ( "help", 'h' );
3409 +
3410 + // 5. PROVIDE THE COMMANDLINE
3411 +@@ -117,6 +119,11 @@
3412 + std::string fragName = "";
3413 + std::string molName = "";
3414 + std::string logFile = "";
3415 ++ bool bConvertOnly = 0;
3416 ++
3417 ++ if ( clo->getFlag( "convert" ) || clo->getFlag( 'c' ) ) {
3418 ++ bConvertOnly = 1;
3419 ++ }
3420 +
3421 + std::string AMBERHOME = getenv("AMBERHOME");
3422 + std::string parametersFile = AMBERHOME + "/dat/mtkpp/hybridize/labute.txt";
3423 +@@ -166,13 +173,13 @@
3424 + else if ( clo->getValue( "frag" ) != 0 ) {
3425 + fragName = clo->getValue( "frag" );
3426 + }
3427 +- else {
3428 ++/* else {
3429 + printHeader(std::cout, prog_name, authors);
3430 + clo->printUsage();
3431 + std::cout << " Please provide a fragment name " << std::endl;
3432 + return 0;
3433 + }
3434 +-
3435 ++*/
3436 + if ( clo->getValue( "l" ) != 0 ) {
3437 + parametersFile = clo->getValue( "l" );
3438 + }
3439 +@@ -186,13 +193,14 @@
3440 + else if ( clo->getValue( "mol" ) != 0 ) {
3441 + molName = clo->getValue( "mol" );
3442 + }
3443 ++/*
3444 + else {
3445 + printHeader(std::cout, prog_name, authors);
3446 + clo->printUsage();
3447 + std::cout << " Please provide a molecule name " << std::endl;
3448 + return 0;
3449 + }
3450 +-
3451 ++*/
3452 + if ( clo->getValue( "a" ) != 0 ) {
3453 + logFile = clo->getValue( "a" );
3454 + }
3455 +@@ -307,6 +315,22 @@
3456 + std::cout << " Incorrect use of prep2xml " << std::endl;
3457 + exit(1);
3458 + }
3459 ++
3460 ++ /////////
3461 ++ if (fragName == "") {
3462 ++ prepParser* pPrepParser = new prepParser();
3463 ++ pPrepParser->Read(prepFile, pStdGroup);
3464 ++ delete pPrepParser;
3465 ++
3466 ++ pStdLibParser->Write(libXmlFile, groupName);
3467 ++ delete pStdLibParser;
3468 ++
3469 ++ // - Clean up - //
3470 ++ delete pCollection;
3471 ++ return 0;
3472 ++ }
3473 ++ ///////////
3474 ++
3475 + stdFrag* pStdFrag = pStdGroup->addStdFrag();
3476 + if (!pStdFrag) {
3477 + std::cout << " Incorrect use of prep2xml " << std::endl;
3478 +@@ -322,6 +346,15 @@
3479 + pPrepParser->Read(prepFile, pStdFrag);
3480 + delete pPrepParser;
3481 +
3482 ++ if (bConvertOnly) {
3483 ++ pStdLibParser->Write(libXmlFile, groupName);
3484 ++ delete pStdLibParser;
3485 ++
3486 ++ // - Clean up - //
3487 ++ delete pCollection;
3488 ++ return 0;
3489 ++ }
3490 ++
3491 + int f = pStdFrag->generateCoordinates();
3492 + if (f) {
3493 + std::cout << " Incorrect use of prep2xml " << std::endl;
3494 +@@ -443,7 +476,7 @@
3495 + // atoms
3496 + for (unsigned int i = 0; i < atomList.size(); i++) {
3497 + stdAtoms[i]->kind = atomList[i]->getType();
3498 +- std::cout << atomList[i]->getIndex() << " " << atomList[i]->getName() << " " << atomList[i]->getType() << std::endl;
3499 ++ //std::cout << atomList[i]->getIndex() << " " << atomList[i]->getName() << " " << atomList[i]->getType() << std::endl;
3500 + }
3501 +
3502 + // bonds
3503 +diff -urN amber11.orig/AmberTools/src/mtkpp/tools/stdLib2Sdf.cpp amber11/AmberTools/src/mtkpp/tools/stdLib2Sdf.cpp
3504 +--- amber11.orig/AmberTools/src/mtkpp/tools/stdLib2Sdf.cpp 2011-04-14 15:30:19.000000000 +0300
3505 ++++ amber11/AmberTools/src/mtkpp/tools/stdLib2Sdf.cpp 2012-03-03 20:03:01.418032565 +0200
3506 +@@ -42,6 +42,9 @@
3507 + // - COMMAND LINE OPTIONS
3508 + #include "Parsers/commLineOptions.h"
3509 +
3510 ++// - Log
3511 ++#include "Log/errorHandler.h"
3512 ++
3513 + // temp
3514 + #include "time.h"
3515 +
3516 +@@ -174,7 +177,7 @@
3517 + }
3518 +
3519 + // Set errorLog stream to the log file
3520 +- //MTKpp::errorLogger.setStream(&oLog);
3521 ++ MTKpp::errorLogger.setStream(&oLog);
3522 +
3523 + // Print MTK++ copyright message
3524 + printHeader(oLog, prog_name, authors);
3525 +diff -urN amber11.orig/AmberTools/src/pbsa/pb_list.f amber11/AmberTools/src/pbsa/pb_list.f
3526 +--- amber11.orig/AmberTools/src/pbsa/pb_list.f 2011-04-14 15:30:19.000000000 +0300
3527 ++++ amber11/AmberTools/src/pbsa/pb_list.f 2012-03-03 20:02:55.131034376 +0200
3528 +@@ -949,7 +949,7 @@
3529 + ymin == ZERO .and. ymax == ZERO .and. &
3530 + zmin == ZERO .and. zmax == ZERO ) newbox = .true.
3531 +
3532 +- if ( newbox ) then
3533 ++ if ( .not. ligand ) then
3534 + if ( ifcap == 0 .or. ifcap == 5 ) then
3535 + xmin = 9999.0; ymin = 9999.0; zmin = 9999.0
3536 + xmax = -9999.0; ymax = -9999.0; zmax = -9999.0
3537 +diff -urN amber11.orig/AmberTools/src/rism/safemem.f amber11/AmberTools/src/rism/safemem.f
3538 +--- amber11.orig/AmberTools/src/rism/safemem.f 2012-03-03 22:43:02.986777264 +0200
3539 ++++ amber11/AmberTools/src/rism/safemem.f 2012-03-03 20:02:52.131035237 +0200
3540 +@@ -62,7 +62,7 @@
3541 + !BYTES_PER_KILOBYTES :: used to convert between bytes and KB
3542 + integer*8,parameter :: BYTES_PER_KB = 1024**1
3543 +
3544 +- type(memTracker),private :: totalMem
3545 ++ type(memTracker),save,private :: totalMem
3546 +
3547 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
3548 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!