Partial commit of the project to remove all static variables.
authorlindahl <lindahl>
Wed, 6 Nov 2002 09:46:18 +0000 (09:46 +0000)
committerlindahl <lindahl>
Wed, 6 Nov 2002 09:46:18 +0000 (09:46 +0000)
Implemented several new input variables.
Started work on Andersen temperature coupling, and a framework for
Generalized-Born type potentials.
Added function types for fourier dihedrals, Amber/OPLS impropers and
dihedral restraints (not yet working).

557 files changed:
acinclude.m4
configure.ac
include/3dview.h
include/Makefile.am
include/assert.h
include/atomprop.h
include/axp_asm.h
include/binio.h [new file with mode: 0644]
include/block_tx.h
include/bondf.h
include/calcgrid.h
include/calch.h
include/calcmu.h
include/callf77.h
include/confio.h
include/constr.h
include/copyrite.h
include/detectcpu.h
include/disre.h
include/do_fit.h
include/do_md.h
include/dummies.h
include/ebin.h
include/edsam.h
include/enxio.h
include/ewald.h
include/ewald_util.h
include/fatal.h
include/ffscanf.h
include/fftgrid.h
include/fftw_wrapper.h
include/filenm.h
include/force.h
include/futil.h
include/gbutil.h
include/gmxcomplex.h
include/gmxfio.h
include/grompp.h
include/gstat.h
include/index.h
include/init.h
include/invblock.h
include/macros.h
include/magic.h
include/main.h
include/maths.h
include/matio.h
include/mdatoms.h
include/mdebin.h
include/mdrun.h
include/metacode.h
include/mshift.h
include/mvdata.h
include/names.h
include/network.h
include/nhash.h
include/nr.h
include/nrama.h
include/nrjac.h
include/nrnb.h
include/ns.h
include/nsb.h
include/nsgrid.h
include/orires.h
include/pbc.h
include/pdbio.h
include/pdebug.h
include/physics.h
include/pme.h
include/ppc_altivec.h
include/pppm.h
include/princ.h
include/pull.h
include/random.h
include/rbin.h
include/rdgroup.h
include/readcomp.h
include/readinp.h
include/renum.h
include/reorder.h
include/rmpbc.h
include/rwtop.h [deleted file]
include/sheader.h
include/shift.h
include/shift_util.h
include/smalloc.h
include/sortwater.h
include/split.h
include/statusio.h
include/statutil.h
include/strdb.h
include/string2.h
include/struc2.h
include/superb.h
include/symtab.h
include/sysstuff.h
include/tags.h
include/tgroup.h
include/tpxio.h
include/transfer.h
include/trnio.h
include/txtdump.h
include/typedefs.h
include/types/atoms.h
include/types/enums.h
include/types/fcdata.h
include/types/forcerec.h
include/types/graph.h
include/types/idef.h
include/types/ifunc.h
include/types/inputrec.h
include/types/nrnb.h
include/types/topology.h
include/update.h
include/utils.h
include/vcm.h
include/vec.h
include/viewit.h
include/wgms.h
include/wman.h
include/writeps.h
include/x86_3dnow.h
include/x86_sse.h
include/x86_sse2.h
include/xdrf.h
include/xtcio.h
include/xvgr.h
share/template/Makefile.am
share/template/README
share/top/ffgmxnb.itp
share/top/ffoplsaa.rtp
share/top/methanol.itp
src/contrib/addquote.c
src/contrib/anaf.c
src/contrib/calcfdev.c
src/contrib/copyrgt.c
src/contrib/do_shift.c
src/contrib/dsspcore.c
src/contrib/ehanal.c
src/contrib/ehdata.c
src/contrib/ehdata.h
src/contrib/ehole.c
src/contrib/g_anavel.c
src/contrib/glasmd.c
src/contrib/hexamer.c
src/contrib/hrefify.c
src/contrib/mk6_n.c
src/contrib/mkice.c
src/contrib/mkyaw.c
src/contrib/my_dssp.c
src/contrib/options.c
src/contrib/optwat.c
src/contrib/prfn.c
src/contrib/sigeps.c
src/contrib/test.c
src/gmxlib/3dview.c
src/gmxlib/Makefile.am
src/gmxlib/atomprop.c
src/gmxlib/block_tx.c
src/gmxlib/bondfree.c
src/gmxlib/calcgrid.c
src/gmxlib/calch.c
src/gmxlib/cinvsqrtdata.c
src/gmxlib/confio.c
src/gmxlib/copyrite.c
src/gmxlib/crecipdata.c
src/gmxlib/debugb.h
src/gmxlib/detectcpu.c
src/gmxlib/disre.c
src/gmxlib/dlb.h
src/gmxlib/do_fit.c
src/gmxlib/enxio.c
src/gmxlib/ewald_util.c
src/gmxlib/f77_wrappers.c
src/gmxlib/fatal.c
src/gmxlib/ffscanf.c
src/gmxlib/filenm.c
src/gmxlib/fnbf.c
src/gmxlib/four1.c
src/gmxlib/fourn.c
src/gmxlib/ftocstr.c
src/gmxlib/futil.c
src/gmxlib/gbutil.c
src/gmxlib/gmxfio.c
src/gmxlib/ifunc.c
src/gmxlib/index.c
src/gmxlib/inner.h
src/gmxlib/inner_altivec.c
src/gmxlib/invblock.c
src/gmxlib/libxdrf.c
src/gmxlib/macros.c
src/gmxlib/main.c
src/gmxlib/maths.c
src/gmxlib/matio.c
src/gmxlib/metacode.c
src/gmxlib/mgmx.c
src/gmxlib/mgmxtest.c
src/gmxlib/minvert.c
src/gmxlib/minvert.h
src/gmxlib/mkinl.c
src/gmxlib/mkinl.h
src/gmxlib/mkinl_calcdist.c
src/gmxlib/mkinl_declarations.c
src/gmxlib/mkinl_fortrandata.h
src/gmxlib/mkinl_innerloop.c
src/gmxlib/mkinl_interactions.c
src/gmxlib/mkinl_invsqrt.c
src/gmxlib/mkinl_outerloop.c
src/gmxlib/mkinl_recip.c
src/gmxlib/mshift.c
src/gmxlib/mvdata.c
src/gmxlib/mvxvf.c
src/gmxlib/names.c
src/gmxlib/network.c
src/gmxlib/nrama.c
src/gmxlib/nrjac.c
src/gmxlib/nrnb.c
src/gmxlib/orires.c
src/gmxlib/pargs.c
src/gmxlib/pbc.c
src/gmxlib/pdbio.c
src/gmxlib/princ.c
src/gmxlib/rando.c
src/gmxlib/random.c
src/gmxlib/rbin.c
src/gmxlib/rdgroup.c
src/gmxlib/readinp.c
src/gmxlib/repfirst.c
src/gmxlib/replace.c
src/gmxlib/replace.h
src/gmxlib/rmpbc.c
src/gmxlib/sheader.c
src/gmxlib/shift_util.c
src/gmxlib/smalloc.c
src/gmxlib/sortwater.c
src/gmxlib/stat.c
src/gmxlib/statutil.c
src/gmxlib/strdb.c
src/gmxlib/string2.c
src/gmxlib/symtab.c
src/gmxlib/testfft.c
src/gmxlib/testlr.c
src/gmxlib/testtab.c
src/gmxlib/testxml.c
src/gmxlib/threadsync.c
src/gmxlib/tpxio.c
src/gmxlib/trnio.c
src/gmxlib/trxio.c
src/gmxlib/tstsqrtc.c
src/gmxlib/txtdump.c
src/gmxlib/typedefs.c
src/gmxlib/vec.c
src/gmxlib/viewit.c
src/gmxlib/wgms.c
src/gmxlib/widget.c
src/gmxlib/widget.h
src/gmxlib/wman.c
src/gmxlib/writeps.c
src/gmxlib/x86_sse.s
src/gmxlib/xdrd.c
src/gmxlib/xmlio.c
src/gmxlib/xmlio.h
src/gmxlib/xtcio.c
src/gmxlib/xvgr.c
src/kernel/add_par.c
src/kernel/add_par.h
src/kernel/convparm.c
src/kernel/convparm.h
src/kernel/do_gct.c
src/kernel/dum_parm.c
src/kernel/dum_parm.h
src/kernel/ffscan.c
src/kernel/gctio.c
src/kernel/gen_ad.c
src/kernel/gen_ad.h
src/kernel/gen_dum.c
src/kernel/gen_dum.h
src/kernel/genhydro.c
src/kernel/genhydro.h
src/kernel/glaasje.c
src/kernel/glaasje.h
src/kernel/gmxcheck.c
src/kernel/gmxdump.c
src/kernel/grompp.c
src/kernel/h_db.c
src/kernel/h_db.h
src/kernel/hackblock.c
src/kernel/hackblock.h
src/kernel/hizzie.c
src/kernel/hizzie.h
src/kernel/init_sh.c
src/kernel/ion_data.h
src/kernel/ionize.c
src/kernel/ionize.h
src/kernel/luck.c
src/kernel/md.c
src/kernel/mdrun.c
src/kernel/mk_ghat.c
src/kernel/nm2type.c
src/kernel/pdb2gmx.c
src/kernel/pdb2top.c
src/kernel/pdb2top.h
src/kernel/pgutil.c
src/kernel/pgutil.h
src/kernel/protonate.c
src/kernel/readir.c
src/kernel/readir.h
src/kernel/relax_sh.c
src/kernel/resall.c
src/kernel/resall.h
src/kernel/rtp2xml.c
src/kernel/sorting.c
src/kernel/sorting.h
src/kernel/specbond.c
src/kernel/specbond.h
src/kernel/splitter.c
src/kernel/splitter.h
src/kernel/ter_db.c
src/kernel/ter_db.h
src/kernel/tomorse.c
src/kernel/topcat.c
src/kernel/topcat.h
src/kernel/topdef.h
src/kernel/topdirs.c
src/kernel/topdirs.h
src/kernel/topexcl.c
src/kernel/topexcl.h
src/kernel/topio.c
src/kernel/topio.h
src/kernel/toppush.c
src/kernel/toppush.h
src/kernel/topshake.c
src/kernel/topshake.h
src/kernel/toputil.c
src/kernel/toputil.h
src/kernel/tpbcmp.c
src/kernel/tpbcmp.h
src/kernel/tpbconv.c
src/kernel/x2top.c
src/kernel/x2top.h
src/kernel/xlate.c
src/kernel/xlate.h
src/kernel/xmdrun.h
src/kernel/xutils.c
src/mdlib/Makefile.am
src/mdlib/calcmu.c
src/mdlib/calcvir.c
src/mdlib/callf77.c
src/mdlib/clincs.c
src/mdlib/compnl.c
src/mdlib/constr.c
src/mdlib/coupling.c
src/mdlib/csettle.c
src/mdlib/dummies.c
src/mdlib/ebin.c
src/mdlib/edsam.c
src/mdlib/ewald.c
src/mdlib/fftgrid.c
src/mdlib/force.c
src/mdlib/ghat.c
src/mdlib/init.c
src/mdlib/mdatom.c
src/mdlib/mdebin.c
src/mdlib/minimize.c
src/mdlib/ns.c
src/mdlib/nsb.c
src/mdlib/nsgrid.c
src/mdlib/pme.c
src/mdlib/pppm.c
src/mdlib/pull.c
src/mdlib/pull_internal.h
src/mdlib/pullinit.c
src/mdlib/pullio.c
src/mdlib/pullutil.c
src/mdlib/shakef.c
src/mdlib/sim_util.c
src/mdlib/splittop.c
src/mdlib/splittop.h
src/mdlib/tables.c
src/mdlib/tgroup.c
src/mdlib/timefft.c
src/mdlib/update.c
src/mdlib/vcm.c
src/mdlib/wnblist.c
src/mdlib/wnblist.h
src/ngmx/Xstuff.h
src/ngmx/alert.bm
src/ngmx/buttons.c
src/ngmx/buttons.h
src/ngmx/dialogs.c
src/ngmx/dialogs.h
src/ngmx/dlg.c
src/ngmx/ff.bm
src/ngmx/fgrid.c
src/ngmx/fgrid.h
src/ngmx/filter.c
src/ngmx/gmxlogo.c
src/ngmx/gromacs.bm
src/ngmx/highway.c
src/ngmx/info.bm
src/ngmx/logo.c
src/ngmx/logo.h
src/ngmx/manager.c
src/ngmx/manager.h
src/ngmx/molps.c
src/ngmx/molps.h
src/ngmx/nener.c
src/ngmx/nener.h
src/ngmx/ngmx.c
src/ngmx/nleg.c
src/ngmx/nleg.h
src/ngmx/nload.c
src/ngmx/nload.h
src/ngmx/nmol.c
src/ngmx/nmol.h
src/ngmx/play.bm
src/ngmx/popup.c
src/ngmx/popup.h
src/ngmx/pulldown.c
src/ngmx/pulldown.h
src/ngmx/rewind.bm
src/ngmx/scrollw.c
src/ngmx/showcol.c
src/ngmx/stop.bm
src/ngmx/stop_ani.bm
src/ngmx/vbox.c
src/ngmx/x11.c
src/ngmx/x11.h
src/ngmx/xdlg.c
src/ngmx/xdlg.h
src/ngmx/xdlghi.c
src/ngmx/xdlghi.h
src/ngmx/xdlgitem.c
src/ngmx/xdlgitem.h
src/ngmx/xmb.c
src/ngmx/xmb.h
src/ngmx/xrama.c
src/ngmx/xstat.c
src/ngmx/xutil.c
src/ngmx/xutil.h
src/tools/addconf.c
src/tools/addconf.h
src/tools/anadih.c
src/tools/angstat.h
src/tools/autocorr.c
src/tools/average.c
src/tools/bondlist.c
src/tools/calcpot.c
src/tools/calcpot.h
src/tools/cdist.c
src/tools/cdist.h
src/tools/cmat.c
src/tools/cmat.h
src/tools/correct.c
src/tools/disco.c
src/tools/disco.h
src/tools/discopar.c
src/tools/dlist.c
src/tools/do_dssp.c
src/tools/dtools.c
src/tools/editconf.c
src/tools/edittop.c
src/tools/eigio.c
src/tools/eigio.h
src/tools/eneconv.c
src/tools/expfit.c
src/tools/fitahx.c
src/tools/fitahx.h
src/tools/g_anaeig.c
src/tools/g_analyze.c
src/tools/g_angle.c
src/tools/g_bond.c
src/tools/g_bundle.c
src/tools/g_chi.c
src/tools/g_cluster.c
src/tools/g_clustsize.c
src/tools/g_com.c
src/tools/g_confrms.c
src/tools/g_covar.c
src/tools/g_density.c
src/tools/g_dielectric.c
src/tools/g_dih.c
src/tools/g_dipoles.c
src/tools/g_disre.c
src/tools/g_dist.c
src/tools/g_dyndom.c
src/tools/g_enemat.c
src/tools/g_energy.c
src/tools/g_gyrate.c
src/tools/g_h2order.c
src/tools/g_hbond.c
src/tools/g_helix.c
src/tools/g_lie.c
src/tools/g_mdmat.c
src/tools/g_mindist.c
src/tools/g_morph.c
src/tools/g_msd.c
src/tools/g_multipoles.c
src/tools/g_nmeig.c
src/tools/g_nmens.c
src/tools/g_order.c
src/tools/g_potential.c
src/tools/g_rama.c
src/tools/g_rdf.c
src/tools/g_relax.c
src/tools/g_rms.c
src/tools/g_rmsdist.c
src/tools/g_rmsf.c
src/tools/g_rotacf.c
src/tools/g_run_rms.c
src/tools/g_saltbr.c
src/tools/g_sas.c
src/tools/g_sgangle.c
src/tools/g_sorient.c
src/tools/g_tcaf.c
src/tools/g_traj.c
src/tools/g_velacc.c
src/tools/g_wham.c
src/tools/genbox.c
src/tools/genconf.c
src/tools/gendr.c
src/tools/genion.c
src/tools/genpr.c
src/tools/hxprops.c
src/tools/hxprops.h
src/tools/levenmar.c
src/tools/lsq.c
src/tools/luck.c
src/tools/make_ndx.c
src/tools/mcprop.c
src/tools/mcprop.h
src/tools/mk_angndx.c
src/tools/my_rdf.c
src/tools/nsc.c
src/tools/nsc.h
src/tools/orise.c
src/tools/orise.h
src/tools/pinput.c
src/tools/pinput.h
src/tools/polynomials.c
src/tools/pp2shift.c
src/tools/proptim.c
src/tools/ql77.c
src/tools/ql77.h
src/tools/readev.c
src/tools/readev.h
src/tools/recomb.c
src/tools/recomb.h
src/tools/residues.c
src/tools/sas2mat.c
src/tools/smooth.c
src/tools/testacf.c
src/tools/trjcat.c
src/tools/trjconv.c
src/tools/trjorder.c
src/tools/wheel.c
src/tools/xpm2ps.c

index 252ca4ed400fd83867452cc64df3f32b2904e787..4390e0f92c9c9095dd5377145981f503b0aafcf2 100644 (file)
@@ -887,6 +887,234 @@ fi
 ])
 
 
+dnl @synopsis ACX_PTHREAD([ACTION-IF-FOUND[, ACTION-IF-NOT-FOUND]])
+dnl
+dnl This macro figures out how to build C programs using POSIX
+dnl threads. It sets the PTHREAD_LIBS output variable to the threads
+dnl library and linker flags, and the PTHREAD_CFLAGS output variable
+dnl to any special C compiler flags that are needed. (The user can also
+dnl force certain compiler flags/libs to be tested by setting these
+dnl environment variables.)
+dnl
+dnl Also sets PTHREAD_CC to any special C compiler that is needed for
+dnl multi-threaded programs (defaults to the value of CC otherwise).
+dnl (This is necessary on AIX to use the special cc_r compiler alias.)
+dnl
+dnl If you are only building threads programs, you may wish to
+dnl use these variables in your default LIBS, CFLAGS, and CC:
+dnl
+dnl LIBS="$PTHREAD_LIBS $LIBS"
+dnl CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+dnl CC="$PTHREAD_CC"
+dnl
+dnl In addition, if the PTHREAD_CREATE_JOINABLE thread-attribute
+dnl constant has a nonstandard name, defines PTHREAD_CREATE_JOINABLE
+dnl to that name (e.g. PTHREAD_CREATE_UNDETACHED on AIX).
+dnl
+dnl ACTION-IF-FOUND is a list of shell commands to run if a threads
+dnl library is found, and ACTION-IF-NOT-FOUND is a list of commands
+dnl to run it if it is not found. If ACTION-IF-FOUND is not specified,
+dnl the default action will define HAVE_PTHREAD.
+dnl
+dnl Please let the authors know if this macro fails on any platform,
+dnl or if you have any other suggestions or comments. This macro was
+dnl based on work by SGJ on autoconf scripts for FFTW (www.fftw.org)
+dnl (with help from M. Frigo), as well as ac_pthread and hb_pthread
+dnl macros posted by AFC to the autoconf macro repository. We are also
+dnl grateful for the helpful feedback of numerous users.
+dnl
+dnl @version $Id$
+dnl @author Steven G. Johnson <stevenj@alum.mit.edu> and Alejandro Forero Cuervo <bachue@bachue.com>
+
+AC_DEFUN([ACX_PTHREAD], [
+AC_REQUIRE([AC_CANONICAL_HOST])
+AC_LANG_SAVE
+AC_LANG_C
+acx_pthread_ok=no
+
+# We used to check for pthread.h first, but this fails if pthread.h
+# requires special compiler flags (e.g. on True64 or Sequent).
+# It gets checked for in the link test anyway.
+
+# First of all, check if the user has set any of the PTHREAD_LIBS,
+# etcetera environment variables, and if threads linking works using
+# them:
+if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
+        AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test x"$acx_pthread_ok" = xno; then
+                PTHREAD_LIBS=""
+                PTHREAD_CFLAGS=""
+        fi
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+fi
+
+# We must check for the threads library under a number of different
+# names; the ordering is very important because some systems
+# (e.g. DEC) have both -lpthread and -lpthreads, where one of the
+# libraries is broken (non-POSIX).
+
+# Create a list of thread flags to try. Items starting with a "-" are
+# C compiler flags, and other items are library names, except for "none"
+# which indicates that we try without any flags at all.
+
+acx_pthread_flags="pthreads none -Kthread -kthread lthread -pthread -pthreads -mthreads pthread --thread-safe -mt"
+
+# The ordering *is* (sometimes) important. Some notes on the
+# individual items follow:
+
+# pthreads: AIX (must check this before -lpthread)
+# none: in case threads are in libc; should be tried before -Kthread and
+# other compiler flags to prevent continual compiler warnings
+# -Kthread: Sequent (threads in libc, but -Kthread needed for pthread.h)
+# -kthread: FreeBSD kernel threads (preferred to -pthread since SMP-able)
+# lthread: LinuxThreads port on FreeBSD (also preferred to -pthread)
+# -pthread: Linux/gcc (kernel threads), BSD/gcc (userland threads)
+# -pthreads: Solaris/gcc
+# -mthreads: Mingw32/gcc, Lynx/gcc
+# -mt: Sun Workshop C (may only link SunOS threads [-lthread], but it
+# doesn't hurt to check since this sometimes defines pthreads too;
+# also defines -D_REENTRANT)
+# pthread: Linux, etcetera
+# --thread-safe: KAI C++
+
+case "${host_cpu}-${host_os}" in
+        *solaris*)
+
+        # On Solaris (at least, for some versions), libc contains stubbed
+        # (non-functional) versions of the pthreads routines, so link-based
+        # tests will erroneously succeed. (We need to link with -pthread or
+        # -lpthread.) (The stubs are missing pthread_cleanup_push, or rather
+        # a function called by this macro, so we could check for that, but
+        # who knows whether they'll stub that too in a future libc.) So,
+        # we'll just look for -pthreads and -lpthread first:
+
+        acx_pthread_flags="-pthread -pthreads pthread -mt $acx_pthread_flags"
+        ;;
+esac
+
+if test x"$acx_pthread_ok" = xno; then
+for flag in $acx_pthread_flags; do
+
+        case $flag in
+                none)
+                AC_MSG_CHECKING([whether pthreads work without any flags])
+                ;;
+
+                -*)
+                AC_MSG_CHECKING([whether pthreads work with $flag])
+                PTHREAD_CFLAGS="$flag"
+                ;;
+
+                *)
+                AC_MSG_CHECKING([for the pthreads library -l$flag])
+                PTHREAD_LIBS="-l$flag"
+                ;;
+        esac
+
+        save_LIBS="$LIBS"
+        save_CFLAGS="$CFLAGS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Check for various functions. We must include pthread.h,
+        # since some functions may be macros. (On the Sequent, we
+        # need a special flag -Kthread to make this header compile.)
+        # We check for pthread_join because it is in -lpthread on IRIX
+        # while pthread_create is in libc. We check for pthread_attr_init
+        # due to DEC craziness with -lpthreads. We check for
+        # pthread_cleanup_push because it is one of the few pthread
+        # functions on Solaris that doesn't have a non-functional libc stub.
+        # We try pthread_create on general principles.
+        AC_TRY_LINK([#include <pthread.h>],
+                    [pthread_t th; pthread_join(th, 0);
+                     pthread_attr_init(0); pthread_cleanup_push(0, 0);
+                     pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
+                    [acx_pthread_ok=yes])
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        AC_MSG_RESULT($acx_pthread_ok)
+        if test "x$acx_pthread_ok" = xyes; then
+                break;
+        fi
+
+        PTHREAD_LIBS=""
+        PTHREAD_CFLAGS=""
+done
+fi
+
+# Various other checks:
+if test "x$acx_pthread_ok" = xyes; then
+        save_LIBS="$LIBS"
+        LIBS="$PTHREAD_LIBS $LIBS"
+        save_CFLAGS="$CFLAGS"
+        CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
+
+        # Detect AIX lossage: threads are created detached by default
+        # and the JOINABLE attribute has a nonstandard name (UNDETACHED).
+        AC_MSG_CHECKING([for joinable pthread attribute])
+        AC_TRY_LINK([#include <pthread.h>],
+                    [int attr=PTHREAD_CREATE_JOINABLE;],
+                    ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
+        if test x"$ok" = xunknown; then
+                AC_TRY_LINK([#include <pthread.h>],
+                            [int attr=PTHREAD_CREATE_UNDETACHED;],
+                            ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
+        fi
+        if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
+                AC_DEFINE(PTHREAD_CREATE_JOINABLE, $ok,
+                          [Define to the necessary symbol if this constant
+                           uses a non-standard name on your system.])
+        fi
+        AC_MSG_RESULT(${ok})
+        if test x"$ok" = xunknown; then
+                AC_MSG_WARN([we do not know how to create joinable pthreads])
+        fi
+
+        AC_MSG_CHECKING([if more special flags are required for pthreads])
+        flag=no
+        case "${host_cpu}-${host_os}" in
+                *-aix* | *-freebsd*) flag="-D_THREAD_SAFE";;
+                *solaris* | alpha*-osf*) flag="-D_REENTRANT";;
+        esac
+        AC_MSG_RESULT(${flag})
+        if test "x$flag" != xno; then
+                PTHREAD_CFLAGS="$flag $PTHREAD_CFLAGS"
+        fi
+
+        LIBS="$save_LIBS"
+        CFLAGS="$save_CFLAGS"
+
+        # More AIX lossage: must compile with cc_r
+        AC_CHECK_PROG(PTHREAD_CC, cc_r, cc_r, ${CC})
+else
+        PTHREAD_CC="$CC"
+fi
+
+AC_SUBST(PTHREAD_LIBS)
+AC_SUBST(PTHREAD_CFLAGS)
+AC_SUBST(PTHREAD_CC)
+
+# Finally, execute ACTION-IF-FOUND/ACTION-IF-NOT-FOUND:
+if test x"$acx_pthread_ok" = xyes; then
+        ifelse([$1],,AC_DEFINE(HAVE_PTHREAD,1,[Define if you have POSIX threads libraries and header files.]),[$1])
+        :
+else
+        acx_pthread_ok=no
+        $2
+fi
+AC_LANG_RESTORE
+])dnl ACX_PTHREAD 
+
+
 
 #
 # Below, we include our patched version of libtool.m4, from 
index f6eef78564aed36c1cb2c26a1dfb1754ce4a7223..d43e79ba81a91b151a3b92aac0b9317e4d5ea2fe 100644 (file)
@@ -3,12 +3,12 @@
 #######################################################################
 
 AC_PREREQ(2.50)
-AC_INIT(GROMACS, 3.1.99_20020920, gmx-users@gromacs.org)
+AC_INIT(GROMACS, 3.1.99_20021031, gmx-users@gromacs.org)
 AC_CONFIG_SRCDIR(src/gmxlib/3dview.c)
 AC_CONFIG_AUX_DIR(config)
 AC_CANONICAL_HOST
 
-AM_INIT_AUTOMAKE(gromacs, 3.1.99_20020920)
+AM_INIT_AUTOMAKE(gromacs, 3.1.99_20021031)
 AC_PREFIX_DEFAULT(/usr/local/gromacs)
 AM_CONFIG_HEADER(src/config.h)
 dnl This is the version info according to the libtool versioning system.
@@ -59,6 +59,10 @@ AC_SUBST(F77LINK,"\$(LINK)")
 AC_ARG_ENABLE(mpi,
  [  --enable-mpi                  compile for parallel runs using MPI],,enable_mpi=no)
 
+### Threads
+AC_ARG_ENABLE(threads,
+ [  --disable-threads             don't try to use multithreading],,enable_threads=yes)
+
 
 ### MPI environment
 AC_ARG_ENABLE(mpi-environment,
@@ -209,7 +213,7 @@ if test -z "$CC_FOR_BUILD"; then
 fi
 AC_SUBST(CC_FOR_BUILD) 
 
-if test "$enable_fortran" = "yes"; then
+if test "$enable_fortran" = "yes"; then 
   AC_PROG_F77( $f77_names )
   if test -z "$F77"; then
     AC_MSG_ERROR([No fortran compiler found])
@@ -239,6 +243,12 @@ if test "$enable_mpi" = "yes"; then
   AC_DEFINE(USE_MPI,,[Make a parallel version of GROMACS using MPI])
 fi
 
+if test "$enable_threads" = "yes"; then
+   AC_MSG_CHECKING([for pthreads])
+   AC_MSG_RESULT([yes])
+#  ACX_PTHREAD([],AC_MSG_ERROR([Cannot compile with pthreads; use --disable-threads])
+fi
+
 if test "$enable_fortran" = "yes"; then
   AC_F77_LIBRARY_LDFLAGS
   AC_F77_WRAPPERS
index c27b1dd30628108889356b5c5c865793a89bf9a6..48ecfcdd857af45c8aaf3d7c0b7c1cc1c8caba8f 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _3dview_h
 #define _3dview_h
 
-static char *SRCID_3dview_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -47,13 +46,15 @@ typedef real vec4[4];
 typedef real mat4[4][4];
 
 typedef int  iv2[2];
-
 typedef struct {
   matrix box;
   vec4   eye,origin;   /* The eye and origin position          */
   mat4   proj;         /* Projection matrix                    */
   mat4   Rot;           /* Total rotation matrix                */
   real   sc_x,sc_y;    /* Scaling for aspect ratio             */
+  mat4   RotP[DIM];     /* state for 3d rotations  */
+  mat4   RotM[DIM];
 } t_3dview;
 
 extern void print_m4(FILE *fp,char *s,mat4 A);
@@ -92,6 +93,9 @@ extern bool zoom_3d(t_3dview *view,real fac);
  * FALSE otherwise.
  */
 
+extern void init_rotate_3d(t_3dview *view);
+/* Initiates the state of 3d rotation matrices in the structure */
+
 extern void rotate_3d(t_3dview *view,int axis,bool bPositive);
 /* Rotate the eye around the center of the box, around axis */
 
index 7c8e05691b5073140aca470185f1ae25c357fdff..f02bb131a592699e30ec49fa2fcfa044a332d6f5 100644 (file)
@@ -7,36 +7,36 @@ SUBDIRS = . types
 
 include_HEADERS = \
        3dview.h        do_md.h         invblock.h      nrjac.h         \
-       rwtop.h         tpxio.h         assert.h                        \
+       rwtop.h         tpxio.h         assert.h        dihre.h         \
        nrnb.h          sheader.h       transfer.h      \
-       atomprop.h      dummies.h       list.h          ns.h            \
+       atomprop.h      dummies.h       ns.h            \
        shift.h         trnio.h         axp_asm.h       ebin.h          \
        macros.h        nsb.h           shift_util.h    txtdump.h       \
-       binio.h         edsam.h         magic.h         nsgrid.h        \
+       edsam.h         magic.h         nsgrid.h        \
        typedefs.h      block_tx.h      enxio.h         \
        main.h          pbc.h           smalloc.h       update.h        \
        bondf.h         ewald.h         maths.h         pdbio.h         \
-       sortwater.h     utils.h         buffer.h        ewald_util.h    \
+       sortwater.h     utils.h         ewald_util.h    \
        matio.h         pdebug.h        split.h         vcm.h           \
        calcgrid.h      fatal.h         mdatoms.h       physics.h       \
        vec.h           calch.h         ffscanf.h       mdebin.h        \
        pme.h           statusio.h      viewit.h        calcmu.h        \
        fftgrid.h       mdrun.h         pppm.h          statutil.h      \
-       vveclib.h       callf77.h       fftw_wrapper.h  memdump.h       \
+       callf77.h       fftw_wrapper.h  \
        princ.h         wgms.h          gmx_system_xdr.h                \
-       filenm.h        memtab.h        pull.h          strdb.h         \
-       wman.h          comlib.h        force.h         memtest.h       \
+       filenm.h        pull.h          strdb.h         \
+       wman.h          force.h      \
        string2.h       writeps.h       gmxcomplex.h    \
        futil.h         metacode.h      random.h        struc2.h        \
-       x86_3dnow.h     comtest.h       gbutil.h                \
-       rbin.h          superb.h        detectcpu.h     tgroup.h        \
-       general.h       mshift.h        rdgroup.h       symtab.h        \
-       x86_sse.h       confio.h        gmxfio.h        mvdata.h        \
-       rdklib.h        sync.h          xdrf.h          constr.h        \
-       grompp.h        names.h         readcomp.h      synclib.h       \
+       x86_3dnow.h     gbutil.h                \
+       rbin.h          detectcpu.h     tgroup.h        \
+       mshift.h        rdgroup.h       symtab.h        \
+       x86_sse.h       confio.h        gmxfio.h                \
+       xdrf.h          constr.h        \
+       grompp.h        names.h         readcomp.h              \
        xtcio.h         copyrite.h      gstat.h         network.h       \
-       readinp.h       sysstuff.h      xvgr.h          delay.h         \
-       index.h         nhash.h         renum.h         systest.h       \
+       readinp.h       sysstuff.h      xvgr.h                  \
+       index.h         mvdata.h    \
        disre.h         orires.h        x86_sse2.h      \
        init.h          nr.h            reorder.h       \
        tags.h          do_fit.h        nrama.h         \
index 37ddddeefb0edc90117a53282727cdaa86300157..7ab60bc5aca8776f687374eb30c15b3185b92a6f 100644 (file)
 #ifndef _assert_h
 #define _assert_h
 
-static char *SRCID_assert_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) assert.h 1.12 11/23/92"
-#endif /* HAVE_IDENT */
-
 #include <ctype.h>
 #include "sysstuff.h"
 
index b213ccae78902202e48990aa897ec224987ab55a..3d477825049600cbf3dd2f3e82bb5868d795f09a 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Grunge ROck MAChoS
  */
-static char *SRCID_atomprop_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index d9d10466b77384b6a5d5a5a3b82c1f782f8f1d74..1d75828254a4152b7149751678e126bf053dc120 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _axp_asm_h
 #define _axp_asm_h
 
-static char *SRCID_axp_asm_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
diff --git a/include/binio.h b/include/binio.h
new file mode 100644 (file)
index 0000000..cdf1e28
--- /dev/null
@@ -0,0 +1,90 @@
+/*
+ * $Id$
+ * 
+ *                This source code is part of
+ * 
+ *                 G   R   O   M   A   C   S
+ * 
+ *          GROningen MAchine for Chemical Simulations
+ * 
+ *                        VERSION 3.1
+ * Copyright (c) 1991-2001, University of Groningen, The Netherlands
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ * 
+ * If you want to redistribute modifications, please consider that
+ * scientific software is very special. Version control is crucial -
+ * bugs must be traceable. We will be happy to consider code for
+ * inclusion in the official distribution, but derived work must not
+ * be called official GROMACS. Details are found in the README & COPYING
+ * files - if they are missing, get the official version at www.gromacs.org.
+ * 
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the papers on the package - you can find them in the top README file.
+ * 
+ * For more info, check our website at http://www.gromacs.org
+ * 
+ * And Hey:
+ * Grunge ROck MAChoS
+ */
+
+#ifndef _binio_h
+#define _binio_h
+
+static char *SRCID_binio_h = "$Id$";
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_IDENT
+#ident "@(#) binio.h 1.5 11/23/92"
+#endif /* HAVE_IDENT */
+
+#include <stdio.h>
+#include "sysstuff.h"
+#include "fatal.h"
+
+/*
+ *    Module to binary write and read.
+ *
+ *                                        @                   
+ *    @@@   @@                            @
+ *     @     @
+ *     @  @  @   @@@   @@ @@@  @@ @@    @@@    @@ @@     @@ @@
+ *     @  @  @  @   @   @@   @  @@  @     @     @@  @   @  @@
+ *     @ @ @ @      @   @       @   @     @     @   @  @    @
+ *      @@ @@   @@@@@   @       @   @     @     @   @  @    @
+ *      @   @  @    @   @       @   @     @     @   @  @    @
+ *      @   @  @   @@   @       @   @     @     @   @   @  @@
+ *      @   @   @@@ @@ @@@@    @@@ @@@  @@@@@  @@@ @@@   @@ @
+ *                                                          @
+ *                                                         @
+ *                                                      @@@
+ *
+ *    Use this module only to write and read simple types or array(s)
+ *    of simple types. STRUCTURES ARE DEFINITELY NOT ALLOWED.
+ */
+
+#define nblockwrite(fp,nelem,data) \
+  _blockwrite(fp,nelem,sizeof(*data),(data),#data,__FILE__,__LINE__)
+#define blockwrite(fp,data) \
+  _blockwrite(fp,1,sizeof(data),&(data),#data,__FILE__,__LINE__)
+#define cblockwrite(fp,ptr,nchars) \
+  _blockwrite(fp,1,(nchars),(ptr),#ptr,__FILE__,__LINE__)
+#define nblockread(fp,nelem,data) \
+  _blockread(fp,nelem,sizeof(*data),(data),#data,__FILE__,__LINE__)
+#define blockread(fp,data) \
+  _blockread(fp,1,sizeof(data),&(data),#data,__FILE__,__LINE__)
+#define cblockread(fp,ptr,nchars) \
+  _blockread(fp,1,(nchars),(ptr),#ptr,__FILE__,__LINE__)
+
+
+extern void _blockwrite(FILE *fp,int nelem,int size,void *data,
+                        char *what,char *file,int line);
+
+extern void _blockread(FILE *fp,int nelem,int size,void *data,
+                       char *what,char *file,int line);
+
+#endif /* _binio_h */
index a8958aae996605bd559cc39d0536a59f3db2ae63..079b6fe5837d216bd2a9df7f4b4891bcee5055dc 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Grunge ROck MAChoS
  */
-static char *SRCID_block_tx_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 4169706aa4a8cbd6b2e59c4f25fae2a73656c86e..844895b84e10a1d79fb355a66eba15ba1f767c23 100644 (file)
 #ifndef _bondf_h
 #define _bondf_h
 
-static char *SRCID_bondf_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) bondf.h 1.28 2/19/97"
-#endif /* HAVE_IDENT */
 
 #ifdef CPLUSPLUS
 extern "C" {
index 0a9e386fae860154a662bb64347a6ba9dfed5ef8..2bcaa4824f00314352b5886f3028ac5dff82e275 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Grunge ROck MAChoS
  */
-static char *SRCID_calcgrid_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 28b8564d674d2c230d9dd0e83b98cec347dac187..dac4c89a1bea3babbdfd11e8203811984ed1015f 100644 (file)
 #ifndef _calch_h
 #define _calch_h
 
-static char *SRCID_calch_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) calch.h 1.8 2/2/97"
-#endif /* HAVE_IDENT */
 #include "typedefs.h"
        
 extern void calc_h_pos(int nht, rvec xa[], rvec xh[]);
index 68af78914f8a5288aa456fe5e99271e37dba65ef..dda5eb9770998fa0575e20d9fbea742a234cc507 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _calcmu_h
 #define _calcmu_h
 
-static char *SRCID_calcmu_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 04f71f16c3ba5f8f63681e48352c10f13004cbcc..e2a84147b6de1ef17b8bbad72d91d8d0a4e5c55a 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _callf77_h
 #define _callf77_h
 
-static char *SRCID_callf77_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 6e7dc6a787d972c9d0feaa5952493bf474a5707e..98d914e4401dac663524207de9aa043b46ca4970 100644 (file)
 #ifndef _confio_h
 #define _confio_h
 
-static char *SRCID_confio_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) confio.h 1.16 11/23/92"
-#endif /* HAVE_IDENT */
-
 #include "typedefs.h"
 
 /* For reading coordinate files it is assumed that enough memory
index 1e35ebe7b21cf0240542a2d3df430a18a18caf70..ef98a2c9f276360ab68d52da436e4d5159eed387 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Grunge ROck MAChoS
  */
-static char *SRCID_constr_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include<config.h>
 #endif
index e5d35de0a4aca3a147a57352453fd2f665257f81..ad6f58e271108216a80ced9076d9b7c2f35abeca 100644 (file)
 #ifndef _copyrite_h
 #define _copyrite_h
 
-static char *SRCID_copyrite_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) copyright.h 1.10 11/23/92"
-#endif /* HAVE_IDENT */
-
 #ifdef CPLUSPLUS
 extern "C" {
 #endif
@@ -49,14 +44,16 @@ extern "C" {
 #include <stdio.h>
   
 /* Has to be a function, so we can get version number from autoconf */   
-char *GromacsVersion(void);
+const char *GromacsVersion(void);
   
   
-static char *CopyrightText[] = {
-  "Copyright (c) 1991-2002, University of Groningen, The Netherlands"
+static const char *CopyrightText[] = {
+  "Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.",
+  "Copyright (c) 1991-2002, University of Groningen, The Netherlands",
+  "Check out http://www.gromacs.org for more information.\n"
 };
 
-static char *GPLText[] = {
+static const char *GPLText[] = {
   "This program is free software; you can redistribute it and/or",
   "modify it under the terms of the GNU General Public License",
   "as published by the Free Software Foundation; either version 2",
@@ -67,10 +64,18 @@ static char *GPLText[] = {
 extern void pr_difftime(FILE *out,double dt);
 
 void CopyRight(FILE *out,char *szProgram);
+  
+/* For both bromacs() and cool_quote() you have to provide a pointer to
+ * a string of reasonable length (say 256) and the string length. This
+ * is necessary to make the routines threadsafe and avoid allocating
+ * a new string each time. The retstring pointer will be the return value.
+ */
+extern char *bromacs(char *retstring, int retsize);
 
-extern char *bromacs(void);
-
-extern char *cool_quote(void);
+/* For cool_quote, the number of the quote used will be returned in cqnum 
+ * if it is non-NULL
+ */
+extern char *cool_quote(char *retstring, int retsize, int *cqnum);
 
 extern int be_cool(void);
 /* Return TRUE when the user is COOL, FALSE otherwise */
index a0dbfbf355a7c45b5f69edc3e2dc506c72f7810a..8768c3685ef2e7c25a0c6d32cab4ee59afa3964b 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _detectcpu_h
 #define _detectcpu_h
 
-static char *SRCID_detectcpu_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -59,6 +59,8 @@ extern int cpu_capabilities;
 #define IA64_CPU              (1 << 7)
 #define PPC_CPU               (1 << 8)
 #define PPC_ALTIVEC_SUPPORT   (1 << 9)
+#define AMD_CPU               (1 << 10)
+#define INTEL_CPU             (1 << 11)
 
 /* Values that are return by cpuid instructions on x86 */
 #define VENDOR_AMD   0x68747541
index 4dc9296cabf73da4307487c9745d8f97b15c16c3..ebf40b3f04f4ab6f97c509f10fe8a2bd3df79e6e 100644 (file)
 #ifndef _disre_h
 #define _disre_h
 
-static char *SRCID_disre_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) disre.h 1.13 2/2/97"
-#endif /* HAVE_IDENT */
-
 #ifdef CPLUSPLUS
 extern "C" {
 #endif
index afe06ee1ac38f6329f804301797041298777cb0f..976270188f21430e682d6e75dc6eb146c49d739b 100644 (file)
 #ifndef _do_fit_h
 #define _do_fit_h
 
-static char *SRCID_do_fit_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) do_fit.h 1.8 2/2/97"
-#endif /* HAVE_IDENT */
+
 extern real calc_similar_ind(bool bRho,int nind,atom_id *index,real mass[],
                             rvec x[],rvec xp[]);
 /* Returns RMSD or Rho (depending on bRho) over all atoms in index */
index 25f46aba3a6f92bf985f3c75ddd073ae15d0103e..29fad3833bee860d35fe5cac8c65b70cd36d4d51 100644 (file)
 #ifndef _do_md_h
 #define _do_md_h
 
-static char *SRCID_do_md_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) do_md.h 1.16 2/2/97"
-#endif /* HAVE_IDENT */
 #include <stdio.h>
 #include "typedefs.h"
 #include "network.h"
index a34d73c492fb771b9906ff2ec217d167a60d6f52..ee14e1a5707783b807d17ea6396da15cd387f83e 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _dummies_h
 #define _dummies_h
 
-static char *SRCID_dummies_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 284c412bb5fefa2593952bb23d5e787282b32dff..d1411645e8347b023a46b4f65287df8b2f1a14cf 100644 (file)
 #ifndef _ebin_h
 #define _ebin_h
 
-static char *SRCID_ebin_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) ebin.h 1.10 5/2/97"
-#endif /* HAVE_IDENT */
+
 #include "sysstuff.h"
 #include "typedefs.h"
        
index 1581b739ca534c4d38d58bc812833fead35b16e8..f38d20b230583430e2943528bc0613a66bffc1d7 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _edsam_h
 #define _edsam_h
 
-static char *SRCID_edsam_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 51e297d08f463d46e03b9103747f128c6bc8edff..4220525a2059a25c6b73f6b5be9b8b46b3d71c74 100644 (file)
 #ifndef _enxio_h
 #define _enxio_h
 
-static char *SRCID_enxio_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) enerio.h 1.13 2/2/97"
-#endif /* HAVE_IDENT */
 
 #ifdef CPLUSPLUS
 external "C" {
index 4eaa416ea35ae3052460ea6a152dfe9b56053a72..ec51396760a7e33a572050a6c6e2bbda02b26342 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _ewald_h
 #define _ewald_h
 
-static char *SRCID_ewald_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index d004a8e115a1fa5864bcd64fae990701e76b995a..ceadb4e551dfe5bb55ced8bf9e7f3a83a070132e 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _ewald_util_h
 #define _ewald_util_h
 
-static char *SRCID_ewald_util_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index a610d3e604837fe082dd81012a0ef1852d51c87d..8fedcd14e18f7a2f21fe8586f359c276ffa3b204 100644 (file)
 #ifndef _fatal_h
 #define _fatal_h
 
-static char *SRCID_fatal_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) fatal.h 1.9 11/23/92"
-#endif /* HAVE_IDENT */
-
 #ifdef CPLUSPLUS
 extern "C" {
 #endif
index 2b8a7fb5bcc6b2fe679ae1b867709c85d5c8641b..63409edc50b57155c8baababfc12c5a78f0679cf 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Grunge ROck MAChoS
  */
-static char *SRCID_ffscanf_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 0402f533c0319a4ec8cb4618f0c767e14afdefce..7a0e885b19fd6e9bba676e26c1591b98f9192537 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _fftgrid_h
 #define _fftgrid_h
 
-static char *SRCID_fftgrid_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index cb9e0323410767cb2c4e452cf9b5ba6cc3c75105..49a1e20982d1dbebeb61ed33a6b293fbce068928 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _fftw_wrapper_h
 #define _fftw_wrapper_h
 
-static char *SRCID_fftw_wrapper_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index eba26d6dba4c1deba9e2db154f73929cafd561b9..1ae6aed74877155fafe741dd7b18d2ddf3628d35 100644 (file)
 #ifndef _filenm_h
 #define _filenm_h
 
-static char *SRCID_filenm_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) filenm.h 1.14 2/2/97"
-#endif /* HAVE_IDENT */
 
 #ifdef CPLUSPLUS
 extern "C" {
 #endif
   
 #include "futil.h"
-  
-void set_default_file_name(char *name);
+
+void set_default_file_name(const char *name);
 /* Set the default file name for all file types to name */
 
-extern char *ftp2ext(int ftp);
+extern const char *ftp2ext(int ftp);
 /* Return extension for filetype */
 
-extern char *ftp2desc(int ftp);
+extern const char *ftp2desc(int ftp);
 /* Return description for file type */
 
-extern char *ftp2defnm(int ftp);
+extern const char *ftp2defnm(int ftp);
 /* Return default file name for file type */
 
-extern char *ftp2ftype(int ftp);
+extern const char *ftp2ftype(int ftp);
 /* Return Binary or ASCII depending on file type */
 
 extern void pr_def(FILE *fp,int ftp);
index de7dbc3dc43e18286e5ceee7b0329dbdb6ea8f8e..ee11c19a1102887ab6c4cfe9e11e8a52e594869a 100644 (file)
 #ifndef _force_h
 #define _force_h
 
-static char *SRCID_force_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) force.h 1.53 5/15/97"
-#endif /* HAVE_IDENT */
+
 #include "typedefs.h"
 #include "pbc.h"
 #include "nsb.h"
index 8b2ea6ce494474118ebd9ac20448d25b62360d47..8e803b36a64007813457666c31356977225f19c4 100644 (file)
 #ifndef _futil_h
 #define _futil_h
 
-static char *SRCID_futil_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) futil.h 1.1 11/23/92"
-#endif /* HAVE_IDENT */
 #include <stdio.h>
 #include "typedefs.h"
 
@@ -51,7 +47,7 @@ extern "C" {
 extern void no_buffers(void);
 /* Turn off buffering of files (which is default) for debugging purposes */
 
-extern bool fexist(char *fname);
+extern bool fexist(const char *fname);
 /* Return TRUE when fname exists, FALSE otherwise */
 
 extern bool eof(FILE *fp);
@@ -60,15 +56,15 @@ extern bool eof(FILE *fp);
 extern bool is_pipe(FILE *fp);
 /* Check whether the file (opened by ffopen) is a pipe */
 
-extern char *backup_fn(char *file);
+extern char *backup_fn(const char *file);
 /* Return a backup name for file (name with # before and after) */
 
 /*  Make a backup of file if necessary.  
     Return false if there was a problem.
 */
-extern bool make_backup(char * file);
+extern bool make_backup(const char * file);
 
-extern FILE *ffopen(char *file,char *mode);
+extern FILE *ffopen(const char *file,char *mode);
 /* Return a valid file pointer when succesfull, exits otherwise 
  * If the file is in compressed format, open a pipe which uncompresses
  * the file! Therefore, files must be closed with ffclose (see below)
index 0a1f7efe0682df3934b9ddd3594c85c9e7d1849e..edd49eed56cbf3a9f79a63aa24bdda2aa6092926 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Grunge ROck MAChoS
  */
-static char *SRCID_gbutil_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index d701c8f120ba534700bc41824d1ede746571deb9..913bd25deffdedb4941763d8c3a761c3711260df 100644 (file)
@@ -32,8 +32,6 @@
 #ifndef _complex_h
 #define _complex_h
 
-static char *SRCID_complex_h = "$Id$";
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 53d0d64cb8c18f09994a7c94e8d8a689b2a27e24..46e7f8b109b767259829fefa59f1f0ef8f09f78e 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _gmxfio_h
 #define _gmxfio_h
 
-static char *SRCID_gmxfio_h = "$Id$";
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index b0ec9cd6905d678f484b031e5ad63b26be868484..0286c6d171a31f8d57624090fd787555ba939ce4 100644 (file)
 #ifndef _grompp_h
 #define _grompp_h
 
-static char *SRCID_grompp_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-
-#ifdef HAVE_IDENT
-#ident "@(#) grompp.h 1.37 2/2/97"
-#endif /* HAVE_IDENT */
-
 #include <stdio.h>
 #include "typedefs.h"
 #include "macros.h"
@@ -84,6 +78,7 @@ typedef struct {
   t_block       cgs;            /* Charge groups                        */
   t_block       mols;           /* Molecules                            */
   t_params      plist[F_NRE];   /* Parameters in old style              */
+  
 } t_molinfo;
 
 typedef struct {
@@ -92,6 +87,9 @@ typedef struct {
   char          ***atomname;   /* Names of the atomtypes               */
   t_param      *nb;            /* Nonbonded force default params       */
   int           *bondatomtype;  /* The bond_atomtype for each atomtype  */
+  real          *radius;        /* Radius for GBSA stuff                */
+  real          *vol;           /* Effective volume for GBSA            */
+  real          *surftens;      /* Surface tension with water, for GBSA */
 } t_atomtype;
 
 typedef struct {
@@ -129,6 +127,7 @@ typedef enum {
   d_angle_restraints_z,
   d_distance_restraints,
   d_orientation_restraints,
+  d_dihedral_restraints,
   d_maxdir,
   d_invalid,
   d_none
@@ -164,9 +163,18 @@ static char *ds[d_maxdir+1] = {
   "angle_restraints_z",
   "distance_restraints",
   "orientation_restraints",
+  "dihedral_restraints",
   "invalid"
   };
 
 extern void convert_harmonics(int nrmols,t_molinfo mols[],t_atomtype *atype);
 
 #endif /* _grompp_h */
+
+
+
+
+
+
+
+
index 01b7e50438cbac05f22bf5c1b2a1bc322c94cfcd..e338249a7b6ee6f87d0c97ad4c3bfd75d5d2f551 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _gstat_h
 #define _gstat_h
 
-static char *SRCID_gstat_h = "$Id$";
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
index befdc5b4f5633c48f6cbb543739c0afde8fe8e70..48384712a61e9ad51b8f5441367202702f0cbffe 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_index_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -40,7 +40,7 @@ extern t_block *new_block(void);
 extern void write_index(char *outf, t_block *b,char **gnames);
 /* Writes index blocks to outf (writes an indexfile) */
 
-void add_grp(t_block *b,char ***gnames,int nra,atom_id a[],char *name);
+void add_grp(t_block *b,char ***gnames,int nra,atom_id a[],const char *name);
 /* Ads group a with name name to block b and namelist gnames */ 
 
 extern void analyse(t_atoms *atoms,t_block *gb,char ***gn,
index 226a367a11603af8954af6b566dc15411552c273..a351f7d9e91d99ac7e886d8a00e4b5622b8567d5 100644 (file)
 #ifndef _init_h
 #define _init_h
 
-static char *SRCID_init_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) init.h 1.13 11/23/92"
-#endif /* HAVE_IDENT */
-
 #include <stdio.h>
 #include "typedefs.h"
 #include "mvdata.h"
index 8fb1c2f1085407f2be37d158f09524bff464c369..75b21c8ef200b00c7b2e60d733b8c5fa3c4ed6b5 100644 (file)
 #ifndef _invblock_h
 #define _invblock_h
 
-static char *SRCID_invblock_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) invblock.h 1.8 2/2/97"
-#endif /* HAVE_IDENT */
 #include <typedefs.h>
 
 extern atom_id *make_invblock(t_block *block,int nr);
index efb8e8664feecec43e1df4db75d44bc98e85bb5a..4cc9a7ad7aca2e4651197e5e104e3adf5b91601c 100644 (file)
 #ifndef _macros_h
 #define _macros_h
 
-static char *SRCID_macros_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) macros.h 1.8 11/23/92"
-#endif /* HAVE_IDENT */
-
 #ifdef CPLUSPLUS
 extern "C" { 
 #endif
@@ -81,15 +77,15 @@ extern "C" {
 /* This macro calculates the size of a array */
 #define asize(a) (sizeof(a)/sizeof((a)[0]))
 
-extern real ZERO;
-extern real THIRD;
-extern real HALF;
-extern real ONE;
-extern real TWO;
-extern real THREE;
-extern real SIX;
-extern real TEN;
-extern real TWELVE;
+extern const real ZERO;
+extern const real THIRD;
+extern const real HALF;
+extern const real ONE;
+extern const real TWO;
+extern const real THREE;
+extern const real SIX;
+extern const real TEN;
+extern const real TWELVE;
 
 #ifdef CPLUSPLUS
 }
index 81024e3553235ba3c8e0f6e53749a9826ebfce3c..92e2a70ecf9102271b24b378056ab97cf71c8075 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_magic_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 8f90e29cfcad06d6c2ceb8f7d174e4d292624e40..9d8d1a15a2582e9e26966e7852ee87b6bfa174a1 100644 (file)
 #ifndef _main_h
 #define _main_h
 
-static char *SRCID_main_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) main.h 1.3 11/23/92"
-#endif /* HAVE_IDENT */
 
 #include <stdio.h>
 #include "network.h"
@@ -48,7 +44,7 @@ static char *SRCID_main_h = "$Id$";
 extern FILE *stdlog;
 extern int  gmx_parallel; /* 1 when running in parallel */
 
-extern char *par_fn(char *base,int ftp,t_commrec *cr);
+extern char *par_fn(char *base,int ftp,t_commrec *cr, char buf[], int bufsize);
 /* Add processor id in the filename right before the extension */
 
 extern void open_log(char *fn,t_commrec *cr);
index ac3581668a1aecce23382c404c6d2056766dd6f0..50877a3d09d35f180fad04931d9bab2c8c397fc0 100644 (file)
 #ifndef _maths_h
 #define _maths_h
 
-static char *SRCID_maths_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) maths.h 1.11 11/24/92"
-#endif /* HAVE_IDENT */
-
 #include <math.h>
 #include "typedefs.h"
 
index 72525d23478a93d4a28e9245e31e5f4fa7f2c70c..7c9cfe5964fb559b23639bf56219f18e014acd7c 100644 (file)
 #ifndef _matio_h
 #define _matio_h
 
-static char *SRCID_matio_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) matio.h 1.11 5/20/97"
-#endif /* HAVE_IDENT */
 #include "typedefs.h"
 
 extern bool matelmt_cmp(t_xpmelmt e1, t_xpmelmt e2);
index 19d453953b5c2a811a51f8574603490c85773773..cfb03cf2d5188084f49b149ad7692bcf39c42911 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _mdatoms_h
 #define _mdatoms_h
 
-static char *SRCID_mdatoms_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 7f6741d369d3631e22176b978f1afd734350103d..78ffc1c4bd76da6a1f1ff31a889b22f74b8195bd 100644 (file)
 #ifndef _mdebin_h
 #define _mdebin_h
 
-static char *SRCID_mdebin_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) mdebin.h 1.12 2/2/97"
-#endif /* HAVE_IDENT */
 #include "typedefs.h"
 #include "sysstuff.h"
 #include "ebin.h"
@@ -70,13 +66,12 @@ extern void upd_mdebin(t_mdebin *md,FILE *fp_dgdl,
                       t_groups *grps,
                       rvec mu_tot, bool bNoseHoover);
      
-extern void print_ebin_header(FILE *log,int steps,real time,
-                             real lamb,real SAfactor);
+extern void print_ebin_header(FILE *log,int steps,real time,real lamb);
 
-extern void print_ebin(int fp_ene,bool bEne,bool bDR,bool bOR,
+extern void print_ebin(int fp_ene,bool bEne,bool bDR,bool bOR,bool bDihR,
                       FILE *log,int steps,real time,
                       int mode,bool bCompact,
-                      t_mdebin *md,t_fcdata *fcd,t_atoms *atoms);
+                      t_mdebin *md,t_fcdata *fcd,t_atoms *atoms, t_grpopts *opts);
 
 #endif /* _mdebin_h */
 
index 93e2fce49a74d5c9bb8908c2d5b5fa5f0b29524b..1efd2ab265c6ac28c9f01e65f112b8d1bcf8d26c 100644 (file)
 #ifndef _mdrun_h
 #define _mdrun_h
 
-static char *SRCID_mdrun_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) do_md.h 1.12 03 Mar 1996"
-#endif /* HAVE_IDENT */
 #include <stdio.h>
 #include "typedefs.h"
 #include "network.h"
@@ -152,11 +148,12 @@ extern void write_xtc_traj(FILE *log,t_commrec *cr,
 extern void close_xtc_traj(void);
 
 /* ROUTINES from sim_util.c */
-extern void init_mdatoms(t_mdatoms *md,real lambda,bool bFirst);
+extern void update_mdatoms(t_mdatoms *md,real lambda, bool bFirst);
 /* Compute fields from mdatoms struct (invmass etc.) which may change
  * due to lambda dependent FEP calculations.
  * If bFirst all values are set, this is necessary once in the
  * first step.
+ * You only have to call this routine again if lambda changes.
  */
  
 extern void print_time(FILE *out,time_t start,int step,t_inputrec *ir);
@@ -288,14 +285,14 @@ extern void mdrunner(t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
 /* Driver routine, that calls the different methods */
 
 extern void init_md(t_commrec *cr,t_inputrec *ir,tensor box,real *t,real *t0,
-                   real *lambda,real *lam0,real *SAfactor,
+                   real *lambda,real *lam0,
                    t_nrnb *mynrnb,bool *bTYZ,t_topology *top,
                    int nfile,t_filenm fnm[],char **traj,
                    char **xtc_traj,int *fp_ene,
                    FILE **fp_dgdl,t_mdebin **mdebin,t_groups *grps,
                    tensor force_vir,tensor pme_vir,
                    tensor shake_vir,t_mdatoms *mdatoms,rvec mu_tot,
-                   bool *bNEMD,t_vcm **vcm,t_nsborder *nsb);
+                   bool *bNEMD,bool *bSimAnn,t_vcm **vcm,t_nsborder *nsb);
 /* Routine in sim_util.c */
                     
 #endif /* _mdrun_h */
index 2f8962fba2097afb0031b7739e7a3579dbc3eec2..5a8c830298c61d53b5b64a9ee7183b9fd7d02033 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _metacode_h
 #define _metacode_h
 
-static char *SRCID_metacode_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 66a5dbf1d895b97e1f875a933ca5d898ce06beb7..5dab276e7bf199c31ac77641912029769edc1446 100644 (file)
 #ifndef _mshift_h
 #define _mshift_h
 
-static char *SRCID_mshift_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) mshift.h 1.11 2/2/97"
-#endif /* HAVE_IDENT */
-
 #include "typedefs.h"
 
+
 extern t_graph *mk_graph(t_idef *idef,int natoms,bool bShakeOnly,bool bSettle);
 /* Build a graph from an idef description. The graph can be used
  * to generate mol-shift indices.
index de655309a01c9701eb6a2444536638fdc497595a..d237304935df1d888bd4848d3f0af7077de56167 100644 (file)
 #ifndef _mvdata_h
 #define _mvdata_h
 
-static char *SRCID_mvdata_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) mvdata.h 1.6 11/23/92"
-#endif /* HAVE_IDENT */
-
 #include "typedefs.h"
 #include "nsb.h"
 
index c5fca3c78be6485d4028ee6a3d99c66a79f3ea43..ca2dc2d7008a8eebd183b6d77ec56f6baa2cc92d 100644 (file)
 #ifndef _names_h
 #define _names_h
 
-static char *SRCID_names_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) names.h 1.23 5/20/97"
-#endif /* HAVE_IDENT */
 
 #include "typedefs.h"
 
@@ -48,30 +44,33 @@ static char *SRCID_names_h = "$Id$";
  * extra argument (the +1)
  * these should correspond to names.c and include/types/enums.h
  */
-extern char *eblock_names[ebNR+1];
-extern char *epbc_names[epbcNR+1];
-extern char *etcoupl_names[etcNR+1];
-extern char *epcoupl_names[epcNR+1];
-extern char *epcoupltype_names[epctNR+1];
-extern char *ens_names[ensNR+1];
-extern char *ei_names[eiNR+1];
-extern char *yesno_names[BOOL_NR+1];
-extern char *bool_names[BOOL_NR+1];
-extern char *eel_names[eelNR+1];
-extern char *eewg_names[eewgNR+1];
-extern char *evdw_names[evdwNR+1];
-extern char *eshake_names[estNR+1];
-extern char *ptype_str[eptNR+1];
-extern char *egrp_nm[egNR+1];
-extern char *edisre_names[edrNR+1];
-extern char *edisreweighting_names[edrwNR+1];
-extern char *enbf_names[eNBF_NR+1];
-extern char *ecomb_names[eCOMB_NR+1];
-extern char *gtypes[egcNR+1];
-extern char *efep_names[efepNR+1];
-extern char *esolv_names[esolNR+1];
-extern char *edispc_names[edispcNR+1];
-extern char *ecm_names[ecmNR+1];
+extern const char *eblock_names[ebNR+1];
+extern const char *epbc_names[epbcNR+1];
+extern const char *etcoupl_names[etcNR+1];
+extern const char *epcoupl_names[epcNR+1];
+extern const char *epcoupltype_names[epctNR+1];
+extern const char *ens_names[ensNR+1];
+extern const char *ei_names[eiNR+1];
+extern const char *yesno_names[BOOL_NR+1];
+extern const char *bool_names[BOOL_NR+1];
+extern const char *eel_names[eelNR+1];
+extern const char *eewg_names[eewgNR+1];
+extern const char *evdw_names[evdwNR+1];
+extern const char *eshake_names[estNR+1];
+extern const char *ptype_str[eptNR+1];
+extern const char *egrp_nm[egNR+1];
+extern const char *edisre_names[edrNR+1];
+extern const char *edisreweighting_names[edrwNR+1];
+extern const char *enbf_names[eNBF_NR+1];
+extern const char *ecomb_names[eCOMB_NR+1];
+extern const char *gtypes[egcNR+1];
+extern const char *efep_names[efepNR+1];
+extern const char *esolv_names[esolNR+1];
+extern const char *edispc_names[edispcNR+1];
+extern const char *ecm_names[ecmNR+1];
+extern const char *eann_names[eannNR+1];
+extern const char *egb_names[egbNR+1];
+extern const char *eis_names[eisNR+1];
 
 #define        UNDEFINED               "UNDEFINED"
 #define ENUM_NAME(e,max,names) ((((e)<0)||((e)>=(max)))?UNDEFINED:(names)[e])
@@ -96,4 +95,7 @@ extern char *ecm_names[ecmNR+1];
 #define ESOLVTYPE(e)   ENUM_NAME(e,esolNR,esolv_names)
 #define EDISPCORR(e)   ENUM_NAME(e,edispcNR,edispc_names)
 #define ECOM(e)        ENUM_NAME(e,ecmNR,ecm_names)
+#define EANNEAL(e)      ENUM_NAME(e,eannNR,eann_names)
+#define EGBALGORITHM(e) ENUM_NAME(e,egbNR,egb_names)
+#define EIMPLICITSOL(e) ENUM_NAME(e,eisNR,eis_names)
 #endif /* _names_h */
index 006ee92824fa5394a88726060f04c363c8eef4a1..4311464bf0d07e608827571b6e98ee592a3b2585 100644 (file)
 #ifndef _network_h
 #define _network_h
 
-static char *SRCID_network_h = "$Id$";
 
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) gmx_comm.h 1.9 11/23/92"
-#endif /* HAVE_IDENT */
 
 /*
  * This module defines the interface of the actual communication routines.
index c844c1c15488390d93a4529e9d57a18797552a94..63434dc137413dd5a006e45c68f87a8b907c955c 100644 (file)
 #ifndef _nhash_h
 #define _nhash_h
 
-static char *SRCID_nhash_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) nhash.h 1.3 11/23/92"
-#endif /* HAVE_IDENT */
-
 #define MAX_LJQQ 997
 
 typedef struct {
index d258f1900005109e7a0b399ece47d42e3622ff67..b34d31589ff4856d5ab6e8e05ea0ededa9e5bd11 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _nr_h
 #define _nr_h
 
-static char *SRCID_nr_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 992e0cef99488895fbf5c1df78cabb8e50c85ce5..8526a1fe46b22d39509b076dce31a819266955e0 100644 (file)
 #ifndef _nrama_h
 #define _nrama_h
 
-static char *SRCID_nrama_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) nrama.h 1.9 2/2/97"
-#endif /* HAVE_IDENT */
 #include "typedefs.h"
 #include "statutil.h"
 #include "mshift.h"
@@ -72,7 +68,7 @@ typedef struct {
   t_idef    *idef;
 } t_xrama;
 
-extern void init_rama(char *infile,char *topfile,t_xrama *xr);
+extern t_topology *init_rama(char *infile,char *topfile,t_xrama *xr);
 
 extern bool new_data(t_xrama *xr);
 
index d5c7bf81f95e38ee16be96e3959ef94c1ab64f55..6a5dc300777ab300e7e46f9c762cd71e37c80c13 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _nrjac_h
 #define _nrjac_h
 
-static char *SRCID_nrjac_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 8ab8161c962c188741cc05a6e4ee17b6d56ab4ef..fcc43ed940fe736ab145e09b20006387f5896fd5 100644 (file)
 #ifndef _nrnb_h
 #define _nrnb_h
 
-static char *SRCID_nrnb_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) nrnb.h 1.9 2/2/97"
-#endif /* HAVE_IDENT */
 #include "typedefs.h"
 
 extern void init_nrnb(t_nrnb *nrnb);
index 4af48361de4aaec5fb2150b05862ee8719aa6d95..ea2926e962d603074d24bd45de6d728fc7d28e59 100644 (file)
 #ifndef _ns_h
 #define _ns_h
 
-static char *SRCID_ns_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) ns.h 1.50 2/2/97"
-#endif /* HAVE_IDENT */
-
 #include <stdio.h>
 #include "sysstuff.h"
 #include "typedefs.h"
index f0225055c0911a9a474090622926bd82716203c5..2fdef89a7d74260f72656b982e534f8302fb41a4 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _nsb_h
 #define _nsb_h
 
-static char *SRCID_nsb_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index ea36817e949642df1023d08824f36dea84f36a85..7ea7a693e5e472dc58acf605839cfe4c66e30804 100644 (file)
 #ifndef _nsgrid_h
 #define _nsgrid_h
 
-static char *SRCID_nsgrid_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) nsgrid.h 1.7 11/23/92"
-#endif /* HAVE_IDENT */
-
 #include "typedefs.h"
 
 extern void init_grid(FILE *log,t_grid *grid,
index 6ce2d73940b46540cfd195fbd9ccbbf22b80a164..aebb0a07a40a1d90f733d9eb4161b20a1230218e 100644 (file)
 #ifndef _orires_h
 #define _orires_h
 
-static char *SRCID_orires_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) disre.h 1.13 2/2/97"
-#endif /* HAVE_IDENT */
-
 #ifdef CPLUSPLUS
 extern "C" {
 #endif
index 47ca53db3fd6b01018cd6a85f15f31e6a0ac5f5f..f6d8e9973ccb2e35ad0ac58291f5da0f0adeee9a 100644 (file)
 #ifndef _pbc_h
 #define _pbc_h
 
-static char *SRCID_pbc_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) pbc.h 1.17 2/2/97"
-#endif /* HAVE_IDENT */
 #include "sysstuff.h"
 #include "typedefs.h"
 
index f1fe7f06f8268ab64e0ee55993d1a0219c94c85c..33df0cd322f4580995aa9153367874dd82211584 100644 (file)
 #ifndef _pdbio_h
 #define _pdbio_h
 
-static char *SRCID_pdbio_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) pdbio.h 1.12 7/28/97"
-#endif /* HAVE_IDENT */
 #include "sysstuff.h"
 #include "typedefs.h"
 #include "symtab.h"
index de150c2a918efd493f49950d8eed7fcc47a1810c..994664c06e4478543604d1da64c2f987783f7598 100644 (file)
 #ifndef _pdebug_h
 #define _pdebug_h
 
-static char *SRCID_pdebug_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) pdebug.h 1.7 2/2/97"
-#endif /* HAVE_IDENT */
-#ifdef HAVE_IDENT
-#endif /* HAVE_IDENT */
 extern void p_debug(char *s,char *file,int line);
 
 #ifdef  DEBUG
index 381c8a295206c422b68a01712454564dfb8f9185..bdee0c94a26b94c52fecf77eeb594ecb11db82bd 100644 (file)
 #ifndef _physics_h
 #define _physics_h
 
-static char *SRCID_physics_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) physics.h 1.6 11/23/92"
-#endif /* HAVE_IDENT */
-
 /*
  * Physical constants to be used in Gromacs.
  * No constants (apart from 0, 1 or 2) should
index 029c6086ec4075dfea0d0ffbe05731f51e12a63e..e4baeb95933c9e253c98eef97489c64e680b5e2d 100644 (file)
@@ -32,8 +32,6 @@
 
 #ifndef _pme_h
 #define _pme_h
-
-static char *SRCID_pme_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 03f2ab722144ec591504b37653f382b89f2cd919..1e4201924623baa337cca3faf80d79f14317051e 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _ppc_altivec_h
 #define _ppc_altivec_h
 
-static char *SRCID_ppc_altivec_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 32a483bc24da6b52d29818f9e3bc675a7dbf6dcf..4ef680972fdb7bfebf12488cad0940f0a19f1188 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _pppm_h
 #define _pppm_h
 
-static char *SRCID_pppm_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 19b31185cb2f0e91f6afef15c8a3163029b577b8..bed8124fb24edb0943d5db07075310e56ae3a7f6 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _princ_h
 #define _princ_h
 
-static char *SRCID_princ_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 10f7481b1b90cfa9c801c7bf9ebe633d86305bb1..03bb71537c791a38178bfff34cc3c6cdfec6bbbc 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _pull_h
 #define _pull_h
 
-static char *SRCID_pull_h = "$Id$";
 #ifdef HAVE_CONFIG_H
   #include <config.h>
 #endif
index 25091951f184a9a1dbbde8bec6d25a2e8469fd4d..5e8a1beef416c966a10c0a3d8982622abbf7e7c6 100644 (file)
 #ifndef _random_h
 #define _random_h
 
-static char *SRCID_random_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) random.h 1.5 12/16/92"
-#endif /* HAVE_IDENT */
-
 #include <typedefs.h>
 
-extern real gauss(real am, real sd, int *ig);
-/* Generate a gaussian number with:
- * am = center of the distribution
- * sd = standard deviation
- * ig = the random number seed.
+
+typedef struct t_gaussdata *t_Gaussdata;
+/* Abstract data type for the internal state of
+ * a gaussian random number generator 
+ */
+
+t_Gaussdata init_gauss(int seed);
+/* Initialize (and warm up) a gaussian random number generator
+ * by copying the seed. The routine returns a handle to the
+ * new generator.
+ */
+
+real 
+gauss(t_Gaussdata data);
+/* Return a new gaussian random number with expectation value
+ * 0.0 and standard deviation 1.0. This routine is NOT thread-safe
+ * for performance reasons - you will either have to do the locking
+ * yourself, or better: initialize one generator per thread.
  */
 
+void 
+finish_gauss(t_Gaussdata data);
+/* Release all the resources used for the generator */
+
+
+
+
 extern int make_seed(void);
 /* Make a random seed: (time+getpid) % 1000000 */
 
-extern real rando(int *ig);
-/* Generate a random number 0 <= r < 1. ig is the (address of) the
- * seed variable.
+extern real rando(int *seed);
+/* Generate a random number 0 <= r < 1. seed is the (address of) the
+ * random seed variable.
  */
 
 extern void grp_maxwell(t_block *grp,real tempi[],int nrdf[],int seed,
index 64b2d5d35e619827f66800c0d3faf866138ecfbb..6abb94ae67186500386f73c4c92b23ad7ff83967 100644 (file)
 #ifndef _rbin_h
 #define _rbin_h
 
-static char *SRCID_rbin_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) rbin.h 1.8 2/2/97"
-#endif /* HAVE_IDENT */
 #include "sysstuff.h"
 #include "typedefs.h"
 #include "network.h"
index a45fb654e8327c35f039e96c61e8fcb00933f6f9..00bf48bcb9f801f5434f716306f2b258d9339472 100644 (file)
 #ifndef _rdgroup_h
 #define _rdgroup_h
 
-static char *SRCID_rdgroup_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) rdgroup.h 1.15 2/2/97"
-#endif /* HAVE_IDENT */
 #include <typedefs.h>
 
 #ifdef CPLUSPLUS
index 8cd59f39df6eab1a21f06c8f5678abd017194005..9affcdd03514bf3b592a43662e90b05a905dab97 100644 (file)
 #ifndef _readcomp_h
 #define _readcomp_h
 
-static char *SRCID_readcomp_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) readcomp.h 1.12 25 Jan 1993"
-#endif /* HAVE_IDENT */
-
 #include "typedefs.h"
 
 /*
index 2b26446f4b8d776b038da8b0475f3ba0e04aa198..03a7ada1e749a781b339928e34cfdbd4d02f2b7e 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _readinp_h
 #define _readinp_h
 
-static char *SRCID_readinp_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -51,20 +50,20 @@ extern t_inpfile *read_inpfile(char *fn,int *ninp);
 
 extern void write_inpfile(char *fn,int ninp,t_inpfile inp[]);
 
-extern int get_eint(int *ninp,t_inpfile **inp,char *name,int def);
+extern int get_eint(int *ninp,t_inpfile **inp,const char *name,int def);
 
-extern real get_ereal(int *ninp,t_inpfile **inp,char *name,real def);
+extern real get_ereal(int *ninp,t_inpfile **inp,const char *name,real def);
 
-extern char *get_estr(int *ninp,t_inpfile **inp,char *name,char *def);
+extern char *get_estr(int *ninp,t_inpfile **inp,const char *name,char *def);
 
-extern int get_eeenum(int *ninp,t_inpfile **inp,char *name,char **defs,
+extern int get_eeenum(int *ninp,t_inpfile **inp,const char *name,const char **defs,
                      int *nerror,bool bPrintError);
 /* defs must be NULL terminated, 
  * Add errors to nerror 
  * When bPrintError=TRUE and invalid enum: print "ERROR: ..."
  */
 
-extern int get_eenum(int *ninp,t_inpfile **inp,char *name,char **defs);
+extern int get_eenum(int *ninp,t_inpfile **inp,const char *name,const char **defs);
 /* defs must be NULL terminated */
 
 /* Here are some macros to extract data from the inp structures.
@@ -115,8 +114,10 @@ extern void get_pargs(int *argc,char *argv[],int nparg,t_pargs pa[],
 extern bool is_hidden(t_pargs *pa);
 /* Return TRUE when the option is a secret one */
 
-extern char *pa_val(t_pargs *pa);
-/* Return a pointer to a static buffer containing the value of pa */
+extern char *pa_val(t_pargs *pa,char *buf, int sz);
+/* Return the value of pa in the provided buffer buf, of size sz.
+ * The return value is also a pointer to buf.
+ */
 
 extern int opt2parg_int(char *option,int nparg,t_pargs pa[]);
 
index 4d293b3b83cbccd2420d3180e8744208d9112d75..aa03ef2b3b09c8b9e0ef089c09505cd878655ff2 100644 (file)
 #ifndef _renum_h
 #define _renum_h
 
-static char *SRCID_renum_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) renum.h 1.6 11/23/92"
-#endif /* HAVE_IDENT */
 
 #include "typedefs.h"
 
index 10cb9d0d3c720ef7f1646eb3417c04eca915b154..16b0c8872c4ccc9448c8f349de31e93a80e45e8e 100644 (file)
 #ifndef _reorder_h
 #define _reorder_h
 
-static char *SRCID_reorder_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) reorder.h 1.4 11/23/92"
-#endif /* HAVE_IDENT */
 
 extern void reorder(t_topology *topin,t_topology topout[],
                     int nnodes,int load[],int tload[]);
index 3417b91effc65a3a74478750039b1d64a69ec58b..9e69888dfcb904ab45aec94d0b7a7cd867c8cbd3 100644 (file)
 #ifndef _rmpbc_h
 #define _rmpbc_h
 
-static char *SRCID_rmpbc_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) rmpbc.h 1.6 2/2/97"
-#endif /* HAVE_IDENT */
+
 #include "typedefs.h"
        
 extern void rm_pbc(t_idef *idef,int natoms,matrix box,rvec x[],rvec x_s[]);
diff --git a/include/rwtop.h b/include/rwtop.h
deleted file mode 100644 (file)
index feb9d17..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * $Id$
- * 
- *                This source code is part of
- * 
- *                 G   R   O   M   A   C   S
- * 
- *          GROningen MAchine for Chemical Simulations
- * 
- *                        VERSION 3.1
- * Copyright (c) 1991-2001, University of Groningen, The Netherlands
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- * 
- * If you want to redistribute modifications, please consider that
- * scientific software is very special. Version control is crucial -
- * bugs must be traceable. We will be happy to consider code for
- * inclusion in the official distribution, but derived work must not
- * be called official GROMACS. Details are found in the README & COPYING
- * files - if they are missing, get the official version at www.gromacs.org.
- * 
- * To help us fund GROMACS development, we humbly ask that you cite
- * the papers on the package - you can find them in the top README file.
- * 
- * For more info, check our website at http://www.gromacs.org
- * 
- * And Hey:
- * Getting the Right Output Means no Artefacts in Calculating Stuff
- */
-
-#ifndef _rwtop_h
-#define _rwtop_h
-
-static char *SRCID_rwtop_h = "$Id$";
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifdef HAVE_IDENT
-#ident "@(#) rwtop.h 1.5 12/16/92"
-#endif /* HAVE_IDENT */
-
-#include <stdio.h>
-#include "typedefs.h"
-
-/*
- * This module handles topolgy manipulation, including (binary) writing
- * to and reading from a file, freeing the allocated space and textual 
- * representation of the complete topology structure.
- */
-
-extern long wr_top(FILE *fp,t_topology *top);
-/*
- * Writes the topology to the file, specified by fp. The function 
- * returns the number of bytes written. The topology is not modified!
- */
-
-extern long rd_top(FILE *fp,t_topology *top);
-/*
- * Reads the topology from the file, specified by fp. This will 
- * include allocating the needed space. The function returns the 
- * number of bytes read.
- */
-
-extern void rm_top(t_topology *top);
-/*
- * Frees the space allocated by the topology. This is only
- * guaranteed to work when the same allocation strategy is used as
- * in rd_top().
- */
-
-extern void pr_energies(FILE *fp,int indent,char *title,t_energy *e,int n);
-/*
- * This routine prints out a (human) readable representation of
- * an array of energy structs to the file fp. Ident specifies the
- * number of spaces the text should be indented. Title is used to
- * print a header text.
- */
-
-extern void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir);
-/*
- * This routine prints out a (human) readable representation of
- * an input record to the file fp. Ident specifies the number of spaces
- * the text should be indented. Title is used to print a header text.
- */
-#endif /* _rwtop_h */
index 4b0396c0452f603cf5fdc8c41b2b419d4fe8a8ce..040fe935795b4961a0597c6603e633f879041359 100644 (file)
 #ifndef _sheader_h
 #define _sheader_h
 
-static char *SRCID_sheader_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) sheader.h 1.4 11/23/92"
-#endif /* HAVE_IDENT */
-
 #include <stdio.h>
 #include "typedefs.h"
 #include "tpxio.h"
index f9ea3a01a98bda7169c13a7def6fa0b18b195fd2..40353723aea3180387a858a7c83cf8dad18ad2f7 100644 (file)
 #ifndef _shift_h
 #define _shift_h
 
-static char *SRCID_shift_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) shift.h 1.6 2/2/97"
-#endif /* HAVE_IDENT */
-#ifdef HAVE_IDENT
-#endif /* HAVE_IDENT */
-
 extern real *mk_shift_tab(int n,real r1,real rc,real dr,real *sfac);
 /* Return a table of length n, containing the parabolic
  * shift function from HJC Berendsen
index 9b28717ad3cb1901d2234474f2abedcc56747631..689a1527fb1324ed096c7d95425012b7d3fb0a75 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _shift_util_h
 #define _shift_util_h
 
-static char *SRCID_shift_util_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 336ada8c8c6a8b5f28b4805a6abd696f3638566f..087a419d8ac8ce6a1d3dad0e9d1efd1b37ea78d4 100644 (file)
 #ifndef _smalloc_h
 #define _smalloc_h
 
-static char *SRCID_smalloc_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) smalloc.h 1.14 11/23/92"
-#endif /* HAVE_IDENT */
-
 /*
  * Memory allocation routines in gromacs:
  *
@@ -91,7 +87,7 @@ static char *SRCID_smalloc_h = "$Id$";
  *    If ptr equals NULL, malloc is called in stead of realloc, in this way
  *    it is possible to combine first and later allocations.
  *
- * extern void save_free(char *name,char *file,int line,void *ptr);
+ * extern void save_free(char *name,char *file,int line,const void *ptr);
  *    Like free, uses name, file and line to generate an error message when 
  *    the free failed.
  *
@@ -129,7 +125,7 @@ void *save_calloc(char *name,char *file,int line,
                  unsigned nelem,unsigned elsize); 
 void *save_realloc(char *name,char *file,int line,
                   void *ptr,unsigned size);
-void save_free(char *name,char *file,int line,void *ptr);
+void save_free(char *name,char *file,int line,const void *ptr);
 unsigned maxavail(void);
 unsigned memavail(void);
 
index 56a059fdc8da7c9a193670b98850d739fb56c21c..2b8ef3002a26ef4c67694aa64f3f5ad4ef51b742 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _sortwater_h
 #define _sortwater_h
 
-static char *SRCID_sortwater_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 481e6d987af6cf36ae9fe0cbd87b192bcde80ce5..ab7fa5399474d1429ae60705fc9d117c52d408c4 100644 (file)
 #ifndef _split_h
 #define _split_h
 
-static char *SRCID_split_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) split.h 1.20 12/16/92"
-#endif /* HAVE_IDENT */
-
 /*
  * Determine on which node a particle should reside and on which
  * node is also should be available. The distribution algorithm
index df20dc69a63b96087ae2ad777f1859162907f70d..c7f8c6f7ef54ee45c394382cc86ff6ec6191eef3 100644 (file)
 #ifndef _statusio_h
 #define _statusio_h
 
-static char *SRCID_statusio_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) statusio.h 1.46 2/2/97"
-#endif /* HAVE_IDENT */
-
 #include "typedefs.h"
 #include "sheader.h"
 
index f6650d3fa0a0d3607d8cfd26cece231fcd930261..80fd3628e2f8adbf1e4c033b4a3e40bfb513e008 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _statutil_h
 #define _statutil_h
 
-static char *SRCID_statutil_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 197f0591767a4a023cfa2b505e6375942fd82378..ef5cd61a67e201e01c8dd9c562bb1fa29f917897 100644 (file)
 #ifndef _strdb_h
 #define _strdb_h
 
-static char *SRCID_strdb_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) strdb.h 1.9 2/2/97"
-#endif /* HAVE_IDENT */
-
 #include "typedefs.h"
 
 extern bool get_a_line(FILE *fp,char line[],int n);
index fdd65e0df1b96e36659de7fd3b9fe13de3438f4a..63f74a5b06bfa932295194d6e191a01ce0af444c 100644 (file)
 #ifndef _string2_h
 #define _string2_h
 
-static char *SRCID_string2_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) string2.h 1.13 11/23/92"
-#endif /* HAVE_IDENT */
-
 /*
  *
  * string2.h
@@ -99,7 +94,7 @@ extern char *gmx_strdup(const char *src);
 #define strdup gmx_strdup
 #endif
 
-extern char *wrap_lines(char *buf,int line_width, int indent);
+extern char *wrap_lines(const char *buf,int line_width, int indent);
 /* wraps lines at 'linewidth', indenting all following
  * lines by 'indent' spaces. A temp buffer is allocated and returned,
  * which can be disposed of if no longer needed.
index a97fe0e27b50d7a98c206ce3ff11e7d45cb54649..d08464093167ce673ce15d513f3dd1d92f4063e9 100644 (file)
 #ifndef _struc2_h
 #define _struc2_h
 
-static char *SRCID_struc2_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) struc2.h 1.2 15 Sep 1993"
-#endif /* HAVE_IDENT */
 #include "typedefs.h"
 
 typedef struct {
index a276bfc2541736411a87929c0602b15bc2fa78f6..754b98fcb2adede268622950a135b7b93b9aa76d 100644 (file)
 #ifndef _superb_h
 #define _superb_h
 
-static char *SRCID_superb_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) superb.h 1.7 2/2/97"
-#endif /* HAVE_IDENT */
 #include <sysstuff.h>
 #include <typedefs.h>
 
index d536d7074870ef79a0f77eb5d35e04852d0e40e1..65e3805193549c616e9a78577cedd42414021d17 100644 (file)
 #ifndef _symtab_h
 #define _symtab_h
 
-static char *SRCID_symtab_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) symtab.h 1.6 12/16/92"
-#endif /* HAVE_IDENT */
 
 #include <stdio.h>
 #include "typedefs.h"
@@ -73,7 +70,7 @@ extern void done_symtab(t_symtab *symtab);
      /* Frees the space allocated by the symbol table, including all
       * entries in it */
 
-extern char **put_symtab(t_symtab *symtab,char *name);
+extern char **put_symtab(t_symtab *symtab,const char *name);
      /* Enters a string into the symbol table symtab, if it was not
       * available, a reference to a copy is returned else a reference 
       * to the earlier entered value is returned. Strings are trimmed
index b00ebbd5bfbe8a39d9a953a193656f5a196a1d13..ce597596e1433839b3609496890d73e799b226b9 100644 (file)
 #ifndef _sysstuff_h
 #define _sysstuff_h
 
-static char *SRCID_sysstuff_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) sysstuff.h 1.22 12/16/92"
-#endif /* HAVE_IDENT */
-
 #ifdef CPLUSPLUS
 extern "C" { 
 #endif
index b85000199c82b48cd31c5ce2a83a9be985d46137..7638d09e84053a6e2dd196148762b53542fb348b 100644 (file)
 #ifndef _tags_h
 #define _tags_h
 
-static char *SRCID_tags_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) tags.h 1.3 11/23/92"
-#endif /* HAVE_IDENT */
-
 #define SYSCALL_TAG    0x11            /* Tag for server system calls      */
 #define SEMGET_TAG     0x10            /* Server subcommand i860_semget()  */
 #define SEMCTL_TAG     0x11            /* Server subcommand i860_semctl()  */
index 0ca4dc9390bf42c40e5611b50b268796815be43f..dcb8786a4e6dd6060818be7c999b0009ed0c4b64 100644 (file)
 #ifndef _tgroup_h
 #define _tgroup_h
 
-static char *SRCID_tgroup_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) tgroup.h 1.12 2/2/97"
-#endif /* HAVE_IDENT */
-#ifdef HAVE_IDENT
-#endif /* HAVE_IDENT */
-
 #include "typedefs.h"
 #include "network.h"
 
index 0680d6b966ac6091a7fe1b1a5bfc5351a7f7d17e..07698f231c7dbbe8e7fdd5712260a24ab5dacb7a 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _tpxio_h
 #define _tpxio_h
 
-static char *SRCID_tpxio_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -86,8 +85,16 @@ extern int open_tpx(char *fn,char *mode);
 extern void close_tpx(int fp);
 /*  Close the file corresponding to fp */
   
-extern void read_tpxheader(char *fn,t_tpxheader *tpx);
-/* Read the header from a tpx file and then close it again */
+extern void read_tpxheader(char *fn,t_tpxheader *tpx, bool TopOnlyOK, int *version, int *generation);
+/* Read the header from a tpx file and then close it again.
+ * By setting TopOnlyOK to true, it is possible to read future
+ * versions too (we skip the changed inputrec), provided we havent
+ * changed the topology description. If it is possible to read
+ * the inputrec it will still be done even if TopOnlyOK is TRUE.
+ *
+ * The version and generation if the topology (see top of tpxio.c)
+ * are returned in the two last arguments.
+ */
 
 extern void write_tpx(char *fn,int step,real t,real lambda,
                      t_inputrec *ir,rvec *box,int natoms,
index 023a7848ef94cc74d1a22b26c30497fc26575f06..60751465ec2083abb8ae761eb1404edf615aa521 100644 (file)
 #ifndef _transfer_h
 #define _transfer_h
 
-static char *SRCID_transfer_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) transfer.h 1.6 11/23/92"
-#endif /* HAVE_IDENT */
 
 extern void linkio_write(int linkno,int nbytes);
 extern void linkio_read(int linkno,int nbytes);
index 3693f43a0850d3c59c0f7cc6bc627bb0865d7712..fe64fb7e0d92720daa030eeb1727c0f7ef14ffec 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _trnio_h
 #define _trnio_h
 
-static char *SRCID_trnio_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 1da6a4d8f4affe36da80c50d49d636b0be391359..b7af51a7ad24c6ab10d2b42fd1201a5e72db3421 100644 (file)
 #ifndef _txtdump_h
 #define _txtdump_h
 
-static char *SRCID_txtdump_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) txtdump.h 1.20 12/16/92"
-#endif /* HAVE_IDENT */
 
 #include <stdio.h>
 #include "typedefs.h"
@@ -55,22 +51,21 @@ extern char *atomname(t_atoms *a,int i);
 /* Return pointer to a buffer which holds the atomname in the
  * form resname resnr atomname. Pointer can be freed afterwards.
  */
-extern void pr_shownumbers(bool bShow);
 extern int available(FILE *fp,void *p,char *title);
 extern int pr_indent(FILE *fp,int n);
 extern int pr_title(FILE *fp,int indent,char *title);
 extern int pr_title_n(FILE *fp,int indent,char *title,int n);
 extern int pr_title_nxn(FILE *fp,int indent,char *title,int n1,int n2);
-extern void pr_ivec(FILE *fp,int indent,char *title,int vec[],int n);
-extern void pr_ivecs(FILE *fp,int indent,char *title,ivec vec[],int n);
-extern void pr_rvec(FILE *fp,int indent,char *title,real vec[],int n);
+extern void pr_ivec(FILE *fp,int indent,char *title,int vec[],int n, bool bShowNumbers);
+extern void pr_ivecs(FILE *fp,int indent,char *title,ivec vec[],int n, bool bShowNumbers);
+extern void pr_rvec(FILE *fp,int indent,char *title,real vec[],int n, bool bShowNumbers);
 extern void pr_rvecs(FILE *fp,int indent,char *title,rvec vec[],int n);
 extern void pr_rvecs_len(FILE *fp,int indent,char *title,rvec vec[],int n);
-extern void pr_block(FILE *fp,int indent,char *title,t_block *block);
+extern void pr_block(FILE *fp,int indent,char *title,t_block *block, bool bShowNumbers);
 extern void pr_iparams(FILE *fp,t_functype ftype,t_iparams *iparams);
-extern void pr_idef(FILE *fp,int indent,char *title,t_idef *idef);
+extern void pr_idef(FILE *fp,int indent,char *title,t_idef *idef, bool bShowNumbers);
 extern void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir);
-extern void pr_top(FILE *fp,int indent,char *title,t_topology *top);
+extern void pr_top(FILE *fp,int indent,char *title,t_topology *top, bool bShowNumbers);
 /*
  * This routine prints out a (human) readable representation of 
  * the topology to the file fp. Ident specifies the number of 
@@ -78,12 +73,11 @@ extern void pr_top(FILE *fp,int indent,char *title,t_topology *top);
  * header text.
  */
 extern void pr_header(FILE *fp,int indent,char *title,t_tpxheader *sh);
-     /*
+      /*
       * This routine prints out a (human) readable representation of
       * a header to the file fp. Ident specifies the number of spaces
       * the text should be indented. Title is used to print a header text.
       */
 
 
-
 #endif /* _txtdump_h */
index b8955f30cc254943eaa6fc369a99eff863e274e3..aa5bdb4376b4901109592895ea0ca7f0ba1202b2 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _typedefs_h
 #define _typedefs_h
 
-static char *SRCID_typedefs_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 4b8ad7f9a037125b35b011b4c361a3560e6ef707..9d8184f2d41edbb669f18b89b6b97aeea0019e04 100644 (file)
@@ -85,12 +85,20 @@ typedef struct {
                                /* use: (*(atomtypeB[i]))               */
   int          nres;           /* Nr of residue names                  */
   char         ***resname;     /* Array of pointers to residue names   */
-                               /* use: (*(resname[i]))                 */
-  int           ngrpname;       /* Number of groupnames                 */
+                               /* use: (*(resname[i]))         */
+  int           ngrpname;        /* Number of groupnames                 */
   char          ***grpname;    /* Names of the groups                  */
-  t_block      excl;           /* Exclusions                           */
+  t_block      excl;           /* Exclusions                   */
   t_grps        grps[egcNR];    /* Groups of things                     */
   t_pdbinfo     *pdbinfo;       /* PDB Information, such as aniso. Bfac */
 } t_atoms;
 
+typedef struct {
+  int           nr;              /* number of atomtypes                     */
+  real         *radius;         /* GBSA radius for each atomtype        */
+  real         *vol;            /* GBSA efective volume for each atomtype   */
+  real         *surftens;       /* implicit solvent surftens for each atomtype */
+} t_atomtypes;
+
+
 #define PERTURBED(a) (((a).mB != (a).m) || ((a).qB != (a).q) || ((a).typeB != (a).type))
index 7043b49d6a26b61288368e01ef7fd160cc5d6f98..a0a978d974aaf57ee3da9dbd61c94608de44b730 100644 (file)
@@ -44,7 +44,7 @@ enum {
 };
 
 enum {
-  etcNO, etcBERENDSEN, etcNOSEHOOVER, etcYES, etcNR
+  etcNO, etcBERENDSEN, etcNOSEHOOVER, etcYES, etcANDERSEN, etcANDERSENINTERVAL, etcNR
 }; /* yes is an alias for berendsen */
 
 enum {
@@ -58,7 +58,7 @@ enum {
 
 enum {
   eelCUT,     eelRF,     eelGRF,   eelPME,  eelEWALD,  eelPPPM, 
-  eelPOISSON, eelSWITCH, eelSHIFT, eelUSER, eelNR
+  eelPOISSON, eelSWITCH, eelSHIFT, eelUSER, eelGB, eelNR
 };
 
 /* Ewald geometry */
@@ -127,3 +127,18 @@ enum {
   ecmLINEAR, ecmANGULAR, ecmNO, ecmNR 
 };
 
+/* New version of simulated annealing */
+enum { 
+  eannNO, eannSINGLE, eannPERIODIC, eannNR 
+};
+
+/* Algorithms for calculating GB radii */
+enum { 
+  egbSTILL, egbKARPLUS, egbNR 
+};
+
+/* Implicit solvent algorithms */
+enum { 
+  eisNO, eisLCPO, eisNR 
+};
+
index 460078b8d6858c4836d039fc3b6b833613d84c1b..e2c3c9488afd180baf48f3a321e7166f10cf282e 100644 (file)
@@ -83,6 +83,23 @@ typedef struct {
   real   ***TMP;      /* An array of temporary 5x5 matrices (nex);          */
 } t_oriresdata;
 
+/* Dihedral restraining stuff */
+typedef struct {
+  real dihre_fc;        /* Force constant for dihres,                       
+                        * which is multiplied by a (possibly)              
+                        * different factor for each restraint            */
+  real dihre_tau;      /* Time constant for dihres                            */
+
+  real ETerm;         /* multiplication factor for time averaging         */
+  real ETerm1;        /* 1 - ETerm1                                       */
+  real exp_min_t_tau; /* Factor for slowly switching on the force         */
+  int  nr;            /* The number of dihedral restraints                */
+  int  ndih;          /* The number of dihedral restraint pairs           */
+  real *diht;         /* The calculated instantaneous dihedrals (npr)     */
+  real *dihav;        /* The calculated time averaged dihedrals (npr)     */
+  real RMSviol;       /* The root-mean-square of violations (degrees)     */  
+} t_dihresdata;
+
 /* 
  * Data struct used in the force calculation routines
  * for storing information which is needed in following steps
@@ -92,4 +109,5 @@ typedef struct {
 typedef struct {
   t_disresdata disres;
   t_oriresdata orires;
+  t_dihresdata dihres;
 } t_fcdata;
index d004a2c927e67ea57e84f34472bc18fdf39a42af..da97f685d88c89aafd725cfbe89b5432a26451e3 100644 (file)
@@ -146,6 +146,15 @@ typedef struct {
 
   /* xmdrun flexible constraints */
   real fc_stepsize;
+
+  /* Generalized born stuff */
+  /* VdW radius for each atomtype (dim is thus ntype) */
+  real *atype_radius;
+  /* Effective radius (derived from effective volume) for each type */
+  real *atype_vol;
+  /* Implicit solvent - surface tension for each atomtype */
+  real *atype_surftens;
+
 } t_forcerec;
 
 #define C6(nbfp,ntp,ai,aj)     (nbfp)[2*((ntp)*(ai)+(aj))]
index 8e57507970b66c19e9a8331922641e7083f8991a..b57ef998b683998b68a89343db4252459cefe188 100644 (file)
@@ -35,6 +35,8 @@
 
 #include "fatal.h"
 
+typedef enum { egcolWhite, egcolGrey, egcolBlack, egcolNR } egCol;
+
 typedef struct {
   int      maxedge;     /* Max number of edges per atom                 */
   int      nnodes;     /* The number of nodes                          */
@@ -44,6 +46,8 @@ typedef struct {
   int      *nedge;     /* For each node the number of edges            */
   atom_id  **edge;     /* For each node, the actual edges (bidirect.)  */
   ivec     *ishift;    /* Shift for each particle                      */
+  int      negc;         
+  egCol   *egc;         /* color of each node */
 } t_graph;
 
 
index 63cecf73dfc3beea275be8c94b49af8815e27240..c83a07de86562f7606c59c3972286d9d8db7772a 100644 (file)
@@ -41,6 +41,7 @@
 #define MAXATOMLIST    5
 #define MAXFORCEPARAM  12
 #define NR_RBDIHS      6
+#define NR_FOURDIHS     4
 
 typedef atom_id t_iatom;
 
@@ -56,8 +57,10 @@ enum {
   F_ANGLES, 
   F_G96ANGLES, 
   F_PDIHS,
-  F_RBDIHS,
+  F_RBDIHS, 
+  F_FOURDIHS,
   F_IDIHS, 
+  F_PIDIHS, 
   F_LJ14,
   F_COUL14,
   F_LJ,
@@ -74,6 +77,8 @@ enum {
   F_ORIRESDEV,
   F_ANGRES,
   F_ANGRESZ,
+  F_DIHRES,
+  F_DIHRESVIOL,
   F_SHAKE,
   F_SHAKENC,
   F_SETTLE,
@@ -102,32 +107,33 @@ typedef union
    * The harmonic type is used for all harmonic potentials:
    * bonds, angles and improper dihedrals
    */
-  struct {real a,b,c;                          } bham;
-  struct {real rA,krA,rB,krB;                  } harmonic; 
-  /* No free energy support for cubic bonds */
-  struct {real b0,kb,kcub;                      } cubic; 
+  struct {real a,b,c;                                     } bham;
+  struct {real rA,krA,rB,krB;                             } harmonic; 
+  /* No free energy supported for cubic bonds */ 
+  struct {real b0,kb,kcub;                                } cubic; 
   /* No free energy supported for WPOL */ 
-  struct {real kx,ky,kz,rOH,rHH,rOD;            } wpol; 
-  struct {real c6,c12;                         } lj;
-  struct {real c6A,c12A,c6B,c12B;              } lj14;
+  struct {real kx,ky,kz,rOH,rHH,rOD;                      } wpol; 
+  struct {real c6,c12;                                    } lj;
+  struct {real c6A,c12A,c6B,c12B;                         } lj14;
   /* Proper dihedrals can not have different multiplicity when
    * doing free energy calculations, because the potential would not
    * be periodic anymore.
    */ 
-  struct {real phiA,cpA;int mult;real phiB,cpB; } pdihs;
-  struct {real dA,dB;                          } shake;
-  /* Settle can not be used for Free energy calculations.
-   * Use shake (or lincs) instead.
-   * The rest of the things cannot (yet) be used in FEP studies either.
+  struct {real phiA,cpA;int mult;real phiB,cpB;          } pdihs;
+  struct {real dA,dB;                                    } shake;
+  /* Settle can not be used for Free energy calculations of water bond geometry.
+   * Use shake (or lincs) instead if you have to change the water bonds.
    */
-  struct {real doh,dhh;                         } settle;
-  struct {real b0,cb,beta;                     } morse;
-  struct {real pos0[DIM],fc[DIM];              } posres;
-  struct {real rbcA[NR_RBDIHS], rbcB[NR_RBDIHS];} rbdihs;
-  struct {real a,b,c,d,e,f;                     } dummy;   
-  struct {real low,up1,up2,kfac;int type,label; } disres; 
-  struct {int  ex,power,label; real c,obs,kfac; } orires;
-  struct {real buf[MAXFORCEPARAM];             } generic; /* Conversion */
+  struct {real doh,dhh;                                   } settle;
+  /* No free energy supported for morse bonds */ 
+  struct {real b0,cb,beta;                                } morse;
+  struct {real pos0[DIM],fc[DIM];                                 } posres;
+  struct {real rbcA[NR_RBDIHS], rbcB[NR_RBDIHS];          } rbdihs;
+  struct {real a,b,c,d,e,f;                               } dummy;   
+  struct {real low,up1,up2,kfac;int type,label;           } disres; 
+  struct {real phi,dphi,kfac;int label,power;             } dihres;  
+  struct {int  ex,power,label; real c,obs,kfac;           } orires;
+  struct {real buf[MAXFORCEPARAM];                        } generic; /* Conversion */
 } t_iparams;
 
 typedef int t_functype;
index 64aac9e66e916851646a47d6a41e6c63278ebc46..9c102801a648f0b1bbe017cdca8cd537c72fa25a 100644 (file)
@@ -85,7 +85,7 @@ typedef struct
 #define IS_CHEMBOND(ftype) (interaction_function[(ftype)].nratoms==2 && interaction_function[(ftype)].flags & IF_CHEMBOND)
 /* IS_CHEMBOND tells if function type ftype represents a chemical bond */
 
-extern t_interaction_function interaction_function[F_NRE];
+extern const t_interaction_function interaction_function[F_NRE];
 /* initialised interaction functions descriptor                                */
 
 #endif
index 92a5bf2b1b7470a2c7470c748ce18b49e304abf0..c41a5166c7d2fe64e4c905f2ea43aadb0c2559f1 100644 (file)
@@ -40,21 +40,28 @@ typedef struct {
 } t_cosines;
 
 typedef struct {
-  int     ngtc;         /* # T-Coupl groups                             */
-  int     ngacc;        /* # Accelerate groups                          */
-  int     ngfrz;        /* # Freeze groups                              */
-  int     ngener;      /* # Ener groups                                */
-  real    *nrdf;       /* Nr of degrees of freedom in a group          */
-  real    *ref_t;      /* Coupling temperature per group               */
-  real    *tau_t;      /* Tau coupling time                            */
-  rvec    *acc;                /* Acceleration per group                       */
-  ivec    *nFreeze;    /* Freeze the group in each direction ?         */
-  bool    *eg_excl;     /* Exclusions of energy group pairs             */
+  int     ngtc;                  /* # T-Coupl groups                       */
+  int     ngacc;                 /* # Accelerate groups                    */
+  int     ngfrz;                 /* # Freeze groups                        */
+  int     ngener;               /* # Ener groups                          */
+  real    *nrdf;                /* Nr of degrees of freedom in a group    */
+  real    *ref_t;               /* Coupling temperature        per group  */
+  int     *annealing;            /* No/simple/periodic SA for each group   */
+  int     *anneal_npoints;       /* Number of annealing time points per grp*/    
+  real    **anneal_time;         /* For ea. group: Time points             */
+  real    **anneal_temp;         /* For ea. grp: Temperature at these times*/
+                                 /* Final temp after all intervals is ref_t*/  
+  real    *tau_t;               /* Tau coupling time                      */
+  rvec    *acc;                         /* Acceleration per group                 */
+  ivec    *nFreeze;             /* Freeze the group in each direction ?   */
+  bool    *eg_excl;              /* Exclusions of energy group pairs       */
 } t_grpopts;
 
+
 typedef struct {
   int  eI;              /* Integration method                          */
   int  nsteps;         /* number of steps to be taken                  */
+  int  init_step;      /* start at a stepcount >0 (used w. tpbconv)    */
   int  ns_type;                /* which ns method should we use?               */
   int  nstlist;                /* number of steps before pairlist is generated */
   int  ndelta;         /* number of cells per rlong                    */
@@ -62,6 +69,7 @@ typedef struct {
   int  decomp_dir;      /* Direction of decomposition (may not be opt.) */
   int  nstcomm;                /* number of steps after which center of mass   */
                         /* motion is removed                           */
+  int nstcheckpoint;    /* checkpointing frequency                      */
   int nstlog;          /* number of steps after which print to logfile */
   int nstxout;         /* number of steps after which X is output      */
   int nstvout;         /* id. for V                                    */
@@ -87,16 +95,20 @@ typedef struct {
   real tau_p;          /* pressure coupling time (ps)                  */
   tensor ref_p;                /* reference pressure (kJ/(mol nm^3))           */
   tensor compress;     /* compressability ((mol nm^3)/kJ)              */
-  bool bSimAnn;         /* simulated annealing (SA)                     */
-  real zero_temp_time;  /* time at which temp becomes zero in sim. ann. */
+  int  andersen_seed;   /* Random seed for Andersen thermostat.         */
   real rlist;          /* short range pairlist cut-off (nm)            */
   int  coulombtype;    /* Type of electrostatics treatment             */
   real rcoulomb_switch; /* Coulomb switch range start (nm)             */
   real rcoulomb;        /* Coulomb cutoff (nm)                         */
+  real epsilon_r;       /* relative dielectric constant                 */ 
+  int  gb_algorithm;    /* Algorithm to use for calculation Born radii  */
+  int  nstgbradii;      /* Frequency of updating Generalized Born radii */
+  real rgbradii;        /* Cutoff for GB radii calculation              */
+  real gb_saltconc;     /* Salt concentration (M) for GBSA models       */
   int  vdwtype;         /* Type of Van der Waals treatment              */
   real rvdw_switch;     /* Van der Waals switch range start (nm)        */
   real rvdw;           /* Van der Waals cutoff (nm)                    */
-  real epsilon_r;       /* relative dielectric constant                 */
+  int  implicit_solvent;/* No (=explicit water), or GBSA solvent models */
   int  eDispCorr;       /* Perform Long range dispersion corrections    */
   real shake_tol;      /* tolerance for shake                          */
   real fudgeQQ;                /* Id. for 1-4 coulomb interactions             */
@@ -113,6 +125,9 @@ typedef struct {
   real orires_fc;      /* force constant for orientational restraints  */
   real orires_tau;     /* time constant for memory function in orires  */
   int  nstorireout;     /* frequency of writing tr(SD) to enx           */ 
+  int  dihre_fc;        /* force constant for dihedral restraints      */
+  int  nstdihreout;     /* frequency of writing dihedrals to enx        */ 
+  real dihre_tau;       /* time constant for memory function in dihres         */
   real em_stepsize;    /* The stepsize for updating                    */
   real em_tol;         /* The tolerance                                */
   int  niter;           /* Number of iterations for convergence of      */
@@ -124,6 +139,7 @@ typedef struct {
   int  eConstrAlg;      /* Type of constraint algorithm                 */
   int  nProjOrder;      /* Order of the LINCS Projection Algorithm      */
   real LincsWarnAngle;  /* If bond rotates more than %g degrees, warn   */
+  int  nLincsIter;      /* Number of iterations in the final Lincs step */
   bool bShakeSOR;       /* Use successive overrelaxation for shake      */
   real bd_temp;         /* Temperature for Brownian Dynamics (BD)       */
   real bd_fric;         /* Friction coefficient for BD (amu / ps)       */
index cca85a6fd851a23b61d7ee5c462686e105dc4d50..c281595d3a2f31d06e617068498718effb4c9db4 100644 (file)
@@ -75,7 +75,8 @@ enum {
   eNR_SHIFTX,               eNR_CGCM,                 eNR_FSUM,
   eNR_BONDS,                eNR_G96BONDS,             eNR_ANGLES,
   eNR_G96ANGLES,            eNR_PROPER,               eNR_IMPROPER,
-  eNR_RB,                   eNR_DISRES,               eNR_ORIRES,
+  eNR_RB,                   eNR_FOURDIH,              eNR_DISRES,               
+  eNR_ORIRES,               eNR_DIHRES,
   eNR_POSRES,               eNR_ANGRES,               eNR_ANGRESZ,
   eNR_MORSE,                eNR_CUBICBONDS,
   eNR_WPOL,                 eNR_VIRIAL,
index fb30126bbe411bb8b572378b9f6bd14ccb02c6c7..666bcbe713ebf0eefbc58baa8907b6ed1e16af42 100644 (file)
 #endif
 
 typedef struct {
-  char         **name;         /* Name of the topology                 */
+  char           **name;               /* Name of the topology         */
   t_idef       idef;           /* The interaction function definition  */
-  t_atoms      atoms;          /* The atoms                            */
-  t_block      blocks[ebNR];   /* The blocks                           */
+  t_atoms      atoms;          /* The atoms                    */
+  t_atomtypes   atomtypes;      /* Atomtype properties                       */
+  t_block      blocks[ebNR];   /* The blocks                   */
   t_symtab     symtab;         /* The symbol table                     */
 } t_topology;
 
index 222ffd3f78ef415b54224ebc2e2363cd62cdf6a9..6b35227533c86dcaf9a35d93b41d7101a8d89e5f 100644 (file)
 #ifndef _update_h
 #define _update_h
 
-static char *SRCID_update_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) update.h 1.33 24 Jun 1996"
-#endif /* HAVE_IDENT */
-
 #include "typedefs.h"
 #include "mshift.h"
 #include "tgroup.h"
@@ -56,7 +51,6 @@ extern void update(int          natoms,       /* number of atoms in simulation */
                   real         lambda, /* FEP scaling parameter */
                   real         *dvdlambda, /* FEP stuff */
                   t_parm       *parm,    /* input record and box stuff */
-                  real         SAfactor, /* simulated annealing factor   */
                   t_mdatoms    *md,
                   rvec         x[],    /* coordinates of home particles */
                   t_graph      *graph, 
@@ -121,12 +115,13 @@ extern void init_sd_consts(int ngtc,real tau_t[],real dt);
  */
 extern real run_aver(real old,real cur,int step,int nmem);
 
-extern void berendsen_tcoupl(t_grpopts *opts,t_groups *grps,
-                            real dt,real SAfactor);
-extern void nosehoover_tcoupl(t_grpopts *opts,t_groups *grps,
-                             real dt,real SAfactor);
+extern void berendsen_tcoupl(t_grpopts *opts,t_groups *grps,real dt);
+extern void nosehoover_tcoupl(t_grpopts *opts,t_groups *grps,real dt);
 /* Compute temperature scaling. For Nose-Hoover it is done in update. */
 
+/* Set reference temp for simulated annealing at time t*/
+extern void update_annealing_target_temp(t_grpopts *opts,real t); 
+
 extern real calc_temp(real ekin,real nrdf);
 /* Calculate the temperature */
 
index 6cad7c1fa0de60b5636c7e7335fb71eb3a0bd920..3fae9b24dc155f8c5f1d8af9fc575b0db53731df 100644 (file)
 #ifndef _utils_h
 #define _utils_h
 
-static char *SRCID_utils_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) utils.h 1.11 2/2/97"
-#endif /* HAVE_IDENT */
-
 #include <stdio.h>
 #include "typedefs.h"
 
index cb5fc0b4f535e942b6121586bf892c97c3e4ec53..bdcf14d670309fa32d3166c0c44987bca6370fdc 100644 (file)
 #ifndef _vcm_h
 #define _vcm_h
 
-static char *SRCID_vcm_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) vcm.h 1.9 9/29/97"
-#endif /* HAVE_IDENT */
 #include "sysstuff.h"
 #include "typedefs.h"
 
index be505a8da82c77eb3d6f0fb585c09fd2aea86fe8..434d9be85baa7d42f88d6cc038921ce75b569147 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _vec_h
 #define _vec_h
 
-static char *SRCID_vec_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #define gmx_inline inline
@@ -172,18 +171,22 @@ extern void vecinvsqrt(real in[],real out[],int n);
 /* Perform out[i]=1.0/sqrt(in[i]) for n elements */
 
 
-
 extern void vecrecip(real in[],real out[],int n);
-/* Perform out[i]=1.0/(in[i]) for n elements 
- * Note that this function can be much faster than writing
- * the loop yourself, even if the recip(x) is slow on your machine.
- * Not only do we get better cache usage in vecrecip, but it
- * might be possible to use optimized vector libraries.
+/* Perform out[i]=1.0/(in[i]) for n elements */
+
+/* Note: If you need a fast version of vecinvsqrt 
+ * and/or vecrecip, call detectcpu() and run the SSE/3DNow/SSE2/Altivec
+ * versions if your hardware supports it.
+ *
+ * To use those routines, your memory HAS TO BE CACHE-ALIGNED.
+ * Start by allocating 31 bytes more than you need, put
+ * this in a temp variable (e.g. _buf, so you can free it later), and
+ * create your aligned array buf with
+ * 
+ *  buf=(real *) ( ( (unsigned long int)_buf + 31 ) & (~0x1f) );
  */
 
 
-
-
 static inline void rvec_add(const rvec a,const rvec b,rvec c)
 {
   real x,y,z;
index a4c712a01be671707fc25fca9be698beebcb6afa..afce5c39c89df7f901265dd69f9e73c98773181f 100644 (file)
 #ifndef _viewit_h
 #define _viewit_h
 
-static char *SRCID_viewit_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "$Id$"
-#endif /* HAVE_IDENT */
-
 #ifdef CPLUSPLUS
 extern "C" {
 #endif
index e94f221acbccce7fa8708d281a3713ceed9ca880..d1f8ec7f7fa9ff26ab46abd2d2360eb0aef6c8e2 100644 (file)
@@ -32,8 +32,6 @@
 
 #ifndef _wgms_h
 #define _wgms_h
-
-static char *SRCID_wgms_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 86752afe8cbfd3c92d026f92250775a9fa20cc2b..c218d964e8f12da15e2d4c3cb0be34efe66f7c03 100644 (file)
 #ifndef _wman_h
 #define _wman_h
 
-static char *SRCID_wman_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) wman.h 1.11 10/2/97"
-#endif /* HAVE_IDENT */
-
 #include "readinp.h"
 
 extern void write_java(FILE *out,char *program,
@@ -57,17 +52,17 @@ extern void write_man(FILE *out,char *mantp,char *program,
                      int nbug,char **bugs,
                      bool bHidden);
 
-extern char *fileopt(unsigned long flag);
+extern char *fileopt(unsigned long flag,char buf[],int maxsize);
 /* Return a string describing the file type in flag.
  * flag should the flag field of a filenm struct.
+ * You have to provide a buffer and buffer length in which
+ * the result will be written. The returned pointer is just
+ * a pointer to this buffer.
  */
 
-extern char *check_tty(char *s);
-extern char *check_tex(char *s);
-extern char *check_html(char *s,char *program);
-/* Check LaTeX or HTML strings for codes, and remove them 
- * the program variable may be NULL
- */
+extern const char *check_tex(const char *s);
+
+extern const char *check_tty(const char *s);
 
 #endif /* _wman_h */
 
index 06b0ac7063d780fe3dcf02a060cda59a9fa9a610..7704fbe62a5f7a148e86627ecb52bab97c97b8c7 100644 (file)
 #ifndef _writeps_h
 #define _writeps_h
 
-static char *SRCID_writeps_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) writeps.h 1.10 8/25/97"
-#endif /* HAVE_IDENT */
 #include <stdio.h>
 #include "typedefs.h"
 
@@ -58,56 +54,62 @@ enum {
   efontCOUR,  efontCOURITALIC,  efontCOURBOLD,  efontCOURBOLDITALIC,
   efontNR };
 
-extern char *fontnm[efontNR];
 
-extern FILE *ps_open(char *fn,real x1,real y1,real x2,real y2);
+typedef struct t_int_psdata *t_psdata;
+/* Only use t_psdata - it is a pointer to an abstract datatype
+ * that maintains the state of the postscript currently written.
+ */
+
+extern const char *fontnm[efontNR];
+
+extern t_psdata ps_open(char *fn,real x1,real y1,real x2,real y2);
 
-extern void ps_linewidth(FILE *ps,int lw);
-extern void ps_color(FILE *ps,real r,real g,real b);
-extern void ps_rgb(FILE *ps,t_rgb *rgb);
+extern void ps_linewidth(t_psdata ps,int lw);
+extern void ps_color(t_psdata ps,real r,real g,real b);
+extern void ps_rgb(t_psdata ps,t_rgb *rgb);
 
-extern void ps_rgb_box(FILE *ps,t_rgb *rgb);
-extern void ps_rgb_nbox(FILE *ps,t_rgb *rgb,real n);
-extern void ps_init_rgb_box(FILE *ps,real xbox, real ybox);
-extern void ps_init_rgb_nbox(FILE *ps,real xbox, real ybox);
+extern void ps_rgb_box(t_psdata ps,t_rgb *rgb);
+extern void ps_rgb_nbox(t_psdata ps,t_rgb *rgb,real n);
+extern void ps_init_rgb_box(t_psdata ps,real xbox, real ybox);
+extern void ps_init_rgb_nbox(t_psdata ps,real xbox, real ybox);
 
-extern void ps_lineto(FILE *ps,real x,real y);
-extern void ps_linerel(FILE *ps,real dx,real dy);
+extern void ps_lineto(t_psdata ps,real x,real y);
+extern void ps_linerel(t_psdata ps,real dx,real dy);
 
-extern void ps_moveto(FILE *ps,real x,real y);
-extern void ps_moverel(FILE *ps,real dx,real dy);
+extern void ps_moveto(t_psdata ps,real x,real y);
+extern void ps_moverel(t_psdata ps,real dx,real dy);
 
-extern void ps_line(FILE *ps,real x1,real y1,real x2,real y2);
+extern void ps_line(t_psdata ps,real x1,real y1,real x2,real y2);
 
-extern void ps_box(FILE *ps,real x1,real y1,real x2,real y2);
-extern void ps_fillbox(FILE *ps,real x1,real y1,real x2,real y2);
+extern void ps_box(t_psdata ps,real x1,real y1,real x2,real y2);
+extern void ps_fillbox(t_psdata ps,real x1,real y1,real x2,real y2);
 
-extern void ps_arc(FILE *ps,real x1,real y1,real rad,real a0,real a1);
-extern void ps_fillarc(FILE *ps,real x1,real y1,real rad,real a0,real a1);
-extern void ps_arcslice(FILE *ps,real xc,real yc,
+extern void ps_arc(t_psdata ps,real x1,real y1,real rad,real a0,real a1);
+extern void ps_fillarc(t_psdata ps,real x1,real y1,real rad,real a0,real a1);
+extern void ps_arcslice(t_psdata ps,real xc,real yc,
                        real rad1,real rad2,real a0,real a1);
-extern void ps_fillarcslice(FILE *ps,real xc,real yc,
+extern void ps_fillarcslice(t_psdata ps,real xc,real yc,
                            real rad1,real rad2,real a0,real a1);
 
-extern void ps_circle(FILE *ps,real x1,real y1,real rad);
+extern void ps_circle(t_psdata ps,real x1,real y1,real rad);
 
-extern void ps_font(FILE *ps,int font,real size);
-extern void ps_strfont(FILE *ps,char *font,real size);
+extern void ps_font(t_psdata ps,int font,real size);
+extern void ps_strfont(t_psdata ps,char *font,real size);
 
-extern void ps_text(FILE *ps,real x1,real y1,char *str);
-extern void ps_ctext(FILE *ps,real x1,real y1,char *str,int expos);
+extern void ps_text(t_psdata ps,real x1,real y1,char *str);
+extern void ps_ctext(t_psdata ps,real x1,real y1,char *str,int expos);
 
-extern void ps_close(FILE *ps);
+extern void ps_close(t_psdata ps);
 
-extern void ps_rotate(FILE *ps,bool bPlus);
+extern void ps_rotate(t_psdata ps,bool bPlus);
 /* Rotate over 90 (bPlus) or -90 (!bPlus) degrees */
-extern void ps_translate(FILE *ps,real x,real y);
+extern void ps_translate(t_psdata ps,real x,real y);
 
-extern void ps_setorigin(FILE *ps);
-extern void ps_unsetorigin(FILE *ps);
+extern void ps_setorigin(t_psdata ps);
+extern void ps_unsetorigin(t_psdata ps);
 
 extern void viewps(char *fn);
 
-extern void ps_comment(FILE *ps,char *s);
+extern void ps_comment(t_psdata ps,char *s);
 
 #endif /* _writeps_h */
index 828ba2aa5a7f98750d2dfa1b7cfed80925745550..961b993c6d9682648d0770404b9fe17a41c04617 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _x86_3dnow_h
 #define _x86_3dnow_h
 
-static char *SRCID_x86_3dnow_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 6fc3d4e25c7a0caacb65e289bc82e63f3fd14eb2..67b96dd56191f6c99c51c1046f2dde56803ad3ff 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _x86_sse_h
 #define _x86_sse_h
 
-static char *SRCID_x86_sse_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 4b403beb8fb98fd74ce28664e93013be20e767fd..58e0d10cc67e9f2553aa2f2e0fb2f6a150d41ccf 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _x86_sse2_h
 #define _x86_sse2_h
 
-static char *SRCID_x86_sse2_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index b68b0bf91da7680493f28ec6c7aceede0f05b3ee..8d202373056a76805fe26cee1f181b91fb7fa4ec 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _xdrf_h
 #define _xdrf_h
 
-static char *SRCID_xdrf_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 3217d12d9c84cf5675da68ec1fb30cb9a7b96a18..400cb24ef401f03fba0f0aedfd75180b86023137 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _xtcio_h
 #define _xtcio_h
 
-static char *SRCID_xtcio_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index e8d32464874759527eaaef83505a7184db505bbc..e0c8c0691fc85e330c6110d9de56f09683e8eca4 100644 (file)
 #ifndef _xvgr_h
 #define _xvgr_h
 
-static char *SRCID_xvgr_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
-#ifdef HAVE_IDENT
-#ident "@(#) xvgr.h 1.8 7/28/97"
-#endif /* HAVE_IDENT */
-
 #ifdef CPLUSPLUS
 extern "C" {
 #endif
@@ -81,7 +76,7 @@ enum {
  *            XVGR   ROUTINES
  ***************************************************/
 
-extern FILE *xvgropen(char *fn,char *title,char *xaxis,char *yaxis);
+extern FILE *xvgropen(const char *fn,const char *title,const char *xaxis,const char *yaxis);
 /* Open a file, and write a title, and axis-labels in Xvgr format */
 
 extern void xvgr_view(FILE *out,real xmin,real ymin,real xmax,real ymax);
index 216c79c2ae001665e39bac6932c2cebf1788a7db..e09ffdd89ec1cb6fcad74bb074407184e5aff5b5 100644 (file)
@@ -33,12 +33,6 @@ Makefile.@host@ Makefile.@host@_double: Template.mak Makefile
        sed 's,@CC\@,$(CC),' | \
        sed 's,@host\@,@host@,' >$@
 
-install-data-hook:
-if DOUBLE
-       (cd $(DESTDIR)$(templatedir) && ! (test -e Makefile) && $(LN_S) Makefile.@host@_double Makefile ; exit 0)
-else
-       (cd $(DESTDIR)$(templatedir) && ! (test -e Makefile) && $(LN_S) Makefile.@host@ Makefile ; exit 0)
-endif
 CLEANFILES = Makefile.@host@ Makefile.@host@_double *~ \\\#*
 
 
index 0c72fc91473d95d5e6c3d4e6dc344e763acc6c08..eb6e841a47b5b9e4ddbbcacb5086e785f2496dbb 100644 (file)
@@ -3,9 +3,9 @@ a small program that you could use as a template when
 writing your own analysis software.
 
 A Makefile.arch is created for each architecture you install 
-(the first one is linked to Makefile) with the correct paths 
-and libraries. If there is more than one, copy the one
-that corresponds best to your computer.
+with the correct paths and libraries. You will have to link
+(or copy) the correct makefile to "Makefile" or use the -f 
+option to gmake in order to select a makefile.
 
 ----------------------------------------------------------
 
index 4d173140cc69a03a53fa3694e4e514eb2c816ef3..56131989c69c7d9bc44b19938ca00bfcc04c8ff5 100644 (file)
@@ -4,9 +4,9 @@
    OM    15.99940       0.000       A   0.22617E-02   0.74158E-06
    OA    15.99940       0.000       A   0.22617E-02   0.15062E-05
 #ifdef HEAVY_H
-   OW     9.95140       0.000       A   0.26171E-02   0.26331E-05
+   OW     9.95140       0.000       A   0.26171E-02   0.26331E-05 1 2 3
 #else
-   OW    15.99940       0.000       A   0.26171E-02   0.26331E-05
+   OW    15.99940       0.000       A   0.26171E-02   0.26331E-05 1 2 3
 #endif
     N    14.00670       0.000       A   0.24362E-02   0.16924E-05
    NT    14.00670       0.000       A   0.24362E-02   0.16924E-05
@@ -24,9 +24,9 @@
     H     1.00800       0.000       A   0.00000E+00   0.00000E+00
    HO     1.00800       0.000       A   0.00000E+00   0.00000E+00
 #ifdef HEAVY_H
-   HW     4.03200       0.000       A   0.00000E+00   0.00000E+00
+   HW     4.03200       0.000       A   0.00000E+00   0.00000E+00 4 5 6
 #else
-   HW     1.00800       0.000       A   0.00000E+00   0.00000E+00
+   HW     1.00800       0.000       A   0.00000E+00   0.00000E+00 4 5 6
 #endif
    HS     1.00800       0.000       A   0.00000E+00   0.00000E+00
     S    32.06000       0.000       A   0.99844E-02   0.13078E-04
index 9d22ebf7f9d121c0ccf011465dcf066e6d3a9680..0c376c069090ef3ab35fc8d8939f4578c552e084 100644 (file)
@@ -31,7 +31,7 @@
    CH3     C
      C     O
 [ impropers ]
-    O     C   +N    CH3     improper_O_C_X_Y
+     C   CH3    +N     O     improper_O_C_X_Y
 
 [ ALA ]
  [ atoms ] 
index e31e651f8ca0ed85875849321bcd18f2afca9874..a589c382195d9f21f32f0e663ef731e9eeb8ab70 100644 (file)
@@ -1,36 +1,64 @@
-#ifndef _FF_GROMOS96
+#ifdef _FF_OPLSAA
 
-[ atomtypes ]
-;   type      mass    charge    ptype       c6            c12
-    OMET    15.999    -0.69     A      2.6169e-3      2.5231e-6
-      OW    15.999    -0.82     A      2.6170e-3      2.6330e-6
-    CMET    15.035     0.29     A      8.8758e-3     17.8426e-6
-       H     1.008     0.4      A      0.0            0.0
-      HW     1.008     0.41     A      0.0            0.0
-#endif
 
 [ moleculetype ]
 ; name  nrexcl
-Methanol        2
+Ethanol        3
 
 [ atoms ]
-;   nr  type    resnr   residu  atom    cgnr    charge mass
-#ifdef _FF_GROMOS96
-1       CMET     1       MeOH    Me1     1        0.176 15.035   
-2       OMET     1       MeOH    O2      1       -0.574 15.999 
-3       H        1       MeOH    H3      1        0.398  1.008 
-#else
-1       CMET     1       MeOH    Me1     1        0.29  15.035
-2       OMET     1       MeOH    O2      1       -0.69  15.999
-3       H        1       MeOH    H3      1        0.40   1.008
-#endif
+; nr  type      resnr  residu  atom    cgnr    charge  mass
+   1  opls_135    1     EtOH    CB       1      -0.18    12.011
+   2  opls_140    1     EtOH    HB1      1       0.06     1.008
+   3  opls_140    1     EtOH    HB2      1       0.06     1.008
+   4  opls_140    1     EtOH    HB3      1       0.06     1.008
+   5  opls_157    1     EtOH    CA       2       0.145   12.011
+   6  opls_140    1     EtOH    HA1      2       0.06     1.008
+   7  opls_140    1     EtOH    HA2      2       0.06     1.008
+   8  opls_154    1     EtOH    OH       2      -0.683   15.994
+   9  opls_155    1     EtOH    HO       2       0.418    1.008
+
 
 [ bonds ]
-;  ai  aj funct           c0           c1
-1       2      1          0.13600     376560.
-2       3      1          0.10000     313800.
+;  ai  aj   funct
+    1   2       1
+    1   3       1
+    1   4       1
+    1   5       1
+    5   6       1
+    5   7       1
+    5   8       1
+    8   9       1
+
 
 [ angles ]
 ;  ai    aj    ak       funct   c0      c1
-    1     2     3       1       108.53  397.5
+    2     1     3         1
+    2     1     4         1
+    2     1     5         1
+    3     1     4         1
+    3     1     5         1
+    4     1     5         1
+    1     5     6         1  
+    1     5     7         1 
+    1     5     8         1
+    6     5     7         1
+    6     5     8         1
+    7     5     8         1
+    5     8     9         1
+
+
+[ dihedrals ]
+;  ai    aj    ak    al    func
+    2     1     5     6      3
+    2     1     5     7      3
+    2     1     5     8      3
+    3     1     5     6      3
+    3     1     5     7      3
+    3     1     5     8      3
+    4     1     5     6      3
+    4     1     5     7      3
+    4     1     5     8      3
+    1     5     8     9      3
+    6     5     8     9      3
+    7     5     8     9      3
 
index e44c38510c1c462c918c9b4b58cc5e6c7c2be807..7c46ace436ce8ed3d790d178f23de85615b4992b 100644 (file)
@@ -29,8 +29,9 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_addquote_c = "$Id$";
+
 #include <ctype.h>
+#include <string.h>
 #include "strdb.h"
 #include "copyrite.h"
 #include "smalloc.h"
index 076d46290747b8dbb38a29543a4eaa66730b4903..3362a5dbce7ae3b17d938b81f2ebc40ab2acf466 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_anaf_c = "$Id$";
+
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
@@ -56,7 +56,7 @@ static char *nm[5]  = { "OW", "HW1", "HW2", "DW", "SW" };
 static void list_trn(char *fn)
 {
   static real mass[5] = { 15.9994, 1.008, 1.008, 0.0, 0.0 };
-  int         i,j,m,fpread,fpwrite,nframe;
+  int         i,j=0,m,fpread,fpwrite,nframe;
   rvec        *x,*v,*f,fmol[2],xcm[2],torque[j],dx;
   real        mmm,len;
   matrix      box;
index c7fe2947c3d5982a38e1d1a4f233b4e991008d0e..dfcd29af395dd905cc852421ee32b795c5698a9f 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_calcfdev_c = "$Id$";
+
 #include "typedefs.h"
 #include "main.h"
 #include "vec.h"
index 4fa23ea3fe8c2735e1bcdd0e46d3d4032b96f955..d0b2fa115967b116585f82974349176898dc148b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_copyrgt_c = "$Id$";
+
 #include "stdio.h"
 #include "stdlib.h"
 #include "macros.h"
@@ -73,7 +73,7 @@ static char *head2[]= {
 #define NH2 asize(head2)
 #define MAXS 10240
 
-void head(FILE *out, char *fn_, bool bH, bool bSRCID,
+void head(FILE *out, char *fn_, bool bH,
          char *cstart, char *ccont, char *cend)
 {
   int i;
@@ -97,10 +97,6 @@ void head(FILE *out, char *fn_, bool bH, bool bSRCID,
     fprintf(out,"#define _%s\n",fn_);
     fprintf(out,"\n");
   }
-  if (bSRCID)
-    fprintf(out,"static char *SRCID_%s = \"$""Id""$\";\n",fn_);
-  /* NOTE: the "" are to mislead CVS so it will not replace by version info */
-  /*fprintf(out,"\n");*/
 }
 
 void cr_c(char *fn)
@@ -108,7 +104,7 @@ void cr_c(char *fn)
   FILE *in,*out;
   char ofn[1024],line[MAXS+1],cwd[1024];
   char *p,*fn_;
-  bool bH,bSRCID;
+  bool bH;
   
   sprintf(ofn,"%s.bak",fn);
   
@@ -146,16 +142,9 @@ void cr_c(char *fn)
           (strstr(line,"#define") != NULL) )
        bH=TRUE;
     } while ( ( (strstr(line,fn_) != NULL)  ||
-               (strstr(line,"static char *SRCID") != NULL) ||
                (strlen(line)==0) ) && (!feof(in) ) );
     getcwd(cwd,STRLEN);
-    bSRCID = TRUE;
-    /* Do not put source id's in include/types since some filenames are
-     * be equal to those in include */
-    if ((strlen(cwd)>strlen("types")) &&
-       (!strcmp(cwd+strlen(cwd)-strlen("types"),"types")))
-      bSRCID = FALSE;
-    head(out,fn_,bH,bSRCID,"/*"," *"," */");
+    head(out,fn_,bH,"/*"," *"," */");
     do {
       fprintf(out,"%s\n",line);
     } while (!feof(in) && fgets2(line,MAXS,in));
@@ -171,12 +160,11 @@ void cr_other(char *fn)
   /*  FILE *in,*out;
   char ofn[1024],line[MAXS+1],line2[MAXS+1],cwd[1024];
   char *p,*fn_,*ptr;
-  bool bH,bSRCID;
+  bool bH;
   
   sprintf(ofn,"%s.bak",fn);
   
-  fprintf(stderr,"Processing %s (backed up to %s)\n",
-         fn,ofn);
+  fprintf(stderr,"Processing %s (backed up to %s)\n",fn,ofn);
   
   if (rename(fn,ofn) != 0) {
     perror(ofn);
@@ -186,55 +174,7 @@ void cr_other(char *fn)
   out=ffopen(fn,"w");
   */
   /* Skip over empty lines in the beginning only */
-  /*
-  do { 
-    if (fgets2(line,MAXS,in))
-      rtrim(line);
-  } while ((strlen(line) == 0) && (!feof(in)));
-  */
-  /* Now we are at end of file, or we have a non-empty string */
-  /*
-  if (strlen(line) != 0) {  
-    strcpy(line2,line);
-    trim(line2);
-    while ((line2[0] == ';') && (!feof(in))) {
-      fgets2(line,MAXS,in);
-      strcpy(line2,line);
-      trim(line2);
-      }
-  */
-    /*
-    fn_=strdup(fn);
-    p=strchr(fn_,'.');
-    if (p)
-      p[0]='_';
-    bH=FALSE;
-    do {
-      fgets2(line,MAXS,in);
-      if ( (strstr(line,fn_) != NULL) && 
-          (strstr(line,"#define") != NULL) )
-       bH=TRUE;
-    } while ( ( (strstr(line,fn_) != NULL)  ||
-               (strstr(line,"static char *SRCID") != NULL) ||
-               (strlen(line)==0) ) && (!feof(in) ) );
-    getcwd(cwd,STRLEN);
-    bSRCID = TRUE;
-    */
-    /* Do not put source id's in include/types since some filenames are
-     * be equal to those in include */
-    /*if ((strlen(cwd)>strlen("types")) &&
-       (strcmp(cwd+strlen(cwd)-strlen("types"),"types") == NULL))
-    */
-  /*
-  bSRCID = FALSE;
-    head(out,fn_,bH,bSRCID,";",";",";");
-    do {
-      fprintf(out,"%s\n",line);
-    } while (!feof(in) && fgets2(line,MAXS,in));
-  }
-  fclose(in);
-  fclose(out);
-  */
+
 }
 
 void cr_tex(char *fn)
index e352da9a95e069f3e0fe2a2e3ae339a9c0bc247e..e441b6357c2641e7467abc5b6432b7a63265e73c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_do_shift_c = "$Id$";
+
 #include <stdlib.h>
 #include "errno.h"
 #include "sysstuff.h"
index c4d2b6abcafa4772d48bd0cca2062245b0aaf383..0fb8cd3d1b189b5f163a0b6d6a36965d781db7de 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_dsspcore_c = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -39,285 +39,6 @@ static char *SRCID_dsspcore_c = "$Id$";
 
 
 
-/* ------------------------------------------------------------------ */
-/*
-
-DSSP version October 1988.
-This copy for Rudi Drunen at Univ_Groningen
-who have agreed to the following software license agreement:
-
-
-An academic license for the DSSP program
-((c) W. Kabsch, C. Sander and MPI-MF, 1983, 1985, 1988)
-is granted to in exchange for the following commitments:
-
-I hereby certify that
-
-        (1) I am an academic user at an academic research institution. In
-            using the software, I will respect the interests of the authors
-            and their institutions.
-
-        (2) I will not use the software in commercial activities without
-            a written commercial license agreement; commercial activities
-            include, in particular, work under contract from a commercial
-            company.
-
-        (3) I will not redistribute the software to others outside of my
-            immediate research group. I will suggest to other interested
-            research groups to contact the authors directly.
-
-        (4) I will not alter or suppress the run-time copyright message.
-
-        (5) I will acknowledge the program authors on any publication of
-            scientific results based in part on use of the program and
-            cite the article in which the program was described.
-
-        (6) I will report evidence of program bugs to the authors.
-
-        (7) I will send the source code of any bug corrections and program
-            extensions, major or minor, to the original authors, for free
-            academic use. If I have made major extensions which are incor-
-            porated by the authors, I reserve the right to be appropriately
-            included in any future commercial license agreement.
-
-        (8) I will not extract part of the software, e.g. modules or sub-
-            routines, for use in other contexts without permission by the
-            authors.
-
-        (9) I will not use the program in the context of classified research.
-*/
-/* PREVIOUS RELEASE: VERSION OCTOBER 1985                             */
-/* PREVIOUS RELEASE: VERSION JUNE 1983                                */
-/* LANGUAGE: STANDARD PASCAL WITH 128 CHARACTER ASCII SET             */
-/* AUTHORS AND COPYRIGHT (1983,1985,1988):
-   Wolfgang Kabsch and Chris Sander, Max Planck Institut
-   fuer Medizinische Forschung, Jahnstr. 29, 6900 Heidelberg, Germany
-   Telephone: +49-6221-486 276  Telex: 461505 mpimf d
-   Bitnet:    KABSCH@EMBL
-   Current address for Chris Sander:
-   Biocomputing, EMBL, 6900 Heidelberg, Germany
-   Telephone: +49-6221-387 361 Telex: 461613 embl d
-   Telefax:   +49-6221-387 306
-   Bitnet:    SANDER@EMBL
-   Do report errors if you find any.
-   Reference: Kabsch,W. and Sander,C. (1983) Biopolymers 22, 2577-2637*/
-/*--------------------------------------------------------------------*/
-/* DEFINES SECONDARY STRUCTURE AND SOLVENT EXPOSURE OF PROTEINS FROM
-   ATOMIC COORDINATES AS GIVEN BY THE BROOKHAVEN PROTEIN DATA BANK.   */
-/*--------------------------------------------------------------------*/
-/* This program including sample input and output files for dataset 1PPT
-   is available from the authors in exchange for an academic or
-   commercial license agreement. The program is no longer available
-   from the Brookhaven Protein Data Bank */
-/*--------------------------------------------------------------------*/
-/* CORRECTION AND MODIFICATION LOG SINCE JUNE 1983 */
-/* (1) MODIFICATIONS THAT AFFECT OUTPUT ON FILE TAPEOUT FOR AT LEAST ONE
-       OF THE 62 PROTEIN DATA SETS IN THE 1983 BIOPOLYMERS PAPER:
-   - SIDECHAIN ATOMS MORE THAN MAXDIST ANGSTROM DISTANT FROM ATOM CA ARE
-     DECLARED ILLEGAL AND IGNORED. OUTPUT CHANGE: ACCESSIBILITY VALUES
-     FOR ASN 76 OF 1SBT (ILLEGAL ATOM OD1) AND PRO 49 OF 156B (ILLEGAL
-     ATOM UNK).
-   - ANY RESIDUE WITH INCOMPLETE BACKBONE IS IGNORED. OUTPUT CHANGE:
-     CHAIN BREAK BETWEEN RESIDUE SER 11 AND ILE 16 IN 2GCH
-     (DUE TO INCOMPLETE COORDINATES FOR SER 11) IS NOW CORRECT.
-   (2) MODIFICATIONS THAT DO NOT AFFECT OUTPUT ON FILE TAPEOUT FOR ANY
-       OF THE 62 PROTEIN DATA SETS IN THE 1983 BIOPOLYMERS PAPER:
-   - SPELLING OF FLAGCHIRALITY AND TESTSSBOND CORRECTED.
-   - WARNING MESSAGE FOR RESIDUES WITH NON-STANDARD NUMBER OF
-     SIDECHAIN ATOMS HAS BEEN ADDED. FOR EXAMPLE, THIS ALERTS THE USER
-     TO BAD DATA FOR RESIDUES 8,12,21,24 AND 44 OF DATA SET 2RXN.
-   - WARNING MESSAGE FOR RESIDUES IGNORED DUE TO NON-STANDARD RESIDUE
-     NAME SUCH AS 'ACE' AND 'FOR' HAS BEEN ADDED.
-   - WARNING MESSAGE FOR ALTERNATE ATOM LOCATION IDENTIFIER HAS BEEN
-     ADDED. FOR EXAMPLE, THE USER IS NOW WARNED THAT ATOM CH2 IN ANY
-     TRP OF DATA SET 1APP IS IGNORED DUE TO BAD ALTERNATE LOCATION
-     IDENTIFIER '2'.
-   WE THANK STEVEN SHERIFF, FRANCOIS COLONNA AND JOHN MOULT FOR
-   REPORTING PROBLEMS AND STEVEN SHERIF, JANET THORNTON AND
-   WILLIE TAYLOR FOR RESULTS OF TEST RUNS ON VAX COMPUTERS.
-
-   Changes after 1985:
-
-   - program speeded up by a factor of two or three by avoiding use
-     of square root.
-   - hydrogen atoms in data set ignored on input (H of NH of backbone
-     is built as before)
-   - 18-AUG-1988: CADIST=9.0, replacing CADIST=8.0. Has affected output
-     for 63/300 proteins in a minor way. Thanks to Jean Richelle (Bruxelles)
-     for pointing out this bug.
-
-     Output changes due to change in parameter CADIST (8 to 9 Angstrom) :
-     additional backbone-backbone Hbonds found with slight
-     adjustments in secondary structure summary. In about 300 protein
-     data sets from the Fall 1988 PDB release, 63 additional
-     Hbonds were found, i.e. 0.2 Hbonds per protein (29 of type
-     i,i+5;  16 of type i,i+4; 6 of type i,i+3; 10 in antiparallel beta
-     bridges and 2 in a parallel beta bridge). These additional
-     Hbonds affected the secondary structure summary of 26 of these
-     protein data sets in a minor way, typically joining a 4-turn to
-     an alpha-helix, changing a geometrical turn to a hydrogen-
-     bonded turn or adding an extra residue pair to a beta ladder.
-     The changes are (using _ for blank):
-
-     [protein id, old secstruc summary > corrected summary]
-
-     1FC2_E > EE   and  _T > ET
-     1GP1GGG > HHH
-     1HBSS > T
-     1HDSS > T and  GGGGGG > TTHHHH
-     1HFM__ > TT
-     1HKGSSS > TTT
-     1IG2S_ > TT
-     1LDX GGG > HTT
-     1MEV__ > TT  and  _BS > TBS  and  SSS > TTS
-     1PFCSSS > TTS
-     1PP2_E > EE  and  _S > ES
-     1RN3E_SS_E > EEEEEE  and _E > EE  (>3-res beta bulge)
-     1RNSsame as 1RN3
-     2ATCHH > TT
-     2CABB_ > EE
-     2CPPSS > TT  and  GGGGGG > HHHHTT
-     2LYZT > H
-     2MDHSSS > TTT
-     3CPA TTT > HHH
-     4CATTTT > HHH
-     4SBVS > T
-     5API_ > B
-     5CPATTT > HHH
-     7LYZS > H
-     8CAT_ > B  and  _ > B
-     8LYZT > H
-
-     Note that this bugfix results in a small variation in the total
-     number of Hbonds, compared to the variation which would
-     result, say, from changing the (somewhat arbitrary) cutoff of
-     -0.5 kcal/mol for the Hbond electrostatic potential energy. We
-     cannot here solve the fundamental difficulty of arbitrary
-     cutoffs involved in extracting binary classifications (an Hbond
-     exists, yes/no) from real numbers (coordinates, energies).
-     However, for most purposes the secondary structure summary agrees
-     will with anyone's intuitive definition, especially for well-refined and
-     high resolution structures. For a more clearcut assignment of protein
-     substructure, we recommend using the detailed H-bond and other assignments
-     in the columns following the summary column, i.e. columns 19-38 (xxx):
-
-     ....;....1....;....2....;....3....;....4....;....5....;....6....;....7..
-                       xxxxxxxxxxxxxxxxxxxx
-                       .-- 3-turns/helix
-                       |.-- 4-turns/helix
-                       ||.-- 5-turns/helix
-                       |||.-- geometrical bend
-                       ||||.-- chirality
-                       |||||.-- beta bridge label
-                       ||||||.-- beta bridge label
-                       |||||||   .-- beta bridge partner resnum
-                       |||||||   |   .-- beta bridge partner resnum
-                       |||||||   |   |.-- beta sheet label
-                       |||||||   |   ||   .-- solvent accessibility
-                       |||||||   |   ||   |
-        35   47   I  E     +     0   0    2
-        36   48   R  E >  S- K   0  39C  97
-        37   49   Q  T 3  S+     0   0   86    (example from 1EST)
-        38   50   N  T 3  S+     0   0   34
-        39   51   W  E <   -KL  36  98C   6
-                                                                           */
-/*--------------------------------------------------------------------*/
-/* GENERAL PROGRAM INSTALLATION GUIDE. */
-/* (1) THE PROGRAM REQUIRES THE FULL STANDARD ASCII 128 CHARACTER SET,
-       IN PARTICULAR LOWER CASE LETTERS 'abcdefg....'.
-   (2) STANDARD PASCAL MAY NOT RECOGNIZE REAL NUMBERS SUCH AS .1, +.1,
-       -.1 ON INPUT. CHANGE TO 0.1,+0.1,-0.1.
-   (3) THE NON-STANDARD PROCEDURE 'DATE' RETURNS THE CURRENT DAY, MONTH,
-       AND YEAR. IF THE PROCEDURE IS NOT CALLED (LINE COMMENTED OUT)
-       THE PSYCHEDELIC DATE DEC 24, 2001 IS RETURNED. YOU MAY  REPLACE
-       'DATE' BY THE CORRESPONDING PROCEDURE FROM YOUR PASCAL
-       IMPLEMENTATION. THE EXAMPLE GIVEN WORKS IN DEC VAX VMS 5.0.
-   (4) DUE TO INCOMPATIBLE ASCII CODES, SQUARE BRACKETS '[' AND ']'
-       MAY APPEAR AS '!','?' ETC. USE YOUR EDITOR TO CONVERT THESE.   */
-/* INSTALLATION GUIDE FOR VAX/VMS USERS. */
-/* (1) THE /OPTIMIZE OPTION OF THE PASCAL COMPILER PRODUCED
-       INCORRECT CODE ON THE VAX 8600 AT EMBL RUNNING UNDER VMS V4.2.
-       LATER VERSIONS OF VMS (E.G. VMS 5.0) PRODUCED CORRECT CODE.
-       IF IN DOUBT, COMPILE USING PASCAL /NOOPTIMIZE.
-   (2) COPY BROOKHAVEN DATA BANK COORDINATE INPUT TO A FILE NAMED
-       TAPEIN.DAT . OUTPUT WILL BE IN A FILE NAMED TAPEOUT.DAT        */
-/* IMPLEMENTATION ON OTHER COMPUTERS */
-/* (1) NORD-500. EXECUTION TIME COMPARABLE TO VAX 780.
-   (2) SUN-3.    EXECUTION TIME COMPARABLE TO VAX 780.
-                 Compile using: pc -L
-                 in ORDER to map upper case letters in keywords
-                 and identifiers to lower case.
-   (3) ATARI 520 ST. RUNS FACTOR 60 SLOWER THAN NORD-500 DUE TO
-       SOFTWARE-EMULATED FLOATING POINT OPERATIONS ON MC68000.        */
-/*--------------------------------------------------------------------*/
-/* INPUT/OUTPUT FILES. */
-/* INPUT:   DEFAULT  INPUT UNIT, E.G. YOUR TERMINAL
-   OUTPUT:  DEFAULT OUTPUT UNIT, E.G. YOUR TERMINAL,
-            USED FOR RUN-TIME MESSAGES. WARNINGS AND ERRORS LOOK
-            LIKE THIS: !!! TEXT !!!
-   TAPEIN:  FILE WITH PROTEIN DATA BANK COORDINATES, E.G. PDB3PTI.COO
-   TAPEOUT: DSSP OUTPUT OF LINE LENGTH 128, E.G. PAPER PRINTER        */
-/*--------------------------------------------------------------------*/
-/* DESCRIPTION OF OUTPUT ON FILE TAPEOUT:
-   LINE LENGTH OF OUTPUT IS 128 CHARCTERS.
-   FOR DEFINITONS, SEE ABOVE BIOPOLYMERS ARTICLE.
-   IN ADDITION NOTE:
-   HISTOGRAMS - E.G. 2 UNDER COLUMN '8' IN LINE 'RESIDUES PER ALPHA
-            HELIX' MEANS: THERE ARE 2 ALPHA HELICES OF LENGTH  8
-            RESIDUES IN THIS DATA SET.
-   #  RESIDUE AA STRUCTURE BP1 BP2 ACC ..ETC..FOR EACH RESIDUE I:
-   #  RESIDUE - TWO COLUMNS OF RESIDUE NUMBERS. FIRST COLUMN IS DSSP'S
-            SEQUENTIAL RESIDUE NUMBER, STARTING AT THE FIRST
-            RESIDUE ACTUALLY IN THE DATA SET AND INCLUDING CHAIN BREAKS;
-            THIS NUMBER IS USED TO REFER TO RESIDUES THROUGHOUT. SECOND
-            COLUMN GIVES CRYSTALLOGRAPHERS' 'RESIDUE SEQUENCE
-            NUMBER','INSERTION CODE' AND 'CHAIN IDENTIFIER' (SEE PROTEIN
-            DATA BANK FILE RECORD FORMAT MANUAL), GIVEN FOR REFERENCE
-            ONLY AND NOT USED FURTHER..
-   AA -     ONE LETTER AMINO ACID CODE, LOWER CASE FOR SS-BRIDGE CYS.
-   STRUCTURE - SEE BIOPOLYMERS
-   BP1 BP2  - RESIDUE NUMBER OF FIRST AND SECOND BRIDGE PARTNER
-            FOLLOWED BY ONE LETTER SHEET LABEL
-   ACC -    NUMBER OF WATER MOLECULES IN CONTACT WITH THIS RESIDUE *10.
-            OR RESIDUE WATER EXPOSED SURFACE IN ANGSTROM**2.
-   N-H-->O ETC. -  HYDROGEN BONDS. E.G. -3,-1.4 MEANS: IF THIS RESIDUE
-            IS RESIDUE I THEN N-H OF I IS H-BONDED TO C=O OF I-3
-            WITH AN ELECTROSTATIC H-BOND ENERGY OF -1.4 KCAL/MOL.
-   TCO -    COSINE OF ANGLE BETWEEN C=O OF RESIDUE I AND C=O OF
-            RESIDUE I-1. FOR ALPHA-HELICES, TCO IS NEAR +1, FOR
-            BETA-SHEETS TCO IS NEAR -1. NOT USED FOR STRUCTURE
-            DEFINITION.
-   KAPPA -  VIRTUAL BOND ANGLE (BEND ANGLE) DEFINED BY THE THREE
-            C-ALPHA ATOMS OF RESIDUES I-2,I,I+2. USED TO DEFINE
-            BEND (STRUCTURE CODE 'S').
-   ALPHA -  VIRTUAL TORSION ANGLE (DIHEDRAL ANGLE) DEFINED BY THE FOUR
-            C-ALPHA ATOMS OF RESIDUES I-1,I,I+1,I+2. USED TO DEFINE
-            CHIRALITY (STRUCTURE CODE '+' OR '-').
-   PHI PSI - IUPAC PEPTIDE BACKBONE TORSION ANGLES
-   X-CA Y-CA Z-CA -  ECHO OF C-ALPHA ATOM COORDINATES              */
-/*--------------------------------------------------------------------*/
-/* WORDS OF CAUTION */
-/* THE VALUES FOR SOLVENT EXPOSURE MAY NOT MEAN WHAT YOU THINK!
-    (A) EFFECTS LEADING TO LARGER THAN EXPECTED VALUES:
-     SOLVENT EXPOSURE CALCULATION IGNORES UNUSUAL RESIDUES, LIKE ACE,
-     OR RESIDUES WITH INCOMPLETE BACKBONE, LIKE ALA 1 OF DATA SET 1CPA.
-     IT ALSO IGNORES HETATOMS, LIKE A HEME OR METAL LIGANDS.
-     ALSO, SIDE CHAINS MAY BE INCOMPLETE (AN ERROR MESSAGE IS WRITTEN).
-    (B) EFFECTS LEADING TO SMALLER THAN EXPECTED VALUES:
-     IF YOU APPLY THIS PROGRAM TO PROTEIN DATA BANK DATA SETS
-     CONTAINING OLIGOMERS, SOLVENT EXPOSURE IS FOR THE ENTIRE ASSEMBLY,
-     NOT FOR THE MONOMER. ALSO, ATOM OXT OF C-TERMINAL RESIDUES IS
-     TREATED LIKE A SIDE CHAIN ATOM IF IT IS LISTED AS PART OF THE LAST
-     RESIDUE. ALSO, PEPTIDE SUBSTRATES, WHEN LISTED AS ATOMS RATHER THAN
-     HETATOMS, ARE TREATED AS PART OF THE PROTEIN, E.G. RESIDUES 499 S
-     AND 500 S IN 1CPA.                                               */
-/* UNKNOWN OR UNUSUAL RESIDUES ARE NAMED X ON OUTPUT AND THEY ARE
-   NOT CHECKED FOR STANDARD NUMBER OF SIDECHAIN ATOMS.                */
-/* ALL EXPLICIT WATER MOLECULES, LIKE OTHER HETATOMS, ARE IGNORED.    */
-/* END OF INTRODUCTORY COMMENTS */
-/**********************************************************************/
-
-
 /************************************************************
 *                                                           *
 *          p2c.h                                            *
@@ -1798,6 +1519,7 @@ int code;
         exit(EXIT_FAILURE);
     fprintf(stderr, "%s\n", _ShowEscape(buf, P_escapecode, P_ioresult, ""));
     exit(EXIT_FAILURE);
+    return 0;
 }
 
 int _EscIO(code)
@@ -2827,8 +2549,8 @@ long i, j;
   backbone *WITH;
 
   WITH = &chain[i];
-  return (WITH->acceptor[0].residue == j && WITH->acceptor[0].energy < HBHIGH ||
-         WITH->acceptor[1].residue == j && WITH->acceptor[1].energy < HBHIGH);
+  return ((WITH->acceptor[0].residue == j && WITH->acceptor[0].energy < HBHIGH) ||
+         (WITH->acceptor[1].residue == j && WITH->acceptor[1].energy < HBHIGH));
 }  /* Testbond */
 
 
@@ -3192,13 +2914,17 @@ Local Void Extendladder()
        switch (WITH->btyp) {
 
        case parallel:
-         bulge = (jb1 - WITH->je < 6 && ib1 - WITH->ie < 3 ||
-                  jb1 - WITH->je < 3) & Nochainbreak(WITH->je, jb1);
+         bulge = ((jb1 - WITH->je < 6 && ib1 - WITH->ie < 3) ||
+                  (jb1 - WITH->je < 3) & Nochainbreak(WITH->je, jb1));
          break;
 
        case antiparallel:
-         bulge = (WITH->jb - je1 < 6 && ib1 - WITH->ie < 3 ||
-                  WITH->jb - je1 < 3) & Nochainbreak(je1, WITH->jb);
+         bulge = ((WITH->jb - je1 < 6 && ib1 - WITH->ie < 3) ||
+                  (WITH->jb - je1 < 3) & Nochainbreak(je1, WITH->jb));
+         break;
+       default:
+         printf("Uh-oh.. this shouln't happen..\n");
+         exit(0);
          break;
        }
       }
@@ -3249,8 +2975,8 @@ long l1, l2;
   ie2 = bridgetable[l2 - 1].ie;
   jb2 = bridgetable[l2 - 1].jb;
   je2 = bridgetable[l2 - 1].je;
-  return (ie1 >= ib2 && ib1 <= ie2 || ie1 >= jb2 && ib1 <= je2 ||
-         je1 >= ib2 && jb1 <= ie2 || je1 >= jb2 && jb1 <= je2);
+  return ((ie1 >= ib2 && ib1 <= ie2) || (ie1 >= jb2 && ib1 <= je2) ||
+         (je1 >= ib2 && jb1 <= ie2) || (je1 >= jb2 && jb1 <= je2));
 }  /* Link */
 
 /***/
index 3dad273c9c644a0c8f1e7c39ec3a78218c3f101d..2dccf98014d55610accbe553b8a4c483b1d23898 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_ehanal_c = "$Id$";
+
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
index 8433ef91ba9a890f86f935a8a5eed924980c6067..e72803d44458e42ebde6642caa4c7e9e7c3c6218 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_ehdata_c = "$Id$";
+
 #include <stdlib.h>
 #include <math.h>
 #include "typedefs.h"
index 3e769346b920af3e2b9eb34544893f26c4455151..8d682d73b294e8d7148ca05fe9f27dd131bc61c9 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_ehdata_h = "$Id$";
+
        
 extern real get_omega(real ekin,int *seed,FILE *fp,char *fn);
 
index 2aa1dc831d79c8e584bf3bf7fb4d3578bb369084..38bd5f10e7bca54aee7d3f7494d2ac4aca35ddbf 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_ehole_c = "$Id$";
+
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
index e58e5ca7e822acc6f236398374b6c478a5b052aa..975c2a82a1456d3bacb349f51efdf7b0ccd8e214 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_g_anavel_c = "$Id$";
+
 #include "sysstuff.h"
 #include "smalloc.h"
 #include "macros.h"
@@ -74,27 +74,28 @@ int main(int argc,char *argv[])
   FILE       *fp;
   int        *npts,nmax;
   int        status;
-  int        i,j,idum,step,nframe=0,natoms,index;
-  real       t,temp,rdum,hboxx,hboxy,scale,xnorm;
+  int        i,j,idum,step,nframe=0,index;
+  real       temp,rdum,hboxx,hboxy,scale,xnorm=0;
   real       **profile=NULL;
   real       *t_x=NULL,*t_y,hi=0;
-  rvec       *x,*v;
   t_topology *top;
   int        d,m,n;
   matrix     box;
   atom_id    *sysindex;
   bool       bHaveV,bReadV;
   t_rgb      rgblo = { 0, 0, 1 },rgbhi = { 1, 0, 0 };
-  
+  int        flags = TRX_READ_X | TRX_READ_V;
+  t_trxframe fr;
+
   
   CopyRight(stderr,argv[0]);
   parse_common_args(&argc,argv,PCA_CAN_TIME | PCA_BE_NICE ,NFILE,fnm,
                    asize(pa),pa,asize(desc),desc,0,NULL);
 
   top    = read_top(ftp2fn(efTPX,NFILE,fnm));
-                   
-  natoms = read_first_x_v(&status,ftp2fn(efTRN,NFILE,fnm),&t,&x,&v,box);
-  
+
+  read_first_frame(&status,ftp2fn(efTRX,NFILE,fnm),&fr,flags);
+       
   if (xmax > 0) {
     scale  = 5;
     nmax   = xmax*scale;
@@ -113,21 +114,21 @@ int main(int argc,char *argv[])
     srenew(profile,++nframe);
     snew(profile[nframe-1],nmax+1);
     srenew(t_x,nframe);
-    t_x[nframe-1] = t*1000;
+    t_x[nframe-1] = fr.time*1000;
     hboxx = box[XX][XX]/2;
     hboxy = box[YY][YY]/2;
-    for(i=0; (i<natoms); i++) {
+    for(i=0; (i<fr.natoms); i++) {
       /* determine position dependent on mode */
       switch (mode) {
       case 0:
-       xnorm = sqrt(sqr(x[i][XX]-hboxx) + sqr(x[i][YY]-hboxy));
+       xnorm = sqrt(sqr(fr.x[i][XX]-hboxx) + sqr(fr.x[i][YY]-hboxy));
        break;
       default:
        fatal_error(0,"Unknown mode %d",mode);
       }
       index = xnorm*scale;
       if (index <= nmax) {
-       temp = top->atoms.atom[i].m*iprod(v[i],v[i])/(2*BOLTZ);
+       temp = top->atoms.atom[i].m*iprod(fr.v[i],fr.v[i])/(2*BOLTZ);
        if (temp > hi)
          hi = temp;
        npts[index]++;
@@ -139,8 +140,8 @@ int main(int argc,char *argv[])
        profile[nframe-1][i] /= npts[i];
       npts[i] = 0;
     }
-  } while (read_next_x_v(status,&t,natoms,x,v,box));
-  close_trn(status);
+  } while (read_next_frame(status,&fr));
+  close_trx(status);
 
   fp = ftp2FILE(efXPM,NFILE,fnm,"w");
   write_xpm(fp,"Temp. profile","T (a.u.)",
index e1c7955408adc219cae412d03e171c3b159d90c3..b81184f9a2fce4b0c5f51aa81fd00c6da5f2611c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_glasmd_c = "$Id$";
+
 #include <stdio.h>
 #include <string.h>
 #include <time.h>
@@ -182,7 +182,8 @@ time_t do_md(FILE *log,t_commrec *cr,int nfile,t_filenm fnm[],
     construct_dummies(log,x,&mynrnb,parm->ir.delta_t,v,&top->idef);
     
     /* Set values for invmass etc. */
-    init_mdatoms(mdatoms,lambda,FALSE);
+    if (parm->ir.bPert)
+      init_mdatoms(mdatoms,lambda,FALSE);
     
     /*init_forcerec(log,fr,&(parm->ir),&(top->blocks[ebMOLS]),cr,
       &(top->blocks[ebCGS]),&(top->idef),mdatoms,parm->box,FALSE);
index e667de06da1a1977c172263d96bb6c1ea6bdccbd..35703a8d9241704d543a10adf88c2774af5f2461 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_hexamer_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include <ctype.h>
index 75270cdf6ba87e25297910fd4b92486454e1ab95..707dc83fdc18610233a226d5105accaa71021120 100644 (file)
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_hrefify_c = "$Id$";
+
 #include <math.h>
-#include <string.h>
+#include <string.h> 
+#include <ctype.h>
 #include "smalloc.h"
 #include "typedefs.h"
 #include "macros.h"
@@ -41,6 +42,7 @@ static char *SRCID_hrefify_c = "$Id$";
 #include "statutil.h"
 #include "copyrite.h"
 #include "pdbio.h"
+#include "strdb.h"
 
 bool isword(char c)
 {
@@ -64,7 +66,7 @@ char *strncasestr(char *line,char *str)
 
 char *strstr_href(char *line,bool *bInHREF,int *i_dat,int n_dat,char **dat)
 {
-  char *start,*found,*href;
+  char *start,*found,*href=NULL;
   bool bIn;
   int i;
 
@@ -88,16 +90,18 @@ char *strstr_href(char *line,bool *bInHREF,int *i_dat,int n_dat,char **dat)
       i=0;
       while((i<n_dat) && !found) {
        found=strncasestr(start,dat[i]);
-       if (found) 
+       if (found) {
          if (href && (found>href))
            found=NULL;
-         else 
+         else {
            if (((found!=start) && isword(found[-1])) || 
                isword(found[strlen(dat[i])])) 
              found=NULL;
            else
              *i_dat=i;
-       i++;
+         }
+         i++;
+       }
       }
     }
   } while (strlen(start) && !found && href);
@@ -133,12 +137,12 @@ int main(int argc, char *argv[])
   static char *in=NULL,*out=NULL,*excl=NULL,*link_text=NULL;
   static bool peratom=FALSE;
   t_pargs pa[] = {
-    { "-f", FALSE, etSTR, &in, "HTML input" },
-    { "-o", FALSE, etSTR, &out, "HTML output" },
-    { "-e", FALSE, etSTR, &excl, "Exclude a string from HREF's, "
+    { "-f", FALSE, etSTR, { &in } , "HTML input" },
+    { "-o", FALSE, etSTR, { &out } , "HTML output" },
+    { "-e", FALSE, etSTR, { &excl } , "Exclude a string from HREF's, "
       "when this option is not set, the filename without path and extension "
       "will be excluded from HREF's"},
-    { "-t", FALSE, etSTR, &link_text, "Insert a string in front of the "
+    { "-t", FALSE, etSTR, { &link_text } , "Insert a string in front of the "
       "href file name, useful for scripts" }
   };
   
@@ -196,7 +200,7 @@ int main(int argc, char *argv[])
        strcpy(word,ref);
         word[ptr-ref+strlen(str[i_str])]='\0';
        strcpy(end,ptr+strlen(str[i_str]));
-       sprintf(line,"%s<a href=\"%s%s.html\">%s</a>%s\0",
+       sprintf(line,"%s<a href=\"%s%s.html\">%s</a>%s",
                start,link_text,str[i_str],word,end);
        fprintf(stderr,"line %d: %s\n",l+1,str[i_str]);
        n_repl++;
index 302b7262c4b5e120222b62f8726479a359a67ca0..df83456e1c47c59701cbfb6a1754295353e2cdc1 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_mk6_n_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
index aa726d142fa0de5bf41a936dd609fdaed5530552..e6f3fe8a996b16bd2d2a8d66400c82cb5d72b6ef 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_mkice_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "typedefs.h"
@@ -457,7 +457,7 @@ int main(int argc,char *argv[])
 #define NFILE asize(fnm)
 
   FILE      *fp;
-  char      *fn;
+  char      *fn,quote[256];
   int       i,j,k,n,nmax,m,natom,natmol;
   t_atoms   *pdba;
   t_atoms   atoms;
@@ -564,11 +564,11 @@ int main(int argc,char *argv[])
            nx,ny,nz,odist,hdist);
     fprintf(fp,"REMARK    Density of this crystal is %g (g/l)\n",
            density(pdba,boxje));
-    write_pdbfile(fp,bromacs(),pdba,xx,boxje,' ',-1);
+    write_pdbfile(fp,bromacs(quote,255),pdba,xx,boxje,' ',-1);
     fclose(fp);
   }
   else {
-    write_sto_conf(fn,bromacs(),pdba,xx,NULL,boxje);
+    write_sto_conf(fn,bromacs(quote,255),pdba,xx,NULL,boxje);
   }
   
   if (ftp2bSet(efTRN,NFILE,fnm))
index de62921ae2760155d9bb8c4812043a684560ea3d..9468811f31e6bf55b2ee3c4121dacaf0b3b40b2b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_mkyaw_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include <ctype.h>
index 79e4ba1b710bdd82bf9be90ce2c6e72e479e0ea4..37320b01566493c4c6566c697df71176b2872725 100644 (file)
@@ -29,6 +29,6 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_my_dssp_c = "$Id$";
+
 #define MY_DSSP
 #include "../tools/do_dssp.c"
index d274c2ed2c84fecb50c08753a8032b5f94bb9e8b..d1cb3b2f3a72e885ac525aaa11b595de96773f1f 100644 (file)
@@ -33,7 +33,7 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_options_c = "$Id$";
+
 
 #include "typedefs.h"
 #include "macros.h"
index 6bc3d4ec514356f567c7afd9a153a169456e2b7a..cace113dcf3253908444635e14222884b1d325f6 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_optwat_c = "$Id$";
+
+#include <string.h>
 #include "typedefs.h"
 #include "smalloc.h"
 #include "vec.h"
@@ -70,21 +71,20 @@ void get_results(char *enx,real P[],real *epot,int pindex,int eindex)
   char     **nms=NULL;
   int      nre,step,ndr,i;
   real     t;
-  t_energy *ener;
+  t_enxframe fr;
   
   fp_ene = open_enx(enx,"r");
   
   do_enxnms(fp_ene,&nre,&nms);
-  snew(ener,nre);
   
   /* Read until the last frame */
-  while (do_enx(fp_ene,&t,&step,&nre,ener,&ndr,NULL));
+  while (do_enx(fp_ene,&fr));
   
   close_enx(fp_ene);
   
-  *epot = ener[eindex].e;
+  *epot = fr.ener[eindex].e;
   for(i=pindex; (i<pindex+9); i++)
-    P[i-pindex] = ener[i].e;
+    P[i-pindex] = fr.ener[i].e;
     
   sfree(ener);
 }
@@ -194,7 +194,7 @@ int main(int argc,char *argv[])
                    asize(desc),desc,0,NULL);
 
   /* Read initial topology and coordaintes etc. */
-  read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&sh);
+  read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&sh,TRUE,NULL,NULL);
   snew(xx,sh.natoms);
   snew(vv,sh.natoms);
   read_tpx(ftp2fn(efTPX,NFILE,fnm),&step,&t,&lambda,&ir,box,&natoms,
index 4f33f3c889e37c1cfd70fcfddf6b850b6414de7c..5e6d13b584ac9851713c702042e79bdd2150875b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_prfn_c = "$Id$";
+
 #include "filenm.h"
 #include "futil.h"
 #include "wman.h"
@@ -76,7 +76,7 @@ void pr_htmldefs(FILE *fp)
 }
 
 
-void main()
+int main()
 {
   FILE *out;
   
@@ -87,5 +87,7 @@ void main()
   out=ffopen("files.html","w");
   pr_htmldefs(out);
   fclose(out);
+
+  return 0;
 }
  
index 08ee1e3de28de98c30d0a7d34198f43cc272f399..716e7aa0d0c466230656bdb9d48ff4ee4551f33b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_sigeps_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "typedefs.h"
index 7103034abaf578516f20736891972b61b874a5d5..716e7aa0d0c466230656bdb9d48ff4ee4551f33b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_test_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "typedefs.h"
index 212d055fadf0ccca68272e5bff62750446f2f102..389b5cede5d5049d87f40715d049a9ca0198fdd8 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_3dview_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "smalloc.h"
@@ -226,39 +226,31 @@ bool zoom_3d(t_3dview *view,real fac)
   return TRUE;
 }
 
-void rotate_3d(t_3dview *view,int axis,bool bPositive)
+void init_rotate_3d(t_3dview *view)
 {
-  static bool bFirst=TRUE;
-  static mat4 RotP[DIM];
-  static mat4 RotM[DIM];
-  int  i,j;
-  mat4 m4;
-
-  if (bFirst) {
-    real rot=DEG2RAD*15;
-
-    for(i=0; (i<DIM); i++) {
-      rotate(i,        rot ,RotP[i]);
-      rotate(i,(real)(-rot),RotM[i]);
+  real rot=DEG2RAD*15;
+  int i;
+  
+  for(i=0; (i<DIM); i++) {
+    rotate(i,        rot ,view->RotP[i]);
+    rotate(i,(real)(-rot),view->RotM[i]);
 #ifdef DEBUG
-      print_m4(debug,"RotP",RotP[i]);
-      print_m4(debug,"RotM",RotM[i]);
+    print_m4(debug,"RotP",view->RotP[i]);
+    print_m4(debug,"RotM",view->RotM[i]);
 #endif
-    }
   }
+}
+
+void rotate_3d(t_3dview *view,int axis,bool bPositive)
+{
+  int  i,j;
+  mat4 m4;
 
-  /*
-    if (bPositive)
-    m4_op(RotP[axis],view->eye,v4);
-    else
-    m4_op(RotM[axis],view->eye,v4);
-    for(i=0; (i<DIM); i++)
-    view->eye[i]=v4[i];
-    */
   if (bPositive)
-    mult_matrix(m4,view->Rot,RotP[axis]);
+    mult_matrix(m4,view->Rot,view->RotP[axis]);
   else
-    mult_matrix(m4,view->Rot,RotM[axis]);
+    mult_matrix(m4,view->Rot,view->RotM[axis]);
   for(i=0; (i<N); i++)
     for(j=0; (j<N); j++)
     view->Rot[i][j]=m4[i][j];
@@ -295,6 +287,8 @@ void reset_view(t_3dview *view)
   /* Initiate the matrix */
   unity_m4(view->Rot);
   calculate_view(view);
+
+  init_rotate_3d(view);
 }
 
 t_3dview *init_view(matrix box)
index 66aa4d476f40c6ae8ffd8d42dcbe3f53b2937083..065319fd981b4cb0e904202cf3866116e6b6ac3f 100644 (file)
@@ -13,13 +13,13 @@ libgmx@LIBSUFFIX@_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@
 
 libgmx@LIBSUFFIX@_la_SOURCES = \
        3dview.c        atomprop.c      block_tx.c      bondfree.c      \
-       buffer.c        calcgrid.c      calch.c         inner.h         \
+       calcgrid.c      calch.c         inner.h                 \
        confio.c        copyrite.c      disre.c         do_fit.c        \
        enxio.c         ewald_util.c    fatal.c         ffscanf.c       \
        filenm.c        futil.c         gbutil.c        fnbf.c          \
        gmxfio.c        ifunc.c         index.c         cinvsqrtdata.c  \
        invblock.c      macros.c        orires.c        gmx_system_xdr.c \
-       main.c          maths.c         matio.c         memdump.c       \
+       main.c          maths.c         matio.c                 \
        mshift.c        mvdata.c        mvxvf.c         names.c         \
        network.c       nrama.c         nrjac.c         nrnb.c          \
        pargs.c         pbc.c           pdbio.c         princ.c         \
@@ -30,7 +30,8 @@ libgmx@LIBSUFFIX@_la_SOURCES = \
        trnio.c         trxio.c         txtdump.c       typedefs.c      \
        viewit.c        wgms.c          wman.c          writeps.c       \
        xdrd.c          xtcio.c         xvgr.c          replace.h       \
-       detectcpu.c     libxdrf.c       vec.c           xmlio.c
+       detectcpu.c     libxdrf.c       vec.c           xmlio.c         \
+       dihres.c
 
 EXTRA_libgmx@LIBSUFFIX@_la_SOURCES = \
        x86_sse.s       x86_sse2.s      x86_3dnow.s     inner_altivec.c \
index b3de795380fb8a35ec32bf43496ea52fb3d64481..801f452b480ace52f7356c11b901d5d2f89c7b7b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * $Id$
  * 
- *                This source code is part of
+ *                This source code ispart of
  * 
  *                 G   R   O   M   A   C   S
  * 
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_atomprop_c = "$Id$";
+
 #include <ctype.h>
 #include "sysstuff.h"
 #include "smalloc.h"
index bdaeac683fce1ae6a7488f4683adf4fe1a5708c0..b7634d903052e85eb7f7085a1716ab5e1ec4ddd4 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_block_tx_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
 #include "network.h"
 #include "block_tx.h"
 #include "fatal.h"
index 4ff8cf8da8cad9066c2cdcb82e0317732d11d21c..5ad46101b57f57cddc75a742049961da63086885 100644 (file)
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_bondfree_c = "$Id$";
+
 #include <math.h>
 #include "assert.h"
 #include "physics.h"
 #include "vec.h"
-#include "vveclib.h"
 #include "maths.h"
 #include "txtdump.h"
 #include "bondf.h"
@@ -704,6 +703,8 @@ real pdihs(int nbonds,
   return vtot;
 }
 
+
+
 real idihs(int nbonds,
           t_iatom forceatoms[],t_iparams forceparams[],
           rvec x[],rvec f[],t_forcerec *fr,t_graph *g,
@@ -712,9 +713,13 @@ real idihs(int nbonds,
           t_fcdata *fcd)
 {
   int  i,type,ai,aj,ak,al;
-  real phi,cos_phi,ddphi,sign,vid,vtot;
+  real phi,phi0,cos_phi,ddphi,sign,vtot;
   rvec r_ij,r_kj,r_kl,m,n;
-  
+  real L1,kk,dp,dp2,kA,kB,pA,pB,dvdl;
+
+  L1 = 1.0-lambda;
+  dvdl = 0;
+
   vtot = 0.0;
   for(i=0; (i<nbonds); ) {
     type = forceatoms[i++];
@@ -726,13 +731,36 @@ real idihs(int nbonds,
     phi=dih_angle(box,x[ai],x[aj],x[ak],x[al],r_ij,r_kj,r_kl,m,n,
                  &cos_phi,&sign);                      /*  84          */
     
-    *dvdlambda += harmonic(forceparams[type].harmonic.krA,
-                          forceparams[type].harmonic.krB,
-                          forceparams[type].harmonic.rA*DEG2RAD,
-                          forceparams[type].harmonic.rB*DEG2RAD,
-                          phi,lambda,&vid,&ddphi);    /*   21          */   
+    /* phi can jump if phi0 is close to Pi/-Pi, which will cause huge
+     * force changes if we just apply a normal harmonic.
+     * Instead, we first calculate phi-phi0 and take it modulo (-Pi,Pi).
+     * This means we will never have the periodicity problem, unless
+     * the dihedral is Pi away from phiO, which is very unlikely due to
+     * the potential.
+     */
+    kA = forceparams[type].harmonic.krA;
+    kB = forceparams[type].harmonic.krB;
+    pA = forceparams[type].harmonic.rA;
+    pB = forceparams[type].harmonic.rB;
+
+    phi0 = L1*kA+lambda*kB;
+    kk   = (L1*pA+lambda*pB)*DEG2RAD;
+    
+    /* dp = (phi-phi0), modulo (-pi,pi) */
+    dp = phi-phi0;  
+    /* dp cannot be outside (-2*pi,2*pi) */
+    if(dp>=M_PI)
+      dp -= 2*M_PI;
+    else if(dp<-M_PI)
+      dp += 2*M_PI;
+    
+    dp2 = dp*dp;
+
+    vtot += 0.5*kk*dp2;
+    ddphi = -kk*dp;
+    
+    dvdl += 0.5*(kB-kA)*dp2 + (pA-pB)*kk*dp;
 
-    vtot += vid;
     do_dih_fup(ai,aj,ak,al,(real)(-ddphi),r_ij,r_kj,r_kl,m,n,
               f,fr,g,x);                               /* 112          */
     /* 217 TOTAL       */
@@ -741,9 +769,12 @@ real idihs(int nbonds,
            ai,aj,ak,al,cos_phi,phi);
 #endif
   }
+  
+  *dvdlambda += dvdl;
   return vtot;
 }
 
+
 real posres(int nbonds,
            t_iatom forceatoms[],t_iparams forceparams[],
            rvec x[],rvec f[],t_forcerec *fr,t_graph *g,
@@ -879,6 +910,7 @@ real angresz(int nbonds,
                    lambda,dvdlambda,TRUE);
 }
 
+
 real unimplemented(int nbonds,
                   t_iatom forceatoms[],t_iparams forceparams[],
                   rvec x[],rvec f[],t_forcerec *fr,t_graph *g,
@@ -905,7 +937,7 @@ real rbdihs(int nbonds,
            t_mdatoms *md,int ngrp,real egnb[],real egcoul[],
            t_fcdata *fcd)
 {
-  static const real c0=0.0,c1=1.0,c2=2.0,c3=3.0,c4=4.0,c5=5.0;
+  const real c0=0.0,c1=1.0,c2=2.0,c3=3.0,c4=4.0,c5=5.0;
   int  type,ai,aj,ak,al,i,j;
   rvec r_ij,r_kj,r_kl,m,n;
   real parmA[NR_RBDIHS];
index cbe6564792d87b222ae9ec713e9d90eb93d88a75..c818c323d566744b0618cfacb359ab06f8488818 100644 (file)
@@ -29,7 +29,6 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_calcgrid_c = "$Id$";
 #include "typedefs.h"
 #include "smalloc.h"
 #include "fatal.h"
index b62b923ac375e08ae2186a5d1219df376fe6fe15..96d59fc5c48cc5d1df605043e6b9dfae832f7150 100644 (file)
@@ -29,7 +29,6 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_calch_c = "$Id$";
 #include "macros.h"
 #include "calch.h"
 #include "maths.h"
index fe4cd69a1db467715ac515369402b80bea6cb650..7c346e71d1f59c5e62c24af571d0613fba715f27 100644 (file)
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_cinvsqrtdata_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
 /* just put something here to avoid empty file warnings */
-int cinvsqrtdata_stub;
+const int cinvsqrtdata_stub;
 
 #ifdef SOFTWARE_INVSQRT
 const unsigned int cinvsqrtexptab[256] = {
index 150b9387f39a2f9b79910113bdd034f639f39704..f3c1b3ab196a6918ff9c5121e31eb77415fd6d17 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_confio_c = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -641,7 +641,7 @@ void write_hconf_indexed_p(FILE *out,char *title,t_atoms *atoms,
   char resnm[6],nm[6],format[100];
   int  ai,i,resnr,l,vpr;
 
-  fprintf (out,"%s\n",(title && title[0])?title:bromacs());
+  fprintf (out,"%s\n",(title && title[0])?title:bromacs(format,99));
   fprintf (out,"%5d\n",nx);
   /* build format string for printing, 
      something like "%8.3f" for x and "%8.4f" for v */
@@ -833,7 +833,7 @@ void write_sto_conf(char *outfile, char *title,t_atoms *atoms,
 void get_stx_coordnum(char *infile,int *natoms)
 {
   FILE *in;
-  int ftp;
+  int ftp,tpxver,tpxgen;
   t_trxframe fr;
 
   ftp=fn2ftp(infile);
@@ -864,7 +864,7 @@ void get_stx_coordnum(char *infile,int *natoms)
   case efTPR: {
     t_tpxheader tpx;
     
-    read_tpxheader(infile,&tpx);
+    read_tpxheader(infile,&tpx,TRUE,&tpxver,&tpxgen);
     *natoms = tpx.natoms;
     break;
   }
index c1aa61357a664c450d2f33918b12c6e07a151a1e..3887c63ea69eae31bfe546837ca8aff5d9ae6c80 100644 (file)
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_copyrite_c = "$Id$";
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef USE_THREADS
+#include <pthread.h>
+#endif
+/* This file is completely threadsafe - keep it that way! */
+
 #include <string.h>
 #include <ctype.h>
 #include "sysstuff.h"
@@ -90,11 +99,16 @@ void pr_difftime(FILE *out,double dt)
   fprintf(out,"\n");
 }
 
+
 bool be_cool(void)
 {
-  static int cool=-1;
+  int cool=-1;
   char *envptr;
-  
+
+  /* Yes, it is bad to check the environment variable every call,
+   * but we dont call this routine often, and it avoids using 
+   * a mutex for locking the variable...
+   */
   if (cool == -1) {
     envptr=getenv("IAMCOOL");
 
@@ -103,6 +117,7 @@ bool be_cool(void)
     else
       cool=1;
   }
+
   return cool;
 }
 
@@ -113,7 +128,7 @@ void space(FILE *out, int n)
 
 void f(char *a){int i;for(i=0;i<(int)strlen(a);i++)a[i]=~a[i]; }
 
-static void sp_print(FILE *out,char *s)
+static void sp_print(FILE *out,const char *s)
 {
   int slen;
   
@@ -122,7 +137,7 @@ static void sp_print(FILE *out,char *s)
   fprintf(out,"%s\n",s);
 }
 
-static void ster_print(FILE *out,char *s)
+static void ster_print(FILE *out,const char *s)
 {
   int  slen;
   char buf[128];
@@ -133,61 +148,70 @@ static void ster_print(FILE *out,char *s)
   fprintf(out,"%s\n",buf);
 }
 
-static int nran=0;
 
-static char *pukeit(char *db,char *defstring)
+static char *pukeit(char *db,char *defstring, char *retstring, int retsize, int *cqnum)
 {
-  static char hulp[STRLEN];
   FILE *fp;
   char **help;
   int  i,nhlp;
   int  seed;
-  
   if (!be_cool())
     return defstring;
   else if ((fp = low_libopen(db,FALSE)) != NULL) {
     nhlp=fget_lines(fp,&help);
     fclose(fp);
     seed=time(NULL);
-    nran=nhlp*rando(&seed);
-    if (strlen(help[nran]) >= STRLEN)
-      help[nran][STRLEN-1] = '\0';
-    strcpy(hulp,help[nran]);
-    f(hulp);
+    *cqnum=nhlp*rando(&seed);
+    if (strlen(help[*cqnum]) >= STRLEN)
+      help[*cqnum][STRLEN-1] = '\0';
+    strncpy(retstring,help[*cqnum],retsize);
+    f(retstring);
     for(i=0; (i<nhlp); i++)
       sfree(help[i]);
     sfree(help);
-  
-    return hulp;
+    return retstring;
   }
   else
     return defstring;
 }
 
-char *bromacs(void)
+
+char *bromacs(char *retstring, int retsize)
 {
+  int dum;
+
   return pukeit("bromacs.dat",
-                "Groningen Machine for Chemical Simulation");
+                "Groningen Machine for Chemical Simulation",
+               retstring,retsize,&dum);
 }
 
-char *cool_quote(void)
+
+char *cool_quote(char *retstring, int retsize, int *cqnum)
 {
-  static char buf[1024];
+  char tmpstr[1024];
   char *s,*ptr;
+  int tmpcq,*p;
+  
+  if(cqnum!=NULL)
+    p=cqnum;
+  else
+    p=&tmpcq;
   
   /* protect audience from explicit lyrics */
-  s = pukeit("gurgle.dat","Thanx for Using GROMACS - Have a Nice Day");
+  pukeit("gurgle.dat","Thanx for Using GROMACS - Have a Nice Day",
+        tmpstr,1024,p);
 
-  if (be_cool() && ((ptr=strchr(s,'_')) != NULL)) {
+  if (be_cool() && ((ptr=strchr(tmpstr,'_')) != NULL)) {
     *ptr='\0';
     ptr++;
-    sprintf(buf,"\"%s\" %s",s,ptr);
+    sprintf(retstring,"\"%s\" %s",tmpstr,ptr);
   }
   else {
-    strcpy(buf,s);
+    strncpy(retstring,tmpstr,1023);
   }
     
-  return buf;
+  return retstring;
 }
 
 void CopyRight(FILE *out,char *szProgram)
@@ -198,7 +222,8 @@ void CopyRight(FILE *out,char *szProgram)
 #define NCR (int)asize(CopyrightText)
 #define NGPL (int)asize(GPLText)
 
-  char buf[256];
+  char buf[256],tmpstr[1024];
+  
   char *ptr;
   
   int i;
@@ -208,7 +233,7 @@ void CopyRight(FILE *out,char *szProgram)
   ster_print(out,"G  R  O  M  A  C  S");
   fprintf(out,"\n");
   
-  ptr=bromacs();
+  ptr=bromacs(tmpstr,1023);
   sp_print(out,ptr); 
   fprintf(out,"\n");
 
@@ -216,6 +241,7 @@ void CopyRight(FILE *out,char *szProgram)
   fprintf(out,"\n");
 
   fprintf(out,"\n");
+
   sp_print(out,"PLEASE NOTE: THIS IS A BETA VERSION\n");
   
   fprintf(out,"\n");
@@ -238,14 +264,18 @@ void CopyRight(FILE *out,char *szProgram)
 
 void thanx(FILE *fp)
 {
+  char tmpbuf[1024];
   char *cq,*c;
+  int cqnum;
 
   /* protect the audience from suggestive discussions */
-  cq=cool_quote();
+  cq=cool_quote(tmpbuf,1023,&cqnum);
   
   if (be_cool()) {
     snew(c,strlen(cq)+20);
-    sprintf(c,"gcq#%d: %s\n",nran,cq);
+
+    sprintf(c,"gcq#%d: %s\n",cqnum,cq);
+
     fprintf(fp,"\n%s\n",c);
     sfree(c);
   }
@@ -389,16 +419,16 @@ void please_cite(FILE *fp,char *key)
   fflush(fp);
 }
 
-char *GromacsVersion()
+/* This routine only returns a static (constant) string, so we use a 
+ * mutex to initialize it. Since the string is only written to the
+ * first time, there is no risk with multiple calls overwriting the
+ * output for each other.
+ */
+const char *GromacsVersion()
 {
-  static bool bFirst=TRUE;
-  static char ver_string[100];
 
-  /* The version number is defined by the autoconf scripts */
-  if(bFirst) {
-    sprintf(ver_string,"VERSION %s",VERSION);
-    bFirst=FALSE;
-  }
+  /* Concatenate the version info during preprocessing */
+  static const char ver_string[]="VERSION " VERSION;
   
   return ver_string;
 }
index 7346515c3583158313a399fcf40b409c3ca2ccf4..c104cf1659b818f38d9bbb2f0cc72a52aaf260f0 100644 (file)
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_crecipdata_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
 /* just put something here to avoid empty file warnings */
-int crecipdata_stub;
+const int crecipdata_stub;
 
 #ifdef SOFTWARE_RECIP
 const unsigned int crecipexptab[256] = {
index ccae4029567fab24d347c8a6b2c3a529b33e3548..c83a958a6c371c7a936d3a95707bf9f45d287215 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_debugb_h = "$Id$";
+
 #ifndef DEBUG
 #define DEBUG_BOND(log,x,ai,aj,dx,dr2,dr,bondparams,delta_r,vbond,fbond,fij)
 #define DEBUG_ANGLE_UPD(log,f_i,f_j,f_k)
index efd0b5db80af7aaa3bdfb3b404613520605f3898..1a56699dc024538c87dea79b4484173d396488d0 100644 (file)
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_detectcpu_c = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
+
+/* This file is completely threadsafe - keep it that way! */
+
+#ifdef USE_THREADS
+#include <pthread.h>
+#endif
+
 #include <stdlib.h>
 #include <stdio.h>
 #include <detectcpu.h>
 
+/* This file uses some global variables to catch illegal instruction
+ * signals from the operating system. To make it thread-safe, we use
+ * a global mutex which is locked immediately when the detect_cpu()
+ * routine is called (if we use threads). Do NOT call any of the 
+ * lower-level CPU detection routines directly, since these do not
+ * lock the mutex.
+ */
+
 
 #if (defined USE_X86_SSE_AND_3DNOW || defined USE_X86_SSE2 || defined USE_PPC_ALTIVEC)
 /* We use some special posix-style long jumps in
@@ -52,8 +67,10 @@ static char *SRCID_detectcpu_c = "$Id$";
  * be clobbered by the longjmp. We get rid of this
  * warning by making them global...
  */
-static int cpuSSE,cpuSSE2,cpu3DNow,doSSE,doSSE2,do3DNow,cpuflags;
-static int cpuAltivec;
+
+#ifdef USE_THREADS
+static pthread_mutex_t detectcpu_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
   
 static jmp_buf mainloop;
 static int success=1;
@@ -85,7 +102,8 @@ static int detect_altivec(FILE *log)
    * to perform the extensive tests like for x86 to recommend
    * users to upgrade. Just check if an instruction works!
    */
-  cpuflags=cpuAltivec=0;
+  int cpuAltivec=0;
+  int cpuflags=0;
   
   /* if we got here, its ppc! */
   cpuflags |= PPC_CPU;
@@ -117,11 +135,8 @@ static int detect_altivec(FILE *log)
 static int detect_sse2(FILE *log)
 {
   unsigned long eax,ebx,ecx,edx;
+  int cpuflags=0;
   
-  cpuSSE2=doSSE2=cpuflags=0;
-  
-  if(log)    
-    fprintf(log,"\nTesting x86 processor CPUID...\n");
   /* start by trying to issue the cpuid instruction */
   success=1;
   signal(SIGILL,sigill_handler);
@@ -139,14 +154,12 @@ static int detect_sse2(FILE *log)
     /* for SSE support, bit 25 of edx should be set */
     x86_cpuid(1,&eax,&ebx,&ecx,&edx);
     if(edx & FLAGS_SUPPORT_SSE2) {
-      cpuSSE2=1;
       cpuflags |= CPU_SSE2_SUPPORT;/* CPU ok, but OS might not be */
       /* try it */
       success=1;
       setjmp(mainloop); /* return to this point if we get SIGILL */
       if(success) {
        checksse2();
-       doSSE2=1;
        cpuflags |= X86_SSE2_SUPPORT;
       }
     }
@@ -160,10 +173,8 @@ static int detect_sse(FILE *log)
 {
   unsigned long eax,ebx,ecx,edx;
   
-  cpuSSE=doSSE=cpuflags=0;
+  int cpuflags=0;
   
-  if(log)    
-    fprintf(log,"\nTesting x86 processor CPUID...\n");
   /* start by trying to issue the cpuid instruction */
   success=1;
   signal(SIGILL,sigill_handler);
@@ -181,14 +192,12 @@ static int detect_sse(FILE *log)
     /* for SSE support, bit 25 of edx should be set */
     x86_cpuid(1,&eax,&ebx,&ecx,&edx);
     if(edx & FLAGS_SUPPORT_SSE) {
-      cpuSSE=1;
       cpuflags |= CPU_SSE_SUPPORT;/* CPU ok, but OS might not be */
       /* try it */
       success=1;
       setjmp(mainloop); /* return to this point if we get SIGILL */
       if(success) {
        checksse();
-       doSSE=1;
        cpuflags |= X86_SSE_SUPPORT;
       }
     }
@@ -200,10 +209,8 @@ static int detect_3dnow(FILE *log)
 {
   unsigned long eax,ebx,ecx,edx;
   
-  cpu3DNow=do3DNow=cpuflags=0;
+  int cpuflags=0;
   
-  if(log)    
-    fprintf(log,"\nTesting x86 processor CPUID...\n");
   /* start by trying to issue the cpuid instruction */
   success=1;
   signal(SIGILL,sigill_handler);
@@ -224,13 +231,11 @@ static int detect_3dnow(FILE *log)
       if(eax>=0x80000001) {
        x86_cpuid(0x80000001,&eax,&ebx,&ecx,&edx);
        if(edx & FLAGS_SUPPORT_EXT_3DNOW) {
-         cpu3DNow=1;
          /* try it */
          success=1;
          setjmp(mainloop); /* return to this point if we get SIGILL */
          if(success) {
            check3dnow();
-           do3DNow=1;
            cpuflags |= X86_3DNOW_SUPPORT;
          }
        }
@@ -244,7 +249,42 @@ static int detect_3dnow(FILE *log)
 #if (defined USE_X86_SSE_AND_3DNOW || defined USE_X86_SSE2)
 static int detect_x86(FILE *log)
 {
-  cpuflags=0;
+  unsigned long eax,ebx,ecx,edx;
+
+  int cpuflags=0;
+
+  /* First we check if this is an Intel or AMD cpu */
+  if(log)    
+    fprintf(log,"\nTesting x86 processor CPUID...\n");
+  /* start by trying to issue the cpuid instruction */
+  success=1;
+  signal(SIGILL,sigill_handler);
+  setjmp(mainloop); /* return to this point if we get SIGILL */  
+
+  if(success) 
+    x86_cpuid(0,&eax,&ebx,&ecx,&edx);
+  else if(log)
+    fprintf(log,"This CPU doesn't support CPUID.\n");
+  
+  if(eax>0) {
+    cpuflags |= X86_CPU;
+  } else {
+    if(log)
+      fprintf(log,"Didn't recognize this as an x86-type CPU.\n");
+    return cpuflags;
+  }
+  
+  if(ebx==VENDOR_INTEL) {
+    if(log) 
+      fprintf(log,"CPU manufactured by Intel.\n");
+    cpuflags |= INTEL_CPU;
+  }
+  else if(ebx==VENDOR_AMD) {
+     if(log) 
+      fprintf(log,"CPU manufactured by AMD.\n");
+    cpuflags |= AMD_CPU;
+  }
+    
 #ifdef USE_X86_SSE2
   /* For double precision we need SSE2 */
   cpuflags=detect_sse2(log);
@@ -298,10 +338,17 @@ static int detect_x86(FILE *log)
 }
 #endif
 
-int detect_cpu(FILE *log)
+
+int 
+detect_cpu(FILE *log)
 {
   int cpuflags=0;
 
+  /* Use a global lock for all CPU detection */
+#ifdef USE_THREADS
+  pthread_mutex_lock(&detectcpu_mutex);
+#endif
+
 #ifdef USE_PPC_ALTIVEC
   cpuflags=detect_altivec(log);
 #elif (defined USE_X86_SSE_AND_3DNOW || defined USE_X86_SSE2)
@@ -311,6 +358,12 @@ int detect_cpu(FILE *log)
     fprintf(log,"Not checking cpu support for SSE/SSE2/3DNow/Altivec\n");
   cpuflags=UNKNOWN_CPU;
 #endif
+
+  /* release lock */
+#ifdef USE_THREADS
+  pthread_mutex_unlock(&detectcpu_mutex);
+#endif
+
   if (getenv("NOASSEMBLYLOOPS") != NULL) {
     cpuflags &= (~X86_SSE_SUPPORT) & (~X86_SSE2_SUPPORT) & (~X86_3DNOW_SUPPORT) & (~PPC_ALTIVEC_SUPPORT);
     
@@ -319,7 +372,11 @@ int detect_cpu(FILE *log)
              "Found environment variable NOASSEMBLYLOOPS.\n"
              "Disabling all SSE/SSE2/3DNow/Altivec support.\n");
   }
+
   return cpuflags;
 }
 #endif /* detectcpu */
 
+
+
+
index 8c9ddd6dbd2a56cde09d67c95ee7e86e96a30b02..918f1840fde62c044313d86ac1a8368279db13bc 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_disre_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <math.h>
 #include "typedefs.h"
 #include "sysstuff.h"
@@ -174,8 +176,8 @@ real ta_disres(int nfa,t_iatom forceatoms[],t_iparams ip[],
               t_mdatoms *md,int ngrp,real egnb[],real egcoul[],
               t_fcdata *fcd)
 {
-  static real sixth=1.0/6.0;
-  static real seven_three=7.0/3.0;
+  const real sixth=1.0/6.0;
+  const real seven_three=7.0/3.0;
   
   atom_id     ai,aj;
   int         fa,res,npairs,p,pair,ki,kj,m;
index ee83ce7379db04b639e94eb310d16ea402497e40..b96c85963d46bb492eabed814d439e90858144f8 100644 (file)
 #ifndef _dlb_h
 #define _dlb_h
 
-static char *SRCID_dlb_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) dlb.h 1.3 31 Jan 1995"
-#endif /* HAVE_IDENT */
 #include "typedefs.h"
 
 extern void count_nb(t_commrec *cr,t_nsborder *nsb,t_block *cgs,int nns,
index 1aed63324b7cf90b7a4101a6f3549e8d34786df1..a3e1c934f9203fd7677f7ec63a6d1614618341fa 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_do_fit_c = "$Id$";
+
 #include "maths.h"
 #include "sysstuff.h"
 #include "typedefs.h"
@@ -94,22 +94,20 @@ real rhodev(int natoms,real mass[],rvec x[],rvec xp[])
 void calc_fit_R(int natoms,real *w_rls,rvec *xp,rvec *x,matrix R)
 {
   int    c,r,n,j,m,i,irot;
-  static double **omega=NULL,**om=NULL;
+  double **omega,**om;
   double d[2*DIM],xnr,xpc;
   matrix vh,vk,u;
   real   mn;
   int    index;
   real   max_d;
 
-  if (omega == NULL) {
-    snew(omega,2*DIM);
-    snew(om,2*DIM);
-    for(i=0; i<2*DIM; i++) {
-      snew(omega[i],2*DIM);
-      snew(om[i],2*DIM);
-    }
+  snew(omega,2*DIM);
+  snew(om,2*DIM);
+  for(i=0; i<2*DIM; i++) {
+    snew(omega[i],2*DIM);
+    snew(om[i],2*DIM);
   }
-
+  
   for(i=0; i<2*DIM; i++) {
     d[i]=0;
     for(j=0; j<2*DIM; j++) {
@@ -182,6 +180,13 @@ void calc_fit_R(int natoms,real *w_rls,rvec *xp,rvec *x,matrix R)
       R[r][c] = vk[0][r]*vh[0][c] +
                vk[1][r]*vh[1][c] +
                vk[2][r]*vh[2][c];
+
+  for(i=0; i<2*DIM; i++) {
+    sfree(omega[i]);
+    sfree(om[i]);
+  }
+  sfree(omega);
+  sfree(om);
 }
 
 void do_fit(int natoms,real *w_rls,rvec *xp,rvec *x)
index f68722d9f01c15e7e3df6cabdba71f27812461f5..4dad5845fd94b48432d7d80dedb5c7cb8300c4a3 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_enxio_c = "$Id$";
+
 #include "futil.h"
 #include "string2.h"
 #include "fatal.h"
index b5254ece51fef3c2e2b6f6d08896f33d30817ce9..e78b0d6aa09b84c2b8d0bae4956524b9fe1017bb 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_ewald_util_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "assert.h"
@@ -78,9 +78,7 @@ real ewald_LRcorrection(FILE *fp,t_nsborder *nsb,t_commrec *cr,t_forcerec *fr,
                        matrix box,rvec mu_tot,real qsum, int ewald_geometry,
                        real epsilon_surface,matrix lr_vir)
 {
-  static  bool bFirst=TRUE;
-  static  real Vself;
-
+  real Vself;
   int     i,i1,i2,j,k,m,iv,jv;
   atom_id *AA;
   double  q2sum; /* Necessary for precision */
index c749980e66b0609c2fbc7e36564ec1471f255940..429156996953e4a8827341f147dd6e08adab91d4 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_f77_wrappers_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 3519d7c60e750628eafdc08bd59d6fb07aefe4e3..53d922b305a2b3a88bda4ca3d38abca633f15b79 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_fatal_c = "$Id$";
+
 #include <sysstuff.h>
 #include <ctype.h>
 #include <errno.h>
@@ -44,6 +44,7 @@ static char *SRCID_fatal_c = "$Id$";
 #include "string2.h"
 #include "smalloc.h"
 
+
 static bool bDebug = FALSE;
 static char *fatal_tmp_file = NULL;
 
index c0f5810c0328b2e5318fdbc884cc7bf37a1bd442..9a6f773d8683721739a34af74f13d798197a5ff7 100644 (file)
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_ffscanf_c = "$Id$";
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* This file is completely threadsafe - keep it that way! */
+
+
 #include <stdarg.h>
 #include <ctype.h>
 #include "typedefs.h"
index 0a09b06b645a35629e5df578ef40a5c829aa34ec..4d3ed7239cd97ba56bf64b97fabbd189545acb7f 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * S  C  A  M  O  R  G
  */
-static char *SRCID_filenm_c = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -63,28 +63,28 @@ enum { eftASC, eftBIN, eftXDR, eftGEN, eftNR };
 /* To support multiple file types with one general (eg TRX) we have 
  * these arrays.
  */
-static    int trxs[]={
+static const int trxs[]={
 #ifdef USE_XDR 
   efXTC, efTRR, 
 #endif
   efTRJ, efGRO, efG96, efPDB, efG87 };
 #define NTRXS asize(trxs)
 
-static    int trns[]={ 
+static const int trns[]={ 
 #ifdef USE_XDR
   efTRR, 
 #endif
   efTRJ };
 #define NTRNS asize(trns)
 
-static    int stos[]={ efGRO, efG96, efPDB, efBRK, 
+static const int stos[]={ efGRO, efG96, efPDB, efBRK, 
 #ifdef HAVE_XML
   efXML, 
 #endif
   efENT};
 #define NSTOS asize(stos)
 
-static    int stxs[]={ efGRO, efG96, efPDB, efBRK, efENT,
+static const int stxs[]={ efGRO, efG96, efPDB, efBRK, efENT,
 #ifdef USE_XDR 
                       efTPR, 
 #endif 
@@ -95,14 +95,14 @@ static    int stxs[]={ efGRO, efG96, efPDB, efBRK, efENT,
                        };
 #define NSTXS asize(stxs)
 
-static    int enxs[]={ 
+static const int enxs[]={ 
 #ifdef USE_XDR
   efEDR, 
 #endif
   efENE };
 #define NENXS asize(enxs)
 
-static    int tpxs[]={ 
+static const int tpxs[]={ 
 #ifdef USE_XDR
   efTPR, 
 #endif
@@ -113,7 +113,7 @@ static    int tpxs[]={
   };
 #define NTPXS asize(tpxs)
 
-static    int tpss[]={ 
+static const int tpss[]={ 
 #ifdef USE_XDR
   efTPR, 
 #endif
@@ -129,10 +129,11 @@ typedef struct {
   char *ext;
   char *defnm;
   char *defopt;
-  char *descr;
+  const char *descr;
   int  ntps;
-  int  *tps;
+  const int  *tps;
 } t_deffile;
 
 /* this array should correspond to the enum in include/types/filenm.h */
 static t_deffile deffile[efNR] = {
@@ -190,9 +191,9 @@ static t_deffile deffile[efNR] = {
 static char *default_file_name=NULL;
 
 #define NZEXT 2
-char *z_ext[NZEXT] = { ".gz", ".Z" };
+const char *z_ext[NZEXT] = { ".gz", ".Z" };
 
-void set_default_file_name(char *name)
+void set_default_file_name(const char *name)
 {
   int i;
 
@@ -202,7 +203,7 @@ void set_default_file_name(char *name)
     deffile[i].defnm = default_file_name;
 }
 
-char *ftp2ext(int ftp)
+const char *ftp2ext(int ftp)
 {
   if ((0 <= ftp) && (ftp < efNR))
     return deffile[ftp].ext+1;
@@ -210,7 +211,7 @@ char *ftp2ext(int ftp)
     return "unknown";
 }
 
-char *ftp2desc(int ftp)
+const char *ftp2desc(int ftp)
 {
   if ((0 <= ftp) && (ftp < efNR))
     return deffile[ftp].descr;
@@ -218,7 +219,7 @@ char *ftp2desc(int ftp)
     return "unknown filetype";
 }
 
-char *ftp2ftype(int ftp)
+const char *ftp2ftype(int ftp)
 {
   if ((ftp >= 0) && (ftp < efNR)) {
     switch (deffile[ftp].ftype) {
@@ -234,7 +235,7 @@ char *ftp2ftype(int ftp)
   return "unknown";
 }
 
-char *ftp2defnm(int ftp)
+const char *ftp2defnm(int ftp)
 {
   static char buf[256];
   
@@ -248,7 +249,8 @@ char *ftp2defnm(int ftp)
 void pr_def(FILE *fp,int ftp)
 {
   t_deffile *df;
-  char *s=NULL,*ext,*desc,*flst;
+  char *s=NULL,*flst;
+  const char *ext,*desc;
   
   df=&(deffile[ftp]);
   /* find default file extension and \tt-ify description */
@@ -304,7 +306,7 @@ void pr_fns(FILE *fp,int nf,t_filenm tfn[])
   for(i=0; (i<nf); i++) {
     for(f=0; f<tfn[i].nf; f++) {
       sprintf(buf, "%4s %14s  %-12s", f==0?tfn[i].opt:"", tfn[i].fns[f],
-             f==0?fileopt(tfn[i].flag):"");
+             f==0?fileopt(tfn[i].flag,buf,255):"");
       if ( f < tfn[i].nf-1 )
        fprintf(fp, "%s\n", buf);
     }
@@ -457,7 +459,7 @@ static void set_grpfnm(t_filenm *fnm,char *name,bool bCanNotOverride)
   int  i,type;
   bool bValidExt;
   int  nopts;
-  int  *ftps;
+  const int  *ftps;
   
   nopts = deffile[fnm->ftp].ntps;
   ftps  = deffile[fnm->ftp].tps;
@@ -705,7 +707,7 @@ char *ftp2fn_null(int ftp,int nfile,t_filenm fnm[])
   return NULL;
 }
 
-static void add_filters(char *filter,int *n,int nf,int ftp[])
+static void add_filters(char *filter,int *n,int nf,const int ftp[])
 {
   char buf[8];
   int  i;
index 91310c5834b4f781f5527be478f51cd3c3970f07..4126ca3eb500bb7461628b688263f76f2c778b79 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_fnbf_c = "$Id$";
+
  
 #ifdef USE_THREADS  
 #include <pthread.h>  /* must come first! */
@@ -1011,7 +1011,7 @@ real do_14(int nbonds,t_iatom iatoms[],t_iparams *iparams,
   if (nbfp14 == NULL) {
     nbfp14 = mk_14parm(fr->ntype,nbonds,iatoms,iparams,md->typeA);
     if (debug)
-      pr_rvec(debug,0,"nbfp14",nbfp14,sqr(fr->ntype));
+      pr_rvec(debug,0,"nbfp14",nbfp14,sqr(fr->ntype),TRUE);
   }
   shift14 = CENTRAL;
   
index 737b81e25c0384aa8d24fca95717b2aec233b8d7..4298ad6302cc3af019cd2f3c14490d58758fe34f 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_four1_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <math.h>
 #include "typedefs.h"
 
index 7d56f88dba34c7c1d8f0d9f7befd3add084940b2..c4f611e414f5062f173a386f059cc70d1682251a 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_fourn_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
 #include <math.h>
 #include "typedefs.h"
 #include "nr.h"
index 491a214a997e45b8f2468ad1cc038025f0127530..09d562bf574bce7db9226ce1f8277a3bb5d48ec4 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_ftocstr_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
 int ftocstr(char *ds, int dl, char *ss, int sl)
     /* dst, src ptrs */
     /* dst max len */
index 9a079a8d1cd8daf8858ad28750fb49a0c9244e70..544468d00015b0e1e68ca585547b2523df7d3db3 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_futil_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -193,7 +193,7 @@ FILE *gunzip(char *fn,char *mode)
   return fp;
 }
 
-bool fexist(char *fname)
+bool fexist(const char *fname)
 {
   FILE *test;
   
@@ -222,7 +222,7 @@ bool eof(FILE *fp)
   }
 }
 
-char *backup_fn(char *file)
+char *backup_fn(const char *file)
 {
   /* Use a reasonably low value for countmax; we might
    * generate 4-5 files in each round, and we dont
@@ -264,7 +264,7 @@ char *backup_fn(char *file)
   return buf;
 }
 
-bool make_backup(char * name)
+bool make_backup(const char * name)
 {
     char * backup;
 
@@ -281,7 +281,7 @@ bool make_backup(char * name)
     return TRUE;
 }
 
-FILE *ffopen(char *file,char *mode)
+FILE *ffopen(const char *file,char *mode)
 {
   FILE *ff=NULL;
   char buf[256],*bf,*bufsize=0,*ptr;
index 5394fac712ebe1e7b30511648f3d03c90cc18aec..a7b1995612632f37f726ba7598b39c42fa0c1ae7 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_gbutil_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
 #include <math.h>
 #include "macros.h"
 #include "vec.h"
index 754da74e49964e0e23dfd174972facc9b0fa61b0..e460dee6dbdbdd5073620bf55c272440ad9194a2 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_gmxfio_c = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -59,14 +59,14 @@ typedef struct {
 } t_fileio;
 
 /* These simple lists define the I/O type for these files */
-static int ftpXDR[] = { efTPR, efTRR, efEDR, efXTC };
-static int ftpASC[] = { efTPA, efGRO, efPDB };
-static int ftpBIN[] = { efTPB, efTRJ, efMTX, efENE };
+static const int ftpXDR[] = { efTPR, efTRR, efEDR, efXTC };
+static const int ftpASC[] = { efTPA, efGRO, efPDB };
+static const int ftpBIN[] = { efTPB, efTRJ, efMTX, efENE };
 #ifdef HAVE_XML
-static int ftpXML[] = { efXML };
+static const int ftpXML[] = { efXML };
 #endif
 
-bool in_ftpset(int ftp,int nset,int set[])
+bool in_ftpset(int ftp,int nset,const int set[])
 {
   int i;
   bool bResult;
index af9fd638bf1b2ba26bc47ec2fde10329074c24c6..bef63e9b0c06495acc3586854ab649b68e03dfea 100644 (file)
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_ifunc_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
 #include "typedefs.h"
 #include "bondf.h"
 #include "disre.h"
+#include "dihre.h"
 #include "orires.h"
 
 #define  def_bonded(str,lstr,nra,nrpa,nrpb,ind,func)\
@@ -66,44 +68,48 @@ static char *SRCID_ifunc_c = "$Id$";
    {str,lstr,    0,     0,     0,IF_NULL,                    -1,unimplemented}
 
 /* this MUST correspond to the enum in include/types/idef.h */
-t_interaction_function interaction_function[F_NRE]=
+const t_interaction_function interaction_function[F_NRE]=
 {
-  def_bond   ("BONDS",    "Bond",            2, 2, 2,  eNR_BONDS,  bonds    ),
-  def_bond   ("G96BONDS", "G96Bond",         2, 2, 2,  eNR_BONDS,  g96bonds ),
-  def_bond   ("MORSE",    "Morse",           2, 3, 0,  eNR_MORSE, morsebonds),
+  def_bond   ("BONDS",    "Bond",            2, 2, 2,  eNR_BONDS,  bonds         ),
+  def_bond   ("G96BONDS", "G96Bond",         2, 2, 2,  eNR_BONDS,  g96bonds      ),
+  def_bond   ("MORSE",    "Morse",           2, 3, 0,  eNR_MORSE, morsebonds     ),
   def_bond   ("CUBICBONDS","Cubic Bonds",    2, 3, 0,  eNR_CUBICBONDS, cubicbonds),
-  def_bondnb ("CONNBONDS","Connect Bonds",   2, 0, 0,  0,      unimplemented),
-  def_bondedg("HARMONIC", "Harmonic Pot.",   2, 2, 2,  eNR_BONDS,  bonds    ),
-  def_angle  ("ANGLES",   "Angle",           3, 2, 2,  eNR_ANGLES, angles   ),
-  def_angle  ("G96ANGLES","G96Angle",        3, 2, 2,  eNR_ANGLES, g96angles),
-  def_bonded ("PDIHS",    "Proper Dih.",     4, 3, 3,  eNR_PROPER, pdihs    ),
-  def_bonded ("RBDIHS",   "Ryckaert-Bell.",  4, 6, 6,  eNR_RB, rbdihs       ),
-  def_bonded ("IDIHS",    "Improper Dih.",   4, 2, 2,  eNR_IMPROPER,idihs   ),
-  def_bonded ("LJ14",     "LJ-14",           2, 2, 2,  eNR_INL1100, do_14   ),
-  def_nofc   ("COUL14",   "Coulomb-14"       ),
-  def_nb     ("LJ",       "LJ (SR)",         2, 2      ),
-  def_nb     ("BHAM",     "BuckingHam",      2, 3      ),
-  def_nofc   ("LJLR",     "LJ (LR)"          ),
-  def_nofc   ("DISPCORR", "Disper. corr."    ),
-  def_nofc   ("SR",       "Coulomb (SR)"     ),
-  def_nofc   ("LR",       "Coulomb (LR)"     ),
-  def_bonded ("WATERPOL", "Water Pol.",      1, 6, 0,  eNR_WPOL,   water_pol),
-  def_bonded ("POSRES",   "Position Rest.",  1, 3, 0,  eNR_POSRES, posres   ),
-  def_bondedg("DISRES",   "Dis. Rest.",      2, 6, 0,  eNR_DISRES, ta_disres),
-  def_nofc   ("DRVIOL",   "D. R. Viol. (nm)" ),    
-  def_bondedg("ORIRES",   "Orient. Rest.",   2, 6, 0,  eNR_ORIRES, orires   ),
-  def_nofc   ("ORDEV",    "Ori. R. RMSD"     ),  
-  def_bondedg("ANGRES",   "Angle Rest.",     4, 3, 3,  eNR_ANGRES, angres   ),
-  def_bondedg("ANGRESZ",  "Angle Rest. Z",   2, 3, 3,  eNR_ANGRESZ,angresz  ),
-  def_shkcb  ("CONSTR",   "Constraint",      2, 1, 1   ),
-  def_shk    ("CONSTRNC", "Constr. No Conn.",2, 1, 1   ),
-  def_shkcb  ("SETTLE",   "Settle",          1, 2, 0   ),
-  def_dummy  ("DUMMY2",   "Dummy2",          3, 1      ),
-  def_dummy  ("DUMMY3",   "Dummy3",          4, 2      ),
-  def_dummy  ("DUMMY3FD", "Dummy3fd",        4, 2      ),
-  def_dummy  ("DUMMY3FAD","Dummy3fad",       4, 2      ),
-  def_dummy  ("DUMMY3OUT","Dummy3out",       4, 3      ),
-  def_dummy  ("DUMMY4FD", "Dummy4fd",        5, 3      ),
+  def_bondnb ("CONNBONDS","Connect Bonds",   2, 0, 0,  0,      unimplemented     ),
+  def_bondedg("HARMONIC", "Harmonic Pot.",   2, 2, 2,  eNR_BONDS,  bonds         ),
+  def_angle  ("ANGLES",   "Angle",           3, 2, 2,  eNR_ANGLES, angles        ),
+  def_angle  ("G96ANGLES","G96Angle",        3, 2, 2,  eNR_ANGLES, g96angles     ),
+  def_bonded ("PDIHS",    "Proper Dih.",     4, 3, 3,  eNR_PROPER, pdihs         ),
+  def_bonded ("RBDIHS",   "Ryckaert-Bell.",  4, 6, 6,  eNR_RB, rbdihs            ),
+  def_bonded ("FOURDIHS", "Fourier Dih.",    4, 4, 4,  eNR_FOURDIH, rbdihs       ),
+  def_bonded ("IDIHS",    "Improper Dih.",   4, 2, 2,  eNR_IMPROPER,idihs        ),
+  def_bonded ("PIDIHS",   "Improper Dih.",   4, 3, 3,  eNR_PROPER, pdihs         ),
+  def_bonded ("LJ14",     "LJ-14",           2, 2, 2,  eNR_INL1100, do_14        ),
+  def_nofc   ("COUL14",   "Coulomb-14"                                           ),
+  def_nb     ("LJ",       "LJ (SR)",         2, 2                                ),
+  def_nb     ("BHAM",     "BuckingHam",      2, 3                                ),
+  def_nofc   ("LJLR",     "LJ (LR)"                                              ),
+  def_nofc   ("DISPCORR", "Disper. corr."                                        ),
+  def_nofc   ("SR",       "Coulomb (SR)"                                         ),
+  def_nofc   ("LR",       "Coulomb (LR)"                                         ),
+  def_bonded ("WATERPOL", "Water Pol.",      1, 6, 0,  eNR_WPOL,   water_pol     ),
+  def_bonded ("POSRES",   "Position Rest.",  1, 3, 0,  eNR_POSRES, posres        ),
+  def_bondedg("DISRES",   "Dis. Rest.",      2, 6, 0,  eNR_DISRES, ta_disres     ),
+  def_nofc   ("DRVIOL",   "D. R. Viol. (nm)"                                     ),    
+  def_bondedg("ORIRES",   "Orient. Rest.",   2, 6, 0,  eNR_ORIRES, orires        ),
+  def_nofc   ("ORDEV",    "Ori. R. RMSD"                                         ),  
+  def_bondedg("ANGRES",   "Angle Rest.",     4, 3, 3,  eNR_ANGRES, angres        ),
+  def_bondedg("ANGRESZ",  "Angle Rest. Z",   2, 3, 3,  eNR_ANGRESZ,angresz       ),
+  def_bondedg("DIHRES",   "Dih. Rest.",      4, 5, 0,  eNR_DIHRES, ta_dihres     ),
+  def_nofc   ("DIHVIOL",  "Dih. Rest. viol."                                     ),    
+  def_shkcb  ("CONSTR",   "Constraint",      2, 1, 1                             ),
+  def_shk    ("CONSTRNC", "Constr. No Conn.",2, 1, 1                             ),
+  def_shkcb  ("SETTLE",   "Settle",          1, 2, 0                             ),
+  def_dummy  ("DUMMY2",   "Dummy2",          3, 1                                ),
+  def_dummy  ("DUMMY3",   "Dummy3",          4, 2                                ),
+  def_dummy  ("DUMMY3FD", "Dummy3fd",        4, 2                                ),
+  def_dummy  ("DUMMY3FAD","Dummy3fad",       4, 2                                ),
+  def_dummy  ("DUMMY3OUT","Dummy3out",       4, 3                                ),
+  def_dummy  ("DUMMY4FD", "Dummy4fd",        5, 3                                ),
   def_nofc   ("EQM",      "Quantum En."      ),
   def_nofc   ("EPOT",     "Potential"        ),
   def_nofc   ("EKIN",     "Kinetic En."      ),
index 37f3afd2d8a68446308674942c732c2ba5e15b5e..b45d6f9bb83608c678c3cddec1b51311a3e022b3 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_index_c = "$Id$";
+
 #include <ctype.h>
 #include <string.h>
 #include "sysstuff.h"
@@ -46,9 +46,9 @@ static char *SRCID_index_c = "$Id$";
 #include "smalloc.h"
 
 typedef enum { etOther, etProt, etDNA, erestNR } eRestp;
-static  char *ResTP[erestNR] = { "OTHER", "PROTEIN", "DNA" };
+static const char *ResTP[erestNR] = { "OTHER", "PROTEIN", "DNA" };
 
-static char   *Sugars[]     = { "A", "T", "G", "C", "U" };
+static const char   *Sugars[]     = { "A", "T", "G", "C", "U" };
 #define  NDNA asize(Sugars)
 
 static bool yn(bool bASK)
@@ -95,7 +95,7 @@ void write_index(char *outf, t_block *b,char **gnames)
   fclose(out);
 }
 
-void add_grp(t_block *b,char ***gnames,int nra,atom_id a[],char *name)
+void add_grp(t_block *b,char ***gnames,int nra,atom_id a[],const char *name)
 {
   int i;
 
@@ -242,35 +242,35 @@ static void analyse_prot(eRestp restp[],t_atoms *atoms,
                         t_block *gb,char ***gn,bool bASK,bool bVerb)
 {
   /* atomnames to be used in constructing index groups: */
-  static char *pnoh[]    = { "H" };
-  static char *pnodum[]  = { "MN1",  "MN2",  "MCB1", "MCB2", "MCG1", "MCG2", 
+  const char *pnoh[]    = { "H" };
+  const char *pnodum[]  = { "MN1",  "MN2",  "MCB1", "MCB2", "MCG1", "MCG2", 
                             "MCD1", "MCD2", "MCE1", "MCE2", "MNZ1", "MNZ2" };
-  static char *calpha[]  = { "CA" };
-  static char *bb[]      = { "N","CA","C" };
-  static char *mc[]      = { "N","CA","C","O","O1","O2","OXT" };
-  static char *mcb[]     = { "N","CA","CB","C","O","O1","O2","OT","OXT" };
-  static char *mch[]     = { "N","CA","C","O","O1","O2","OT","OXT",
+  const char *calpha[]  = { "CA" };
+  const char *bb[]      = { "N","CA","C" };
+  const char *mc[]      = { "N","CA","C","O","O1","O2","OXT" };
+  const char *mcb[]     = { "N","CA","CB","C","O","O1","O2","OT","OXT" };
+  const char *mch[]     = { "N","CA","C","O","O1","O2","OT","OXT",
                             "H1","H2","H3","H" };
   /* array of arrays of atomnames: */
-  static char **chains[] = { NULL,pnoh,calpha,bb,mc,mcb,mch,mch,mch,pnodum };
+  const char **chains[] = { NULL,pnoh,calpha,bb,mc,mcb,mch,mch,mch,pnodum };
 #define NCH asize(chains)
   /* array of sizes of arrays of atomnames: */
-  static int       sizes[NCH] = { 
+  const int       sizes[NCH] = { 
     0, asize(pnoh), asize(calpha), asize(bb), 
     asize(mc), asize(mcb), asize(mch), asize(mch), asize(mch), asize(pnodum)
   };
   /* descriptive names of index groups */
-  static char   *ch_name[NCH] = { 
+  const char   *ch_name[NCH] = { 
     "Protein", "Protein-H", "C-alpha", "Backbone", 
     "MainChain", "MainChain+Cb", "MainChain+H", "SideChain", "SideChain-H", 
     "Prot-Masses"
   };
   /* construct index group containing (TRUE) or excluding (FALSE)
      given atom names */
-  static bool complement[NCH] = { 
+  const bool complement[NCH] = { 
     TRUE, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE, TRUE, TRUE
   };
-  static int  wholename[NCH]  = { -1, 0,-1,-1,-1,-1,-1,-1, 11,-1 };
+  const int  wholename[NCH]  = { -1, 0,-1,-1,-1,-1,-1,-1, 11,-1 };
   /* the index in wholename gives the first item in the arrays of 
    * atomtypes that should be tested with 'strncasecmp' in stead of
    * strcasecmp, or -1 if all items should be tested with strcasecmp
@@ -279,7 +279,7 @@ static void analyse_prot(eRestp restp[],t_atoms *atoms,
    */
   /* only add index group if it differs from the specified one, 
      specify -1 to always add group */
-  static int compareto[NCH] = { -1,-1,-1,-1,-1,-1,-1,-1,-1, 0 };
+  const int compareto[NCH] = { -1,-1,-1,-1,-1,-1,-1,-1,-1, 0 };
 
   int     i,n,j;
   atom_id *aid;
@@ -400,15 +400,11 @@ static void analyse_dna(eRestp restp[],t_atoms *atoms,
 
 bool is_protein(char *resnm)
 {
-  static bool bRead=FALSE;
-  static int  naa;
-  static char **aas;
+  int  naa;
+  char **aas;
   int i;
   
-  if (!bRead) {
-    naa = get_strings("aminoacids.dat",&aas);
-    bRead=TRUE;
-  }
+  naa = get_strings("aminoacids.dat",&aas);
   
   for(i=0; (i<naa); i++)
     if (strcasecmp(aas[i],resnm) == 0)
index fe6704c92b0a80bd6e40f9fbed1ddd2dc0d2aea5..8d1380be98a56ef07578610a4b0c89a52047c1ac 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _inner_h
 #define _inner_h
 
-static char *SRCID_inner_h = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 17c188313c1f53c20c2ac55189b122aae8b4a798..1d0410ac6185463f7263a57b0a48377a92814a78 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_inner_altivec_c = "$Id$";
+
 #include <ppc_altivec.h>
 
 #include<stdio.h>
index 854e1f30dad867761bde2e51e2eaf051787ba0ef..ea8664c1c04f197f4945a2b88b13b95a958a4758 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_invblock_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include "typedefs.h"
 #include "smalloc.h"
 #include "invblock.h"
index 95d4b347f64922fc60fc45db50e26ef4fd631d09..14c3e47d06865838e64c288e877f39cba0479e7b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_libxdrf_c = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -42,12 +42,15 @@ static char *SRCID_libxdrf_c = "$Id$";
 #include "xdrf.h"
 #include <callf77.h>
 
-#define MAXID 20
+
+
+#define MAXID 256
 static FILE *xdrfiles[MAXID];
 static XDR *xdridptr[MAXID];
 static char xdrmodes[MAXID];
 static unsigned int cnt;
 
+
 #ifdef USE_FORTRAN
 
 typedef void (* F77_FUNC(xdrfproc,XDRFPROC))(int *, void *, int *);
index 28ece1f0b5a04acaf30f78941c481d064ad9fa42..fa67db7c88f7e84ec2ddfbabcac2737d70ba70cd 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_macros_c = "$Id$";
+
 #include "macros.h"
 
-real ZERO   =  0.0;
-real THIRD  =  (1.0/3.0);
-real HALF   =  0.5;
-real ONE    =  1.0;
-real TWO    =  2.0;
-real THREE  =  3.0;
-real SIX    =  6.0;
-real TEN    = 10.0;
-real TWELVE = 12.0;
+const real ZERO   =  0.0;
+const real THIRD  =  (1.0/3.0);
+const real HALF   =  0.5;
+const real ONE    =  1.0;
+const real TWO    =  2.0;
+const real THREE  =  3.0;
+const real SIX    =  6.0;
+const real TEN    = 10.0;
+const real TWELVE = 12.0;
index ee189852d8b5da1115756129b3d68811746cb112..9a8967b903c8e29e7c2e36b668fbba6f9d70b98d 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_main_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -44,6 +44,18 @@ static char *SRCID_main_c = "$Id$";
 
 #define BUFSIZE        1024
 
+
+#ifdef USE_THREADS
+/* These are a couple of Global mutex variables that
+ * we use when writing to log files, so we avoid different
+ * threads printing to the same file at once. (It wont crash,
+ * but the print statements would be completely mixed up)
+ */
+pthread_mutex_t gmx_logfile_mtx = PTHREAD_MUTEX_INITIALIZER;
+pthread_mutex_t gmx_stdout_mtx  = PTHREAD_MUTEX_INITIALIZER;
+
+#endif
+
 FILE *stdlog=NULL;
 int  gmx_parallel=0;
 
@@ -114,13 +126,16 @@ static int get_nodeid(FILE *log,int left,int right,int *nodeid,int *nnodes)
   return 1;
 }
 
-char *par_fn(char *base,int ftp,t_commrec *cr)
+char *par_fn(char *base,int ftp,t_commrec *cr, char buf[], int bufsize)
 {
-  static char buf[256];
+  int n;
   
+  if(bufsize<(strlen(base)+4))
+     fatal_error(0,"Character buffer too small!\n");
+
   /* Copy to buf, and strip extension */
   strcpy(buf,base);
-  buf[strlen(base)-4] = '\0';
+  buf[strlen(buf)-4] = '\0';
   
   /* Add node info */
   if (PAR(cr)) 
@@ -164,7 +179,7 @@ void check_multi_int(FILE *log,t_commrec *mcr,int val,char *name)
 void open_log(char *lognm,t_commrec *cr)
 {
   int  len,testlen,pid;
-  char *buf,*host;
+  char buf[256],*host;
   
   debug_gmx();
   
@@ -197,7 +212,7 @@ void open_log(char *lognm,t_commrec *cr)
   debug_gmx();
 
   /* Since log always ends with '.log' let's use this info */
-  buf    = par_fn(lognm,efLOG,cr);
+  par_fn(lognm,efLOG,cr,buf,255);
   stdlog = ffopen(buf,"w");
   
   /* Get some machine parameters */
@@ -258,7 +273,7 @@ t_commrec *init_multisystem(t_commrec *cr,int nfile,t_filenm fnm[])
 {
   t_commrec *mcr;
   int  i,ftp;
-  char *buf;
+  char buf[256];
   
   snew(mcr,1);
 
@@ -274,6 +289,19 @@ t_commrec *init_multisystem(t_commrec *cr,int nfile,t_filenm fnm[])
     /* Because of possible multiple extensions per type we must look 
      * at the actual file name 
      */
+<<<<<<< main.c
+    ftp = fn2ftp(fnm[i].fn);
+    if (ftp != efLOG) {
+#ifdef DEBUGPAR
+      fprintf(stderr,"Old file name: %s",fnm[i].fn);
+#endif
+      par_fn(fnm[i].fn,ftp,mcr,buf,255);
+      sfree(fnm[i].fn);
+      fnm[i].fn = strdup(buf);
+#ifdef DEBUGPAR
+      fprintf(stderr,", new: %s\n",fnm[i].fn);
+#endif
+=======
     ftp = fn2ftp(fnm[i].fns[0]);
     if (ftp != efLOG && ftp!= efTPX && ftp != efTPR && ftp != efTPS && ftp!=efTPA && ftp!=efTPB) {
       /* fprintf(stderr,"Old file name: %s",fnm[i].fns[0]); */
@@ -281,6 +309,7 @@ t_commrec *init_multisystem(t_commrec *cr,int nfile,t_filenm fnm[])
       sfree(fnm[i].fns[0]);
       fnm[i].fns[0] = strdup(buf);
       /* fprintf(stderr,", new: %s\n",fnm[i].fns[0]); */
+>>>>>>> 1.30
     }
   }
 
index 6ec8fc95a1c9524e8a2943d143e819951c5bd5f2..3a38c9a10a6598e3545a2fc939bff0d44bc26f24 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_maths_c = "$Id$";
+
 #include <math.h>
 #include <limits.h>
 #include "maths.h"
index e91cbb9b5c74f706c7176909af309b9473b2c91e..3a95e88d0f96588a48a9f0a88b20fb57d2c36736 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_matio_c = "$Id$";
+
 #include <ctype.h>
 #include "sysstuff.h"
 #include "futil.h"
@@ -42,7 +42,7 @@ static char *SRCID_matio_c = "$Id$";
 
 #define round(a) (int)(a+0.5)
 
-static char mapper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+{}|;:',<.>/?";
+static const char mapper[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+{}|;:',<.>/?";
 #define NMAP strlen(mapper)
 
 #define MAX_XPM_LINELENGTH 4096
index 1ab486ff6959a95a44210776fd9c106cc99dac14..1b7092c73b30cae7c797c16106e99904857e9cdb 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_metacode_c = "$Id$";
+
 #include <stdlib.h>
 #include <string.h>
 #include <metacode.h>
 #include <stdarg.h>
 #include <ctype.h>
 
+/* This file is NOT threadsafe, but it is only used to create
+ * the innerloops during the build process, so it will never be
+ * executed by multiple threads.
+ */
+
 #define MAXCODESIZE 1000000
 #define MAXDECL 1000
 #define F77IND 6
index 5b63b43194aa64b592f8a81a8b7266e8e21fe943..d421e21e9004a15ffb0e1bd383d0d7e34286eb13 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_mgmx_c = "$Id$";
+
 #include <string.h>
 #include <ctype.h>
 
@@ -455,8 +455,9 @@ static XmString xs_str_array_to_xmstr(char *header,int ndesc,char *desc[])
 {
   int      i;
   XmString xmstr;
-  char     *ptr,*cptr,*nlptr;
-  
+  char     *cptr,*nlptr;
+  const char *ptr;
+
   if (ndesc <= 0)
     return empty_str;
   else {
@@ -533,7 +534,7 @@ static windex mk_filedlgs(int parent,int top,int nfile,
   char   **wname;
   int    i,j,ftp,narg,dx,www[NWC];
   Widget topw;
-  char   *fn,dbuf[256];
+  char   *fn,dbuf[256],buf[255];
 
   wc[nwcTEXT]   = xmTextFieldWidgetClass;
   wc[nwcFDLG]   = xmPushButtonWidgetClass;
@@ -548,7 +549,7 @@ static windex mk_filedlgs(int parent,int top,int nfile,
   for(i=0; (i<nfile); i++) {
     ftp = fnm[i].ftp;
     dx  = (i % 2)*50;
-    sprintf(dbuf,"%s [%s]",ftp2desc(ftp),fileopt(fnm[i].flag));
+    sprintf(dbuf,"%s [%s]",ftp2desc(ftp),fileopt(fnm[i].flag,buf,255));
     if ((fn = strrchr(fnm[i].fns[0],'/')) == NULL)
       fn = fnm[i].fns[0];
     else
@@ -742,8 +743,9 @@ static void append_str(char **buf,int *blen,int *maxlen,char *str,
 {
 #define DELTA 256
   int  i,slen,width=80;
-  char *ptr,*nptr;
+  char *nptr;
+  const char *ptr;
+
   ptr = check_tty(str);
   if (indent > 0) {
     slen=strlen(ptr);
@@ -910,8 +912,7 @@ static int mk_about(Widget base)
     "In the fifth pane you find the usual buttons, [BB]OK[bb], [BB]Cancel[bb],",
     "[BB]Help[bb], and [BB]About[bb] which presumably don't need any explanation.[PAR]",
     "The GUI was written by David van der Spoel (comments to spoel@xray.bmc.uu.se)[PAR]",
-    "And hey:[BR]",
-    NULL
+    "And hey:[BR]"
   };
 #define NABOUT asize(about)
 
@@ -921,8 +922,9 @@ static int mk_about(Widget base)
     "It took about 1500 lines of pretty ugly C code to get this dialog box working"
   };
 
-  about[NABOUT-1] = cool_quote();
-
+  char tmpstr[256];
+  int dum;
+  
   return low_mk_help(base,
                     "ABOUT THE GROMACS MOTIF USER INTERFACE",asize(about),about,
                     "PROBLEMS IN THE GUI",asize(mbugs),mbugs,
index 3551eb4b16228ee66ce457f31f2acabc56026056..115a4069e88cc141ee06c6a9ecc32ff97f5a1242 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mgmxtest_c = "$Id$";
+
 #include "copyrite.h"
 #include "statutil.h"
 #include "macros.h"
index cb744f8b87e507bfe820ae5c3ccb93ab1569f040..607caa7981302c6536fd3d50949a24f3cfc6ba93 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_minvert_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include "minvert.h"
 #include "nr.h"
 #include "smalloc.h"
@@ -97,19 +99,16 @@ void print_mat(FILE *fp,char *title,int n,real **a,int *indx)
 
 void invert_mat(int n,real **A,real **Ainv)
 {
-  static real *col=NULL;
-  static int  *indx=NULL;
-  static int  N=0;
+  real *col=NULL;
+  int  *indx=NULL;
   
   real d;
   int  i,j;
   
-  if (n > N) {
-    srenew(col,n+1);
-    srenew(indx,n+1);
-    N=n;
-  }
-  ludcmp(A,N,indx,&d);
+  snew(col,n+1);
+  snew(indx,n+1);
+  
+  ludcmp(A,n,indx,&d);
   
   /* A is an LU-decomposed matrix, now back substitute to get Ainv */
   for(j=1; (j<=n); j++) {
@@ -120,5 +119,7 @@ void invert_mat(int n,real **A,real **Ainv)
     for(i=1; (i<=n); i++)
       Ainv[i][j]=col[i];
   }
+  sfree(col);
+  sfree(indx);
 }
 
index e0a48406fb56130d725685c4019d87a0d78c9b63..363e6bbcfbef7712cf959dc23d555a68ffefe061 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _minvert_h
 #define _minvert_h
 
-static char *SRCID_minvert_h = "$Id$";
+
 #include "typedefs.h"
 
 /* A bunch of routines that works on matrices that run from 1 thru n
index 64e69b0c140435ccdf3fef71545d63c01411c149..5fe9a488fd9c36d2f63d4772239628060431ff99 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mkinl_c = "$Id$";
+
+/* This file is NOT threadsafe, but it is only used to create
+ * the innerloops during the build process, so it will never be
+ * executed by multiple threads.
+ */
+
 #include <string.h>
 #include "mkinl.h"
 #include <types/simple.h>
index c32c74e3c673c577e8927f9a3926eba694c662ec..8e8f16cb5f4c1cfc2026387a9dd428f9d7916b5d 100644 (file)
 #ifndef _mkinl_h
 #define _mkinl_h
 
-static char *SRCID_mkinl_h = "$Id$";
+/* This file is NOT threadsafe, but it is only used to create
+ * the innerloops during the build process, so it will never be
+ * executed by multiple threads.
+ */
+
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index c136718090addd98515aafbd00cf2121bcb68733..1cf7ed8c8f2d5d23d33696a73ca4d121e12990d8 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mkinl_calcdist_c = "$Id$";
+
+/* This file is NOT threadsafe, but it is only used to create
+ * the innerloops during the build process, so it will never be
+ * executed by multiple threads.
+ */
+
 #include "mkinl.h"
 #include <string.h>
 
index b3cc44ddd5cb3ca8464578a0de1881d6b8675590..d4d74f205aeb0cb8045adee70a6695f9f1557764 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mkinl_declarations_c = "$Id$";
+
+/* This file is NOT threadsafe, but it is only used to create
+ * the innerloops during the build process, so it will never be
+ * executed by multiple threads.
+ */
+
 #include "mkinl.h"
 #include <string.h>
 #include <mkinl_fortrandata.h>
index 39f3892af78059f32a13a1e0a95c3687965ef3d2..9f20660bf920b19d57e2b494142af0a4faf782df 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mkinl_fortrandata_h = "$Id$";
-static char finvsqrtdata[]={  
+
+/* This file is completely threadsafe - keep it that way! */
+
+static const char finvsqrtdata[]={  
   "      DATA (finvsqrtexptab(I), I=    1,   64) /\n"
   "     $     X'5f000000', X'5e800000', X'5e800000', X'5e000000',\n"
   "     $     X'5e000000', X'5d800000', X'5d800000', X'5d000000',\n"
index b9a0d3da95ae4d993111bf9bfccc8d5de7a610ef..0722d8ef569a523b3bfed408bc250885e7168791 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mkinl_innerloop_c = "$Id$";
+
+/* This file is NOT threadsafe, but it is only used to create
+ * the innerloops during the build process, so it will never be
+ * executed by multiple threads.
+ */
+
 #include "mkinl.h"
 
 void unpack_inner_data(bool calcdist,bool calcforce)
index 8ea9de4f44d1a6e80b4781c3e5f452f1b5928610..fe06b92fa5f860f6ff26db86b3862c0d220615f2 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mkinl_interactions_c = "$Id$";
+
+/* This file is NOT threadsafe, but it is only used to create
+ * the innerloops during the build process, so it will never be
+ * executed by multiple threads.
+ */
+
 #include "mkinl.h"
 #include <string.h>
 
index 4b8d87802d8c45a4c0808b384100e2da5403f768..7f6eb1a2002062f4d3c698dfc24348cbf9bc67ef 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mkinl_invsqrt_c = "$Id$";
+
+/* This file is NOT threadsafe, but it is only used to create
+ * the innerloops during the build process, so it will never be
+ * executed by multiple threads.
+ */
+
 #include "mkinl.h"
 #include <string.h>
 
index c6004701825c25f00564df16393b4e7142b39a2c..16879fd0e2ef348a0184b77f9eeb6b7d071e6ea2 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mkinl_outerloop_c = "$Id$";
+
+/* This file is NOT threadsafe, but it is only used to create
+ * the innerloops during the build process, so it will never be
+ * executed by multiple threads.
+ */
+
 #include <string.h>
 #include "mkinl.h"
 
index 0c0424000eb04f0eb076eead0ff1434e841a66d7..387d4c65b113fd1cb0b2228b80ac74fdc849cc32 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mkinl_recip_c = "$Id$";
+
 #include "mkinl.h"
 #include <string.h>
 
index f71b9af01fbb872aad5edd5cf660243319a79ff9..13c618b0d8954759fb8a9bf05a2f85f6ddfb6275 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mshift_c = "$Id$";
+
 #include <string.h>
 #include "assert.h"
 #include "smalloc.h"
@@ -55,8 +55,6 @@ static char *SRCID_mshift_c = "$Id$";
  *
  ************************************************************/
  
-typedef enum { egcolWhite, egcolGrey, egcolBlack, egcolNR } egCol;
-
 static void add_gbond(t_graph *g,t_iatom ia[],int np)
 {
   int     j,k,l;
@@ -282,6 +280,10 @@ t_graph *mk_graph(t_idef *idef,int natoms,bool bShakeOnly,bool bSettle)
 #ifdef DEBUG
   p_graph(stdlog,"graph",g);
 #endif
+
+  g->negc = 0;
+  g->egc = NULL;
+  
   return g;
 }
 
@@ -293,6 +295,7 @@ void done_graph(t_graph *g)
     /* This is malloced in a NASTY way, see above */
     sfree(g->edge[0]);
     sfree(g->edge);
+    sfree(g->egc);
   }
 }
 
@@ -412,8 +415,6 @@ void mk_mshift(FILE *log,t_graph *g,matrix box,rvec x[])
   int    nW,nG,nB;             /* Number of Grey, Black, White */
   int    fW,fG;                        /* First of each category       */
   int    nerror=0;
-  static int   negc=0;
-  static egCol *egc=NULL;      /* The colour of each node      */
 
   /* This puts everything in the central box, that is does not move it 
    * at all. If we return without doing this for a system without bonds
@@ -427,11 +428,11 @@ void mk_mshift(FILE *log,t_graph *g,matrix box,rvec x[])
     return;
 
   nnodes=g->nnodes;
-  if (nnodes > negc) {
-    negc = nnodes;
-    srenew(egc,negc);
+  if (nnodes > g->negc) {
+    g->negc = nnodes;
+    srenew(g->egc,g->negc);
   }
-  memset(egc,0,(size_t)(nnodes*sizeof(egc[0])));
+  memset(g->egc,0,(size_t)(nnodes*sizeof(g->egc[0])));
 
   nW=g->nbound;
   nG=0;
@@ -450,11 +451,11 @@ void mk_mshift(FILE *log,t_graph *g,matrix box,rvec x[])
      * number than before, because no nodes are made white
      * in the loop
      */
-    if ((fW=first_colour(fW,egcolWhite,g,egc)) == -1) 
+    if ((fW=first_colour(fW,egcolWhite,g,g->egc)) == -1) 
       fatal_error(0,"No WHITE nodes found while nW=%d\n",nW);
     
     /* Make the first white node grey */
-    egc[fW]=egcolGrey;
+    g->egc[fW]=egcolGrey;
     nG++;
     nW--;
 
@@ -465,18 +466,18 @@ void mk_mshift(FILE *log,t_graph *g,matrix box,rvec x[])
            nW,nG,nB,nW+nG+nB);
 #endif
     while (nG > 0) {
-      if ((fG=first_colour(fG,egcolGrey,g,egc)) == -1)
+      if ((fG=first_colour(fG,egcolGrey,g,g->egc)) == -1)
        fatal_error(0,"No GREY nodes found while nG=%d\n",nG);
       
       /* Make the first grey node black */
-      egc[fG]=egcolBlack;
+      g->egc[fG]=egcolBlack;
       nB++;
       nG--;
 
       /* Make all the neighbours of this black node grey
        * and set their periodicity 
        */
-      ng=mk_grey(log,nnodes,egc,g,&fG,box,x,&nerror);
+      ng=mk_grey(log,nnodes,g->egc,g,&fG,box,x,&nerror);
       /* ng is the number of white nodes made grey */
       nG+=ng;
       nW-=ng;
index a9b4a976c7df1acd1bf16e74a7fc55ba4c130923..45f6a35e7f51c2d2e085d13ced3a55e4411569ec 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mvdata_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
 #include <sysstuff.h>
 #include <string.h>
 #include "typedefs.h"
index 0b999c7094de12299a11f103ca5a89b7d6fdb539..0ddc731d20b545f7429128139f9af3152d3cde3e 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_mvxvf_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
 #include <sysstuff.h>
 #include <string.h>
 #include "typedefs.h"
index 1b65f74768b9564b67c5413286c016abd14d6366..ac92bbf12e491be8b3cbeff2c0742a9da1dc1b0d 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_names_c = "$Id$";
+
 #include "typedefs.h"
 #include "names.h"
 
 /* note: these arrays should correspond to enums in include/types/enums.h */
 
-char *eblock_names[ebNR+1]=
+const char *eblock_names[ebNR+1]=
 {
   "CGS","MOLS","SBLOCKS",NULL
 };
 
-char *epbc_names[epbcNR+1]=
+const char *epbc_names[epbcNR+1]=
 {
   "xyz", "no", NULL
 };
 
-char *ens_names[ensNR+1]=
+const char *ens_names[ensNR+1]=
 {
   "Grid","Simple", NULL
 };
 
-char *ei_names[eiNR+1]=
+const char *ei_names[eiNR+1]=
 {
   "md", "steep", "cg", "bd", "sd", "nm", NULL 
 };
 
-char *bool_names[BOOL_NR+1]=
+const char *bool_names[BOOL_NR+1]=
 {
   "FALSE","TRUE", NULL
 };
 
-char *yesno_names[BOOL_NR+1]=
+const char *yesno_names[BOOL_NR+1]=
 {
   "no","yes", NULL
 };
 
-char *ptype_str[eptNR+1] = {
+const char *ptype_str[eptNR+1] = {
   "Atom", "Nucleus", "Shell", "Bond", "Dummy", NULL
 };
 
-char *eel_names[eelNR+1] = {
+const char *eel_names[eelNR+1] = {
   "Cut-off", "Reaction-Field", "Generalized-Reaction-Field",
-  "PME", "Ewald", "PPPM", "Poisson", "Switch", "Shift", "User", NULL
+  "PME", "Ewald", "PPPM", "Poisson", "Switch", "Shift", "User", 
+  "Generalized-Born", NULL
 };
 
-char *eewg_names[eewgNR+1] = {
+const char *eewg_names[eewgNR+1] = {
   "3d", "3dc", NULL
 };
 
-char *evdw_names[evdwNR+1] = {
+const char *evdw_names[evdwNR+1] = {
   "Cut-off", "Switch", "Shift", "User", NULL
 };
 
-char *eshake_names[estNR+1] = {
+const char *eshake_names[estNR+1] = {
   "Lincs", "Shake", NULL
 };
 
-char *egrp_nm[egNR+1] = { 
+const char *egrp_nm[egNR+1] = { 
   "Coul-SR","LJ","Buck", "Coul-LR", "LJ-LR", "Coul-14", "LJ-14", NULL
 };
 
-char *etcoupl_names[etcNR+1] = {
-  "No", "Berendsen", "Nose-Hoover", "yes", NULL
+const char *etcoupl_names[etcNR+1] = {
+  "No", "Berendsen", "Nose-Hoover", "yes", "Andersen", "Andersen-interval", NULL
 }; /* yes is alias for berendsen */
 
-char *epcoupl_names[epcNR+1] = {
+const char *epcoupl_names[epcNR+1] = {
   "No", "Berendsen", "Parrinello-Rahman", "Isotropic", NULL
 }; /* isotropic is alias for berendsen */
 
-char *epcoupltype_names[epctNR+1] = {
+const char *epcoupltype_names[epctNR+1] = {
   "Isotropic", "Semiisotropic", "Anisotropic", "Surface-Tension", NULL
 };
 
-char *edisre_names[edrNR+1] = {
+const char *edisre_names[edrNR+1] = {
   "No", "Simple", "Ensemble", NULL
 };
 
-char *edisreweighting_names[edrwNR+1] = {
+const char *edisreweighting_names[edrwNR+1] = {
   "Conservative", "Equal", NULL
 };
 
-char *enbf_names[eNBF_NR+1] = {
+const char *enbf_names[eNBF_NR+1] = {
   "", "LJ", "Buckingham", NULL
 };
 
-char *ecomb_names[eCOMB_NR+1] = {
+const char *ecomb_names[eCOMB_NR+1] = {
   "", "Arithmetic", "Geometric", "ArithSigEps", NULL
 };
 
-char *gtypes[egcNR+1] = {
+const char *gtypes[egcNR+1] = {
   "T-Coupling", "Energy Mon.", "Acceleration", "Freeze",
   "User1", "User2", "VCM", "XTC", "Or. Res. Fit", NULL
 };
 
-char *efep_names[efepNR+1] = {
+const char *efep_names[efepNR+1] = {
   "no", "yes", NULL
 };
 
-char *esolv_names[esolNR+1] = {
+const char *esolv_names[esolNR+1] = {
   "General", "MNO Solvent", "Water", "Water-Water", NULL
 };
 
-char *edispc_names[edispcNR+1] = {
+const char *edispc_names[edispcNR+1] = {
   "No", "EnerPres", "Ener", NULL
 };
 
-char *ecm_names[ecmNR+1] = { 
+const char *ecm_names[ecmNR+1] = { 
   "Linear", "Angular", "None", NULL 
 };
+
+const char *eann_names[eannNR+1] = {
+  "No", "Single", "Periodic", NULL
+};
+
+const char *egb_names[egbNR+1] = {
+  "Still", "Karplus", NULL
+};
+
+const char *eis_names[eisNR+1] = {
+  "No", "LCPO", NULL
+};
index 12c42093e9849842a469e6978ff1b377e039d251..c03d160669f6594c5db8eade292746e33ff364d1 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_network_c = "$Id$";
+
 #include <string.h>
 #include "fatal.h"
 #include "main.h"
@@ -40,9 +40,6 @@ static char *SRCID_network_c = "$Id$";
 #endif
 
 #ifdef USE_MPI
-static int  mpi_num_nodes=0;
-static int  mpi_my_rank=-1;
-static char mpi_hostname[MPI_MAX_PROCESSOR_NAME];
 
 static MPI_Request mpi_req_tx=MPI_REQUEST_NULL,mpi_req_rx;
 #else
@@ -185,6 +182,9 @@ int gmx_setup(int *argc,char **argv,int *nnodes)
   char   buf[256];
   int    resultlen;               /* actual length of node name      */
   int    i,flag;
+  int  mpi_num_nodes;
+  int  mpi_my_rank;
+  char mpi_hostname[MPI_MAX_PROCESSOR_NAME];
 
   /* Call the MPI routines */
   (void) MPI_Init(argc,&argv);
@@ -206,7 +206,9 @@ int  gmx_node_num(void)
 #ifndef USE_MPI
   return 1;
 #else
-  return mpi_num_nodes;
+  int i;
+  return MPI_Comm_size(MPI_COMM_WORLD, &i);
+  return i;
 #endif
 }
 
@@ -215,7 +217,9 @@ int gmx_node_id(void)
 #ifndef USE_MPI
   return 0;
 #else
-  return mpi_my_rank;
+  int i;
+  return MPI_Comm_rank(MPI_COMM_WORLD, &i);
+  return i;
 #endif
 }
 
index ef23e82466ed74154743b38b8816259c43c5845b..f72505850d2f7ba85f393912874c75a47c77e605 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_nrama_c = "$Id$";
+
 #include <math.h>
 #include "assert.h"
 #include "sysstuff.h"
@@ -44,7 +44,7 @@ static char *SRCID_nrama_c = "$Id$";
 #include "nrama.h"
 #include "rmpbc.h"
 
-static char *pp_pat[] = { "C", "N", "CA", "C", "N" };
+static const char *pp_pat[] = { "C", "N", "CA", "C", "N" };
 #define NPP (sizeof(pp_pat)/sizeof(pp_pat[0]))
 
 static int d_comp(const void *a,const void *b)
@@ -91,7 +91,7 @@ bool new_data(t_xrama *xr)
   return TRUE;
 }
 
-static int find_atom(char *find,char ***names,int start,int nr)
+static int find_atom(const char *find,char ***names,int start,int nr)
 {
   int i;
 
@@ -121,7 +121,7 @@ static void add_xr(t_xrama *xr,int ff[5],t_atoms *atoms)
          atoms->atom[ff[1]].resnr+1);
   xr->pp[xr->npp].label=strdup(buf);
   xr->npp++;
-}
+} 
 
 static void get_dih(t_xrama *xr,t_atoms *atoms)
 {
@@ -288,9 +288,11 @@ static void get_dih_props(t_xrama *xr,t_idef *idef)
                  xr->dih[i].ai[1],xr->dih[i].ai[2]);
 }
 
-void init_rama(char *infile,char *topfile,t_xrama *xr)
+
+
+t_topology *init_rama(char *infile,char *topfile,t_xrama *xr)
 {
-  static t_topology *top;
+  t_topology *top;
   real   t;
 
   top=read_top(topfile);
@@ -303,5 +305,7 @@ void init_rama(char *infile,char *topfile,t_xrama *xr)
   
   min_max(xr);
   calc_dihs(xr);
+
+  return top;
 }
 
index d9cb3758cd98a7283ae96a737686c0b622751379..8e51a40c5e31cb55952c2bea389f400765ed22d3 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_nrjac_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
 #include "gstat.h"
 #include "smalloc.h"
 
-/* These routines were taken from NUMERICAL RECIPES */
 
 #define ROTATE(a,i,j,k,l) g=a[i][j];h=a[k][l];a[i][j]=g-s*(h+g*tau);\
   a[k][l]=h+s*(g-h*tau);
        
-static void nrerror(char *error_text)
-{
-  fatal_error(0,"Numerical Recipes: %s\n",error_text);
-}
-
 void jacobi(double **a,int n,double d[],double **v,int *nrot)
 {
   int j,i;
@@ -124,7 +119,7 @@ void jacobi(double **a,int n,double d[],double **v,int *nrot)
       z[ip]  =  0.0;
     }
   }
-  nrerror("Too many iterations in routine JACOBI");
+  fatal_error(0,"Error: Too many iterations in routine JACOBI\n");
 }
 
 int m_inv_gen(real **m,int n,real **minv)
index 0d400dfc242548ab36a6d96cde1f94226532f257..9002e165d18e33be73ba0ad449cdb2794db22ecd 100644 (file)
  * And Hey:
  * Gyas ROwers Mature At Cryogenic Speed
  */
-static char *SRCID_nrnb_c = "$Id$";
+
 #include <string.h>
 #include "sysstuff.h"
 #include "fatal.h"
-#include "vveclib.h"
 #include "names.h"
 #include "macros.h"
 #include "nrnb.h"
@@ -47,7 +46,7 @@ typedef struct {
 } t_nrnb_data;
 
 
-static t_nrnb_data nbdata[eNRNB] = {
+static const t_nrnb_data nbdata[eNRNB] = {
   { "LJ",                              31 }, /* inl0100 */
   { "LJ(S)",                           31 }, /* inl0110 */  
   { "Buckingham",                      36 }, /* inl0200 */
@@ -147,8 +146,10 @@ static t_nrnb_data nbdata[eNRNB] = {
   { "Propers",                        229 },
   { "Impropers",                      208 },
   { "RB-Dihedrals",                   247 },
+  { "Four. Dihedrals",                247 },
   { "Dist. Restr.",                   200 },
   { "Orient. Restr.",                 200 },
+  { "Dihedral Restr.",                200 },
   { "Pos. Restr.",                     50 },
   { "Angle Restr.",                   191 },
   { "Angle Restr. Z",                 164 },
@@ -300,14 +301,14 @@ char *nrnb_str(int enr)
   return nbdata[enr].name;
 }
 
-static int    force_index[]={ 
+static const int    force_index[]={ 
   eNR_BONDS,  eNR_ANGLES,  eNR_PROPER, eNR_IMPROPER, 
   eNR_RB,     eNR_DISRES,  eNR_ORIRES, eNR_POSRES,
   eNR_NS,     eNR_INL_IATOM
 };
 #define NFORCE_INDEX asize(force_index)
 
-static int    shake_index[]={ 
+static const int    shake_index[]={ 
   eNR_SHAKE,     eNR_SHAKE_RIJ, eNR_SETTLE,       eNR_UPDATE,       eNR_PCOUPL,
   eNR_SHAKE_VIR, eNR_SHAKE_V,   eNR_PSHAKEINITLD, eNR_PSHAKEINITMD, eNR_PSHAKE
 };
index 25c26eed945ebfb5f94ab5f002dbbcd88d711eb1..a0a1b02ef5d7d112f788510a024dcc4956eef14a 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_orires_c = "$Id$";
+
 #include "typedefs.h"
 #include "smalloc.h"
 #include "vec.h"
@@ -216,7 +216,7 @@ real calc_orires_dev(t_commrec *mcr,
   rvec         *xref,*xtmp,com,r_unrot,r;
   t_oriresdata *od;
   bool         bTAV;
-  static real  two_thr=2.0/3.0;
+  const real  two_thr=2.0/3.0;
 
   od = &(fcd->orires);
 
index efa734e5976a7baedcb1043ead912b390bcd4adf..a98c8b4fc0358350e482bad71793c89677427802 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_pargs_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
@@ -218,11 +220,14 @@ char *opt2parg_enum(char *option,int nparg,t_pargs pa[])
   return NULL;
 }
 
-char *pa_val(t_pargs *pa)
+char *pa_val(t_pargs *pa, char buf[], int sz)
 {
-  static char buf[256];
   
   buf[0]='\0';
+
+  if(sz<255)
+    fatal_error(0,"Buffer must be at least 255 chars\n");
+  
   switch(pa->type) {
   case etINT:
     sprintf(buf,"%d",*(pa->u.i));
@@ -236,7 +241,7 @@ char *pa_val(t_pargs *pa)
     break;
   case etSTR:
     if (*(pa->u.c)) {
-      if (strlen(*(pa->u.c)) >= 256)
+      if (strlen(*(pa->u.c)) >= sz)
        fatal_error(0,"Argument too long: \"%d\"\n",*(pa->u.c));
       else
        strcpy(buf,*(pa->u.c));
@@ -255,7 +260,7 @@ char *pa_val(t_pargs *pa)
 void print_pargs(FILE *fp, int npargs,t_pargs pa[])
 {
   bool bShowHidden;
-  char buf[32],buf2[256];
+  char buf[32],buf2[256],tmp[256];
   char *wdesc;
   int  i;
   
@@ -281,14 +286,14 @@ void print_pargs(FILE *fp, int npargs,t_pargs pa[])
        if (strlen(buf)>((OPTLEN+TYPELEN)-max(strlen(argtp[pa[i].type]),4))) {
          fprintf(fp,"%12s\n",buf);
          sprintf(buf2,"%12s %6s %6s  %s\n",
-               "",argtp[pa[i].type],pa_val(&(pa[i])),check_tty(pa[i].desc));
+               "",argtp[pa[i].type],pa_val(&(pa[i]),tmp,255),check_tty(pa[i].desc));
        } else if (strlen(buf)>OPTLEN) {
          /* so type can be 4 or 5 char's (max(...,4)), this fits in the %5s */
          sprintf(buf2,"%-14s%5s %6s  %s\n",
-                 buf,argtp[pa[i].type],pa_val(&(pa[i])),check_tty(pa[i].desc));
+                 buf,argtp[pa[i].type],pa_val(&(pa[i]),tmp,255),check_tty(pa[i].desc));
        } else
          sprintf(buf2,"%12s %6s %6s  %s\n",
-               buf,argtp[pa[i].type],pa_val(&(pa[i])),check_tty(pa[i].desc));
+               buf,argtp[pa[i].type],pa_val(&(pa[i]),tmp,255),check_tty(pa[i].desc));
        wdesc=wrap_lines(buf2,80,28);
        fprintf(fp,wdesc);
        sfree(wdesc);
index aea677178cba250b90dcca6aaf19f9c44a94a81a..e7268bfb80937c85d956ab30657a0c8893e04a8c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_pbc_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "typedefs.h"
index b2facc6569716bfac5aeb4f4b6312d18e838373f..805e94031431b70baabf151705b53082cff92691 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_pdbio_c = "$Id$";
+
 #include "sysstuff.h"
 #include "string2.h"
 #include "vec.h"
@@ -44,7 +44,7 @@ static char *SRCID_pdbio_c = "$Id$";
 #include "physics.h"
 #include "pbc.h"
        
-static char *pdbtp[epdbNR]={
+static const char *pdbtp[epdbNR]={
   "ATOM  ","HETATM", "ANISOU", "CRYST1",
   "COMPND", "MODEL", "ENDMDL", "TER", "HEADER", "TITLE", "REMARK" 
 };
@@ -83,14 +83,14 @@ void write_pdbfile_indexed(FILE *out,char *title,
                           t_atoms *atoms,rvec x[],matrix box,char chain,
                           int model_nr, atom_id nindex, atom_id index[])
 {
-  char resnm[6],nm[6],ch,pdbform[128];
+  char resnm[6],nm[6],ch,pdbform[128],pukestring[100];
   atom_id i,ii;
   int  resnr,type;
   real occup,bfac;
   real alpha,beta,gamma;
   bool bOccup;
 
-  fprintf(out,"HEADER    %s\n",(title && title[0])?title:bromacs());
+  fprintf(out,"HEADER    %s\n",(title && title[0])?title:bromacs(pukestring,99));
   if (bWideFormat) {
     fprintf(out,"REMARK    This file does not adhere to the PDB standard\n");
     fprintf(out,"REMARK    As a result of, some programs may not like it\n");
index a5fd167dc2da25b703b58b4c259a337f2d2ea0fd..db42899a8799813ace5abd5ffc53f49568c7254f 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_princ_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include "typedefs.h"
 #include "vec.h"
 #include "smalloc.h"
index c3ee90669e46fd883b6aade6b5ea3b955a643a63..48be152a2c48e6d8223f70fd543f14b61351077d 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_rando_c = "$Id$";
+
 #include <time.h>
 #include "sysstuff.h"
 #include "typedefs.h"
index 4b49f2079b849ef6615c2808a0a22a406bcb0817..e47be4bf13148de9e1b928e520e75179bdcb1a92 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_random_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "smalloc.h"
@@ -38,57 +38,111 @@ static char *SRCID_random_c = "$Id$";
 #include "vec.h"
 #include "random.h"
 
-real gauss (real am, real sd, int *ig)
-     /* we use the boxmuller method  to calculate the gaussian.    */
-     /* this method calculates two gaussians at a time, one of     */
-     /* which is stored in glgset until the next call to gauss.    */
-     /* see: numerical recipes p.716                               */
+#define GAUSS_NXP 16
+/* The size of the data area is 2^GAUSS_NXP */
+
+struct t_gaussdata {
+  real  *x;      /* Pointer to the work area */
+  int   seed;    /* The random seed */
+  int   uselast; /* Is there a saved number we can use? */
+  real  last;    /* The possibly saved number */
+};
+
+
+/* Initialize (and warm up) a gaussian random number generator
+ * by copying the seed. The routine returns a handle to the
+ * new generator.
+ */
+t_Gaussdata 
+init_gauss(int seed)
 {
-  /* use our own gaussian, or modified boxmuller's ? */
-#define STRAND
-
-#ifdef STRAND
-  real a;
-  int  i;
-#else
-  static bool gliset=FALSE;
-  static real glgset;
-  real fac,r,v1,v2;
-#endif
-  real gval;
-
-#ifdef STRAND
-  a = 0;
-  for (i=0; (i<12); i++)
-    a = a + rando (ig);
-  gval = (a-6.0)*sd+am;
-#else
-  if (!gliset) {
+  int size = (1 << GAUSS_NXP);
+  int nwarmup = GAUSS_NXP*(size-1);
+  int k;
+  real tmp;
+  t_Gaussdata gaussdata;
+  gaussdata=(t_Gaussdata)malloc(sizeof(struct t_gaussdata));
+  gaussdata->x=(real *)malloc(size*sizeof(real));
+  gaussdata->seed    = seed;
+  gaussdata->last    = 0;
+  gaussdata->uselast = 0;
+  
+  for(k=0;k<size;k++)
+    gaussdata->x[k]=1;
+
+  for(k=0;k<nwarmup;k++)
+    tmp=gauss(gaussdata);
+
+  return gaussdata;
+}
+
+
+
+/* Return a new gaussian random number with expectation value
+ * 0.0 and standard deviation 1.0. This routine is NOT thread-safe
+ * for performance reasons - you will either have to do the locking
+ * yourself, or better: initialize one generator per thread.
+ */
+real 
+gauss(t_Gaussdata gaussdata)
+{
+  int i,n1=0,n2;
+  int intt;
+  int mo;
+  int j1;
+  int isgn;
+  int ne = 31-GAUSS_NXP;
+
+  if(gaussdata->uselast) {
+    gaussdata->uselast=0;
+    return gaussdata->last;
+  } else {
     do {
-      v1 = 2.0*rando(ig)-1.0;
-      v2 = 2.0*rando(ig)-1.0;
-      r = v1*v1 + v2*v2;
-    } while (r >= 1.0);
-    fac = sqrt (-2*log(r)/r);
-    glgset = v1*fac;
-    gval = v2*fac;
+      for (i=0;i<2;i++) {
+       intt=(gaussdata->seed)/127773;
+       mo=(gaussdata->seed)-intt*127773;
+       j1=2836*intt;
+       (gaussdata->seed)=16807*mo-j1;
+       if(gaussdata->seed<0)
+         gaussdata->seed+=2147483647;
+       if(i==0)
+         n1 = gaussdata->seed >> ne;
+      }
+      n2 = gaussdata->seed >> ne;
+    } while (n1==n2);
+    
+    isgn=2*(gaussdata->seed & 1)-1;
+
+    gaussdata->x[n1]=isgn*(0.7071067811865475*(gaussdata->x[n1]+gaussdata->x[n2]));
+    gaussdata->x[n2]=-gaussdata->x[n1]+isgn*1.414213562373095*gaussdata->x[n2];
+    gaussdata->last = gaussdata->x[n2];
+    gaussdata->uselast = 1;
+    return gaussdata->x[n1];
   }
-  else 
-    gval = glgset; /* use the spare gaussian  */
-  gliset=!gliset;  /* set the spare indicator */
-#endif
+}
 
-  return gval;
+
+
+/* Release all the resources used for the generator */
+void 
+finish_gauss(t_Gaussdata data)
+{
+  free(data->x);
+  free(data);
+  data=NULL;
+  
+  return;
 }
 
-void low_mspeed(real tempi,int nrdf,int seed,int nat,atom_id a[],
-               t_atoms *atoms,rvec v[])
+
+
+void low_mspeed(real tempi,int nrdf,int nat,atom_id a[],
+               t_atoms *atoms,rvec v[], t_Gaussdata gaussdata)
 {
-  int  i,j,m,ig;
+  int  i,j,m;
   real boltz,sd;
   real ekin,temp,mass,scal;
 
-  ig=seed;
   boltz=BOLTZ*tempi;
   ekin=0.0;
   for (i=0; (i<nat); i++) {
@@ -97,7 +151,7 @@ void low_mspeed(real tempi,int nrdf,int seed,int nat,atom_id a[],
     if (mass > 0) {
       sd=sqrt(boltz/mass);
       for (m=0; (m<DIM); m++) {
-       v[j][m]=gauss(0.0,sd,&ig);
+       v[j][m]=sd*gauss(gaussdata);
        ekin+=0.5*mass*v[j][m]*v[j][m];
       }
     }
@@ -123,27 +177,43 @@ void grp_maxwell(t_block *grp,real tempi[],int nrdf[],int seed,
                 t_atoms *atoms,rvec v[])
 {
   int i,s,n;
+  t_Gaussdata gaussdata;
+  bool bFirst=TRUE;
+
+  if(bFirst) {
+    bFirst=FALSE;
+    gaussdata = init_gauss(seed);
+  }
 
   for(i=0; (i<grp->nr); i++) {
     s=grp->index[i];
     n=grp->index[i+1]-s;
-    low_mspeed(tempi[i],nrdf[i],seed,n,&(grp->a[s]),atoms,v);
+    low_mspeed(tempi[i],nrdf[i],n,&(grp->a[s]),atoms,v,gaussdata);
   }
 }
 
+
 void maxwell_speed(real tempi,int nrdf,int seed,t_atoms *atoms, rvec v[])
 {
   atom_id *dummy;
   int     i;
+  t_Gaussdata gaussdata;
+  bool bFirst=TRUE;
   
   if (seed == -1) {
     seed = make_seed();
     fprintf(stderr,"Using random seed %d for generating velocities\n",seed);
   }
+
+  if(bFirst) {
+    bFirst=FALSE;
+    gaussdata = init_gauss(seed);
+  }
+
   snew(dummy,atoms->nr);
   for(i=0; (i<atoms->nr); i++)
     dummy[i]=i;
-  low_mspeed(tempi,nrdf,seed,atoms->nr,dummy,atoms,v);
+  low_mspeed(tempi,nrdf,atoms->nr,dummy,atoms,v,gaussdata);
   sfree(dummy);
 }
 
index 1ff4195487eb289344828164cbfe28082e8aa5cb..65bbe6eb3260a18bbc7828631be0884776abab6b 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_rbin_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include "typedefs.h"
 #include "main.h"
 #include "network.h"
index b78a1f8d68ff4260fccd60e2751673fd825bb04b..91247c1ab8feced16f99a9b0a255ae7120e32be1 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_rdgroup_c = "$Id$";
+
 #include "sysstuff.h"
 #include "smalloc.h"
 #include "typedefs.h"
index 17ba5f2161b51679a39d61c5c4bac4c763597017..e1e3da533c498adc7b1b6c114ef23a1ebbcd266b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_readinp_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include "typedefs.h"
@@ -140,9 +140,12 @@ void write_inpfile(char *fn,int ninp,t_inpfile inp[])
   out=ffopen(fn,"w");
   nice_header(out,fn);
   for(i=0; (i<ninp); i++) {
-    if (inp[i].bSet)
-      fprintf(out,"%-24s = %s\n",inp[i].name,inp[i].value ? inp[i].value : "");
-    else {
+    if (inp[i].bSet) {
+      if(inp[i].name[0]==';' || (strlen(inp[i].name)>2 && inp[i].name[1]==';'))
+       fprintf(out,"%-24s\n",inp[i].name);
+      else
+       fprintf(out,"%-24s = %s\n",inp[i].name,inp[i].value ? inp[i].value : "");
+     } else {
       sprintf(warn_buf,"Unknown left-hand %s in parameter file\n",
              inp[i].name);
       warning(NULL);
@@ -151,7 +154,7 @@ void write_inpfile(char *fn,int ninp,t_inpfile inp[])
   fclose(out);
 }
 
-static int get_einp(int *ninp,t_inpfile **inp,char *name)
+static int get_einp(int *ninp,t_inpfile **inp,const char *name)
 {
   int    i;
   
@@ -177,7 +180,7 @@ static int get_einp(int *ninp,t_inpfile **inp,char *name)
     return i;
 }
 
-int get_eint(int *ninp,t_inpfile **inp,char *name,int def)
+int get_eint(int *ninp,t_inpfile **inp,const char *name,int def)
 {
   char buf[32];
   int  ii;
@@ -194,7 +197,7 @@ int get_eint(int *ninp,t_inpfile **inp,char *name,int def)
     return atoi((*inp)[ii].value);
 }
 
-real get_ereal(int *ninp,t_inpfile **inp,char *name,real def)
+real get_ereal(int *ninp,t_inpfile **inp,const char *name,real def)
 {
   char buf[32];
   int  ii;
@@ -211,7 +214,7 @@ real get_ereal(int *ninp,t_inpfile **inp,char *name,real def)
     return atof((*inp)[ii].value);
 }
 
-char *get_estr(int *ninp,t_inpfile **inp,char *name,char *def)
+char *get_estr(int *ninp,t_inpfile **inp,const char *name,char *def)
 {
   char buf[32];
   int  ii;
@@ -232,7 +235,7 @@ char *get_estr(int *ninp,t_inpfile **inp,char *name,char *def)
     return (*inp)[ii].value;
 }
 
-int get_eeenum(int *ninp,t_inpfile **inp,char *name,char **defs,
+int get_eeenum(int *ninp,t_inpfile **inp,const char *name,const char **defs,
               int *nerror,bool bPrintError)
 {
   int  ii,i,j;
@@ -268,7 +271,7 @@ int get_eeenum(int *ninp,t_inpfile **inp,char *name,char **defs,
   return i;
 }
 
-int get_eenum(int *ninp,t_inpfile **inp,char *name,char **defs)
+int get_eenum(int *ninp,t_inpfile **inp,const char *name,const char **defs)
 {
   int dum=0;
 
index 76e3a184760c61c3ece54724844f5071dfb924a8..ca404b493573e513bd20d7aad95dc9321afd3345 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_repfirst_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
 #include "string2.h"
 #include "typedefs.h"
 #include "smalloc.h"
index b8637260d8c8f51e9bbe751d3213a6c7aa8f96e0..c845e3eaec4d20c216eaffad14a32cf79a26b3fa 100644 (file)
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_replace_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <ctype.h>
 #include "string2.h"
 #include "smalloc.h"
 #include "macros.h"
 #include "replace.h"
 
-char *replace(char *string,char *search,char *replace)
+char *replace(const char *string,const char *search,const char *replace)
 {
   char *buf=NULL,*ptr=NULL,*bufptr=NULL;
   int  blen,stringlen,slen,rlen;
@@ -80,7 +82,7 @@ char *replace(char *string,char *search,char *replace)
   return buf;
 }
 
-char *replaceww(char *string,char *search,char *replace)
+char *replaceww(char *string,const char *search,const char *replace)
 {
   char *buf=NULL,*ptr=NULL,*bufptr=NULL;
   int  buflen,stringlen,searchlen,replacelen;
index 2f873978fc5d31c4853fe0732eb39360e63be1e8..4fe380898f427dc8f9035e506c7ff54aac0394c8 100644 (file)
 #ifndef _replace_h
 #define _replace_h
 
-static char *SRCID_replace_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) replace.h 1.16 10/14/97"
-#endif /* HAVE_IDENT */
-extern char *replace(char *string,char *search,char *replace);
+extern char *replace(const char *string,const char *search,const char *replace);
 /* Replace all occurences of 
  * string 'search' in string 'string' by 'replace' 
  */
 
-extern char *replaceww(char *string,char *search,char *replace);
+extern char *replaceww(char *string,const char *search,const char *replace);
 /* Replace all occurences of string 'search' delimited by non-alphanum
  * characters (i.e. whole words) in string 'string' by 'replace' 
  */
index 431da78c8bb6e30fae3ef6b94eb8bd3caa8668f8..f47aeabed2e91497fe7be88b044edd0b45d68fc0 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_rmpbc_c = "$Id$";
+
 #include "sysstuff.h"
 #include "typedefs.h"
 #include "smalloc.h"
index b7219d56042a221ad9fa6836a54959656dfa7227..f5a28cfb26cb997d63fd85160c6c2536216a4b84 100644 (file)
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_sheader_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <string.h>
 #include "sheader.h"
 #include "txtdump.h"
 #include "tpxio.h"
 
-static char *version="@(#) sheader.c 1.5 12/16/92";
+
 
 void pr_header(FILE *fp,int indent,char *title,t_tpxheader *sh)
 {
index 3695d377d4577ca0f9aea48b6132196b95a651c4..ea4c2e44edc8012e75fe39eb92d7a9ab7ba2cd03 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_shift_util_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "typedefs.h"
@@ -462,7 +462,7 @@ static real rgbset(real col)
 
 void plot_phi(char *fn,rvec box,int natoms,rvec x[],real phi[])
 {
-  FILE *eps;
+  t_psdata eps;
   real phi_max,rr,gg,bb,fac,dx,x0,y0;
   real offset;
   int  i;
index 056301f0f16a7980d4a964c0a83c90f8af961293..2feef745829ede034b8038dea75e50dc2e73d554 100644 (file)
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_smalloc_c = "$Id$";
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* This file is completely threadsafe - keep it that way! */
+#ifdef USE_THREADS
+#include <pthread.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -48,6 +57,12 @@ static void log_action(int bMal,char *what,char *file,int line,
   bytes=size*nelem;
   if (!bMal)
     bytes=-bytes;
+  
+#ifdef USE_THREADS
+  pthread_mutex_lock(&gmx_logfile_mtx);
+#endif
+
+  /* This static variable is protected by the mutex too... */
   btot+=bytes;
     
   bytes/=1024;
@@ -55,6 +70,9 @@ static void log_action(int bMal,char *what,char *file,int line,
     fprintf(stdlog,"%30s:%6d kb (%7d kb) [%s, line %d, nelem %d, size %d]\n",
            what ? what : NN,bytes,btot/1024,
            file ? file : NN,line,nelem,size);
+#ifdef USE_THREADS
+  pthread_mutex_unlock(&gmx_logfile_mtx);
+#endif
 }
 #endif
 
@@ -122,7 +140,7 @@ void *save_realloc(char *name,char *file,int line,void *ptr,unsigned size)
   return p;
 }
 
-void save_free(char *name,char *file,int line,void *ptr)
+void save_free(char *name,char *file,int line,const void *ptr)
 {
 #ifdef DEBUG
   log_action(0,name,file,line,0,0,ptr);
index 4ce363a00e4135db83187209bd84f7b16e292f70..103076537c051c487aa7a7f15ba20b486a7953db 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_sortwater_c = "$Id$";
+
 #include "typedefs.h"
 #include "random.h"
 #include "smalloc.h"
index 48e832a83c35f0edf6a92f6e9db2ccdf0d06088d..9204d61c4a5becd66f1c47e049ffad7edf4c151d 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_stat_c = "$Id$";
+
 #include <string.h>
 #include <stdio.h>
 #include "typedefs.h"
index 042a298477130c9f6b84618dfecc6f2d925936f3..703728cf5a1f1947762d99ef6f5088b3581d937d 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_statutil_c = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index ae35089e992aa04e1494738d22eef2fbf7490d9b..5b23052da35ff5051668035631bc357ada28010b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_strdb_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include "string2.h"
@@ -40,14 +40,11 @@ static char *SRCID_strdb_c = "$Id$";
 
 bool get_a_line(FILE *fp,char line[],int n)
 {
-  static char *line0=NULL;
-  static int nalloc=0;
+  char *line0;
   char *dum;
   
-  if (n>nalloc) {
-    nalloc=n;
-    srenew(line0,nalloc+1);
-  }
+  snew(line0,n+1);
   do {
     if (!fgets(line0,n+1,fp)) {
       return FALSE;
@@ -64,11 +61,12 @@ bool get_a_line(FILE *fp,char line[],int n)
     dum=strchr(line0,';');
     if (dum) 
       dum[0]='\0';
-    strcpy(line,line0);
+    strncpy(line,line0,n);
     dum=line0;
     ltrim(dum);
   } while (dum[0] == '\0'); 
-
+  
+  sfree(line0);
   return TRUE;
 }
 
index 5555b3c8a14b812d62880edaab662a05aea93f61..4f37603a9de2636a1aa3d34c3fb0c27df84de47f 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_string2_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -230,7 +232,7 @@ char *gmx_strdup(const char *src)
   return dest;
 }
 
-char *wrap_lines(char *buf,int line_width, int indent)
+char *wrap_lines(const char *buf,int line_width, int indent)
 {
   char *b2;
   int i,i0,i2,j,b2len,lspace=0,l2space=0;
index 66a5748fbceb6bdfac68902ad5614b1f91f6e436..897ee4734f0a7ad48006df6280d32cd35117c7fb 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_symtab_c = "$Id$";
+
 #include <stdio.h>
 #include <string.h>
 #include "sysstuff.h"
@@ -45,22 +45,24 @@ static char *SRCID_symtab_c = "$Id$";
 #define        BUFSIZE                 1024
 #define        TABLESIZE               5
 
-static char *trim_string(char *s)
+static char *trim_string(char *s,char *out, int maxlen)
      /*
       * Returns a pointer to a static area which contains a copy 
       * of s without leading or trailing spaces. Strings are
       * truncated to BUFSIZE positions.
       */      
 {
-  static char buf[BUFSIZE];
   int len,i;
+  if(strlen(s)>maxlen-1)
+    fatal_error(0,"Character buffer size too small\n");
   
   for (; (*s)&&((*s)==' '); s++);
   for (len=strlen(s); (len>0); len--) if (s[len-1]!=' ') break;
   if (len>=BUFSIZE) len=BUFSIZE-1;
-  for (i=0; i<len; i++) buf[i]=*(s++);
-  buf[i]=0;
-  return buf;
+  for (i=0; i<len; i++) out[i]=*(s++);
+  out[i]=0;
+  return out;
 }
 
 int lookup_symtab(t_symtab *symtab,char **name)
@@ -148,9 +150,11 @@ static char **enter_buf(t_symtab *symtab,char *name)
   return &(symbuf->buf[0]);
 }
 
-char **put_symtab(t_symtab *symtab,char *name)
+char **put_symtab(t_symtab *symtab,const char *name)
 {
-  return enter_buf(symtab,trim_string(name));
+  char buf[256];
+  
+  return enter_buf(symtab,trim_string(name,buf,255));
 }
 
 void open_symtab(t_symtab *symtab)
index 2f4d2527f8f1bcd2ea9d62934dcdffa17fe45f1e..b788a95db2cd46bb1c6937a7b5fdaa2317bfbfaf 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_testfft_c = "$Id$";
+
 #include <math.h>
 #include <stdio.h>
 #include "typedefs.h"
index 7a044f12984b4f6bbf682bed2efc39842bfbe80a..2596f37e8d1084a217d71827e4c4ec53f856e215 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_testlr_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "typedefs.h"
@@ -274,7 +274,7 @@ int main(int argc,char *argv[])
   
 
   /* Read topology and coordinates */
-  read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&stath);
+  read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&stath,FALSE);
   snew(x,stath.natoms);
   snew(f_sr,stath.natoms);
   snew(f_excl,stath.natoms);
index 37c9d2a71d6c7d5b6fd4b349262b514af90a2720..5726369df22a879df9d5ceb96447f8737b7ce221 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_testtab_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
 #include <stdio.h>
 #include "typedefs.h"
 #include "force.h"
index 0115f84143bfd8cefb5cc5b9b442e0dcdb0407c0..7b98bfa3b5136cee84a517562aa22aaaa5fbe0e0 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_testxml_c = "$Id$";
+
 #include "macros.h"
 #include "smalloc.h"
 #include "xmlio.h"
@@ -61,7 +61,7 @@ int main(int argc,char *argv[])
   else {
     t_tpxheader tpx;
     
-    read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&tpx);
+    read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&tpx,FALSE);
     snew(x,tpx.natoms);
     snew(v,tpx.natoms);
     f = NULL;
index 8f0a07db2793f2c503ec023c4c94b7d519765921..4b4a4102cbc6f7997506a86c1f802d3c67693e49 100644 (file)
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_threadsync_c = "$Id$";
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* This file is completely threadsafe - keep it that way! */
+#ifdef USE_THREADS
+#include <pthread.h>
+#endif
+
+
 /* Since most fortran compilers dont support threads started
  * in a calling c program we call these wrapper syncronization
  * routines from the fortran innerloops
@@ -39,11 +49,15 @@ void FUNCTION(inlsync)(int *nri,int *nthreads,int *count,int *ii0,
                       int *ii1, pthread_mutex_t *mtx)
 {
   int t0,t1;
+#ifdef USE_THREADS
   pthread_mutex_lock(mtx);
+#endif
   t0=*count;
   t1=t0+(*nri-t0)/nthreads+1;
   *count=t1;
+#ifdef USE_THREADS
   pthread_mutex_unlock(mtx);
+#endif
   *ii0=t0;
   *ii1=t1;
 }
index 56cd4db6a11e0681b4c2307bfe230c20b6a8f3f9..e7f21092e8f0d37921c3f224639b26838254e7de 100644 (file)
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_tpxio_c = "$Id$";
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* This file is completely threadsafe - keep it that way! */
+#ifdef USE_THREADS
+#include <pthread.h>
+#endif
+
 #include <ctype.h>
 #include "sysstuff.h"
 #include "smalloc.h"
@@ -53,11 +61,25 @@ static char *SRCID_tpxio_c = "$Id$";
 #endif
 
 /* This number should be increased whenever the file format changes! */
-static int tpx_version = 25;
-/* This number should be the most recent incompatible version */
-static int tpx_incompatible_version = 9;
-/* This is the version of the file we are reading */
-static int file_version = 0;
+static const int tpx_version = 26;
+
+/* This number should only be increased when you edit the TOPOLOGY section
+ * of the tpx format. This way we can maintain forward compatibility too
+ * for all analysis tools and/or external programs that only need to
+ * know the atom/residue names, charges, and bond connectivity.
+ *  
+ * It first appeared in tpx version 26, when I also moved the inputrecord
+ * to the end of the tpx file, so we can just skip it if we only
+ * want the topology.
+ */
+static const int tpx_generation = 1;
+
+/* This number should be the most recent backwards incompatible version 
+ * I.e., if this number is 9, we cannot read tpx version 9 with this code.
+ */
+static const int tpx_incompatible_version = 9;
+
+
 
 /* Struct used to maintain tpx compatibility when function types are added */
 typedef struct {
@@ -70,14 +92,18 @@ typedef struct {
  * 1. ascending file version number
  * 2. ascending function type number
  */
-t_ftupd ftupd[] = {
-  { 20, F_CUBICBONDS },
-  { 20, F_CONNBONDS  },
-  { 20, F_HARMONIC   },
-  { 20, F_EQM,       },
-  { 22, F_DISRESVIOL },
-  { 22, F_ORIRES     },
-  { 22, F_ORIRESDEV  }
+static const t_ftupd ftupd[] = {
+  { 20, F_CUBICBONDS   },
+  { 20, F_CONNBONDS    },
+  { 20, F_HARMONIC     },
+  { 20, F_EQM,         },
+  { 22, F_DISRESVIOL   },
+  { 22, F_ORIRES       },
+  { 22, F_ORIRESDEV    },
+  { 26, F_FOURDIHS     },
+  { 26, F_PIDIHS       },
+  { 26, F_DIHRES       },
+  { 26, F_DIHRESVIOL   }
 };
 #define NFTUPD asize(ftupd)
 
@@ -118,13 +144,15 @@ void _do_section(int fp,int key,bool bRead,char *src,int line)
  * Now the higer level routines that do io of the structures and arrays
  *
  **************************************************************/
-static void do_inputrec(t_inputrec *ir,bool bRead)
+static void do_inputrec(t_inputrec *ir,bool bRead, int file_version)
 {
-  int  i,j,*tmp,idum=0; 
+  int  i,j,k,*tmp,idum=0; 
   bool bDum=TRUE;
   real rdum;
   rvec vdum;
-
+  bool bSimAnn;
+  real zerotemptime,finish_t,init_temp,finish_temp;
+  
   if (file_version != tpx_version) {
     /* Give a warning about features that are not accessible */
     fprintf(stderr,"Note: tpx file_version %d, software version %d\n",
@@ -135,6 +163,11 @@ static void do_inputrec(t_inputrec *ir,bool bRead)
     /* Basic inputrec stuff */  
     do_int(ir->eI); 
     do_int(ir->nsteps); 
+    if(file_version > 25)
+      do_int(ir->init_step);
+    else
+      ir->init_step=0;
+
     do_int(ir->ePBC);
     if (file_version <= 15 && ir->ePBC == 2)
       ir->ePBC = epbcNONE;
@@ -144,6 +177,12 @@ static void do_inputrec(t_inputrec *ir,bool bRead)
     do_int(ir->bDomDecomp);
     do_int(ir->decomp_dir);
     do_int(ir->nstcomm); 
+
+    if(file_version > 25)
+      do_int(ir->nstcheckpoint);
+    else
+      ir->nstcheckpoint=0;
+    
     do_int(ir->nstcgsteep); 
     do_int(ir->nstlog); 
     do_int(ir->nstxout); 
@@ -169,6 +208,21 @@ static void do_inputrec(t_inputrec *ir,bool bRead)
     do_real(ir->rvdw); 
     do_int(ir->eDispCorr); 
     do_real(ir->epsilon_r);
+
+    if(file_version > 25) {
+      do_int(ir->gb_algorithm);
+      do_int(ir->nstgbradii);
+      do_real(ir->rgbradii);
+      do_real(ir->gb_saltconc);
+      do_int(ir->implicit_solvent);
+    } else {
+      ir->gb_algorithm=egbSTILL;
+      ir->nstgbradii=0;
+      ir->rgbradii=0;
+      ir->gb_saltconc=0;
+      ir->implicit_solvent=eisNO;
+    }
+
     do_int(ir->nkx); 
     do_int(ir->nky); 
     do_int(ir->nkz);
@@ -239,9 +293,18 @@ static void do_inputrec(t_inputrec *ir,bool bRead)
       do_rvec(ir->compress[YY]);
       do_rvec(ir->compress[ZZ]);
     }
-    do_int(ir->bSimAnn); 
-    do_real(ir->zero_temp_time); 
+    if(file_version > 25)
+      do_int(ir->andersen_seed);
+    else
+      ir->andersen_seed=0;
+    
+    if(file_version < 26) {
+      do_int(bSimAnn); 
+      do_real(zerotemptime);
+    }
+    
     do_real(ir->epsilon_r); 
+
     do_real(ir->shake_tol);
     do_real(ir->fudgeQQ);
     do_int(ir->efep);
@@ -277,6 +340,16 @@ static void do_inputrec(t_inputrec *ir,bool bRead)
       ir->orires_tau = 0;
       ir->nstorireout = 0;
     }
+    if(file_version >=26) {
+      do_real(ir->dihre_fc);
+      do_real(ir->dihre_tau);
+      do_int(ir->nstdihreout);
+    } else {
+      ir->dihre_fc=0;
+      ir->dihre_tau=0;
+      ir->nstdihreout=0;
+    }
+
     do_real(ir->em_stepsize); 
     do_real(ir->em_tol); 
     if (file_version >= 22) 
@@ -299,6 +372,8 @@ static void do_inputrec(t_inputrec *ir,bool bRead)
     do_real(ir->LincsWarnAngle);
     if (file_version <= 14)
       do_int(idum);
+    if (file_version >=26)
+      do_int(ir->nLincsIter);
     do_real(ir->bd_temp);
     do_real(ir->bd_fric);
     do_int(ir->ld_seed);
@@ -319,10 +394,15 @@ static void do_inputrec(t_inputrec *ir,bool bRead)
     do_int(ir->opts.ngtc); 
     do_int(ir->opts.ngacc); 
     do_int(ir->opts.ngfrz); 
-    do_int(ir->opts.ngener); 
+    do_int(ir->opts.ngener);
+
     if (bRead) {
       snew(ir->opts.nrdf,   ir->opts.ngtc); 
       snew(ir->opts.ref_t,  ir->opts.ngtc); 
+      snew(ir->opts.annealing, ir->opts.ngtc); 
+      snew(ir->opts.anneal_npoints, ir->opts.ngtc); 
+      snew(ir->opts.anneal_time, ir->opts.ngtc); 
+      snew(ir->opts.anneal_temp, ir->opts.ngtc); 
       snew(ir->opts.tau_t,  ir->opts.ngtc); 
       snew(ir->opts.nFreeze,ir->opts.ngfrz); 
       snew(ir->opts.acc,    ir->opts.ngacc); 
@@ -348,6 +428,41 @@ static void do_inputrec(t_inputrec *ir,bool bRead)
     if (file_version >= 12)
       ndo_int(ir->opts.eg_excl,ir->opts.ngener*ir->opts.ngener,bDum);
 
+    if(bRead && file_version < 26) {
+      for(i=0;i<ir->opts.ngtc;i++) {
+       if(bSimAnn) {
+         ir->opts.annealing[i] = eannSINGLE;
+         ir->opts.anneal_npoints[i] = 2;
+         snew(ir->opts.anneal_time[i],2);
+         snew(ir->opts.anneal_temp[i],2);
+         /* calculate the starting/ending temperatures from reft, zerotemptime, and nsteps */
+         finish_t = ir->init_t + ir->nsteps * ir->delta_t;
+         init_temp = ir->opts.ref_t[i]*(1-ir->init_t/zerotemptime);
+         finish_temp = ir->opts.ref_t[i]*(1-finish_t/zerotemptime);
+         ir->opts.anneal_time[i][0] = ir->init_t;
+         ir->opts.anneal_time[i][1] = finish_t;
+         ir->opts.anneal_temp[i][0] = init_temp;
+         ir->opts.anneal_temp[i][1] = finish_temp;
+       } else {
+         ir->opts.annealing[i] = eannNO;
+         ir->opts.anneal_npoints[i] = 0;
+       }
+      }
+    } else {
+      /* file version 26 or later */
+      /* First read the lists with annealing and npoints for each group */
+      ndo_int(ir->opts.annealing,ir->opts.ngtc,bDum);
+      ndo_int(ir->opts.anneal_npoints,ir->opts.ngtc,bDum);
+      for(j=0;j<(ir->opts.ngtc);j++) {
+       k=ir->opts.anneal_npoints[j];
+       if(bRead) {
+         snew(ir->opts.anneal_time[j],k);
+         snew(ir->opts.anneal_temp[j],k);
+       }
+       ndo_real(ir->opts.anneal_time[j],k,bDum);
+       ndo_real(ir->opts.anneal_temp[j],k,bDum);
+      }
+    }             
     /* Cosine stuff for electric fields */
     for(j=0; (j<DIM); j++) {
       do_int  (ir->ex[j].n);
@@ -378,6 +493,7 @@ void do_iparams(t_functype ftype,t_iparams *iparams,bool bRead, int file_version
 {
   int i;
   bool bDum;
+  real VA[4],VB[4];
   
   if (!bRead)
     set_comment(interaction_function[ftype].name);
@@ -428,6 +544,7 @@ void do_iparams(t_functype ftype,t_iparams *iparams,bool bRead, int file_version
     do_real(iparams->lj14.c12B);
     break;
   case F_PDIHS:
+  case F_PIDIHS:
     do_real(iparams->pdihs.phiA);
     do_real(iparams->pdihs.cpA);
     do_real(iparams->pdihs.phiB);
@@ -450,6 +567,13 @@ void do_iparams(t_functype ftype,t_iparams *iparams,bool bRead, int file_version
     do_real(iparams->orires.obs);
     do_real(iparams->orires.kfac);
     break;
+  case F_DIHRES:
+    do_int (iparams->dihres.power);
+    do_int (iparams->dihres.label);
+    do_real(iparams->dihres.phi);
+    do_real(iparams->dihres.dphi);
+    do_real(iparams->dihres.kfac);
+    break;
   case F_POSRES:
     do_rvec(iparams->posres.pos0);
     do_rvec(iparams->posres.fc);
@@ -459,6 +583,13 @@ void do_iparams(t_functype ftype,t_iparams *iparams,bool bRead, int file_version
     if(file_version>=25) 
       ndo_real(iparams->rbdihs.rbcB,NR_RBDIHS,bDum);
     break;
+  case F_FOURDIHS:
+    /* Fourier dihedrals are internally represented
+     * as Ryckaert-Bellemans since those are faster to compute.
+     */
+    ndo_real(VA,NR_RBDIHS,bDum);
+    ndo_real(VB,NR_RBDIHS,bDum);
+    break;
   case F_SHAKE:
   case F_SHAKENC:
     do_real(iparams->shake.dA);
@@ -507,7 +638,7 @@ static void do_ilist(t_ilist *ilist,bool bRead,char *name)
     unset_comment();
 }
 
-static void do_idef(t_idef *idef,bool bRead)
+static void do_idef(t_idef *idef,bool bRead, int file_version)
 {
   int i,j,k;
   bool bDum=TRUE,bClear;
@@ -562,7 +693,7 @@ static void do_block(t_block *block,bool bRead)
   ndo_int(block->a,block->nra,bDum);
 }
 
-static void do_atom(t_atom *atom,int ngrp,bool bRead)
+static void do_atom(t_atom *atom,int ngrp,bool bRead, int file_version)
 {
   do_real (atom->m);
   do_real (atom->q);
@@ -579,7 +710,7 @@ static void do_atom(t_atom *atom,int ngrp,bool bRead)
   do_nuchar(atom->grpnr,ngrp);
 }
 
-static void do_grps(int ngrp,t_grps grps[],bool bRead)
+static void do_grps(int ngrp,t_grps grps[],bool bRead, int file_version)
 {
   int i,j;
   bool bDum=TRUE;
@@ -620,7 +751,7 @@ static void do_strstr(int nstr,char ***nm,bool bRead,t_symtab *symtab)
     do_symstr(&(nm[j]),bRead,symtab);
 }
 
-static void do_atoms(t_atoms *atoms,bool bRead,t_symtab *symtab)
+static void do_atoms(t_atoms *atoms,bool bRead,t_symtab *symtab, int file_version)
 {
   int i;
   
@@ -637,7 +768,7 @@ static void do_atoms(t_atoms *atoms,bool bRead,t_symtab *symtab)
     atoms->pdbinfo = NULL;
   }
   for(i=0; (i<atoms->nr); i++)
-    do_atom(&atoms->atom[i],egcNR,bRead);
+    do_atom(&atoms->atom[i],egcNR,bRead, file_version);
   do_strstr(atoms->nr,atoms->atomname,bRead,symtab);
   if (bRead && (file_version <= 20)) {
     for(i=0; i<atoms->nr; i++) {
@@ -651,11 +782,36 @@ static void do_atoms(t_atoms *atoms,bool bRead,t_symtab *symtab)
   do_strstr(atoms->nres,atoms->resname,bRead,symtab);
   do_strstr(atoms->ngrpname,atoms->grpname,bRead,symtab);
   
-  do_grps(egcNR,atoms->grps,bRead);
+  do_grps(egcNR,atoms->grps,bRead,file_version);
   
   do_block(&(atoms->excl),bRead);
 }
 
+static void do_atomtypes(t_atomtypes *atomtypes,bool bRead,t_symtab *symtab, int file_version)
+{
+  int i,j;
+  bool bDum = TRUE;
+  
+  if (file_version > 25) {
+    do_int(atomtypes->nr);
+    j=atomtypes->nr;
+    if(bRead) {
+      snew(atomtypes->radius,j);
+      snew(atomtypes->vol,j);
+      snew(atomtypes->surftens,j);
+    }
+    ndo_real(atomtypes->radius,j,bDum);
+    ndo_real(atomtypes->vol,j,bDum);
+    ndo_real(atomtypes->surftens,j,bDum);
+  } else {
+    /* File versions prior to 26 cannot do GBSA, so they dont use this structure */
+    atomtypes->nr = 0;
+    atomtypes->radius = NULL;
+    atomtypes->vol = NULL;
+    atomtypes->surftens = NULL;
+  }  
+}
+
 static void do_symtab(t_symtab *symtab,bool bRead)
 {
   int i,nr;
@@ -710,14 +866,15 @@ static void make_chain_identifiers(t_atoms *atoms,t_block *mols)
       atoms->atom[a].chain=' ';
 }
   
-static void do_top(t_topology *top,bool bRead)
+static void do_top(t_topology *top,bool bRead, int file_version)
 {
   int  i;
   
   do_symtab(&(top->symtab),bRead);
   do_symstr(&(top->name),bRead,&(top->symtab));
-  do_atoms (&(top->atoms),bRead,&(top->symtab));
-  do_idef  (&(top->idef),bRead);
+  do_atoms (&(top->atoms),bRead,&(top->symtab), file_version);
+  do_atomtypes (&(top->atomtypes),bRead,&(top->symtab), file_version);
+  do_idef  (&(top->idef),bRead,file_version);
   for(i=0; (i<ebNR); i++)
     do_block(&(top->blocks[i]),bRead);
   if (bRead) {
@@ -726,12 +883,22 @@ static void do_top(t_topology *top,bool bRead)
   }
 }
 
-static void do_tpxheader(int fp,bool bRead,t_tpxheader *tpx)
+/* If TopOnlyOK is TRUE then we can read even future versions
+ * of tpx files, provided the file_generation hasn't changed.
+ * If it is FALSE, we need the inputrecord too, and bail out
+ * if the file is newer than the program.
+ * 
+ * The version and generation if the topology (see top of this file)
+ * are returned in the two last arguments.
+ * 
+ * If possible, we will read the inputrec even when TopOnlyOK is TRUE.
+ */
+static void do_tpxheader(int fp,bool bRead,t_tpxheader *tpx, bool TopOnlyOK, int *file_version, int *file_generation)
 {
   char  buf[STRLEN];
   bool  bDouble;
   int   precision;
+  int   fver,fgen;
   fio_select(fp);
   fio_setdebug(fp,bDebugMode());
   
@@ -759,16 +926,29 @@ static void do_tpxheader(int fp,bool bRead,t_tpxheader *tpx)
     bDouble = (precision == sizeof(double));
     fio_setprecision(fp,bDouble);
     do_int(precision);
-    file_version = tpx_version;
+    fver = tpx_version;
   }
   
   /* Check versions! */
-  do_int(file_version);
-  if ((file_version <= tpx_incompatible_version) ||
-      (file_version > tpx_version))
+  do_int(fver);
+  
+  if(fver>=26)
+    do_int(fgen);
+  else
+    fgen=0;
+  if(file_version!=NULL)
+    *file_version = fver;
+  if(file_version!=NULL)
+    *file_generation = fgen;
+   
+  
+  if ((fver <= tpx_incompatible_version) ||
+      ((fver > tpx_version) && !TopOnlyOK) ||
+      (fgen > tpx_generation))
     fatal_error(0,"reading tpx file (%s) version %d with version %d program",
-               fio_getname(fp),file_version,tpx_version);
-    
+               fio_getname(fp),fver,tpx_version);
+  
   do_section(eitemHEADER,bRead);
   do_int (tpx->natoms);
   do_int (tpx->step);
@@ -780,6 +960,11 @@ static void do_tpxheader(int fp,bool bRead,t_tpxheader *tpx)
   do_int (tpx->bV);
   do_int (tpx->bF);
   do_int (tpx->bBox);
+
+  if((fgen > tpx_generation)) {
+    /* This can only happen if TopOnlyOK=TRUE */
+    tpx->bIr=FALSE;
+  }
 }
 
 static void do_tpx(int fp,bool bRead,int *step,real *t,real *lambda,
@@ -789,7 +974,9 @@ static void do_tpx(int fp,bool bRead,int *step,real *t,real *lambda,
   t_tpxheader tpx;
   t_inputrec  dum_ir;
   t_topology  dum_top;
-
+  bool        TopOnlyOK;
+  int         file_version,file_generation;
+  
   if (!bRead) {
     tpx.natoms = *natoms;
     tpx.step   = *step;
@@ -803,39 +990,48 @@ static void do_tpx(int fp,bool bRead,int *step,real *t,real *lambda,
     tpx.bBox = (box != NULL);
   }
   
-  do_tpxheader(fp,bRead,&tpx);
+  TopOnlyOK = (ir==NULL);
   
+  do_tpxheader(fp,bRead,&tpx,TopOnlyOK,&file_version,&file_generation);
+
   if (bRead) {
     *natoms = tpx.natoms;
     *step   = tpx.step;
     *t      = tpx.t;
     *lambda = tpx.lambda;
   }
-  
+
 #define do_test(b,p) if (bRead && (p!=NULL) && !b) fatal_error(0,"No %s in %s",#p,fio_getname(fp)) 
-  
+
   do_test(tpx.bBox,box);
   do_section(eitemBOX,bRead);
   if (tpx.bBox) ndo_rvec(box,DIM);
 
-  do_test(tpx.bIr,ir);
-  do_section(eitemIR,bRead);
-  if (tpx.bIr) {
-    if (ir)
-      do_inputrec(ir,bRead);
-    else {
-      init_inputrec(&dum_ir);
-      do_inputrec  (&dum_ir,bRead);
-      done_inputrec(&dum_ir);
+  /* Prior to tpx version 26, the inputrec was here.
+   * I moved it to enable partial forward-compatibility
+   * for analysis/viewer programs.
+   */
+  if(file_version<26) {
+    do_test(tpx.bIr,ir);
+    do_section(eitemIR,bRead);
+    if (tpx.bIr) {
+      if (ir)
+       do_inputrec(ir,bRead,file_version);
+      else {
+       init_inputrec(&dum_ir);
+       do_inputrec  (&dum_ir,bRead,file_version);
+       done_inputrec(&dum_ir);
+      }
     }
   }
+  
   do_test(tpx.bTop,top);
   do_section(eitemTOP,bRead);
   if (tpx.bTop) {
     if (top)
-      do_top(top,bRead);
+      do_top(top,bRead, file_version);
     else {
-      do_top(&dum_top,bRead);
+      do_top(&dum_top,bRead,file_version);
       done_top(&dum_top);
     }
   }
@@ -850,6 +1046,20 @@ static void do_tpx(int fp,bool bRead,int *step,real *t,real *lambda,
   do_test(tpx.bF,f);
   do_section(eitemF,bRead);
   if (tpx.bF) ndo_rvec(f,*natoms);
+
+  /* Starting with tpx version 26, we have the inputrec
+   * at the end of the file, so we can ignore it 
+   * if the file is never than the software (but still the
+   * same generation - see comments at the top of this file.
+   *
+   * 
+   */
+  if((file_version>=26) && (file_generation<=tpx_generation)) {
+    do_test(tpx.bIr,ir);
+    do_section(eitemIR,bRead);
+    if (tpx.bIr && ir)
+      do_inputrec(ir,bRead,file_version);
+  }
 }
 
 /************************************************************
@@ -868,7 +1078,7 @@ void close_tpx(int fp)
   fio_close(fp);
 }
 
-void read_tpxheader(char *fn,t_tpxheader *tpx)
+void read_tpxheader(char *fn,t_tpxheader *tpx, bool TopOnlyOK,int *file_version, int *file_generation)
 {
   int fp;
 
@@ -879,7 +1089,7 @@ void read_tpxheader(char *fn,t_tpxheader *tpx)
   else {
 #endif
     fp = open_tpx(fn,"r");
-    do_tpxheader(fp,TRUE,tpx);
+    do_tpxheader(fp,TRUE,tpx,TopOnlyOK,file_version,file_generation);
     close_tpx(fp);
 #ifdef HAVE_XML
   }
@@ -953,12 +1163,12 @@ bool read_tps_conf(char *infile,char *title,t_topology *top,
 {
   t_tpxheader  header;
   real         t,lambda;
-  int          natoms,step,i;
+  int          natoms,step,i,version,generation;
   bool         bTop,bXNULL;
-
+  
   bTop=fn2bTPX(infile);
   if (bTop) {
-    read_tpxheader(infile,&header);
+    read_tpxheader(infile,&header,TRUE,&version,&generation);
     if (x)
       snew(*x,header.natoms);
     if (v)
index b61acf95cba87d87e8967b92806ccd0dac110d05..d4cb16b016343a9293411c5510022d4c3bd33454 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_trnio_c = "$Id$";
+
  
 #include <string.h>
 #include "sysstuff.h"
@@ -67,8 +67,8 @@ static int nFloatSize(t_trnheader *sh)
 
 static bool do_trnheader(int fp,bool bRead,t_trnheader *sh, bool *bOK)
 {
-  static int magic=GROMACS_MAGIC;
-  static char *version = "GMX_trn_file";
+  const int magic=GROMACS_MAGIC;
+  const char *version = "GMX_trn_file";
   static bool bFirst=TRUE;
   char buf[256];
   bool bDouble;
@@ -100,6 +100,7 @@ static bool do_trnheader(int fp,bool bRead,t_trnheader *sh, bool *bOK)
   if (!*bOK) return *bOK; 
   bDouble = (nFloatSize(sh) == sizeof(double));
   fio_setprecision(fp,bDouble);
+
   if (bRead && bFirst) {
     fprintf(stderr,"(%s precision)\n",bDouble ? "double" : "single");
     bFirst = FALSE;
index 66e1f61f470d1a213290e9528129075a3f28cbea..dabfc41978e468df879abd3d06ea1fe2edd274df 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_trxio_c = "$Id$";
+
 #include <ctype.h>
 #include "sysstuff.h"
 #include "string2.h"
index 3237f53c09e6d6c9650c462cdf724bb3a1e4f416..e8969a58bbdcc7fec4daf77384032f46af795002 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_tstsqrtc_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include "vec.h"
 
 int main(int argc,char *argv[])
index 22213141e295f39cf302b36560fc2ef797ae1377..0484d65b37805591c5fba29342eef3e49a7ced4e 100644 (file)
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_txtdump_c = "$Id$";
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/* This file is completely threadsafe - please keep it that way! */
+#ifdef USE_THREADS
+#include <pthread.h>
+#endif
+
 #include <stdio.h>
 #include "smalloc.h"
 #include "typedefs.h"
@@ -38,12 +47,6 @@ static char *SRCID_txtdump_c = "$Id$";
 #include "string2.h"
 #include "vec.h"
 
-static bool bShowNumbers=TRUE;
-
-void pr_shownumbers(bool bShow)
-{
-  bShowNumbers=bShow;
-}
 
 int available(FILE *fp,void *p,char *title)
 {
@@ -80,7 +83,7 @@ int pr_title_nxn(FILE *fp,int indent,char *title,int n1,int n2)
   return (indent+INDENT);
 }
 
-void pr_ivec(FILE *fp,int indent,char *title,int vec[],int n)
+void pr_ivec(FILE *fp,int indent,char *title,int vec[],int n, bool bShowNumbers)
 {
   int i;
 
@@ -95,7 +98,7 @@ void pr_ivec(FILE *fp,int indent,char *title,int vec[],int n)
     }
 }
 
-void pr_ivecs(FILE *fp,int indent,char *title,ivec vec[],int n)
+void pr_ivecs(FILE *fp,int indent,char *title,ivec vec[],int n, bool bShowNumbers)
 {
   int i,j;
 
@@ -116,7 +119,7 @@ void pr_ivecs(FILE *fp,int indent,char *title,ivec vec[],int n)
     }
 }
 
-void pr_rvec(FILE *fp,int indent,char *title,real vec[],int n)
+void pr_rvec(FILE *fp,int indent,char *title,real vec[],int n, bool bShowNumbers)
 {
   int i;
 
@@ -209,7 +212,7 @@ void pr_energies(FILE *fp,int indent,char *title,t_energy *e,int n)
 
 void pr_grp_opts(FILE *out,int indent,char *title,t_grpopts *opts)
 {
-  int i,m;
+  int i,m,j;
 
   fprintf(out,"%s:\n",title);
   
@@ -231,6 +234,30 @@ void pr_grp_opts(FILE *out,int indent,char *title,t_grpopts *opts)
     fprintf(out,"  %10g",opts->tau_t[i]);
   fprintf(out,"\n");  
   
+  /* Pretty-print the imulated annealing info */
+   fprintf(out,"anneal:\t\t");
+  for(i=0; (i<opts->ngtc); i++)
+    fprintf(out,"  %10s",EANNEAL(opts->annealing[i]));
+  fprintf(out,"\n");  
+  fprintf(out,"ann_npoints:\t");
+  for(i=0; (i<opts->ngtc); i++)
+    fprintf(out,"  %10d",opts->anneal_npoints[i]);
+  fprintf(out,"\n");  
+  for(i=0; (i<opts->ngtc); i++) {
+    if(opts->anneal_npoints[i]>0) {
+      fprintf(out,"ann. times [%d]:\t",i);
+      for(j=0; (j<opts->anneal_npoints[i]); j++)
+       fprintf(out,"  %10.1f",opts->anneal_time[i][j]);
+      fprintf(out,"\n");  
+      fprintf(out,"ann. temps [%d]:\t",i);
+      for(j=0; (j<opts->anneal_npoints[i]); j++)
+       fprintf(out,"  %10.1f",opts->anneal_temp[i][j]);
+      fprintf(out,"\n");  
+    }
+  }
+  
   pr_indent(out,indent);
   fprintf(out,"acc:\t");
   for(i=0; (i<opts->ngacc); i++)
@@ -245,6 +272,7 @@ void pr_grp_opts(FILE *out,int indent,char *title,t_grpopts *opts)
       fprintf(out,"  %10s",opts->nFreeze[i][m] ? "Y" : "N");
   fprintf(out,"\n");
 
+
   for(i=0; (i<opts->ngener); i++) {
     pr_indent(out,indent);
     fprintf(out,"energygrp_excl[%3d]:",i);
@@ -289,7 +317,7 @@ static void pr_real(FILE *fp,int indent,char *title,real r)
   fprintf(fp,"%-20s = %g\n",title,r);
 }
 
-static void pr_str(FILE *fp,int indent,char *title,char *s)
+static void pr_str(FILE *fp,int indent,char *title,const char *s)
 {
   pr_indent(fp,indent);
   fprintf(fp,"%-20s = %s\n",title,s);
@@ -306,12 +334,14 @@ void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir)
 #define PR(t,s) pr_real(fp,indent,t,s)
     PS("integrator",EI(ir->eI));
     PI("nsteps",ir->nsteps);
+    PI("init_step",ir->init_step);
     PS("ns_type",ENS(ir->ns_type));
     PI("nstlist",ir->nstlist);
     PI("ndelta",ir->ndelta);
     PS("bDomDecomp",BOOL(ir->bDomDecomp));
     PI("decomp_dir",ir->decomp_dir);
     PI("nstcomm",ir->nstcomm);
+    PI("nstcheckpoint",ir->nstcheckpoint);
     PI("nstlog",ir->nstlog);
     PI("nstxout",ir->nstxout);
     PI("nstvout",ir->nstvout);
@@ -338,8 +368,7 @@ void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir)
     PR("tau_p",ir->tau_p);
     pr_rvecs(fp,indent,"ref_p",ir->ref_p,DIM);
     pr_rvecs(fp,indent,"compress",ir->compress,DIM);
-    PS("bSimAnn",BOOL(ir->bSimAnn)); 
-    PR("zero_temp_time",ir->zero_temp_time); 
+    PI("andersen_seed",ir->andersen_seed);
     PR("rlist",ir->rlist);
     PS("coulombtype",EELTYPE(ir->coulombtype));
     PR("rcoulomb_switch",ir->rcoulomb_switch);
@@ -351,6 +380,11 @@ void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir)
       PR("epsilon_r",ir->epsilon_r);
     else
       PS("epsilon_r",infbuf);
+    PS("gb_algorithm",EGBALGORITHM(ir->gb_algorithm));
+    PI("nstgbradii",ir->nstgbradii);
+    PR("rgbradii",ir->rgbradii);
+    PR("gb_saltconc",ir->gb_saltconc);
+    PS("implicit_solvent",EIMPLICITSOL(ir->implicit_solvent));
     PS("DispCorr",EDISPCORR(ir->eDispCorr));
     PR("fudgeQQ",ir->fudgeQQ);
     PS("free_energy",EFEPTYPE(ir->efep));
@@ -358,6 +392,7 @@ void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir)
     PR("sc_alpha",ir->sc_alpha);
     PR("sc_sigma",ir->sc_sigma);
     PR("delta_lambda",ir->delta_lambda);
+    
     PS("disre_weighting",EDISREWEIGHTING(ir->eDisreWeighting));
     PS("disre_mixed",BOOL(ir->bDisreMixed));
     PR("dr_fc",ir->dr_fc);
@@ -366,6 +401,11 @@ void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir)
     PR("orires_fc",ir->orires_fc);
     PR("orires_tau",ir->orires_tau);
     PR("nstorireout",ir->nstorireout);
+
+    PR("dihre-fc",ir->dihre_fc);
+    PR("dihre-tau",ir->dihre_tau);
+    PR("nstdihreout",ir->nstdihreout);
+    
     PR("em_stepsize",ir->em_stepsize);
     PR("em_tol",ir->em_tol);
     PI("niter",ir->niter);
@@ -375,6 +415,7 @@ void pr_inputrec(FILE *fp,int indent,char *title,t_inputrec *ir)
     PR("shake_tol",ir->shake_tol);
     PI("lincs_order",ir->nProjOrder);
     PR("lincs_warnangle",ir->LincsWarnAngle);
+    PI("lincs_iter",ir->nLincsIter);
     PR("bd_temp",ir->bd_temp);
     PR("bd_fric",ir->bd_fric);
     PI("ld_seed",ir->ld_seed);
@@ -410,7 +451,8 @@ static void pr_harm(FILE *fp,t_iparams *iparams,char *r,char *kr)
 void pr_iparams(FILE *fp,t_functype ftype,t_iparams *iparams)
 {
   int i;
-  
+  real VA[4],VB[4],*rbcA,*rbcB;
+
   switch (ftype) {
   case F_ANGLES:
   case F_G96ANGLES:
@@ -471,6 +513,11 @@ void pr_iparams(FILE *fp,t_functype ftype,t_iparams *iparams)
            iparams->orires.ex,iparams->orires.label,iparams->orires.power,
            iparams->orires.c,iparams->orires.obs,iparams->orires.kfac);
     break;
+  case F_DIHRES:
+    fprintf(fp,"label=%d, power=%4d phi=%15.8e, dphi=%15.8e, kfac=%15.8e)\n",
+           iparams->dihres.label,iparams->dihres.power,
+           iparams->dihres.phi,iparams->dihres.dphi,iparams->dihres.kfac);
+    break;
   case F_POSRES:
     fprintf(fp,"pos0=(%15.8e,%15.8e,%15.8e), fc=(%15.8e,%15.8e,%15.8e)\n",
            iparams->posres.pos0[XX],iparams->posres.pos0[YY],
@@ -485,6 +532,31 @@ void pr_iparams(FILE *fp,t_functype ftype,t_iparams *iparams)
       fprintf(fp,"%srbcB[%d]=%15.8e",i==0?"":", ",i,iparams->rbdihs.rbcB[i]);
     fprintf(fp,"\n");
     break;
+  case F_FOURDIHS:
+    /* Use the OPLS -> Ryckaert-Bellemans formula backwards to get the
+     * OPLS potential constants back.
+     */
+    rbcA = iparams->rbdihs.rbcA;
+    rbcB = iparams->rbdihs.rbcB;
+
+    VA[3] = -0.25*rbcA[4];
+    VA[2] = -0.5*rbcA[3];
+    VA[1] = 4.0*VA[3]-rbcA[2];
+    VA[0] = 3.0*VA[2]-2.0*rbcA[1];
+
+    VB[3] = -0.25*rbcB[4];
+    VB[2] = -0.5*rbcB[3];
+    VB[1] = 4.0*VB[3]-rbcB[2];
+    VB[0] = 3.0*VB[2]-2.0*rbcB[1];
+
+    for (i=0; i<NR_FOURDIHS; i++) 
+      fprintf(fp,"%sFourA[%d]=%15.8e",i==0?"":", ",i,VA[i]);
+    fprintf(fp,"\n");
+    for (i=0; i<NR_FOURDIHS; i++) 
+      fprintf(fp,"%sFourB[%d]=%15.8e",i==0?"":", ",i,VB[i]);
+    fprintf(fp,"\n");
+    break;
+   
   case F_SHAKE:
   case F_SHAKENC:
     fprintf(fp,"dA=%15.8e, dB=%15.8e\n",iparams->shake.dA,iparams->shake.dB);
@@ -513,7 +585,7 @@ void pr_iparams(FILE *fp,t_functype ftype,t_iparams *iparams)
 }
 
 static void pr_ilist(FILE *fp,int indent,char *title,
-                     t_idef *idef,t_ilist *ilist)
+                     t_idef *idef,t_ilist *ilist, bool bShowNumbers)
 {
   int i,j,k,type,ftype;
   t_iatom *iatoms;
@@ -554,7 +626,7 @@ static void pr_ilist(FILE *fp,int indent,char *title,
     }
 }
 
-void pr_idef(FILE *fp,int indent,char *title,t_idef *idef)
+void pr_idef(FILE *fp,int indent,char *title,t_idef *idef, bool bShowNumbers)
 {
   int i,j;
   
@@ -575,7 +647,7 @@ void pr_idef(FILE *fp,int indent,char *title,t_idef *idef)
     }
     for(j=0; (j<F_NRE); j++)
       pr_ilist(fp,indent,interaction_function[j].longname,
-              idef,&idef->il[j]);
+              idef,&idef->il[j],bShowNumbers);
   }
 }
 
@@ -599,7 +671,7 @@ static int pr_block_title(FILE *fp,int indent,char *title,t_block *block)
   return indent;
 }
 
-static void low_pr_block(FILE *fp,int indent,char *title,t_block *block)
+static void low_pr_block(FILE *fp,int indent,char *title,t_block *block, bool bShowNumbers)
 {
   int i;
   
@@ -621,7 +693,7 @@ static void low_pr_block(FILE *fp,int indent,char *title,t_block *block)
     }
 }
 
-void pr_block(FILE *fp,int indent,char *title,t_block *block)
+void pr_block(FILE *fp,int indent,char *title,t_block *block, bool bShowNumbers)
 {
   int i,j,ok,size,start,end;
   
@@ -660,13 +732,13 @@ void pr_block(FILE *fp,int indent,char *title,t_block *block)
         {
           (void) pr_indent(fp,indent);
           (void) fprintf(fp,"tables inconsistent, dumping complete tables:\n");
-          low_pr_block(fp,indent,title,block);
+          low_pr_block(fp,indent,title,block,bShowNumbers);
         }
     }
 }
 
 static void pr_blocks(FILE *fp,int indent,char *title,
-                      t_block block[],int n,char *block_names[])
+                      t_block block[],int n,const char *block_names[], bool bShowNumbers)
 {
   int i;
   char s[STRLEN];
@@ -680,7 +752,7 @@ static void pr_blocks(FILE *fp,int indent,char *title,
             sprintf(s,"%s[%d]",title,i);
           else
             sprintf(s,"%s[%s]",title,block_names[i]);
-          pr_block(fp,indent,s,&(block[i]));
+          pr_block(fp,indent,s,&(block[i]),bShowNumbers);
         }
     }
 }
@@ -705,7 +777,7 @@ static void pr_atom(FILE *fp,int indent,char *title,t_atom *atom,int n)
 }
 
 static void pr_grps(FILE *fp,int indent,char *title,t_grps grps[],int ngrp,
-                   char **grpname[])
+                   char **grpname[], bool bShowNumbers)
 {
   int i,j;
   
@@ -717,7 +789,7 @@ static void pr_grps(FILE *fp,int indent,char *title,t_grps grps[],int ngrp,
   }
 }
 
-static void pr_strings(FILE *fp,int indent,char *title,char ***nm,int n)
+static void pr_strings(FILE *fp,int indent,char *title,char ***nm,int n, bool bShowNumbers)
 {
   int i;
 
@@ -734,7 +806,7 @@ static void pr_strings(FILE *fp,int indent,char *title,char ***nm,int n)
 }
 
 static void pr_strings2(FILE *fp,int indent,char *title,
-                       char ***nm,char ***nmB,int n)
+                       char ***nm,char ***nmB,int n, bool bShowNumbers)
 {
   int i;
 
@@ -750,30 +822,44 @@ static void pr_strings2(FILE *fp,int indent,char *title,
     }
 }
 
-static void pr_atoms(FILE *fp,int indent,char *title,t_atoms *atoms)
+static void pr_atoms(FILE *fp,int indent,char *title,t_atoms *atoms, bool bShownumbers)
 {
   if (available(fp,atoms,title))
     {
       indent=pr_title(fp,indent,title);
       pr_atom(fp,indent,"atom",atoms->atom,atoms->nr);
-      pr_grps(fp,indent,"grp",atoms->grps,egcNR,atoms->grpname);
-      pr_strings(fp,indent,"atom",atoms->atomname,atoms->nr);
-      pr_strings2(fp,indent,"type",atoms->atomtype,atoms->atomtypeB,atoms->nr);
-      pr_strings(fp,indent,"residue",atoms->resname,atoms->nres);
-      pr_strings(fp,indent,"grpname",atoms->grpname,atoms->ngrpname);
-      pr_block(fp,indent,"excl",&atoms->excl);
+      pr_grps(fp,indent,"grp",atoms->grps,egcNR,atoms->grpname,bShownumbers);
+      pr_strings(fp,indent,"atom",atoms->atomname,atoms->nr,bShownumbers);
+      pr_strings2(fp,indent,"type",atoms->atomtype,atoms->atomtypeB,atoms->nr,bShownumbers);
+      pr_strings(fp,indent,"residue",atoms->resname,atoms->nres,bShownumbers);
+      pr_strings(fp,indent,"grpname",atoms->grpname,atoms->ngrpname,bShownumbers);
+      pr_block(fp,indent,"excl",&atoms->excl,bShownumbers);
     }
 }
 
-void pr_top(FILE *fp,int indent,char *title,t_topology *top)
+static void pr_atomtypes(FILE *fp,int indent,char *title,t_atomtypes *atomtypes, bool bShowNumbers)
+{
+  int i;
+  if (available(fp,atomtypes,title)) {
+      indent=pr_title(fp,indent,title);
+      for(i=0;i<atomtypes->nr;i++) {
+       pr_indent(fp,indent);
+       fprintf(fp,"atomtype[%3d]={radius=%12.5e, volume=%12.5e, surftens=%12.5e)}\n",
+               bShowNumbers?i:-1,atomtypes->radius[i],atomtypes->vol[i],atomtypes->surftens[i]);
+      }
+  }
+}
+
+void pr_top(FILE *fp,int indent,char *title,t_topology *top, bool bShowNumbers)
 {
   if (available(fp,top,title)) {
     indent=pr_title(fp,indent,title);
     (void) pr_indent(fp,indent);
     (void) fprintf(fp,"name=\"%s\"\n",*(top->name));
-    pr_atoms(fp,indent,"atoms",&(top->atoms));
-    pr_blocks(fp,indent,"blocks",top->blocks,ebNR,eblock_names);
-    pr_idef(fp,indent,"idef",&top->idef);
+    pr_atoms(fp,indent,"atoms",&(top->atoms),bShowNumbers);
+    pr_atomtypes(fp,indent,"atomtypes",&(top->atomtypes),bShowNumbers);
+    pr_blocks(fp,indent,"blocks",top->blocks,ebNR,eblock_names, bShowNumbers);
+    pr_idef(fp,indent,"idef",&top->idef,bShowNumbers);
   }
 }
 
index 8441555ccce69c3d2761ebf0cf5bfe3e3cf75e19..4f3c5020f9aee4437314f755ab3ef8e9294adccc 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_typedefs_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
 #include "smalloc.h"
 #include "assert.h"
 #include "symtab.h"
index 849478dc6937a21e4824d8c901c3b7e7faed0536..ca47cd08251e67bce40ef24d9ec711bc7c6d31a6 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_vec_c = "$Id$";
+
 #include <typedefs.h>
 #include <vec.h>
 #include <detectcpu.h>
@@ -38,20 +38,11 @@ static char *SRCID_vec_c = "$Id$";
  * Assembly routines are used for Alpha processors, AMD processors
  * with 3DNow. On IBM we use the MASS libraries if they are present.
  * 
- * WE ALSO HAVE AN ASSEMBLY LOOP FOR PENTIUM PROCESSORS, BUT IT CAN
- * ONLY BE USED IF YOUR INPUT AND OUTPUT ARRAYS ARE ALIGNED TO
- * THE CACHE LINE!
- * This is not complicated to do, but you must do it when you allocate
- * your memory. Start by allocating 31 bytes more than you need, put
- * this in a temp variable (e.g. _buf, so you can free it later), and
- * create your aligned array buf with
- * 
- *  buf=(real *) ( ( (unsigned long int)_buf + 31 ) & (~0x1f) );
- *
- * And, of course, simliar for your output buffer. 
- * If you have an SSE-enabled CPU (pentium III and later) and OS
- * (Linux 2.4 and later) you will now be able to perform 1/sqrt(x)
- * in 3-4 clocks/element for long lists!
+ * We cannot call the SSE/3DNow/SSE2/Altivec from this general loop,
+ * since the CPU detection is costly and we dont want to maintain
+ * a separate variable for the cpu detected. Call detectcpu()
+ * yourself, and use the SSE/3DNow/SSE2/Altivec versions directly
+ * if the flags match. 
  */
  
 void vecinvsqrt(real in[],real out[],int n)
@@ -62,17 +53,15 @@ void vecinvsqrt(real in[],real out[],int n)
    sqrtiv_(in,out,&n);
 #  else /* SINGLE */
    ssqrtiv_(in,out,&n);
-#  endif    
+#  endif /* SINGLE/DOUBLE */   
 #elif defined HAVE_LIBMASSV_ANY
  /* On IBM we should definitely use vectorized MASS if present. */ 
 #  ifdef DOUBLE
    vrsqrt(out,in,&n);
 #  else /* SINGLE */
    vsrsqrt(out,in,&n);
-#  endif 
-#else /* not alpha, and not IBM with MASS */
-   /* Software routines and calls to x86 assembly. */
-#ifdef SOFTWARE_INVSQRT
+#  endif  /* SINGLE/DOUBLE */   
+#elif defined SOFTWARE_INVSQRT /* gromacs software 1/sqrt*/
   const real  half=0.5;
   const real  three=3.0;
   t_convert   result,bit_pattern;
@@ -81,59 +70,12 @@ void vecinvsqrt(real in[],real out[],int n)
   real        x;
 #ifdef DOUBLE
   real        y;
-#endif
-#endif /* VARIABLES FOR SOFTWARE_INVSQRT */
-  int i;
-#if (defined USE_X86_SSE_AND_3DNOW && !defined DOUBLE) 
-  static bool bFirst=TRUE;
-  static int cpu_capabilities;
-  
-  if(bFirst) {
-    cpu_capabilities=detect_cpu(NULL);
-    bFirst=FALSE;
-  }
-
-  if((cpu_capabilities & X86_SSE_SUPPORT) && !((unsigned long int)in & 0x1f) && !((unsigned long int)out & 0x1f)) /* SSE data must be cache aligned */
-    vecinvsqrt_sse(in,out,n);
-  else if(cpu_capabilities & X86_3DNOW_SUPPORT)
-    vecinvsqrt_3dnow(in,out,n);
-  else
-#endif /* no x86 optimizations */
-#if (defined USE_X86_SSE2 && defined DOUBLE) 
-  static bool bFirst=TRUE;
-  static int cpu_capabilities;
-  
-  if(bFirst) {
-    cpu_capabilities=detect_cpu(NULL);
-    bFirst=FALSE;
-  }
-
-  if((cpu_capabilities & X86_SSE2_SUPPORT) && !((unsigned long int)in & 0x1f) && !((unsigned long int)out & 0x1f)) /* SSE2 data must be cache aligned */
-    vecinvsqrt_sse2(in,out,n);
-  else
-#endif /* no sse2 optimizations */
-#ifdef SOFTWARE_INVSQRT
-    for(i=0;i<n;i++) {
-      x=in[i];
-      bit_pattern.fval=x;
-      exp   = EXP_ADDR(bit_pattern.bval);
-      fract = FRACT_ADDR(bit_pattern.bval);
-      result.bval=cinvsqrtexptab[exp] | cinvsqrtfracttab[fract];
-      lu    = result.fval;
-      
-#ifdef DOUBLE
-      y=(half*lu*(three-((x*lu)*lu)));
-      out[i]=(half*y*(three-((x*y)*y)));
-#else
-      out[i]=(half*lu*(three-((x*lu)*lu)));
-#endif
-    }
-#else  /* no gmx invsqrt */
+#endif /* DOUBLE */
+#else /* NO INVSQRT */
+  int i; 
     for(i=0;i<n;i++)
       out[i]=1.0f/sqrt(in[i]);
 #endif /* SOFTWARE_INVSQRT */
-#endif
 }
 
 
@@ -153,32 +95,6 @@ void vecrecip(real in[],real out[],int n)
 
   int i;
 
-#if (defined USE_X86_SSE_AND_3DNOW && !defined DOUBLE)
-  static bool bFirst=TRUE;
-  static int cpu_capabilities;
-
-  if(bFirst) {
-    cpu_capabilities=detect_cpu(NULL);
-    bFirst=FALSE;
-  }
-  if((cpu_capabilities & X86_SSE_SUPPORT) && !((unsigned long int)in & 0x1f) && !((unsigned long int)out & 0x1f)) /* SSE data must be cache aligned */
-    vecrecip_sse(in,out,n);
-  else if(cpu_capabilities & X86_3DNOW_SUPPORT)
-    vecrecip_3dnow(in,out,n);
-  else
-#endif /* no x86 optimizations */
-#if (defined USE_X86_SSE2 && defined DOUBLE)
-  static bool bFirst=TRUE;
-  static int cpu_capabilities;
-
-  if(bFirst) {
-    cpu_capabilities=detect_cpu(NULL);
-    bFirst=FALSE;
-  }
-  if((cpu_capabilities & X86_SSE2_SUPPORT) && !((unsigned long int)in & 0x1f) && !((unsigned long int)out & 0x1f)) /* SSE2 data must be cache aligned */
-    vecrecip_sse2(in,out,n);
-  else
-#endif /* no sse2 optimizations */
     for(i=0;i<n;i++)
       out[i]=1.0f/(in[i]);
 #endif
index 4edd553a3c86ea9e8d9179428ca1ca005e9c8c59..a7a069ea9e38e6ee527c49aae6db4719e86c64ef 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_viewit_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
 #include <string.h>
 #include "statutil.h"
 #include "viewit.h"
@@ -37,11 +38,11 @@ static char *SRCID_viewit_c = "$Id$";
 #include "filenm.h"
 #include "macros.h"
 
-static int can_view_ftp[] = { 0,
+static const int can_view_ftp[] = { 0,
   efEPS,           efXPM,         efXVG,          efPDB };
 #define NVIEW asize(can_view_ftp)
-static char* view_program[] = { NULL,
-  "ghostview",    "xv",           NULL,           "xterm -e rasmol" };
+static const char* view_program[] = { NULL,
+  "ghostview",    "display",      NULL,           "xterm -e rasmol" };
 
 int can_view(int ftp)
 {
@@ -57,7 +58,8 @@ int can_view(int ftp)
 void do_view(char *fn, char *opts)
 {
 #define N_EXT 3
-  char buf[STRLEN], env[20], ext[N_EXT], *cmd;
+  char buf[STRLEN], env[20], ext[N_EXT];
+  const char *cmd;
   int ftp, n;
   
   if (bDoView() && fn) {
index feb1751a098e512335654440ad850b29c1d40a9a..0e0f96b12a5204874c8fa2ccd1fb8ed2530aba60 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_wgms_c = "$Id$";
+
 #include <stdio.h>
 #include "gstat.h"
 
index 25f589cf7bd28ee2d2daae848f135a7f1eec573f..0b994f7b4fc60133c8de597e34524736828e3691 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_widget_c = "$Id$";
+
 #include "widget.h"
 #include "smalloc.h"
 #include "fatal.h"
@@ -257,7 +257,7 @@ void set_widget_other(windex win,Widget www)
   w[win].other = www;
 }
    
-XmString char2xms(char *ptr)
+XmString char2xms(const char *ptr)
 {
   return XmStringCreate(ptr,XmSTRING_DEFAULT_CHARSET);
 }
index eaa925afb3d50e7ebc4bac9d7f84453dc8a1a2f0..800a852752d8b48c6ca9452f25a3a8cc767285d0 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _widget_h
 #define _widget_h
 
-static char *SRCID_widget_h = "$Id$";
+
 #include "typedefs.h"
 #include <Xm/Xm.h>
 
@@ -62,7 +62,7 @@ extern Widget   get_widget_other(windex win,bool bFail);
 extern void     set_widget_other(windex win,Widget www);
 
 extern void     mk_desc_callbacks(void);
-extern XmString char2xms(char *ptr);
+extern XmString char2xms(const char *ptr);
 extern char     *xms2char(XmString xms);
 
 #endif
index 53eed9c4e48c4f6964bb49b2c27c8621f38549a4..b0bcccc0a4b9c79a7f16566620751606dcca5b19 100644 (file)
@@ -29,7 +29,6 @@
  * And Hey:
  * Great Red Owns Many ACres of Sand 
  */
-static char *SRCID_wman_c = "$Id$";
 #include "string2.h"
 #include "smalloc.h"
 #include "sysstuff.h"
@@ -47,7 +46,7 @@ typedef struct {
   char *search,*replace;
 } t_sandr;
 
-t_sandr sandrTeX[] = {
+const t_sandr sandrTeX[] = {
   { "[TT]", "{\\tt " },
   { "[tt]", "}"      },
   { "[BB]", "{\\bf " },
@@ -72,7 +71,7 @@ t_sandr sandrTeX[] = {
 };
 #define NSRTEX asize(sandrTeX)
 
-t_sandr sandrTty[] = {
+const t_sandr sandrTty[] = {
   { "[TT]", "" },
   { "[tt]", "" },
   { "[BB]", "" },
@@ -84,7 +83,7 @@ t_sandr sandrTty[] = {
 };
 #define NSRTTY asize(sandrTty)
 
-t_sandr sandrNROFF[] = {
+const t_sandr sandrNROFF[] = {
   { "[TT]", "\n.B " },
   { "[tt]", "\n" },
   { "[BB]", "\n.B " },
@@ -101,7 +100,7 @@ t_sandr sandrNROFF[] = {
 };
 #define NSRNROFF asize(sandrNROFF)
 
-t_sandr sandrHTML[] = {
+const t_sandr sandrHTML[] = {
   { "<",    "&lt;" },
   { ">",    "&gt;" },
   { "[TT]", "<tt>" },
@@ -115,29 +114,30 @@ t_sandr sandrHTML[] = {
 };
 #define NSRHTML asize(sandrHTML)
 
-static char *mydate(void)
+static char *mydate(char buf[], int maxsize)
 {
-  static char *mon[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", 
+  const char *mon[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", 
                         "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
-  static char *day[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+  const char *day[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
   time_t now;
-  static char tbuf[128];
   struct tm *tm;
   
   (void) time(&now);
   tm = localtime(&now);
-  sprintf(tbuf,"%s %d %s %d",day[tm->tm_wday],tm->tm_mday,
+  /* subtract one from maxsize, so we have room for \0. */
+  snprintf(buf,maxsize-1,"%s %d %s %d",day[tm->tm_wday],tm->tm_mday,
          mon[tm->tm_mon],tm->tm_year+1900);
   
-  return tbuf;
+  return buf;
 }
 
-static char *repall(char *s,int nsr,t_sandr sa[])
+static const char *repall(const char *s,int nsr,const t_sandr sa[])
 {
   int  i;
-  char *buf,*buf2;
+  const char *buf;
+  char *buf2;
   
-  buf=s;
+  buf=s; 
   for(i=0; (i<nsr); i++) {
     buf2=replace(buf,sa[i].search,sa[i].replace);
     if (i && buf)
@@ -146,14 +146,14 @@ static char *repall(char *s,int nsr,t_sandr sa[])
   }
   
   return buf;
-}
+} 
 
-static char *repallww(char *s,int nsr,t_sandr sa[])
+static char *repallww(char *s,int nsr,const t_sandr sa[])
 {
   int  i;
   char *buf,*buf2;
   
-  buf=s;
+  buf=s; 
   for(i=0; (i<nsr); i++) {
     buf2=replaceww(buf,sa[i].search,sa[i].replace);
     if (i && buf)
@@ -164,64 +164,98 @@ static char *repallww(char *s,int nsr,t_sandr sa[])
   return buf;
 }
 
-char *check_tex(char *s)
+const char *check_tex(const char *s)
 {
   return repall(s,NSRTEX,sandrTeX);
 }
 
-char *check_nroff(char *s)
+static const char *check_nroff(const char *s)
 {
   return repall(s,NSRNROFF,sandrNROFF);
 }
 
-static char *html_xref(char *s,char *program)
+/* Data structure for saved HTML links */
+typedef struct {
+  int     nsr;
+  t_sandr *sr;
+} t_linkdata;
+
+static t_linkdata *init_linkdata()
+{
+  t_linkdata *p;
+  snew(p,1);
+  p->sr=NULL;
+  p->nsr=0;
+
+  return p;
+}
+
+static void finish_linkdata(t_linkdata *p)
+{
+  int i;
+  
+  sfree(p->sr);
+  for(i=0;i<p->nsr;i++) {
+    sfree(p->sr[i].search);    
+    sfree(p->sr[i].replace);
+  }
+  sfree(p);
+}
+
+static char *html_xref(char *s,char *program, t_linkdata *links)
 {
-  static int     nstr;
-  static char    **str;
-  static t_sandr *sr=NULL;
-  char   buf[256];
-  int    i,j;
+  char   buf[256],**filestr;
+  int    i,j,n;
   
-  if (sr == NULL) {
-    nstr=get_file("links.dat",&str);
-    snew(sr,nstr);
-    for(i=j=0; (i<nstr); i++) {
-      if (!program || (strcasecmp(program,str[i]) != 0)) {
-       sr[j].search=str[i];
-       sprintf(buf,"<a href=\"%s.html\">%s</a>",str[i],str[i]);
-       sr[j].replace=strdup(buf);
+  if (links->sr == NULL) {
+    n=get_file("links.dat",&(filestr));
+    links->nsr=n;
+    snew(links->sr,n);
+    for(i=0,j=0; (i<n); i++) {
+      if (!program || (strcasecmp(program,filestr[i])  != 0)) {
+       links->sr[j].search=strdup(filestr[i]);
+       sprintf(buf,"<a href=\"%s.html\">%s</a>",filestr[i],filestr[i]);
+       links->sr[j].replace=strdup(buf);
        j++;
       }
     }
-    nstr=j;
+    links->nsr=j;
+    for(i=0;i<n;i++)
+      sfree(filestr[i]);
+    sfree(filestr);
   }
-  return repallww(s,nstr,sr);
+  return repallww(s,links->nsr,links->sr);
 }
 
 #define FLAG_SET(flag, mask) ((flag & mask) == mask)
-char *fileopt(unsigned long flag)
+char *fileopt(unsigned long flag,char buf[],int maxsize)
 {
-  static char buf[32];
+  char tmp[256];
   
   if (FLAG_SET(flag, ffRW))
-    strcpy(buf,"In/Out");
+    sprintf(tmp,"In/Out");
   else if (FLAG_SET(flag, ffREAD))
-    strcpy(buf,"Input");
+    sprintf(tmp,"Input");
   else if (FLAG_SET(flag, ffWRITE))
-    strcpy(buf,"Output");
+    sprintf(tmp,"Output");
   else
-    strcpy(buf,"Dunno");
+    sprintf(tmp,"Dunno");
+
   if (FLAG_SET(flag, ffOPT)) {
-    strcat(buf,", Opt");
+    strcat(tmp,", Opt");
     if (FLAG_SET(flag, ffSET)) 
-      strcat(buf,"!");
+      strcat(tmp,"!");
     else
-      strcat(buf,".");
+      strcat(tmp,".");
   }
   if (FLAG_SET(flag, ffLIB))
-    strcat(buf,", Lib.");
+    strcat(tmp,", Lib.");
   if (FLAG_SET(flag, ffMULT))
-    strcat(buf,", Mult.");
+    strcat(tmp,", Mult.");
+
+  snprintf(buf,maxsize-1,tmp);
+  
   return buf;
 }
 
@@ -232,6 +266,7 @@ static void write_texman(FILE *out,char *program,
                         int nbug,char **bugs)
 {
   int i;
+  char tmp[256];
   
   fprintf(out,"\\section{\\normindex{%s}}\n\n",check_tex(program));
   
@@ -248,7 +283,7 @@ static void write_texman(FILE *out,char *program,
       fprintf(out,"\\>{\\tt %s} \\'\\> {\\tt %s} \\' %s \\> "
              "\\parbox[t]{0.55\\linewidth}{%s} \\\\\n",
              check_tex(fnm[i].opt),check_tex(fnm[i].fns[0]),
-             check_tex(fileopt(fnm[i].flag)),
+             check_tex(fileopt(fnm[i].flag,tmp,255)),
              check_tex(ftp2desc(fnm[i].ftp)));
     fprintf(out,"\\end{tabbing}\\vspace{-4ex}\n");
   }
@@ -258,18 +293,18 @@ static void write_texman(FILE *out,char *program,
     fprintf(out,"{\\tt ~~~~~~~~~~} \\= vector \\= "
            "{\\tt ~~~~~~~} \\= \\nopagebreak\\kill\n");
     for(i=0; (i<npargs); i++) {
-      if (strlen(check_tex(pa_val(&(pa[i])))) <= 8)
+      if (strlen(check_tex(pa_val(&(pa[i]),tmp,255))) <= 8)
        fprintf(out,"\\> {\\tt %s} \\'\\> %s \\'\\> {\\tt %s} \\' "
                "\\parbox[t]{0.68\\linewidth}{%s}\\\\\n",
                check_tex(pa[i].option),argtp[pa[i].type],
-               check_tex(pa_val(&(pa[i]))),
+               check_tex(pa_val(&(pa[i]),tmp,255)),
                check_tex(pa[i].desc));
       else
        fprintf(out,"\\> {\\tt %s} \\'\\> %s \\'\\>\\\\\n"
                "\\> \\'\\> \\'\\> {\\tt %s} \\' "
                "\\parbox[t]{0.7\\linewidth}{%s}\\\\\n",
                check_tex(pa[i].option),argtp[pa[i].type],
-               check_tex(pa_val(&(pa[i]))),
+               check_tex(pa_val(&(pa[i]),tmp,255)),
                check_tex(pa[i].desc));
     }
     fprintf(out,"\\end{tabbing}\\vspace{-4ex}\n");
@@ -293,8 +328,10 @@ static void write_nroffman(FILE *out,
 
 {
   int i;
+  char tmp[256];
+  
   
-  fprintf(out,".TH %s 1 \"%s\"\n",program,mydate());
+  fprintf(out,".TH %s 1 \"%s\"\n",program,mydate(tmp,255));
   fprintf(out,".SH NAME\n");
   fprintf(out,"%s\n",program);
   fprintf(out,".B %s\n",GromacsVersion());
@@ -329,7 +366,7 @@ static void write_nroffman(FILE *out,
     fprintf(out,".SH FILES\n");
     for(i=0; (i<nfile); i++)
       fprintf(out,".BI \"%s\" \" %s\" \n.B %s\n %s \n\n",
-             fnm[i].opt,fnm[i].fns[0],fileopt(fnm[i].flag),
+             fnm[i].opt,fnm[i].fns[0],fileopt(fnm[i].flag,tmp,255),
              check_nroff(ftp2desc(fnm[i].ftp)));
   }
   
@@ -340,11 +377,11 @@ static void write_nroffman(FILE *out,
       if (pa[i].type == etBOOL)
        fprintf(out,".BI \"-[no]%s\"  \"%s\"\n %s\n\n",
                check_nroff(pa[i].option+1),
-               pa_val(&(pa[i])),check_nroff(pa[i].desc));
+               pa_val(&(pa[i]),tmp,255),check_nroff(pa[i].desc));
       else
        fprintf(out,".BI \"%s\"  \" %s\" \" %s\" \n %s\n\n",
                check_nroff(pa[i].option),argtp[pa[i].type],
-               pa_val(&(pa[i])),check_nroff(pa[i].desc));
+               pa_val(&(pa[i]),tmp,255),check_nroff(pa[i].desc));
     }
   }
 
@@ -355,14 +392,15 @@ static void write_nroffman(FILE *out,
 
 }
 
-char *check_tty(char *s)
+const char *check_tty(const char *s)
 {
   return repall(s,NSRTTY,sandrTty);
 }
 
 void print_tty_formatted(FILE *out, int nldesc, char **desc)
 {
-  char *buf,*temp;
+  char *buf;
+  const char *temp;
   int i,j;
 
   /* Just to be sure */
@@ -393,11 +431,12 @@ static void write_ttyman(FILE *out,
                         int nbug,char **bugs,bool bHeader)
 {
   int i;
+  char buf[256];
   char *tmp;
   
   if (bHeader) {
     fprintf(out,"%s\n\n",check_tty(program));
-    fprintf(out,"%s\n%s\n",GromacsVersion(),mydate());
+    fprintf(out,"%s\n%s\n",GromacsVersion(),mydate(buf,255));
   }
   if (nldesc > 0) {
     fprintf(out,"DESCRIPTION:\n\n");
@@ -422,12 +461,12 @@ static void write_ttyman(FILE *out,
   }
 }
 
-char *check_html(char *s,char *program)
+static const char *check_html(const char *s,char *program, t_linkdata *links)
 {
-  char *buf;
+  const char *buf;
   
   buf=repall(s,NSRHTML,sandrHTML);
-  buf=html_xref(buf,program);
+  buf=html_xref(buf,program,links);
   
   return buf;
 }
@@ -440,9 +479,12 @@ static void write_htmlman(FILE *out,
                          int nbug,char **bugs)
 {
   int i;
-  char link[10];
+  char link[10],tmp[255];
+  t_linkdata *links;
   
-#define NSR(s) check_html(s,program)
+  links=init_linkdata();
+
+#define NSR(s) check_html(s,program,links)
   
   fprintf(out,"<HTML>\n<HEAD>\n<TITLE>%s</TITLE>\n",program);
   fprintf(out,"<LINK rel=stylesheet href=\"style.css\" type=\"text/css\">\n");
@@ -456,7 +498,7 @@ static void write_htmlman(FILE *out,
          "<br><h2>%s</h2>",program);
   fprintf(out,"<font size=-1><A HREF=\"../online.html\">Main Table of Contents</A></font><br>");
   fprintf(out,"<br></td>\n</TABLE></TD><TD WIDTH=\"*\" ALIGN=RIGHT VALIGN=BOTTOM><p><B>%s<br>\n",GromacsVersion());
-  fprintf(out,"%s</B></td></tr></TABLE>\n<HR>\n",mydate());
+  fprintf(out,"%s</B></td></tr></TABLE>\n<HR>\n",mydate(tmp,255));
   
   if (nldesc > 0) {
     fprintf(out,"<H3>Description</H3>\n<p>\n");
@@ -485,7 +527,7 @@ static void write_htmlman(FILE *out,
              "<TD> %s </TD>"
              "<TD> %s </TD>"
              "</TR>\n",
-             fnm[i].opt,link,fnm[i].fns[0],fileopt(fnm[i].flag),
+             fnm[i].opt,link,fnm[i].fns[0],fileopt(fnm[i].flag,tmp,255),
              NSR(ftp2desc(fnm[i].ftp)));
     }
     fprintf(out,"</TABLE>\n");
@@ -510,7 +552,7 @@ static void write_htmlman(FILE *out,
              "<TD> %s </TD>"
              "</TD>\n",
              (pa[i].type == etBOOL)?"-[no]":"-",pa[i].option+1,
-             argtp[pa[i].type],pa_val(&(pa[i])),NSR(pa[i].desc));
+             argtp[pa[i].type],pa_val(&(pa[i]),tmp,255),NSR(pa[i].desc));
     fprintf(out,"</TABLE>\n");
   }
   if (nbug > 0) {
@@ -528,6 +570,8 @@ static void write_htmlman(FILE *out,
          "gromacs@gromacs.org</a></font><br>\n");
   fprintf(out,"</div>\n");
   fprintf(out,"</BODY>\n");
+
+  finish_linkdata(links);
 }
 
 static void pr_opts(FILE *fp, 
index 56c8d9bc0e47caeb50c74cc08c3cd3dba2fa5e13..915dc8ded55151704dc5950eb57592e40afac139 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_writeps_c = "$Id$";
+
 #include <stdio.h>
 #include "futil.h"
 #include "fatal.h"
@@ -37,111 +37,127 @@ static char *SRCID_writeps_c = "$Id$";
 #include "writeps.h"
 #include "smalloc.h"
 
-static int maxrgb=0;
-static int   nrgb=0;
-static t_rgb *rgb=NULL;
+const char *fontnm[efontNR] = { 
+  "Times-Roman","Times-Italic",     "Times-Bold",    "Times-BoldItalic",
+  "Helvetica",  "Helvetica-Oblique","Helvetica-Bold","Helvetica-BoldOblique",
+  "Courier",    "Courier-Oblique",  "Courier-Bold",  "Courier-BoldOblique"
+};
+
+
+/* Internal psdata structure (abstract datatype) 
+ * to maintain the current state of the ps engine.
+ */
+struct t_int_psdata  {
+  FILE   *fp;
+  int    maxrgb;
+  int    nrgb;
+  t_rgb  *rgb;
+  real   gen_ybox;
+  int    ostack;
+};
 
-FILE *ps_open(char *fn,real x1,real y1,real x2,real y2)
+
+t_psdata ps_open(char *fn,real x1,real y1,real x2,real y2)
 {
-  FILE *ps;
+  t_psdata ps;
+  
+  snew(ps,1);
+  
+  ps->fp=ffopen(fn,"w");
+  fprintf(ps->fp,"%%!PS-Adobe-2.0 EPSF-1.2\n");
+  fprintf(ps->fp,"%%%%Creator: GROMACS\n");
+  fprintf(ps->fp,"%%%%Title: %s\n",fn);
+  fprintf(ps->fp,"%%%%BoundingBox: %g %g %g %g\n",x1,y1,x2,y2);
+  fprintf(ps->fp,"%%%%EndComments\n");
+  fprintf(ps->fp,"/m {moveto} bind def\n");
+  fprintf(ps->fp,"/l {lineto} bind def\n");
+  fprintf(ps->fp,"/rm {rmoveto} bind def\n");
+  fprintf(ps->fp,"/r  {rlineto} bind def\n");
+  fprintf(ps->fp,"/f {fill} bind def\n");
+  fprintf(ps->fp,"/s {stroke} bind def\n");
+
+  ps->nrgb=0;
+  ps->maxrgb=0;
+  ps->rgb=NULL;
+  ps->gen_ybox=0;
+  ps->ostack=0;
   
-  ps=ffopen(fn,"w");
-  fprintf(ps,"%%!PS-Adobe-2.0 EPSF-1.2\n");
-  fprintf(ps,"%%%%Creator: GROMACS\n");
-  fprintf(ps,"%%%%Title: %s\n",fn);
-  fprintf(ps,"%%%%BoundingBox: %g %g %g %g\n",x1,y1,x2,y2);
-  fprintf(ps,"%%%%EndComments\n");
-  fprintf(ps,"/m {moveto} bind def\n");
-  fprintf(ps,"/l {lineto} bind def\n");
-  fprintf(ps,"/rm {rmoveto} bind def\n");
-  fprintf(ps,"/r  {rlineto} bind def\n");
-  fprintf(ps,"/f {fill} bind def\n");
-  fprintf(ps,"/s {stroke} bind def\n");
-
-  if (nrgb > 0) {
-    fprintf(stderr,"Warning: resetting color table in %s when opening %s\n",
-           __FILE__,fn);
-    nrgb=0;
-  }
-      
   return ps;
 }
 
-void ps_linewidth(FILE *ps, int lw)
+void ps_linewidth(t_psdata ps, int lw)
 {
-  fprintf(ps,"%d setlinewidth\n",lw);
+  fprintf(ps->fp,"%d setlinewidth\n",lw);
 }
 
-static void ps_defcolor(FILE *ps,real r,real g,real b,char *cname)
+static void ps_defcolor(t_psdata ps,real r,real g,real b,char *cname)
 {
-  fprintf(ps,"/%s {%g %g %g setrgbcolor} bind def\n",cname,r,g,b);
+  fprintf(ps->fp,"/%s {%g %g %g setrgbcolor} bind def\n",cname,r,g,b);
 }
 
-static void ps_selcolor(FILE *ps,char *cname)
+static void ps_selcolor(t_psdata ps,char *cname)
 {
-  fprintf(ps,"%s\n",cname);
+  fprintf(ps->fp,"%s\n",cname);
 }
 
-static char *i2a(int i)
-{
-  static char buf[12];
-  
-  sprintf(buf,"C%d",i);
-  
-  return buf;
-}
-
-static int search_col(FILE *ps,real r,real g,real b)
+static int search_col(t_psdata ps,real r,real g,real b)
 {
   int  i;
+  char buf[12];
   
-  for(i=0; (i<nrgb); i++)
-    if ((rgb[i].r == r) && (rgb[i].g == g) && (rgb[i].b == b))
+  for(i=0; (i<ps->nrgb); i++)
+    if ((ps->rgb[i].r == r) && (ps->rgb[i].g == g) && (ps->rgb[i].b == b))
       return i;
   
-  if (nrgb >= maxrgb) {
-    maxrgb+=100;
-    srenew(rgb,maxrgb);
+  if (ps->nrgb >= ps->maxrgb) {
+    ps->maxrgb+=100;
+    srenew(ps->rgb,ps->maxrgb);
   }
   
-  ps_defcolor(ps,r,g,b,i2a(nrgb));
-  fprintf(ps,"/B%d {%s b} bind def\n",nrgb,i2a(nrgb));
-  rgb[i].r=r;
-  rgb[i].g=g;
-  rgb[i].b=b;
-  nrgb++;
+  snprintf(buf,11,"C%d",ps->nrgb);
+  ps_defcolor(ps,r,g,b,buf);
+  fprintf(ps->fp,"/B%d {%s b} bind def\n",ps->nrgb,buf);
+  ps->rgb[i].r=r;
+  ps->rgb[i].g=g;
+  ps->rgb[i].b=b;
+  ps->nrgb++;
   
-  return nrgb-1;
+  return (ps->nrgb-1);
 }
 
-void ps_color(FILE *ps,real r,real g,real b)
+void ps_color(t_psdata ps,real r,real g,real b)
 {
-  ps_selcolor(ps,i2a(search_col(ps,r,g,b)));
+  char buf[12];
+  int i;
+  
+  i=search_col(ps,r,g,b);
+  
+  snprintf(buf,11,"C%d",i);
+  ps_selcolor(ps,buf);
 }
 
-void ps_rgb(FILE *ps,t_rgb *rgb)
+void ps_rgb(t_psdata ps,t_rgb *rgb)
 {
   ps_color(ps,rgb->r,rgb->g,rgb->b);
 }
 
-static real gen_ybox=0;
 
-void ps_init_rgb_nbox(FILE *ps,real xbox, real ybox)
+void ps_init_rgb_nbox(t_psdata ps,real xbox, real ybox)
 {
-  gen_ybox=ybox;
-  fprintf(ps,"/by {def currentpoint "
+  ps->gen_ybox=ybox;
+  fprintf(ps->fp,"/by {def currentpoint "
          "%g y r %g %g r %g y neg r %g %g r f y add moveto} bind def\n",
          0.0,xbox,0.0,0.0,-xbox,0.0);
   /* macro bn is used in ps_rgb_nbox to draw rectangular boxes */
 }
 
-void ps_rgb_nbox(FILE *ps,t_rgb *rgb,real n)
+void ps_rgb_nbox(t_psdata ps,t_rgb *rgb,real n)
 {
   int i;
   
   if ( n>2 ) {
     ps_rgb(ps,rgb);
-    fprintf(ps,"/y %g by\n",n*gen_ybox);
+    fprintf(ps->fp,"/y %g by\n",n*ps->gen_ybox);
     /* macro by is defined in ps_init_rgb_nbox */
   } else
     for (i=0; (i<n); i++)
@@ -149,48 +165,48 @@ void ps_rgb_nbox(FILE *ps,t_rgb *rgb,real n)
   
 }
 
-void ps_init_rgb_box(FILE *ps,real xbox, real ybox)
+void ps_init_rgb_box(t_psdata ps,real xbox, real ybox)
 {
-  fprintf(ps,"/b {currentpoint "
+  fprintf(ps->fp,"/b {currentpoint "
          "%g %g r %g %g r %g %g r %g %g r f %g add moveto} bind def\n",
          0.0,ybox,xbox,0.0,0.0,-ybox,-xbox,0.0,ybox);
   /* macro b is used in search_col to define macro B */
 }
 
-void ps_rgb_box(FILE *ps,t_rgb *rgb)
+void ps_rgb_box(t_psdata ps,t_rgb *rgb)
 {
-  fprintf(ps,"B%d\n",search_col(ps,rgb->r,rgb->g,rgb->b));
+  fprintf(ps->fp,"B%d\n",search_col(ps,rgb->r,rgb->g,rgb->b));
   /* macro B is defined in search_col from macro b */
 }
 
-void ps_lineto(FILE *ps,real x,real y)
+void ps_lineto(t_psdata ps,real x,real y)
 {
-  fprintf(ps,"%g %g l\n",x,y);
+  fprintf(ps->fp,"%g %g l\n",x,y);
 }
 
-void ps_linerel(FILE *ps,real dx,real dy)
+void ps_linerel(t_psdata ps,real dx,real dy)
 {
-  fprintf(ps,"%g %g r\n",dx,dy);
+  fprintf(ps->fp,"%g %g r\n",dx,dy);
 }
 
-void ps_moveto(FILE *ps,real x,real y)
+void ps_moveto(t_psdata ps,real x,real y)
 {
-  fprintf(ps,"%g %g m\n",x,y);
+  fprintf(ps->fp,"%g %g m\n",x,y);
 }
 
-void ps_moverel(FILE *ps,real dx,real dy)
+void ps_moverel(t_psdata ps,real dx,real dy)
 {
-  fprintf(ps,"%g %g rm\n",dx,dy);
+  fprintf(ps->fp,"%g %g rm\n",dx,dy);
 }
 
-void ps_line(FILE *ps,real x1,real y1,real x2,real y2)
+void ps_line(t_psdata ps,real x1,real y1,real x2,real y2)
 {
   ps_moveto(ps,x1,y1);
   ps_lineto(ps,x2,y2);
-  fprintf(ps,"s\n");
+  fprintf(ps->fp,"s\n");
 }
 
-static void do_box(FILE *ps,real x1,real y1,real x2,real y2)
+static void do_box(t_psdata ps,real x1,real y1,real x2,real y2)
 {
   ps_moveto(ps,x1,y1);
   ps_linerel(ps,0,(real)(y2-y1));
@@ -199,137 +215,131 @@ static void do_box(FILE *ps,real x1,real y1,real x2,real y2)
   ps_linerel(ps,(real)(x1-x2),0);
 }
 
-void ps_box(FILE *ps,real x1,real y1,real x2,real y2)
+void ps_box(t_psdata ps,real x1,real y1,real x2,real y2)
 {
   do_box(ps,x1,y1,x2,y2);
-  fprintf(ps,"s\n");
+  fprintf(ps->fp,"s\n");
 }
 
-void ps_fillbox(FILE *ps,real x1,real y1,real x2,real y2)
+void ps_fillbox(t_psdata ps,real x1,real y1,real x2,real y2)
 {
   do_box(ps,x1,y1,x2,y2);
-  fprintf(ps,"f\n");
+  fprintf(ps->fp,"f\n");
 }
 
-void ps_arc(FILE *ps,real x1,real y1,real rad,real a0,real a1)
+void ps_arc(t_psdata ps,real x1,real y1,real rad,real a0,real a1)
 {
-  fprintf(ps,"%g %g %g %g %g arc s\n",x1,y1,rad,a0,a1);
+  fprintf(ps->fp,"%g %g %g %g %g arc s\n",x1,y1,rad,a0,a1);
 }
 
-void ps_fillarc(FILE *ps,real x1,real y1,real rad,real a0,real a1)
+void ps_fillarc(t_psdata ps,real x1,real y1,real rad,real a0,real a1)
 {
-  fprintf(ps,"%g %g %g %g %g arc f\n",x1,y1,rad,a0,a1);
+  fprintf(ps->fp,"%g %g %g %g %g arc f\n",x1,y1,rad,a0,a1);
 }
 
-void ps_arcslice(FILE *ps,real xc,real yc,
+void ps_arcslice(t_psdata ps,real xc,real yc,
                 real rad1,real rad2,real a0,real a1)
 {
-  fprintf(ps,"newpath %g %g %g %g %g arc %g %g %g %g %g arcn closepath s\n",
+  fprintf(ps->fp,"newpath %g %g %g %g %g arc %g %g %g %g %g arcn closepath s\n",
          xc,yc,rad1,a0,a1,xc,yc,rad2,a1,a0);
 }
   
-void ps_fillarcslice(FILE *ps,real xc,real yc,
+void ps_fillarcslice(t_psdata ps,real xc,real yc,
                     real rad1,real rad2,real a0,real a1)
 {
-  fprintf(ps,"newpath %g %g %g %g %g arc %g %g %g %g %g arcn closepath f\n",
+  fprintf(ps->fp,"newpath %g %g %g %g %g arc %g %g %g %g %g arcn closepath f\n",
          xc,yc,rad1,a0,a1,xc,yc,rad2,a1,a0);
 }
   
-void ps_circle(FILE *ps,real x1,real y1,real rad)
+void ps_circle(t_psdata ps,real x1,real y1,real rad)
 {
   ps_arc(ps,x1,y1,rad,0,360);
 }
 
-char *fontnm[efontNR] = { 
-  "Times-Roman","Times-Italic",     "Times-Bold",    "Times-BoldItalic",
-  "Helvetica",  "Helvetica-Oblique","Helvetica-Bold","Helvetica-BoldOblique",
-  "Courier",    "Courier-Oblique",  "Courier-Bold",  "Courier-BoldOblique"
-};
-
-void ps_font(FILE *ps,int font,real size)
+void ps_font(t_psdata ps,int font,real size)
 {
   
   if ((font < 0) || (font > efontNR)) {
     fprintf(stderr,"Invalid Font: %d, using %s\n",font,fontnm[0]);
     font=0;
   }
-  fprintf(ps,"/%s findfont\n",fontnm[font]);
-  fprintf(ps,"%g scalefont setfont\n",size);
+  fprintf(ps->fp,"/%s findfont\n",fontnm[font]);
+  fprintf(ps->fp,"%g scalefont setfont\n",size);
 }
 
-void ps_strfont(FILE *ps,char *font,real size)
+void ps_strfont(t_psdata ps,char *font,real size)
 {
-  fprintf(ps,"/%s findfont\n",font);
-  fprintf(ps,"%g scalefont setfont\n",size);
+  fprintf(ps->fp,"/%s findfont\n",font);
+  fprintf(ps->fp,"%g scalefont setfont\n",size);
 }
 
-void ps_text(FILE *ps,real x1,real y1,char *str)
+void ps_text(t_psdata ps,real x1,real y1,char *str)
 {
   ps_moveto(ps,x1,y1);
-  fprintf(ps,"(%s) show\n",str);
+  fprintf(ps->fp,"(%s) show\n",str);
 }
 
-void ps_rotate(FILE *ps,bool bPlus)
+void ps_rotate(t_psdata ps,bool bPlus)
 {
   if (bPlus) 
-    fprintf(ps,"612.5 0 translate 90 rotate\n");
+    fprintf(ps->fp,"612.5 0 translate 90 rotate\n");
   else
-    fprintf(ps,"-90 rotate -612.5 0 translate\n");
+    fprintf(ps->fp,"-90 rotate -612.5 0 translate\n");
 }
 
-void ps_ctext(FILE *ps,real x1,real y1,char *str,int expos)
+void ps_ctext(t_psdata ps,real x1,real y1,char *str,int expos)
 {
   if (expos == eXLeft) {
     ps_text(ps,x1,y1,str);
     return;
   }
   ps_moveto(ps,x1,y1);
-  fprintf(ps,"(%s) stringwidth\n",str);
+  fprintf(ps->fp,"(%s) stringwidth\n",str);
   switch (expos) {
   case eXLeft:
-    fprintf(ps,"exch 0 exch pop exch\n");
+    fprintf(ps->fp,"exch 0 exch pop exch\n");
     break;
   case eXCenter:
-    fprintf(ps,"exch 2 div neg exch\n");
+    fprintf(ps->fp,"exch 2 div neg exch\n");
     break;
   case eXRight:
-    fprintf(ps,"exch neg exch\n");
+    fprintf(ps->fp,"exch neg exch\n");
     break;
   default:
     fatal_error(0,"invalid position index (expos=%d)",expos);
   }
-  fprintf(ps,"rmoveto (%s) show\n",str);
+  fprintf(ps->fp,"rmoveto (%s) show\n",str);
 }
 
-void ps_translate(FILE *ps,real x,real y)
+void ps_translate(t_psdata ps,real x,real y)
 {
-  fprintf(ps,"%g %g translate\n",x,y);
+  fprintf(ps->fp,"%g %g translate\n",x,y);
 }
 
-static int ostack=0;
-
-void ps_setorigin(FILE *ps)
+void ps_setorigin(t_psdata ps)
 {
-  fprintf(ps,"currentpoint dup 3 -1 roll dup 4 1 roll exch translate\n");
-  ostack++;
+  fprintf(ps->fp,"currentpoint dup 3 -1 roll dup 4 1 roll exch translate\n");
+  ps->ostack++;
 }
 
-void ps_unsetorigin(FILE *ps)
+void ps_unsetorigin(t_psdata ps)
 {
-  if (ostack <= 0)
+  if (ps->ostack <= 0)
     fatal_error(0,"No origin on stack!\n");
-  fprintf(ps,"neg exch neg exch translate\n");
-  ostack--;
+  fprintf(ps->fp,"neg exch neg exch translate\n");
+  ps->ostack--;
 }
 
-void ps_close(FILE *ps)
+void ps_close(t_psdata ps)
 {
-  fprintf(ps,"%%showpage\n");
-  fprintf(ps,"%%%%EOF\n");
-  fclose(ps);
+  fprintf(ps->fp,"%%showpage\n");
+  fprintf(ps->fp,"%%%%EOF\n");
+  fclose(ps->fp);
+  sfree(ps->rgb);
+  sfree(ps);
 }
 
-void ps_comment(FILE *ps,char *s)
+void ps_comment(t_psdata ps,char *s)
 {
-  fprintf(ps,"%%%% %s\n",s);
+  fprintf(ps->fp,"%%%% %s\n",s);
 }
index f3a3e87219b259f8e1d55700bfca14629fb1c7e8..029f64721f5714750dc8fd75da348f4c486053fa 100644 (file)
@@ -126,7 +126,7 @@ _vecinvsqrt_sse:
        mov eax, [ebp + 8]
        mov ebx, [ebp + 12]     
        mov ecx, [ebp + 16]
-    mov edx, ecx
+        mov edx, ecx
        movups xmm6,[sse_three]
        movups xmm7,[sse_minushalf]
     shr ecx, 3
index ddec4803daa980ca2f7a32f3f0bbe3abf0d8c695..0b17e24cc5def8e39675a228ccd3a01e57b2385e 100644 (file)
@@ -29,7 +29,6 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_xdrd_c = "$Id$";
 #include "typedefs.h"
 #include "xdrf.h"
 #include "fatal.h"
@@ -54,19 +53,17 @@ int xdr_real(XDR *xdrs,real *r)
 int xdr3drcoord(XDR *xdrs, real *fp, int *size, real *precision)
 {
 #ifdef DOUBLE
-  static float *ffp=NULL;
+  float *ffp;
   float  fprec;
   int    i,ret,isize;
   
   isize=*size*DIM;
-  if (ffp == NULL)  {
-    if (isize > 0) {
-      snew(ffp,isize);
-    }
-    else
-      fatal_error(0,"Don't know what to malloc for ffp (file %s, line %d)",
-                 __FILE__,__LINE__);
-  }
+  if (isize > 0) 
+    snew(ffp,isize);
+  else
+    fatal_error(0,"Don't know what to malloc for ffp (file %s, line %d)",
+               __FILE__,__LINE__);
+
   for(i=0; (i<isize); i++)
     ffp[i]=fp[i];
   fprec=*precision;
@@ -75,7 +72,8 @@ int xdr3drcoord(XDR *xdrs, real *fp, int *size, real *precision)
   *precision=fprec;
   for(i=0; (i<isize); i++)
     fp[i]=ffp[i];
-  
+
+  sfree(ffp);
   return ret;
 #else
   return xdr3dfcoord(xdrs,(float *)fp,size,(float *)precision);
index fd372ee8b62ba22a36df4f2c906ed0e4d6201286..d643a30235ca803bf1f1495ac7f05b77054091fd 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_xmlio_c = "$Id$";
+
 #ifdef HAVE_XML
 #include <libxml/parser.h>
 #include <libxml/tree.h>
@@ -46,10 +46,10 @@ static char *SRCID_xmlio_c = "$Id$";
 #include "symtab.h"
 #include "xmlio.h"
 
-static char *xyz_names[]    = { 
+static const char *xyz_names[]    = { 
   "x", "y", "z" 
 };
-static char *tensor_names[] = { 
+static const char *tensor_names[] = { 
   "xx", "xy", "xz", "yx", "yy", "yz", "zx", "zy", "zz"
 };
 
@@ -68,7 +68,7 @@ typedef struct {
   real value;
 } t_masstype;
 
-static char *xmltypes[] = { 
+static const char *xmltypes[] = { 
   NULL, 
   "XML_ELEMENT_NODE",
   "XML_ATTRIBUTE_NODE",
@@ -106,7 +106,7 @@ enum {
   exmlCOORDINATES, exmlVELOCITIES,  exmlFORCES,      exmlNR 
 };
   
-static char *exml_names[] = {
+static const char *exml_names[] = {
   "gromacs",
   /* Inputrec stuff */
   "parameters",  "output",     "coupling", "cutoff",   "pmeparm",
@@ -135,13 +135,13 @@ static int find_elem(char *name,int nr,char *names[])
   return i;
 }
        
-static char *sp(int n)
+static char *sp(int n, char buf[], int maxindent)
 {
-  static char buf[80];
   int i;
+  if(n>=maxindent)
+    n=maxindent-1;
   
-  /* Don't indent more than 80 characters */
-  n = n % 80;
+  /* Don't indent more than maxindent characters */
   for(i=0; (i<n); i++)
     buf[i] = ' ';
   buf[i] = '\0';
@@ -153,6 +153,7 @@ static void process_attr(FILE *fp,xmlAttrPtr attr,int elem,
                         int indent,t_xmlrec *xml)
 {
   char *attrname,*attrval;
+  char buf[100];
   
   while (attr != NULL) {
     attrname = (char *)attr->name;
@@ -193,7 +194,7 @@ static void process_attr(FILE *fp,xmlAttrPtr attr,int elem,
     case exmlFORCES: 
     default:
       if (fp)
-       fprintf(fp,"%sProperty: '%s' Value: '%s'\n",sp(indent),
+       fprintf(fp,"%sProperty: '%s' Value: '%s'\n",sp(indent,buf,99),
                attrname,attrval);
     }
     attr = attr->next;
@@ -204,13 +205,14 @@ static void process_attr(FILE *fp,xmlAttrPtr attr,int elem,
 static void process_tree(FILE *fp,xmlNodePtr tree,int indent,t_xmlrec *xml)
 {
   int elem;
+  char buf[100];
   
   while (tree != NULL) {
     switch (tree->type) {
     case XML_ELEMENT_NODE:
       elem = find_elem((char *)tree->name,exmlNR,exml_names);
       if (fp)
-       fprintf(fp,"%sElement node name %s\n",sp(indent),(char *)tree->name);
+       fprintf(fp,"%sElement node name %s\n",sp(indent,buf,99),(char *)tree->name);
       
       process_attr(fp,tree->properties,elem,indent+2,xml);
       
@@ -261,29 +263,19 @@ void read_xml(char *fn,int *step,real *t,real *lambda,
   sfree(xml);
 }
 
-static char *itoa(int i)
-{
-  static char buf[32];
-  sprintf(buf,"%d",i);
-  return buf;
-}
-
-static char *dtoa(double d)
-{
-  static char buf[32];
-  sprintf(buf,"%g",d);
-  return buf;
-}
-
 static void add_xml_int(xmlNodePtr ptr,char *name,int val)
 {
-  if (xmlSetProp(ptr,name,itoa(val)) == 0)
+  char buf[32];
+  sprintf(buf,"%d",val);
+  if (xmlSetProp(ptr,name,buf) == 0)
     fatal_error(0,"Setting %s %d",name,val);
 }
 
 static void add_xml_real(xmlNodePtr ptr,char *name,real val)
 {
-  if (xmlSetProp(ptr,name,dtoa(val)) == 0)
+  char buf[32];
+  sprintf(buf,"%g",val);
+  if (xmlSetProp(ptr,name,buf) == 0)
     fatal_error(0,"Setting %s %f",name,val);
 }
 
@@ -373,6 +365,7 @@ static void add_xml_inputrec(xmlNodePtr parent,t_inputrec *ir,t_atoms *atoms)
   add_xml_int(outputptr,"energy",ir->nstenergy);
   add_xml_int(outputptr,"x-xtc",ir->nstxtcout);
   add_xml_int(outputptr,"xtc-precision",ir->xtcprec);
+  add_xml_int(outputptr,"andersen_seed",ir->andersen_seed);
   
   tcptr = add_xml_child(irptr,exmlTCOUPLING);
   add_xml_char(tcptr,"algorithm",etcoupl_names[ir->etc]);
index 7e01b0eb4088647f389641d470d55bab8c06b22a..c7f99aa5a72104b84f1cfc0d7f4f2b05fcdc8dba 100644 (file)
@@ -29,7 +29,6 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_xmlio_h = "$Id$";
 extern void read_xml(char *fn,int *step,real *t,real *lambda,
                     t_inputrec *ir,rvec *box,int *natoms,
                     rvec **x,rvec **v,rvec **f,t_topology *top);
index cec276fbe8a3bb3cabc3ef7bd061551a3c746905..0008cc41adc83396d230cf37f6b202dd1be37642 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_xtcio_c = "$Id$";
+
 #include <string.h>
 #include "typedefs.h"
 #include "xdrf.h"
index 82a7685060f27b60f1029c0d331f77bee8e4c1af..96b75f47ba28cdb5c94f07407197e01857e8bd0e 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gnomes, ROck Monsters And Chili Sauce
  */
-static char *SRCID_xvgr_c = "$Id$";
+
 #include <string.h>
 #include <ctype.h>
 #include "sysstuff.h"
@@ -52,15 +52,17 @@ static bool use_xmgr()
   return (env!=NULL && strcmp(env,"xmgr")==0);
 } 
 
-FILE *xvgropen(char *fn,char *title,char *xaxis,char *yaxis)
+FILE *xvgropen(const char *fn,const char *title,const char *xaxis,const char *yaxis)
 {
   FILE *xvgr;
+  char pukestr[100];
+  
   time_t t;
   
   xvgr=(FILE *)ffopen(fn,"w");
   fprintf(xvgr,"# This file was created by %s\n",Program());
   fprintf(xvgr,"# which is part of G R O M A C S:\n");
-  fprintf(xvgr,"# %s\n",bromacs());
+  fprintf(xvgr,"# %s\n",bromacs(pukestr,99));
   time(&t);
   fprintf(xvgr,"# All this happened at: %s",ctime(&t));
   fprintf(xvgr,"#\n");
@@ -114,8 +116,8 @@ void xvgr_line_props(FILE *out, int NrSet, int LineStyle, int LineColor)
   fprintf(out, "@    s%d color %d\n", NrSet, LineColor);
 }
 
-static char *LocTypeStr[] = { "view", "world" };
-static char *BoxFillStr[] = { "none", "color", "pattern" };
+static const char *LocTypeStr[] = { "view", "world" };
+static const char *BoxFillStr[] = { "none", "color", "pattern" };
  
 void xvgr_box(FILE *out,
              int LocType,
@@ -174,30 +176,26 @@ real lsq_y_ax_b(int n, real x[], real y[], real *a, real *b)
     return 0;
 }
 
-static char *fgets3(FILE *fp)
+static char *fgets3(FILE *fp,char ptr[],int *len)
 {
-  static char *ptr = NULL;
-  static int  len  = STRLEN;
   char *p;
   int  slen;
-  
-  if (ptr==NULL)
-    snew(ptr,len);
 
-  if (fgets(ptr,len-1,fp) == NULL)
+  if (fgets(ptr,*len-1,fp) == NULL)
     return NULL;
   p = ptr;
   while ((strchr(ptr,'\n') == NULL) && (!feof(fp))) {
     /* This line is longer than len characters, let's increase len! */
-    len += STRLEN;
-    p   += STRLEN;
-    srenew(ptr,len);
+    *len += STRLEN;
+    p    += STRLEN;
+    srenew(ptr,*len);
     if (fgets(p-1,STRLEN,fp) == NULL)
       break;
   }
   slen = strlen(ptr);
   if (ptr[slen-1] == '\n')
     ptr[slen-1] = '\0';
+
   return ptr;
 }
 
@@ -229,13 +227,17 @@ int read_xvg(char *fn,real ***y,int *ny)
   int    k,line=0,nny,nx,maxx,rval;
   double lf;
   real   **yy=NULL;
-  
+  char  *tmpbuf;
+  int    len=STRLEN;
   *ny  = 0;
   nny  = 0;
   nx   = 0;
   maxx = 0;
   fp   = ffopen(fn,"r");
-  while ((ptr = fgets3(fp)) != NULL) {
+
+  snew(tmpbuf,len);
+
+  while ((ptr = fgets3(fp,tmpbuf,&len)) != NULL) {
     line++;
     trim(ptr);
     if ((ptr[0] != '@') && (ptr[0] != '#')) {
@@ -283,7 +285,8 @@ int read_xvg(char *fn,real ***y,int *ny)
   ffclose(fp);
   
   *y = yy;
-  
+  sfree(tmpbuf);
+
   return nx;
 }
 
index 4ddab07acd2a481cbd71604dfc4b55857343e964..0ce57f92dd03ea52c6d425bfd31fd99a6e5449dc 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_add_par_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <string.h>
 #include "typedefs.h"
 #include "smalloc.h"
index d563f0f3a4644aaa141ce76ce10ea120f287b84c..206b0b2470d246d7022d8308a3da011cf2fbc059 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _add_par_h
 #define _add_par_h
 
-static char *SRCID_add_par_h = "$Id$";
+
 #include "typedefs.h"
 #include "pdb2top.h"
 
index 552c3ccb39527338ba4a212d5029b2f138ef08f4..e79f1c5c6d7243a8ab21989d89262bc8559cce16 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_convparm_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <math.h>
 #include "sysstuff.h"
 #include "physics.h"
@@ -47,7 +49,7 @@ static void assign_param(t_functype ftype,t_iparams *new,
                         real old[MAXFORCEPARAM])
 {
   int i,j;
-  
+
   /* Set to zero */
   for(j=0; (j<MAXFORCEPARAM); j++)
     new->generic.buf[j]=0.0;
@@ -146,12 +148,39 @@ static void assign_param(t_functype ftype,t_iparams *new,
     new->orires.obs   = old[4];
     new->orires.kfac  = old[5];
     break;
+  case F_DIHRES:
+    new->dihres.label = old[0];
+    new->dihres.phi   = old[1];
+    new->dihres.dphi  = old[2];
+    new->dihres.kfac  = old[3];
+    new->dihres.power = old[4];
+    break;
   case F_RBDIHS:
     for (i=0; (i<NR_RBDIHS); i++) {
       new->rbdihs.rbcA[i]=old[i]; 
       new->rbdihs.rbcB[i]=old[NR_RBDIHS+i]; 
     }
     break;
+  case F_FOURDIHS:
+    /* Read the dihedral parameters to temporary arrays,
+     * and convert them to the computationally faster
+     * Ryckaert-Bellemans form.
+     */   
+    /* Use conversion formula for OPLS to Ryckaert-Bellemans: */
+    new->rbdihs.rbcA[0]=old[1]+0.5*(old[0]+old[2]);
+    new->rbdihs.rbcA[1]=0.5*(3.0*old[2]-old[0]);
+    new->rbdihs.rbcA[2]=4.0*old[3]-old[1];
+    new->rbdihs.rbcA[3]=-2.0*old[2];
+    new->rbdihs.rbcA[4]=-4.0*old[3];
+    new->rbdihs.rbcA[5]=0.0;
+
+    new->rbdihs.rbcB[0]=old[NR_FOURDIHS+1]+0.5*(old[NR_FOURDIHS+0]+old[NR_FOURDIHS+2]);
+    new->rbdihs.rbcB[1]=0.5*(3.0*old[NR_FOURDIHS+2]-old[NR_FOURDIHS+0]);
+    new->rbdihs.rbcB[2]=4.0*old[NR_FOURDIHS+3]-old[NR_FOURDIHS+1];
+    new->rbdihs.rbcB[3]=-2.0*old[NR_FOURDIHS+2];
+    new->rbdihs.rbcB[4]=-4.0*old[NR_FOURDIHS+3];
+    new->rbdihs.rbcB[5]=0.0;
+    break;    
   case F_SHAKE:
   case F_SHAKENC:
     new->shake.dA = old[0];
@@ -289,7 +318,7 @@ void convert_params(int atnr,t_params nbtypes[],
                 &maxtypes,TRUE,TRUE);
   enter_function(&(plist[F_POSRES]),(t_functype)F_POSRES,idef,
                 &maxtypes,FALSE,TRUE);
-                
+
   for(i=0; (i<F_NRE); i++) {
     flags = interaction_function[i].flags;
     if ((i != F_LJ) && (i != F_BHAM) && (i != F_POSRES) &&
index 45770783df90ab1ab0e47d7681d55e909b3ce27a..314d792e271bb6578f6e559955d73b16a6ee66c7 100644 (file)
 #ifndef _convparm_h
 #define _convparm_h
 
-static char *SRCID_convparm_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) convparm.h 1.2 12/16/92"
-#endif /* HAVE_IDENT */
 
 #include "typedefs.h"
 
index 28618c7f5688704e063f5a7ad4c056199a5e8bf5..696ae127850b66edda6f413d8144c797a277fb7c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_do_gct_c = "$Id$";
+
 #include "typedefs.h"
 #include "xmdrun.h"
 #include "block_tx.h"
index 77afd6797f5964df354bcfbde2d198a8b60d88ab..851e5b525d339902cac6c6c35d911375375a1af0 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_dum_parm_c = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 1c6725038fbe2dc30fdfefc03841b0e0f6a06175..1db336ba8080c1d94bbe77d12da2a16a26922e8d 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _dum_parm_h
 #define _dum_parm_h
 
-static char *SRCID_dum_parm_h = "$Id$";
+
 #include "typedefs.h"
 #include "grompp.h"
 
index 4067fc700f6c5747f57322422f4eb6d3feebcbf2..bc0ad02594426feee7b920379fa07a8424f2ae7f 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_ffscan_c = "$Id$";
+
 #include <math.h>
 #include "typedefs.h"
 #include "macros.h"
index d6f3385c3c985492f12020be894a1ae0fdd5f695..d4faafc62fdc206e827971838762de6a72a617fd 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_gctio_c = "$Id$";
+
 #include "typedefs.h"
 #include "xmdrun.h"
 #include "block_tx.h"
@@ -66,7 +66,7 @@ static int Name2eo(char *s)
   return res;
 }
 
-static char *NoYes[] = { "No", "Yes" };
+static const char *NoYes[] = { "No", "Yes" };
        
 static void send_tcr(int dest,t_coupl_rec *tcr)
 {
index 8530c79ecd8c64d212b709a665914198e024093f..3ce0c841752d531a21e3d412767bad15264b3bdd 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_gen_ad_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <math.h>
 #include <ctype.h>
 #include "sysstuff.h"
@@ -340,9 +342,10 @@ static void clean_dih(t_param *dih, int *ndih,t_param idih[],int nidih,
   snew(index,*ndih+1);
   if (bAlldih) {
     fprintf(stderr,"Keeping all generated dihedrals\n");
-    nind = *ndih+1;
+    nind = *ndih;
     for(i=0; i<nind; i++) 
       index[i] = i;
+    index[nind] = *ndih;
   } else {
     /* Make an index of all dihedrals over each bond */
     nind = 0;
@@ -389,6 +392,7 @@ static void clean_dih(t_param *dih, int *ndih,t_param idih[],int nidih,
       k++;
     }
   }
+
   for (i=k; i<*ndih; i++)
     strcpy(dih[i].s,"");
   *ndih = k;
@@ -777,11 +781,11 @@ void gen_pad(t_nextnb *nnb, t_atoms *atoms, int nrexcl, bool bH14,
   /* Sort angles with respect to j-i-k (middle atom first) */
   if (nang > 1)
     qsort(ang,nang,(size_t)sizeof(ang[0]),acomp);
-
+  
   /* Sort dihedrals with respect to j-k-i-l (middle atoms first) */
   if (ndih > 1)
     qsort(dih,ndih,(size_t)sizeof(dih[0]),dcomp);
-
+  
   /* Sort the pairs */
   if (npai > 1)
     qsort(pai,npai,(size_t)sizeof(pai[0]),pcomp);
@@ -798,7 +802,7 @@ void gen_pad(t_nextnb *nnb, t_atoms *atoms, int nrexcl, bool bH14,
 
   /* Sort the impropers */
   sort_id(nidih,idih);
-
   if (ndih > 0) {
     /* Remove dihedrals which are impropers
        and when bAlldih is not set remove multiple dihedrals over one bond.
@@ -806,7 +810,7 @@ void gen_pad(t_nextnb *nnb, t_atoms *atoms, int nrexcl, bool bH14,
     fprintf(stderr,"Before cleaning: %d dihedrals\n",ndih);
     clean_dih(dih,&ndih,idih,nidih,atoms,bAlldih);
   }
-  
+
   /* Now we have unique lists of angles and dihedrals 
    * Copy them into the destination struct
    */
index 23026e11daaaad8695cd58b264e4a382451c65d0..9e2bd31710a2d287914b9f15f37b5071deb739a4 100644 (file)
 #ifndef _gen_ad_h
 #define _gen_ad_h
 
-static char *SRCID_gen_ad_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) gen_ad.h 1.17 9/30/97"
-#endif /* HAVE_IDENT */
+
 #include "typedefs.h"
 #include "toputil.h"
 #include "topio.h"
index b60b5f3a8a52cf4f6b38e48fd56adc0a876d634e..4f8b5d724a06c6cfcbd7e04e15db177cfc9f8961 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_gen_dum_c = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -93,7 +93,7 @@ enum { DDB_CH3, DDB_NH3, DDB_NH2, DDB_PHE, DDB_TYR,
 
 typedef char t_dirname[STRLEN];
 
-static t_dirname ddb_dirnames[DDB_DIR_NR] = {
+static const t_dirname ddb_dirnames[DDB_DIR_NR] = {
   "CH3",
   "NH3",
   "NH2",
index 8a40401ffe02b115c884593d32a090c141682757..df0e509f2aa08cd3a4d3b2d8a99584326a82285b 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _gen_dum_h
 #define _gen_dum_h
 
-static char *SRCID_gen_dum_h = "$Id$";
+
 #include "typedefs.h"
 #include "grompp.h"
 #include "hackblock.h"
index 850bbc2815f69632702c8e17767b910e0865b291..46a5f170e9808b2fad9b869466e0c6376454bed1 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_genhydro_c = "$Id$";
+
 #include <time.h>
 #include <ctype.h>
 #include "assert.h"
@@ -140,19 +140,15 @@ static t_hackblock *get_hackblocks(t_atoms *pdba, int nah, t_hackblock ah[],
   return hb;
 }
 
-static char Hnum[] = "123456";
+static const char Hnum[] = "123456";
 
 static void expand_hackblocks_one(t_hackblock *hbr, char *atomname, 
                                  int *nabi, t_hack **abi, bool bN, bool bC)
 {
   int j, k, l, d;
   bool bIgnore;
-  /* recursion depth is recorded for debug purposes only: */
-  static int depth=-1;
   
-  depth++;
   /* we'll recursively add atoms to atoms */
-  if (debug) fprintf(debug,"\n[%d] %s:",depth,atomname);
   for(j=0; j < hbr->nhack; j++) {
     /* first check if we're in the N- or C-terminus, then we should ignore 
        all hacks involving atoms from resp. previous or next residue
@@ -209,7 +205,6 @@ static void expand_hackblocks_one(t_hackblock *hbr, char *atomname,
                                nabi, abi, bN, bC);
     }
   }
-  depth--;
 }
 
 static void expand_hackblocks(t_atoms *pdba, t_hackblock hb[], 
index 9d66a46483ae05711d8642d3b0c1bf2d94eebb28..9eac97aa55296cab1ed08aca8b481ef4b6f97f6b 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _genhydro_h
 #define _genhydro_h
 
-static char *SRCID_genhydro_h = "$Id$";
+
 #include "pdbio.h"
 #include "hackblock.h"
 
index 7419119529bb6d6092dedcf46f2085f889e6e6d9..259495c9f8b460ddfae882e3ddff540c012c1bb6 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_glaasje_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "typedefs.h"
index d07de406df65e482a865f1e9e014dc23602645af..6dcf5b39da96eac5380a21347fda3803b0bf37e3 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_glaasje_h = "$Id$";
+
 extern void do_glas(FILE *log,int start,int homenr,rvec x[],rvec f[],
                    t_forcerec *fr,t_mdatoms *md,int atnr,t_inputrec *ir,
                    real ener[]);
index beeeac7bed099c10c670d00ee38b8ed97b340bbe..7e708dac2c6395038294e9da78276942c9dbcc2b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_gmxcheck_c = "$Id$";
+
 #include <stdio.h>
 #include <string.h>
 #include <ctype.h>
index 9b7360c067ce30002cf453e5ad75ce7804b6f87b..c0db3b7c0ba198ba3fab599226f183ee093b50bd 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_gmxdump_c = "$Id$";
+
 #include <stdio.h>
 #include <string.h>
 #include <math.h>
@@ -51,7 +51,7 @@ static char *SRCID_gmxdump_c = "$Id$";
 #include "trnio.h"
 #include "txtdump.h"
 
-static void list_tpx(char *fn)
+static void list_tpx(char *fn, bool bShowNumbers)
 {
   int         step,natoms,fp,indent,i,j,**gcount,atot;
   real        t,lambda;
@@ -60,11 +60,11 @@ static void list_tpx(char *fn)
   t_inputrec  ir;
   t_tpxheader tpx;
   t_topology  top;
-  read_tpxheader(fn,&tpx);
+  read_tpxheader(fn,&tpx,TRUE,NULL,NULL);
   snew(x,tpx.natoms);
   snew(v,tpx.natoms);
   snew(f,tpx.natoms);
+
   read_tpx(fn,&step,&t,&lambda,
           tpx.bIr  ? &ir : NULL,
           tpx.bBox ? box : NULL,
@@ -83,7 +83,7 @@ static void list_tpx(char *fn)
     pr_rvecs(stdout,indent,"x",x,natoms);
     pr_rvecs(stdout,indent,"v",v,natoms);
     pr_rvecs(stdout,indent,"f",f,natoms);
-    pr_top(stdout,indent,"topology",&(top));
+    pr_top(stdout,indent,"topology",&(top),bShowNumbers);
   }
 
   snew(gcount,egcNR);
@@ -301,10 +301,10 @@ int main(int argc,char *argv[])
   CopyRight(stderr,argv[0]);
   parse_common_args(&argc,argv,0,NFILE,fnm,asize(pa),pa,
                    asize(desc),desc,0,NULL);
-  
-  pr_shownumbers(bShowNumbers);
+
+
   if (ftp2bSet(efTPX,NFILE,fnm)) 
-    list_tpx(ftp2fn(efTPX,NFILE,fnm));
+    list_tpx(ftp2fn(efTPX,NFILE,fnm),bShowNumbers);
     
   if (ftp2bSet(efTRX,NFILE,fnm)) 
     list_trx(ftp2fn(efTRX,NFILE,fnm),bXVG);
index fee02aee4e755bd4de4eacabc1c1a3a1efa4e6d6..0ba66fd0770529e51da547b95246d173b4ca28b6 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_grompp_c = "$Id$";
+
 #include <sys/types.h>
 #include <math.h>
 #include <string.h>
@@ -398,6 +398,11 @@ static int *new_status(char *topfile,char *topppfile,char *confin,
     if (bVerbose && i)
       fprintf(stderr,"removed %d orientation restraints\n",i);
   }
+  if (opts->eDihre == edrNone) {
+    i = rm_interactions(F_DIHRES,nrmols,molinfo);
+    if (bVerbose && i)
+      fprintf(stderr,"removed %d dihedral restraints\n",i);
+  }
   
   topcat(msys,nrmols,molinfo,ntab,tab,Nsim,Sims,bEnsemble);
   
@@ -546,8 +551,9 @@ static void gen_posres(t_params *pr,char *fn)
   sfree(v);
 }
 
-static int search_array(int atnr,int *n,int map[],int key,
-                       t_param param[],int ftype)
+static int 
+search_atomtypes(t_atomtype *at,int *n,int typelist[],int thistype,
+                t_param param[],int ftype)
 {
   int i,nn,nrfp,j,k,found;
 
@@ -555,13 +561,18 @@ static int search_array(int atnr,int *n,int map[],int key,
   nrfp  = NRFP(ftype);
 
   for(i=0; (i<nn); i++) {
-    if (map[i] == key) /* This type number has already been added */
+    if (typelist[i] == thistype) /* This type number has already been added */
       break;
     /* If not, check if the parameters are identical */
     found=1;
-    for(j=0;j<atnr && found;j++) {
-      for(k=0;k<nrfp && found;k++)
-       found=(param[atnr*map[i]+j].c[k]==param[atnr*key+j].c[k]);
+    for(j=0;j<at->nr && found;j++) {
+      /* Check nonbonded parameters */
+      for(k=0;k<nrfp && found;k++) 
+       found=(param[at->nr*typelist[i]+j].c[k]==param[at->nr*thistype+j].c[k]);
+      /* Check radius, volume, surftens */
+      found = found && ((at->radius[typelist[i]] == at->radius[thistype]) &&
+                       (at->vol[typelist[i]] == at->vol[thistype]) &&
+                       (at->surftens[typelist[i]] == at->surftens[thistype]));
     }
     if(found) 
       break;
@@ -569,10 +580,10 @@ static int search_array(int atnr,int *n,int map[],int key,
   
   if (i == nn) {
     if (debug)
-      fprintf(debug,"Renumbering atomtype %d to %d\n",key,nn);
-    if (nn == atnr)
+      fprintf(debug,"Renumbering atomtype %d to %d\n",thistype,nn);
+    if (nn == at->nr)
       fatal_error(0,"Atomtype horror n = %d, %s, %d",nn,__FILE__,__LINE__);
-    map[nn]=key;
+    typelist[nn]=thistype;
     nn++;
   }
   *n = nn;
@@ -581,14 +592,14 @@ static int search_array(int atnr,int *n,int map[],int key,
 }
 
 static int renum_atype(t_params plist[],t_topology *top,
-                      int atnr,t_inputrec *ir,bool bVerbose)
+                      t_atomtype *at,bool bVerbose)
 {
 
   int      i,j,k,l,mi,mj,nat,nrfp,ftype;
   t_param  *nbsnew;
-  int      *map;
+  int      *typelist;
 
-  snew(map,atnr);
+  snew(typelist,at->nr);
 
   if (bVerbose)
     fprintf(stderr,"renumbering atomtypes...\n");
@@ -597,6 +608,10 @@ static int renum_atype(t_params plist[],t_topology *top,
    * we want to reduce the number of atom types by merging 
    * ones with identical nonbonded interactions, in addition
    * to removing unused ones.
+   *
+   * With Generalized-Born electrostatics, or implicit solvent
+   * we also check that the atomtype radius, effective_volume
+   * and surface tension match.
    */
   
   /* Get nonbonded interaction type */
@@ -605,43 +620,56 @@ static int renum_atype(t_params plist[],t_topology *top,
   else
     ftype=F_BHAM;
    
-  /* Renumber atomtypes and meanwhile make a list of atomtypes.
-   * We provide the list of nonbonded parameters so search_array
+  /* Renumber atomtypes by first making a list of which ones are actually used.
+   * We provide the list of nonbonded parameters so search_atomtypes
    * can determine if two types should be merged. 
    */    
   nat=0;
   for(i=0; (i<top->atoms.nr); i++) {
     top->atoms.atom[i].type=
-      search_array(atnr,&nat,map,top->atoms.atom[i].type,plist[ftype].param,ftype);
+      search_atomtypes(at,&nat,typelist,top->atoms.atom[i].type,
+                      plist[ftype].param,ftype);
     top->atoms.atom[i].typeB=
-      search_array(atnr,&nat,map,top->atoms.atom[i].typeB,plist[ftype].param,ftype);
+      search_atomtypes(at,&nat,typelist,top->atoms.atom[i].typeB,
+                      plist[ftype].param,ftype);
   }
   
+  /* We now have a list of unique atomtypes in typelist */
+
   if (debug)
-    pr_ivec(debug,0,"map",map,nat);
-    
-  /* Renumber nlist */
+    pr_ivec(debug,0,"typelist",typelist,nat,TRUE);
     
+  /* Renumber nlist */ 
   nbsnew = NULL;
   snew(nbsnew,plist[ftype].nr);
+
   nrfp  = NRFP(ftype);
   
   for(i=k=0; (i<nat); i++) {
-    mi=map[i];
+    mi=typelist[i];
     for(j=0; (j<nat); j++,k++) {
-      mj=map[j];
+      mj=typelist[j];
       for(l=0; (l<nrfp); l++)
-       nbsnew[k].c[l]=plist[ftype].param[atnr*mi+mj].c[l];
+       nbsnew[k].c[l]=plist[ftype].param[at->nr*mi+mj].c[l];
     }
+    at->radius[i] = at->radius[mi];
+    at->vol[i] = at->vol[mi];
+    at->surftens[i] = at->surftens[mi];
   }
+  
   for(i=0; (i<nat*nat); i++) {
     for(l=0; (l<nrfp); l++)
       plist[ftype].param[i].c[l]=nbsnew[i].c[l];
   }
   plist[ftype].nr=i;
+  srenew(at->radius,nat);
+  srenew(at->vol,nat);
+  srenew(at->surftens,nat);
+
+  at->nr=nat;
+
   sfree(nbsnew);
-  sfree(map);
+  sfree(typelist);
   
   return nat;
 }
@@ -805,7 +833,8 @@ int main (int argc, char *argv[])
   char         fn[STRLEN],*mdparin;
   int          nerror;
   bool         bNeedVel,bGenVel;
-
+  bool         have_radius,have_vol,have_surftens;
+  
   t_filenm fnm[] = {
     { efMDP, NULL,  NULL,        ffOPTRD },
     { efMDP, "-po", "mdout",     ffWRITE },
@@ -823,7 +852,7 @@ int main (int argc, char *argv[])
   /* Command line options */
   static bool bVerbose=TRUE,bRenum=TRUE,bShuffle=FALSE;
   static bool bRmDumBds=TRUE,bSort=FALSE,bCheckPairs=FALSE;
-  static int  nnodes=1,maxwarn=10;
+  static int  i,nnodes=1,maxwarn=10;
   static real fr_time=-1;
   static char *cap=NULL;
   t_pargs pa[] = {
@@ -929,6 +958,29 @@ int main (int argc, char *argv[])
     }
   }
 
+  /* If we are doing GBSA, check that we got the parameters we need */
+  have_radius=have_vol=have_surftens=TRUE;
+  for(i=0;i<atype.nr;i++) {
+    have_radius=have_radius && (atype.radius[i]>0);
+    have_vol=have_vol && (atype.vol[i]>0);
+    have_surftens=have_surftens && (atype.surftens[i]>=0);
+  }
+  if(!have_radius && ir->coulombtype==eelGB) {
+    fprintf(stderr,"Can't do GB electrostatics; the forcefield is missing values for\n"
+               "atomtype radii, or they might be zero.");
+    nerror++;
+  }
+  if(!have_vol && ir->gb_algorithm==egbKARPLUS) {
+    fprintf(stderr,"Can't calculate Karplus Born radii; the forcefield is missing values\n"
+               " for atomtype effective volumes, or they might be zero.");
+    nerror++;
+  }
+  if(!have_surftens && ir->implicit_solvent!=eisNO) {
+    fprintf(stderr,"Can't do implicit solvent; the forcefield is missing values\n"
+               " for atomtype surface tension.");
+    nerror++;
+  }
+
   if (nerror) {
     print_warn_num();
     if (nerror==1)
@@ -955,8 +1007,20 @@ int main (int argc, char *argv[])
     clean_dum_bondeds(msys.plist,sys->atoms.nr,bRmDumBds);
   
   if (bRenum) 
-    atype.nr=renum_atype(plist, sys, atype.nr, ir, bVerbose);
+    atype.nr=renum_atype(plist, sys, &atype, bVerbose);
   
+  /* Copy the atomtype data to the topology atomtype list */
+  sys->atomtypes.nr=atype.nr;
+  snew(sys->atomtypes.radius,atype.nr);
+  snew(sys->atomtypes.vol,atype.nr);
+  snew(sys->atomtypes.surftens,atype.nr);
+
+  for(i=0;i<atype.nr;i++) {
+    sys->atomtypes.radius[i]=atype.radius[i];
+    sys->atomtypes.vol[i]=atype.vol[i];
+    sys->atomtypes.surftens[i]=atype.surftens[i];
+  }
+
   if (debug)
     pr_symtab(debug,0,"After renum_atype",&sys->symtab);
 
index 5d9d005bcc83922d56209d7ee7fbfc2383f066d6..0cc4603b4e0217d76eb756e64f1b9683cfecd131 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_h_db_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <string.h>
 #include "string2.h"
 #include "sysstuff.h"
@@ -44,8 +46,8 @@ static char *SRCID_h_db_c = "$Id$";
  * Here these number are given. Because arrays start at 0 an
  * extra dummy for index 0 is added 
  */
-/*                       1  2  3  4  5  6  7  8  9 */
-int ncontrol[12] = { -1, 3, 3, 3, 3, 4, 3, 1, 3, 3 };
+/*                                    1  2  3  4  5  6  7  8  9 */
+const int ncontrol[12] = { -1, 3, 3, 3, 3, 4, 3, 1, 3, 3 };
 
 int compaddh(const void *a,const void *b)
 {
index 8d4cffc7d4a8ec51a2ab4e33d3dbdde0d18cf73f..a6772d244f91fb39d78cd8c76874d5d4538e2ce4 100644 (file)
 #ifndef _h_db_h
 #define _h_db_h
 
-static char *SRCID_h_db_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) h_db.h 1.10 2/2/97"
-#endif /* HAVE_IDENT */
 #include "sysstuff.h"
 #include "hackblock.h"
 
 /* number of control atoms for each 'add' type */
-extern int ncontrol[];
+extern const int ncontrol[];
   
 /* functions for the h-database */
 
index 5e29eb51656a282165c31ff728456278f8321fc7..8e6990f010d403e93535652fcafd91be644f422f 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_hackblock_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <string.h>
 #include "hackblock.h"
 #include "smalloc.h"
@@ -37,8 +39,8 @@ static char *SRCID_hackblock_c = "$Id$";
 #include "string2.h"
 
 /* these MUST correspond to the enum in hackblock.h */
-char *btsNames[ebtsNR] = { "bonds", "angles", "dihedrals", "impropers", "exclusions" };
-int btsNiatoms[ebtsNR] = { 2,       3,        4,           4,          2 };
+const char *btsNames[ebtsNR] = { "bonds", "angles", "dihedrals", "impropers", "exclusions" };
+const int btsNiatoms[ebtsNR] = { 2,       3,        4,           4,          2 };
 
 static void free_t_bonded(t_rbonded *rb)
 {
index 4ab33c5f775dd0588adce8f6da99f501779077d3..baf035c9fadfd1d0bf03799a4cfe4002dbdca88c 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _hackblock_h
 #define _hackblock_h
 
-static char *SRCID_hackblock_h = "$Id$";
+
 #include "typedefs.h"
 #include "pdbio.h"
 #include "grompp.h"
@@ -42,8 +42,8 @@ static char *SRCID_hackblock_h = "$Id$";
 /* ebtsBONDS must be the first, new types can be added to the end */
 /* these *MUST* correspond to the arrays in hackblock.c */
 enum { ebtsBONDS, ebtsANGLES, ebtsPDIHS, ebtsIDIHS, ebtsEXCLS, ebtsNR };
-extern char *btsNames[ebtsNR];
-extern int btsNiatoms[ebtsNR];
+extern const char *btsNames[ebtsNR];
+extern const int btsNiatoms[ebtsNR];
 
 /* if changing any of these structs, make sure that all of the
    free/clear/copy/merge_t_* functions stay updated */
index b265ec29dbf276a8d185f403d9d6aa3bcc96a57e..b1e7a327b432fe943f4a3b9ae24d5e2aeeab99c6 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_hizzie_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <stdio.h>
 #include <string.h>
 #include "typedefs.h"
@@ -41,7 +43,7 @@ static char *SRCID_hizzie_c = "$Id$";
 #include "pdb2top.h"
 #include "string2.h"
 
-static int in_strings(char *key,int nstr,char **str)
+static int in_strings(char *key,int nstr,const char **str)
 {
   int j;
   
@@ -167,11 +169,11 @@ static void calc_ringh(rvec xattach,rvec xb,rvec xc,rvec xh)
 }
 
 void set_histp(t_atoms *pdba,rvec *x,real angle,real dist){
-  static char *prot_acc[] = {
+  static const char *prot_acc[] = {
     "O", "OD1", "OD2", "OE1", "OE2", "OG", "OG1", "OH", "OW"
   };
 #define NPA asize(prot_acc)
-  static char *prot_don[] = {
+  static const char *prot_don[] = {
     "N", "NH1", "NH2", "NE", "ND1", "ND2", "NE2", "NZ", "OG", "OG1", "OH", "NE1", "OW"
   };
 #define NPD asize(prot_don)
index 3e105f532c4a31111535b4970494ca812b3da03c..85a443165922a0effea1fa8951daaa9e8159e0d9 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _hizzie_h
 #define _hizzie_h
 
-static char *SRCID_hizzie_h = "$Id$";
+
 extern void set_histp(t_atoms *pdba,rvec *x,real angle,real distance);
 /* calculate HIStidine protonation state */
 
index 7c820189f423dd1c61a04c994503a97b8c54de13..23a6a7fadc8a51adfbf49478fd7fbe01640f7f3c 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_init_sh_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
 #include "xmdrun.h"
 #include "smalloc.h"
 #include "assert.h"
index 4f1d33367830228fd780ef7c808eabd7622fa948..f78cef83724b8eb9404c2472a1bb3aa305cd66ec 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_ion_data_h = "$Id$";
+
        
 typedef struct {
   real photo,coh,incoh,incoh_abs;
index d4f118ce12c6dc0f1b9c6a614293eae8a77ea253..15a281ecca2af5489a500a13e85ed90acc8070ba 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_ionize_c = "$Id$";
+
 #include <string.h>
 #include "smalloc.h"
 #include "typedefs.h"
@@ -56,7 +56,7 @@ typedef struct {
 /* Units are barn. They are converted to nm^2 by multiplying  */
 /* by 1e-10, which is done in Imax (ionize.c)                 */
 
-static t_cross   cross_sec_h[] = {
+static const t_cross   cross_sec_h[] = {
   { 2.63e-2,     1.01e-1,      5.49e-1,         7.12e-3 },
   { 9.79e-3,     6.18e-2,      5.83e-1,         9.60e-3 },
   { 4.55e-3,     4.16e-2,      5.99e-1,         1.19e-2 },
@@ -64,7 +64,7 @@ static t_cross   cross_sec_h[] = {
   { 1.12e-3,     1.96e-2,      6.09e-1,         1.73e-2 },
   { 4.16e-4,     1.13e-2,      6.07e-1,         2.23e-2 }
 };
-static t_cross   cross_sec_c[] = {
+static const t_cross   cross_sec_c[] = {
   { 1.99e+2,     5.88e+0,      2.29e+0,         3.06e-2 },
   { 8.01e+1,     4.22e+0,      2.56e+0,         4.38e-2 },
   { 3.92e+1,     3.26e+0,      2.74e+0,         5.72e-2 },
@@ -72,7 +72,7 @@ static t_cross   cross_sec_c[] = {
   { 1.06e+1,     1.97e+0,      3.04e+0,         9.15e-2 },
   { 4.15e+0,     1.30e+0,      3.20e+0,         1.24e-1 }
 };
-static t_cross   cross_sec_n[] = {
+static const t_cross   cross_sec_n[] = {
   { 3.91e+2,     8.99e+0,      2.49e+0,         3.43e-2 },
   { 1.59e+2,     6.29e+0,      2.86e+0,         5.01e-2 },
   { 7.88e+1,     4.76e+0,      3.10e+0,         6.57e-2 },
@@ -80,7 +80,7 @@ static t_cross   cross_sec_n[] = {
   { 2.16e+1,     2.82e+0,      3.46e+0,         1.05e-1 },
   { 8.52e+0,     1.88e+0,      3.65e+0,         1.43e-1 }
 };
-static t_cross   cross_sec_o[] = {
+static const t_cross   cross_sec_o[] = {
   { 6.90e+2,     1.33e+1,      2.66e+0,         3.75e-2 },
   { 2.84e+2,     9.21e+0,      3.14e+0,         5.62e-2 },
   { 1.42e+2,     6.85e+0,      3.44e+0,         7.43e-2 },
@@ -88,7 +88,7 @@ static t_cross   cross_sec_o[] = {
   { 3.95e+1,     3.97e+0,      3.87e+0,         1.18e-1 },
   { 1.57e+1,     2.64e+0,      4.10e+0,         1.61e-1 }
 };
-static t_cross   cross_sec_s[] = {
+static const t_cross   cross_sec_s[] = {
   { 1.10e+4,      5.54e+1,     3.98e+0,         5.42e-2 },
   { 4.91e+3,      4.29e+1,     4.71e+0,         8.38e-2 },
   { 2.58e+3,      3.36e+1,     5.32e+0,         1.16e-1 },
@@ -100,10 +100,10 @@ static t_cross   cross_sec_s[] = {
 typedef struct {
   char *name;
   int  nel;
-  t_cross *cross;
+  const t_cross *cross;
 } t_element;
 
-static t_element element[] = {
+static const t_element element[] = {
   { "H",   1, cross_sec_h },
   { "C",   6, cross_sec_c },
   { "N",   7, cross_sec_n },
@@ -129,7 +129,7 @@ typedef struct {
   real E_K,E_L,Prob_K,tau;
 } t_recoil;
 
-t_recoil recoil[] = {
+const t_recoil recoil[] = {
   { 0.0,    0.0,   0.0,   0},                
   { 0.0136, 0.0,   0.0,   0},
   { 0.0246, 0.0,   0.0,   0},
@@ -483,7 +483,8 @@ void ionize(FILE *fp,t_mdatoms *md,char **atomname[],real t,t_inputrec *ir,
   static int   dq_tot,nkd_tot,ephot,mode;
   static t_cross_atom *ca;
   static int   Eindex=-1;
-    
+  static t_Gaussdata gaussrand=NULL;
+  
   real factor,E_lost=0;
   real pt,ptot,pphot,pcoll[ecollNR],tmax;
   real hboxx,hboxy,rho2;
@@ -498,11 +499,12 @@ void ionize(FILE *fp,t_mdatoms *md,char **atomname[],real t,t_inputrec *ir,
     nphot    = ir->userreal2;  /* Intensity                             */
     width    = ir->userreal3;  /* Width of the peak (in time)           */
     rho      = ir->userreal4;  /* Diameter of the focal spot (nm)       */
-    ionize_seed = ir->userint1;   /* Random seed for stochastic ionization */
+    ionize_seed= ir->userint1;   /* Random seed for stochastic ionization */
     ephot    = ir->userint2;   /* Energy of the photons                 */
     mode     = ir->userint3;   /* Mode of ionizing                      */
     interval = 0.001*ir->userint4;   /* Interval between pulses (ps)    */
-     
+    gaussrand=init_gauss(ionize_seed);
+   
     if ((width <= 0) || (nphot <= 0))
       fatal_error(0,"Your parameters for ionization are not set properly\n"
                  "width (userreal3) = %f,  nphot (userreal2) = %f",
@@ -640,7 +642,8 @@ void ionize(FILE *fp,t_mdatoms *md,char **atomname[],real t,t_inputrec *ir,
        
        /* Get parameters for photoelestic effect */
        /* Note that in the article this is called 2 theta */
-       theta = DEG2RAD*gauss(70.0,26.0,&ionize_seed);
+       theta = DEG2RAD*gauss(gaussrand)*26.0+70.0;
+       
        phi   = 2*M_PI*rando(&ionize_seed);
        
        if (bL)
@@ -669,7 +672,7 @@ void ionize(FILE *fp,t_mdatoms *md,char **atomname[],real t,t_inputrec *ir,
            dv[m] -= factor*ddv[m];
        
          if (debug)
-           pr_rvec(debug,0,"ELL",dv,DIM);
+           pr_rvec(debug,0,"ELL",dv,DIM,TRUE);
          
          bIonize = TRUE;
        }
@@ -701,7 +704,7 @@ void ionize(FILE *fp,t_mdatoms *md,char **atomname[],real t,t_inputrec *ir,
            dv[ZZ] -= factor*cos(theta);
          */
          if (debug)
-           pr_rvec(debug,0,"INELL",dv,DIM);
+           pr_rvec(debug,0,"INELL",dv,DIM,TRUE);
        }
        break;
       }
index 3af2a82efccbbbd145d4e0e24739a90da751e642..f7ba11c2091b981d48adcce624209325af83dcf2 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _ionize_h
 #define _ionize_h
 
-static char *SRCID_ionize_h = "$Id$";
+
 #include <stdio.h>
 #include "typedefs.h"
 
index bfea153bc30ce6733aa006b676f99cd475cac13f..2f2c6816abf1719e61e2dee7d3de6688b977692c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_luck_c = "$Id$";
+
 #include <stdio.h>
 #include "copyrite.h"
 #include "string.h"
@@ -37,14 +37,15 @@ static char *SRCID_luck_c = "$Id$";
 
 int main(int argc,char *argv[])
 {
-
+  char quote[256];
+  
   /* Necessary to find the library directory before installation */
   set_program_name(argv[0]);
 
   if ( argc == 2 ) 
     if ( strcmp(argv[1],"-c")==0)
       CopyRight(stdout,argv[0]);
-  printf("%s\n",cool_quote());
+  printf("%s\n",cool_quote(quote,255,NULL));
   return 0;
 }
  
index 30b81ffdebceaa02d289c7c27868b1de3e779d53..17263d2a125d9845adb2b7b3b09955045ca91a19 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_md_c = "$Id$";
+
 #include <signal.h>
 #include <stdlib.h>
 #include "typedefs.h"
@@ -56,6 +56,7 @@ static char *SRCID_md_c = "$Id$";
 #include "xmdrun.h"
 #include "disre.h"
 #include "orires.h"
+#include "dihre.h"
 #include "pppm.h"
 #include "pme.h"
 #include "mdatoms.h"
@@ -160,6 +161,10 @@ void mdrunner(t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
   init_orires(stdlog,top->idef.il[F_ORIRES].nr,top->idef.il[F_ORIRES].iatoms,
              top->idef.iparams,x,mdatoms,&(parm->ir),mcr,fcd);
 
+  /* Dihedral Restraints */
+  init_dihres(stdlog,top->idef.il[F_DIHRES].nr,top->idef.il[F_DIHRES].iatoms,
+             top->idef.iparams,&(parm->ir),mcr,fcd);
+
   /* check if there are dummies */
   bDummies=FALSE;
   for(i=0; (i<F_NRE) && !bDummies; i++)
@@ -254,8 +259,8 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
   int        fp_ene=0,fp_trn=0,step;
   FILE       *fp_dgdl=NULL;
   time_t     start_t;
-  real       t,lambda,t0,lam0,SAfactor;
-  bool       bNS,bStopCM,bTYZ,bRerunMD,bNotLastFrame=FALSE,
+  real       t,lambda,t0,lam0;
+  bool       bNS,bSimAnn,bStopCM,bTYZ,bRerunMD,bNotLastFrame=FALSE,
              bFirstStep,bLastStep,bNEMD,do_log,bRerunWarnNoV=TRUE;
   tensor     force_vir,pme_vir,shake_vir;
   t_nrnb     mynrnb;
@@ -296,10 +301,10 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
   bFFscan  = (Flags & MD_FFSCAN) == MD_FFSCAN;
   
   /* Initial values */
-  init_md(cr,&parm->ir,parm->box,&t,&t0,&lambda,&lam0,&SAfactor,
+  init_md(cr,&parm->ir,parm->box,&t,&t0,&lambda,&lam0,
          &mynrnb,&bTYZ,top,
          nfile,fnm,&traj,&xtc_traj,&fp_ene,&fp_dgdl,&mdebin,grps,
-         force_vir,pme_vir,shake_vir,mdatoms,mu_tot,&bNEMD,&vcm,nsb);
+         force_vir,pme_vir,shake_vir,mdatoms,mu_tot,&bNEMD,&bSimAnn,&vcm,nsb);
   debug_gmx();
 
   /* Check for polarizable models */
@@ -360,10 +365,10 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
   ener[F_TEMP] = sum_ekin(&(parm->ir.opts),grps,parm->ekin,bTYZ);
   if(parm->ir.etc==etcBERENDSEN)
     berendsen_tcoupl(&(parm->ir.opts),grps,
-                    parm->ir.delta_t,SAfactor);
+                    parm->ir.delta_t);
   else if(parm->ir.etc==etcNOSEHOOVER)
     nosehoover_tcoupl(&(parm->ir.opts),grps,
-                     parm->ir.delta_t,SAfactor);
+                     parm->ir.delta_t);
   debug_gmx();
   
   /* Initiate data for the special cases */
@@ -390,6 +395,10 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
       fprintf(stderr,"starting mdrun '%s'\n%d steps, %8.1f ps.\n\n",
              *(top->name),parm->ir.nsteps,parm->ir.nsteps*parm->ir.delta_t);
   }
+
+  /* Initialize values for invmass, etc. */
+  update_mdatoms(mdatoms,lambda,TRUE);
+
   /* Set the node time counter to 0 after initialisation */
   start_time();
   debug_gmx();
@@ -472,7 +481,8 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
     /* Set values for invmass etc. This routine not parallellized, but hardly
      * ever used, only when doing free energy calculations.
      */
-    init_mdatoms(mdatoms,lambda,bFirstStep);
+    if(parm->ir.efep != efepNO)
+      update_mdatoms(mdatoms,lambda,FALSE); 
     
     clear_mat(force_vir);
     
@@ -535,14 +545,11 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
       else
        lambda = lam0 + step*parm->ir.delta_lambda;
     }
-    if (parm->ir.bSimAnn) {
-      SAfactor = 1.0  - t/parm->ir.zero_temp_time;
-      if (SAfactor < 0) 
-       SAfactor = 0;
-    }
+    if (bSimAnn) 
+      update_annealing_target_temp(&(parm->ir.opts),t);
 
     if (MASTER(cr) && do_log && !bFFscan)
-      print_ebin_header(log,step,t,lambda,SAfactor);
+      print_ebin_header(log,step,t,lambda);
     
     if (bDummies) 
       spread_dummy_f(log,x,f,&mynrnb,&top->idef,dummycomm,cr);
@@ -597,7 +604,7 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
     /* bOK = update(nsb->natoms,START(nsb),HOMENR(nsb),step,lambda,&ener[F_DVDL], */
     bOK = TRUE;
     update(nsb->natoms,START(nsb),HOMENR(nsb),step,lambda,&ener[F_DVDL],
-                parm,SAfactor,mdatoms,x,graph,f,buf,vold,vt,v,
+                parm,mdatoms,x,graph,f,buf,vold,vt,v,
                 top,grps,shake_vir,cr,&mynrnb,bTYZ,TRUE,edyn,&pulldata,bNEMD);
     if (!bOK && !bFFscan)
       fatal_error(0,"Constraint error: Shake, Lincs or Settle could not solve the constrains");
@@ -694,7 +701,7 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
       /* erase the terminate signal */
       terminate = 0;
     }
-
+      
     /* Do center of mass motion removal */
     if (bStopCM && !bFFscan) {
       check_cm_grp(log,vcm);
@@ -732,9 +739,9 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
      * target temp when doing simulated annealing
      */
     if(parm->ir.etc==etcBERENDSEN)
-      berendsen_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t,SAfactor);
+      berendsen_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t);
     else if(parm->ir.etc==etcNOSEHOOVER)
-      nosehoover_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t,SAfactor);
+      nosehoover_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t);
 
     /* Calculate pressure and apply LR correction if PPPM is used */
     calc_pres(fr->ePBC,parm->box,parm->ekin,parm->vir,parm->pres,
@@ -769,7 +776,7 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
 
     /* Output stuff */
     if (MASTER(cr) && !bFFscan) {
-      bool do_ene,do_dr,do_or;
+      bool do_ene,do_dr,do_or,do_dihr;
       
       upd_mdebin(mdebin,fp_dgdl,mdatoms->tmass,step,t,ener,parm->box,shake_vir,
                 force_vir,parm->vir,parm->pres,grps,mu_tot,
@@ -777,8 +784,9 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
       do_ene = do_per_step(step,parm->ir.nstenergy) || bLastStep;
       do_dr  = do_per_step(step,parm->ir.nstdisreout) || bLastStep;
       do_or  = do_per_step(step,parm->ir.nstorireout) || bLastStep;
-      print_ebin(fp_ene,do_ene,do_dr,do_or,do_log?log:NULL,step,t,
-                eprNORMAL,bCompact,mdebin,fcd,&(top->atoms));
+      do_dihr= do_per_step(step,parm->ir.nstdihreout) || bLastStep;
+      print_ebin(fp_ene,do_ene,do_dr,do_or,do_dihr,do_log?log:NULL,step,t,
+                eprNORMAL,bCompact,mdebin,fcd,&(top->atoms),&(parm->ir.opts));
       if (bVerbose)
        fflush(log);
     }
@@ -824,10 +832,10 @@ time_t do_md(FILE *log,t_commrec *cr,t_commrec *mcr,int nfile,t_filenm fnm[],
     sfree(ct);
   }
   if (MASTER(cr)) {
-    print_ebin(fp_ene,FALSE,FALSE,FALSE,log,step,t,
-              eprAVER,FALSE,mdebin,fcd,&(top->atoms));
-    print_ebin(fp_ene,FALSE,FALSE,FALSE,log,step,t,
-              eprRMS,FALSE,mdebin,fcd,&(top->atoms));
+    print_ebin(fp_ene,FALSE,FALSE,FALSE,FALSE,log,step,t,
+              eprAVER,FALSE,mdebin,fcd,&(top->atoms),&(parm->ir.opts));
+    print_ebin(fp_ene,FALSE,FALSE,FALSE,FALSE,log,step,t,
+              eprRMS,FALSE,mdebin,fcd,&(top->atoms),&(parm->ir.opts));
     close_enx(fp_ene);
     if (!bRerunMD && parm->ir.nstxtcout)
       close_xtc_traj();
index 4d996da8f2e67695913429b70a5f1aa94131e32b..be1e1cc1672184f831e30236d7bcfac5331d12f7 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_mdrun_c = "$Id$";
+
 #include "typedefs.h"
 #include "macros.h"
 #include "copyrite.h"
@@ -148,9 +148,13 @@ int main(int argc,char *argv[])
   static int  nDLB=0; 
   static int  nnodes=1;
   static int  nstepout=10;
+  static int  nthreads=1;
+
   static t_pargs pa[] = {
     { "-np",      FALSE, etINT, {&nnodes},
       "Number of nodes, must be the same as used for grompp" },
+    { "-nt",      FALSE, etINT, {&nthreads},
+      "Number of threads to start on each node" },
     { "-v",       FALSE, etBOOL,{&bVerbose},  
       "Be loud and noisy" },
     { "-compact", FALSE, etBOOL,{&bCompact},  
@@ -185,6 +189,10 @@ int main(int argc,char *argv[])
   if (nnodes > 1) 
     fatal_error(0,"GROMACS compiled without MPI support - can't do parallel runs");
 #endif
+#ifndef USE_THREADS
+  if(nthreads > 1)
+    fatal_error(0,"GROMACS compiled without threads support - can only use one thread");
+#endif
 
   open_log(ftp2fn(efLOG,NFILE,fnm),cr);
 
index a5cb9340632c7f5e4516174808fc463ca460f840..81351d0ef3336db70380d18dbe314adec9c095a5 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_mk_ghat_c = "$Id$";
+
 #include <math.h>
 #include <stdio.h>
 #include "copyrite.h"
index 27b82d913bc4ac0358a55ff8dff101cc6cd06d5e..85653bdeb929aa802fcb55fdaa5db074834df4e2 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_nm2type_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include "maths.h"
 #include "macros.h"
 #include "copyrite.h"
index 8924977a0caf84212bb51faa065b77e0f384cba0..455ba83c691088f5cbdf764949539a0aaf68ff7f 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_pdb2gmx_c = "$Id$";
+
 #include <time.h>
 #include <ctype.h>
 #include "assert.h"
@@ -63,7 +63,7 @@ static char *SRCID_pdb2gmx_c = "$Id$";
 #include "hizzie.h"
 
 
-static char *select_res(int nr,int resnr,char *name[],char *expl[],char *title)
+static const char *select_res(int nr,int resnr,const char *name[],const char *expl[],char *title)
 {
   int sel=0;
 
@@ -78,11 +78,11 @@ static char *select_res(int nr,int resnr,char *name[],char *expl[],char *title)
   return name[sel];
 }
 
-static char *get_asptp(int resnr)
+static const char *get_asptp(int resnr)
 {
   enum { easp, easpH, easpNR };
-  static char *lh[easpNR] = { "ASP", "ASPH" };
-  static char *expl[easpNR] = {
+  const char *lh[easpNR] = { "ASP", "ASPH" };
+  const char *expl[easpNR] = {
     "Not protonated (charge -1)",
     "Protonated (charge 0)"
   };
@@ -90,11 +90,11 @@ static char *get_asptp(int resnr)
   return select_res(easpNR,resnr,lh,expl,"ASPARTIC ACID");
 }
 
-static char *get_glutp(int resnr)
+static const char *get_glutp(int resnr)
 {
   enum { eglu, egluH, egluNR };
-  static char *lh[egluNR] = { "GLU", "GLUH" };
-  static char *expl[egluNR] = {
+  const char *lh[egluNR] = { "GLU", "GLUH" };
+  const char *expl[egluNR] = {
     "Not protonated (charge -1)",
     "Protonated (charge 0)"
   };
@@ -102,11 +102,11 @@ static char *get_glutp(int resnr)
   return select_res(egluNR,resnr,lh,expl,"GLUTAMIC ACID");
 }
 
-static char *get_lystp(int resnr)
+static const char *get_lystp(int resnr)
 {
   enum { elys, elysH, elysNR };
-  static char *lh[elysNR] = { "LYS", "LYSH" };
-  static char *expl[elysNR] = {
+  const  char *lh[elysNR] = { "LYS", "LYSH" };
+  const char *expl[elysNR] = {
     "Not protonated (charge 0)",
     "Protonated (charge +1)"
   };
@@ -114,11 +114,11 @@ static char *get_lystp(int resnr)
   return select_res(elysNR,resnr,lh,expl,"LYSINE");
 }
 
-static char *get_cystp(int resnr)
+static const char *get_cystp(int resnr)
 {
   enum { ecys, ecysH, ecysNR };
-  static char *lh[ecysNR] = { "CYS", "CYSH" };
-  static char *expl[ecysNR] = {
+  const char *lh[ecysNR] = { "CYS", "CYSH" };
+  const char *expl[ecysNR] = {
     "Cysteine in disulfide bridge",
     "Protonated"
   };
@@ -127,9 +127,9 @@ static char *get_cystp(int resnr)
 
 }
 
-static char *get_histp(int resnr)
+static const char *get_histp(int resnr)
 {
-  static char *expl[ehisNR] = {
+  const char *expl[ehisNR] = {
     "H on ND1 only",
     "H on NE2 only",
     "H on ND1 and NE2",
@@ -155,11 +155,12 @@ static void rename_pdbres(t_atoms *pdba,char *oldnm,char *newnm,
 }
 
 static void rename_pdbresint(t_atoms *pdba,char *oldnm,
-                            char *gettp(int),bool bFullCompare,
+                            const char *gettp(int),bool bFullCompare,
                             t_symtab *symtab)
 {
   int  i;
-  char *ptr,*resnm;
+  const char *ptr;
+  char *resnm;
   
   for(i=0; i<pdba->nres; i++) {
     resnm=*pdba->resname[i];
@@ -588,7 +589,7 @@ int main(int argc, char *argv[])
   char       **gnames;
   matrix     box;
   rvec       box_space;
-  char       *ff;
+  char       ff[256];
   int        i,j,k,l,nrtp;
   int        *swap_index,si;
   int        bts[ebtsNR];
@@ -597,7 +598,7 @@ int main(int argc, char *argv[])
   t_symtab   symtab;
   t_atomtype *atype;
   char       fn[256],*top_fn,itp_fn[STRLEN],posre_fn[STRLEN],buf_fn[STRLEN];
-  char       molname[STRLEN],title[STRLEN],resname[STRLEN];
+  char       molname[STRLEN],title[STRLEN],resname[STRLEN],quote[256];
   char       *c;
   int        nah,nNtdb,nCtdb,ntdblist;
   t_hackblock *ntdb,*ctdb,**tdblist;
@@ -873,7 +874,7 @@ int main(int argc, char *argv[])
   
   check_occupancy(&pdba_all,opt2fn("-f",NFILE,fnm));
   
-  ff=choose_ff();
+  choose_ff(ff,255);
   printf("Using %s force field\n",ff);
   
   /* Read atomtypes... */
@@ -1089,7 +1090,7 @@ int main(int argc, char *argv[])
        sprintf(fn,"chain.pdb");
       else
        sprintf(fn,"chain_%c.pdb",cc->chain);
-      write_sto_conf(fn,cool_quote(),pdba,x,NULL,box);
+      write_sto_conf(fn,cool_quote(quote,255,NULL),pdba,x,NULL,box);
     }
   }
   
index 162a8ea4ed5ff7d103c3efa14fef9c7956000f6a..73d08aa3119b867489ddb6257fc616817942e76c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_pdb2top_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include <ctype.h>
@@ -59,7 +59,7 @@ static char *SRCID_pdb2top_c = "$Id$";
 #include "add_par.h"
 
 /* this must correspond to enum in pdb2top.h */
-char *hh[ehisNR]   = { "HISA", "HISB", "HISH", "HIS1" };
+const char *hh[ehisNR]   = { "HISA", "HISB", "HISH", "HIS1" };
 
 static int missing_atoms(t_restp *rp, int resnr,
                         t_atoms *at, int i0, int i, bool bCTer)
@@ -104,10 +104,9 @@ bool is_int(double x)
   return (fabs(x-ix) < tol);
 }
 
-char *choose_ff(void)
+char *choose_ff(char ffbuf[],int size)
 {
   typedef struct { char *desc,*fn; } t_fff;
-  static  char *fnsel;
   FILE    *in;
   t_fff   *fff;
   int     i,nff,sel;
@@ -140,7 +139,7 @@ char *choose_ff(void)
   else
     sel=0;
 
-  fnsel=strdup(fff[sel].fn);
+  strncpy(ffbuf,fff[sel].fn,size-1);
 
   for(i=0; (i<nff); i++) {
     sfree(fff[i].desc);
@@ -148,7 +147,7 @@ char *choose_ff(void)
   }
   sfree(fff);
   
-  return fnsel;
+  return ffbuf;
 }
 
 static int name2type(t_atoms *at, int **cgnr, t_atomtype *atype, 
@@ -234,9 +233,11 @@ static void print_top_heavy_H(FILE *out, real mHmult)
 
 void print_top_comment(FILE *out,char *filename,char *title,bool bITP)
 {
+  char tmp[256]; 
+  
   nice_header(out,filename);
   fprintf(out,";\tThis is your %stopology file\n",bITP ? "include " : "");
-  fprintf(out,";\t%s\n",title[0]?title:cool_quote());
+  fprintf(out,";\t%s\n",title[0]?title:cool_quote(tmp,255,NULL));
   fprintf(out,";\n");
 }
 
index 3687720817f8106eddfeee1781b1d551c210381e..a09b32780c63b8fc1c73b4903dbf420a294b74ed 100644 (file)
 #ifndef _pdb2top_h
 #define _pdb2top_h
 
-static char *SRCID_pdb2top_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) pdb2top.h 1.19 2/2/97"
-#endif /* HAVE_IDENT */
 #include "typedefs.h"
 #include "toputil.h"
 #include "hackblock.h"
 
 /* this *MUST* correspond to array in pdb2top.c */
 enum { ehisA, ehisB, ehisH, ehis1, ehisNR };
-extern char *hh[ehisNR];
+extern const char *hh[ehisNR];
 
 typedef struct {
   int  res1,res2;
@@ -55,7 +51,7 @@ typedef struct {
   int  nr;
 } t_mols;
 
-extern char *choose_ff(void);
+extern char *choose_ff(char buf[],int sz);
 /* Strange place for this function... */
 
 extern void print_top_comment(FILE *out,char *filename,char *title,bool bITP);
index 5afcaeeda942f62a1a7f12b4640586b0448d1c58..b06bb00726803177c49b0f7331d38a158aa914c5 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_pgutil_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index c793d8d88dafecf956e4c4d80dfe2b7b00d85456..20a56085f64ad90bed701ba7bcd6bc1a92db9c8a 100644 (file)
 #ifndef _pgutil_h
 #define _pgutil_h
 
-static char *SRCID_pgutil_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) pgutil.h 1.14 9/30/97"
-#endif /* HAVE_IDENT */
 #include "typedefs.h"
 
 extern atom_id search_atom(char *type,int start,
index 6f6b5e2d39ea0a83c17f9e77b9c4d7bcd99d8a2b..7e694a9a83be7ec154cd0d4f7a0e058d9db7f957 100644 (file)
@@ -29,7 +29,6 @@
  * And Hey:\r
  * GROningen Mixture of Alchemy and Childrens' Stories\r
  */\r
-static char *SRCID_protonate_c = "$Id$";\r
 #include <math.h>\r
 #include "typedefs.h"\r
 #include "macros.h"\r
index 69d1066191a0b0b5de45612e9969d8537d5733f1..e667e265ad8478f068403ef14be7e6620e02de84 100644 (file)
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_readir_c = "$Id$";
+
 #include <ctype.h>
 #include <stdlib.h>
+#include <limits.h>
 #include "sysstuff.h"
 #include "smalloc.h"
 #include "typedefs.h"
@@ -43,7 +44,7 @@ static char *SRCID_readir_c = "$Id$";
 #include "symtab.h"
 #include "string2.h"
 #include "readinp.h"
-#include "readir.h"
+#include "readir.h" 
 #include "toputil.h"
 #include "index.h"
 #include "network.h"
@@ -64,6 +65,8 @@ static char tcgrps[STRLEN],tau_t[STRLEN],ref_t[STRLEN],
   acc[STRLEN],accgrps[STRLEN],freeze[STRLEN],frdim[STRLEN],
   energy[STRLEN],user1[STRLEN],user2[STRLEN],vcm[STRLEN],xtc_grps[STRLEN],
   orirefitgrp[STRLEN],egexcl[STRLEN];
+static char anneal[STRLEN],anneal_npoints[STRLEN],
+  anneal_time[STRLEN],anneal_temp[STRLEN];
 static char efield_x[STRLEN],efield_xt[STRLEN],efield_y[STRLEN],
   efield_yt[STRLEN],efield_z[STRLEN],efield_zt[STRLEN];
 
@@ -196,11 +199,13 @@ void check_ir(t_inputrec *ir, t_gromppopts *opts,int *nerror)
                   "changing \"yes\" to \"Berendsen\"\n");
   }
   
-  if(ir->etc==etcNOSEHOOVER && ir->epc==epcBERENDSEN) {
+  if((ir->etc==etcNOSEHOOVER || ir->etc==etcANDERSEN || ir->etc==etcANDERSENINTERVAL ) 
+     && ir->epc==epcBERENDSEN) {
     sprintf(warn_buf,"Using Berendsen pressure coupling invalidates the "
-           "true ensemble for the Nose-Hoover thermostat");
+           "true ensemble for the thermostat");
     warning(NULL);
   }
+
   /* ELECTROSTATICS */
   /* More checks are in triple check (grompp.c) */
   sprintf(err_buf,"epsilon_r must be >= 0 instead of %g\n",ir->epsilon_r);
@@ -258,11 +263,21 @@ void check_ir(t_inputrec *ir, t_gromppopts *opts,int *nerror)
   if((ir->coulombtype == eelSHIFT) || (ir->coulombtype == eelSWITCH) ||
      (ir->vdwtype == evdwSWITCH) || (ir->vdwtype == evdwSHIFT)) 
     if((ir->rlist == ir->rcoulomb) || (ir->rlist == ir->rvdw)) {
-      sprintf(warn_buf,"For strict energy conservation with switch/shift potentials, rlist should be 0.1 to 0.3 nm larger than rcoulomb/rvdw.");
+      sprintf(warn_buf,"For energy conservation with switch/shift potentials, rlist should be 0.1 to 0.3 nm larger than rcoulomb/rvdw.");
       warning(NULL);
     }
 
+  /* CONSTRAINTS */
+  if(ir->etc==etcNO && ir->eConstrAlg==estLINCS && ir->nLincsIter==1) {
+    sprintf(warn_buf,"For energy conservation with LINCS, lincs_iter should be 2 or larger.\n"
+           "You can safely ignore this if your system doesn't have any LINCS-constrained bonds;\n"
+           "for water molecules we normally use the analytical SETTLE algorithm instead."); 
+    warning(NULL);
+  }
+  if(((ir->eI == eiSteep) || (ir->eI == eiCG)) && (ir->nLincsIter<4)) {
+    sprintf(warn_buf,"For energy minimization with constraints, lincs_iter should be 4 to 8.");
+    warning(NULL);
+  }
 }
 
 static int str_nelem(char *str,int maxptr,char *ptr[])
@@ -311,6 +326,7 @@ void get_ir(char *mdparin,char *mdparout,
 
   snew(dumstr[0],STRLEN);
   snew(dumstr[1],STRLEN);
+
   CCTYPE ("VARIOUS PREPROCESSING OPTIONS");
   STYPE ("title",      opts->title,    NULL);
   STYPE ("cpp",                opts->cpp,      "/lib/cpp");
@@ -323,6 +339,8 @@ void get_ir(char *mdparin,char *mdparout,
   RTYPE ("tinit",      ir->init_t,     0.0);
   RTYPE ("dt",         ir->delta_t,    0.001);
   ITYPE ("nsteps",      ir->nsteps,     0);
+  CTYPE ("after checkpoint or tpbconv restart we can start on step > 0");
+  ITYPE ("init_step",   ir->init_step,  0);
   CTYPE ("mode for center of mass motion removal");
   EETYPE("comm-mode",   ecm_mode,       ecm_names, nerror, TRUE);
   CTYPE ("number of steps for center of mass motion removal");
@@ -354,6 +372,8 @@ void get_ir(char *mdparin,char *mdparout,
   ITYPE ("nstxout",    ir->nstxout,    100);
   ITYPE ("nstvout",    ir->nstvout,    100);
   ITYPE ("nstfout",    ir->nstfout,    0);
+  CTYPE ("Checkpointing helps you continue after crashes");
+  ITYPE ("nstcheckpoint",  ir->nstcheckpoint,  1000);
   CTYPE ("Output frequency for energies to log file and energy file");
   ITYPE ("nstlog",     ir->nstlog,     100);
   ITYPE ("nstenergy",   ir->nstenergy,  100);
@@ -394,7 +414,8 @@ void get_ir(char *mdparin,char *mdparout,
   CTYPE ("cut-off lengths");
   RTYPE ("rvdw-switch",        ir->rvdw_switch,        0.0);
   RTYPE ("rvdw",       ir->rvdw,       1.0);
-    
+
+
   CTYPE ("Apply long range dispersion corrections for Energy and Pressure");
   EETYPE("DispCorr",    ir->eDispCorr,  edispc_names, nerror, TRUE);
   CTYPE ("Spacing for the PME/PPPM FFT grid");
@@ -410,6 +431,20 @@ void get_ir(char *mdparin,char *mdparout,
   RTYPE ("epsilon_surface", ir->epsilon_surface, 0.0);
   EETYPE("optimize_fft",ir->bOptFFT,  yesno_names, nerror, TRUE);
 
+  CCTYPE ("GENERALIZED BORN ELECTROSTATICS"); 
+  CTYPE ("Algorithm for calculating Born radii");
+  EETYPE("gb_algorithm", ir->gb_algorithm, egb_names, nerror, TRUE);
+  CTYPE ("Frequency of calculating the Born radii inside rlist");
+  ITYPE ("nstgbradii", ir->nstgbradii, 1);
+  CTYPE ("Cutoff for Born radii calculation; the contribution from atoms");
+  CTYPE ("between rlist and rgbradii is updated every nstlist steps");
+  RTYPE ("rgbradii",  ir->rgbradii, 2.0);
+  CTYPE ("Salt concentration in M for Generalized Born models");
+  RTYPE ("gb_saltconc",  ir->gb_saltconc, 0.0); 
+
+  CCTYPE("IMPLICIT SOLVENT (for use with Generalized Born electrostatics)");
+  EETYPE("implicit_solvent", ir->implicit_solvent, eis_names, nerror, TRUE);
+  
   /* Coupling stuff */
   CCTYPE ("OPTIONS FOR WEAK COUPLING ALGORITHMS");
   CTYPE ("Temperature coupling");
@@ -427,11 +462,19 @@ void get_ir(char *mdparin,char *mdparout,
   STYPE ("compressibility",    dumstr[0],      NULL);
   STYPE ("ref-p",       dumstr[1],      NULL);
   
+  CTYPE ("Random seed for Andersen thermostat");
+  ITYPE ("andersen_seed", ir->andersen_seed, 815131);
+
   /* Simulated annealing */
-  CCTYPE ("SIMULATED ANNEALING CONTROL");
-  EETYPE("annealing",  ir->bSimAnn,    yesno_names, nerror, TRUE);
-  CTYPE ("Time at which temperature should be zero (ps)");
-  RTYPE ("zero-temp_time",ir->zero_temp_time,0.0);
+  CCTYPE("SIMULATED ANNEALING");
+  CTYPE ("Type of annealing for each temperature group (no/single/periodic)");
+  STYPE ("annealing",   anneal,      NULL);
+  CTYPE ("Number of time points to use for specifying annealing in each group");
+  STYPE ("annealing_npoints", anneal_npoints, NULL);
+  CTYPE ("List of times at the annealing points for each group");
+  STYPE ("annealing_time",       anneal_time,       NULL);
+  CTYPE ("Temp. at each annealing point, for each group.");
+  STYPE ("annealing_temp",  anneal_temp,  NULL);
   
   /* Startup run */
   CCTYPE ("GENERATE VELOCITIES FOR STARTUP RUN");
@@ -452,6 +495,10 @@ void get_ir(char *mdparin,char *mdparout,
   RTYPE ("shake-tol", ir->shake_tol, 0.0001);
   CTYPE ("Highest order in the expansion of the constraint coupling matrix");
   ITYPE ("lincs-order", ir->nProjOrder, 4);
+  CTYPE ("Number of iterations in the final step of LINCS. 1 is fine for");
+  CTYPE ("normal simulations, but use 2 to conserve energy in NVE runs.");
+  CTYPE ("For energy minimization with constraints it should be 4 to 8.");
+  ITYPE ("lincs-iter", ir->nLincsIter, 1);
   CTYPE ("Lincs will write a warning to the stderr if in one step a bond"); 
   CTYPE ("rotates over more degrees than");
   RTYPE ("lincs-warnangle", ir->LincsWarnAngle, 30.0);
@@ -483,6 +530,12 @@ void get_ir(char *mdparin,char *mdparout,
   STYPE ("orire-fitgrp",orirefitgrp,    NULL);
   CTYPE ("Output frequency for trace(SD) to energy file");
   ITYPE ("nstorireout", ir->nstorireout, 100);
+  CTYPE ("Dihedral angle restraints: No, Simple or Ensemble");
+  EETYPE("dihre",       opts->eDihre,   edisre_names, nerror, TRUE);
+  RTYPE ("dihre-fc",   ir->dihre_fc,   1000.0);
+  RTYPE ("dihre-tau",  ir->dihre_tau,  0.0);
+  CTYPE ("Output frequency for dihedral values to energy file");
+  ITYPE ("nstdihreout", ir->nstdihreout, 100);
 
   /* Free energy stuff */
   CCTYPE ("Free energy control stuff");
@@ -653,7 +706,7 @@ static void do_numbering(t_atoms *atoms,int ng,char *ptrs[],
   unsigned short *cbuf;
   t_grps *groups=&(atoms->grps[gtype]);
   int    i,j,gid,aj,ognr,ntot=0;
-  char   *title;
+  const char  *title;
 
   if (debug)
     fprintf(debug,"Starting numbering %d groups of type %d\n",ng,gtype);
@@ -895,11 +948,12 @@ void do_index(char *ndx,
 {
   t_block *grps;
   char    warnbuf[STRLEN],**gnames;
-  int     nr,ntcg,ntau_t,nref_t,nacc,nofg;
+  int     nr,ntcg,ntau_t,nref_t,nacc,nofg,nSA,nSA_points,nSA_time,nSA_temp;
   int     nacg,nfreeze,nfrdim,nenergy,nuser,negexcl;
   char    *ptr1[MAXPTR],*ptr2[MAXPTR],*ptr3[MAXPTR];
   int     i,j,k,restnm;
-  bool    bExcl,bSetTCpar;
+  real    SAtime;
+  bool    bExcl,bSetTCpar,bAnneal;
   
   if (bVerbose)
     fprintf(stderr,"processing index file...\n");
@@ -927,14 +981,6 @@ void do_index(char *ndx,
   for(i=0; (i<atoms->nr); i++)
     for(j=0; (j<egcNR); j++)
       atoms->atom[i].grpnr[j]=NOGID;
-  
-  if (ir->bSimAnn) {
-    if (ir->eI==eiMD && ir->etc==etcNO)
-      fatal_error(0,"You must select a temperature coupling algorithm "
-                 "for simulated annealing");
-    if (ir->zero_temp_time == 0)
-      fatal_error(0,"Cannot anneal to zero temp at t=0");
-  }  
 
   ntau_t = str_nelem(tau_t,MAXPTR,ptr1);
   nref_t = str_nelem(ref_t,MAXPTR,ptr2);
@@ -972,14 +1018,105 @@ void do_index(char *ndx,
     }
   }
 
+  /* Simulated annealing for each group. There are nr groups */
+  nSA = str_nelem(anneal,MAXPTR,ptr1);
+  if(nSA>0 && nSA != nr) 
+    fatal_error(0,"Not enough annealing values: %d (for %d groups)\n",nSA,nr);
+  else {
+    snew(ir->opts.annealing,nr);
+    snew(ir->opts.anneal_npoints,nr);
+    snew(ir->opts.anneal_time,nr);
+    snew(ir->opts.anneal_temp,nr);
+    if(nSA==0) {
+      fprintf(stderr,"Not using any simulated annealing\n"); 
+      for(i=0;i<nr;i++) {
+       ir->opts.annealing[i]=eannNO;
+       ir->opts.anneal_npoints[i]=0;
+       ir->opts.anneal_time[i]=NULL;
+       ir->opts.anneal_temp[i]=NULL;
+      }
+    } else {
+      bAnneal=FALSE;
+      for(i=0;i<nr;i++) { 
+       if(ptr1[i][0]=='n' || ptr1[i][0]=='N') {
+         ir->opts.annealing[i]=eannNO;
+       } else if(ptr1[i][0]=='s'|| ptr1[i][0]=='S') {
+         ir->opts.annealing[i]=eannSINGLE;
+         bAnneal=TRUE;
+       } else if(ptr1[i][0]=='p'|| ptr1[i][0]=='P') {
+         ir->opts.annealing[i]=eannPERIODIC;
+         bAnneal=TRUE;
+       } 
+      } 
+      if(bAnneal) {
+       /* Read the other fields too */
+       nSA_points = str_nelem(anneal_npoints,MAXPTR,ptr1);
+       if(nSA_points!=nSA) 
+         fatal_error(0,"Found %d annealing_npoints values for %d groups\n",nSA_points,nSA);
+       for(k=0,i=0;i<nr;i++) {
+         ir->opts.anneal_npoints[i]=strtol(ptr1[i],NULL,10);
+         if(ir->opts.anneal_npoints[i]==1)
+           fatal_error(0,"It doesn't make sense to use only one point for annealing!\n");
+         snew(ir->opts.anneal_time[i],ir->opts.anneal_npoints[i]);
+         snew(ir->opts.anneal_temp[i],ir->opts.anneal_npoints[i]);
+         k += ir->opts.anneal_npoints[i];
+       }
+       
+       nSA_time = str_nelem(anneal_time,MAXPTR,ptr1);
+       if(nSA_time!=k) 
+         fatal_error(0,"Found %d annealing_time values, wanter %d\n",nSA_time,k);
+       nSA_temp = str_nelem(anneal_temp,MAXPTR,ptr2);
+       if(nSA_temp!=k) 
+         fatal_error(0,"Found %d annealing_temp values, wanted %d\n",nSA_temp,k);
+       for(i=0,k=0;i<nr;i++) {
+           if(ir->opts.anneal_time[i][0] > (ir->init_t+GMX_REAL_EPS))
+             fatal_error(0,"First time point for annealing > init_t.\n");      
+         
+         for(j=0;j<ir->opts.anneal_npoints[i];j++) {
+           ir->opts.anneal_time[i][j]=atof(ptr1[k]);
+           ir->opts.anneal_temp[i][j]=atof(ptr2[k]);
+           if(j>0 && (ir->opts.anneal_time[i][j]<ir->opts.anneal_time[i][j-1]))
+             fatal_error(0,"Annealing timepoints out of order: t=%f comes after t=%f\n",
+                         ir->opts.anneal_time[i][j],ir->opts.anneal_time[i][j-1]);
+           if(ir->opts.anneal_temp[i][j]<0) 
+             fatal_error(0,"Found negative temperature in annealing: %f\n",ir->opts.anneal_temp[i][j]);    
+           k++;
+         }
+       }
+       /* Print out some summary information, to make sure we got it right */
+       for(i=0,k=0;i<nr;i++) {
+         if(ir->opts.annealing[i]!=eannNO) {
+           j=atoms->grps[egcTC].nm_ind[i];
+           fprintf(stderr,"Simulated annealing for group %s: %s, %d timepoints\n",
+                   *(atoms->grpname[j]),eann_names[ir->opts.annealing[i]],
+                   ir->opts.anneal_npoints[i]);
+           fprintf(stderr,"Time (ps)   Temperature (K)\n");
+           /* All terms except the last one */
+           for(j=0;j<(ir->opts.anneal_npoints[i]-1);j++) 
+               fprintf(stderr,"%9.1f      %5.1f\n",ir->opts.anneal_time[i][j],ir->opts.anneal_temp[i][j]);
+           
+           /* Finally the last one */
+           j = ir->opts.anneal_npoints[i]-1;
+           if(ir->opts.annealing[i]==eannSINGLE)
+             fprintf(stderr,"%9.1f-     %5.1f\n",ir->opts.anneal_time[i][j],ir->opts.anneal_temp[i][j]);
+           else {
+             fprintf(stderr,"%9.1f      %5.1f\n",ir->opts.anneal_time[i][j],ir->opts.anneal_temp[i][j]);
+             if(fabs(ir->opts.anneal_temp[i][j]-ir->opts.anneal_temp[i][0])>GMX_REAL_EPS)
+               fprintf(stderr,"Note: There is a temperature jump when your annealing loops back.\n");
+           }
+         }
+       } 
+      }
+    }
+  }    
+
   nacc = str_nelem(acc,MAXPTR,ptr1);
   nacg = str_nelem(accgrps,MAXPTR,ptr2);
   if (nacg*DIM != nacc)
     fatal_error(0,"Invalid Acceleration input: %d groups and %d acc. values",
                nacg,nacc);
   do_numbering(atoms,nacg,ptr2,grps,gnames,egcACC,
-              restnm,forward,FALSE,bVerbose);
-  nr=atoms->grps[egcACC].nr;
+              restnm,forward,FALSE,bVerbose);  nr=atoms->grps[egcACC].nr;
   snew(ir->opts.acc,nr);
   ir->opts.ngacc=nr;
   
@@ -1104,9 +1241,9 @@ void do_index(char *ndx,
   sfree(gnames);
   done_block(grps);
   sfree(grps);
-}
+       }
 
-  static void check_disre(t_topology *sys)
+       static void check_disre(t_topology *sys)
 {
   t_functype *functype;
   t_iparams  *ip;
@@ -1220,7 +1357,6 @@ void double_check(t_inputrec *ir,matrix box,t_molinfo *mol,int *nerror)
        if (TRICLINIC(box))
          fprintf(stderr,"Grid search might allow larger cut-off's than simple search with triclinic boxes.");
       }
-      
     }
   }
 }
index d3c5cd9c8a54b8b6d8c3c4087f148a4d233f7a08..ba95378afe8c9d7cb5414ac8dc76364fdf161564 100644 (file)
 #ifndef _readir_h
 #define _readir_h
 
-static char *SRCID_readir_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) readir.h 1.20 9/30/97"
-#endif /* HAVE_IDENT */
 
 #include "typedefs.h"
 #include "string2.h"
@@ -44,7 +40,7 @@ static char *SRCID_readir_h = "$Id$";
 
 enum { eshNONE, eshHBONDS, eshALLBONDS, eshHANGLES, eshALLANGLES, eshNR };
 
-static char *constraints[eshNR+1]    = { 
+static const char *constraints[eshNR+1]    = { 
     "none", "h-bonds", "all-bonds", "h-angles", "all-angles", NULL 
   };
 
@@ -65,6 +61,7 @@ typedef struct {
   int  seed;
   int  eDisre;
   bool bOrire;
+  int  eDihre;
   bool bMorse;
 } t_gromppopts;
 
index e86c062d6c72c390b461f15a28be4c28fe0215b4..fa22462c2c88e86d0e52f20ada46f15583a88f0c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_relax_sh_c = "$Id$";
+
 #include <string.h>
 #include "assert.h"
 #include "typedefs.h"
@@ -85,9 +85,9 @@ static void shell_pos_sd(FILE *log,real step,rvec xold[],rvec xnew[],rvec f[],
     k_1   = s[i].k_1;
     do_1pos(xnew[shell],xold[shell],f[shell],k_1,step);
     if (debug && 0) {
-      pr_rvec(debug,0,"fshell",f[shell],DIM);
-      pr_rvec(debug,0,"xold",xold[shell],DIM);
-      pr_rvec(debug,0,"xnew",xnew[shell],DIM);
+      pr_rvec(debug,0,"fshell",f[shell],DIM,TRUE);
+      pr_rvec(debug,0,"xold",xold[shell],DIM,TRUE);
+      pr_rvec(debug,0,"xnew",xnew[shell],DIM,TRUE);
     }
   }
 }
index b9638a5af0da8b1ff86dca06afe764d146f9b3ee..75a7dc8a55b685957e3d7b921c6cfb675b0c2ffb 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_resall_c = "$Id$";
+
 #include "sysstuff.h"
 #include <ctype.h>
 #include "assert.h"
index e8173e538695f52d1dcdc270f5af7f2bbdedb377..6b1722322a573088aab492c726a4b0ce10db3290 100644 (file)
 #ifndef _resall_h
 #define _resall_h
 
-static char *SRCID_resall_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) resall.h 1.16 9/30/97"
-#endif /* HAVE_IDENT */
-
 #include "typedefs.h"
 #include "hackblock.h"
 #include "grompp.h"
index 5284f7c538f18cc24312c3bd7ad00204effbf456..d23743c2e9b3b9770943f3fdc4b563a2dcb1aca8 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROningen Mixture of Alchemy and Childrens' Stories
  */
-static char *SRCID_pdb2gmx_c = "$Id$";
+
 #include <time.h>
 #include <ctype.h>
 #include "assert.h"
index aa8c14546e4905878db18bd385c0a28111bfdada..fa72b85f0376300acec570cac39debc58123f4cc 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_sorting_c = "$Id$";
+
 #include <limits.h>
 #include "sysstuff.h"
 #include "smalloc.h"
index ad3570674846a0d7626619f27248f0b62650b153..e25dcf1848b67812ae9a6961718d264bf11e5b6e 100644 (file)
 #ifndef _sorting_h
 #define _sorting_h
 
-static char *SRCID_sorting_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) sorting.h 1.21 9/30/97"
-#endif /* HAVE_IDENT */
 
 #include "typedefs.h"
 typedef atom_id t_bond[2];
index 1ddc7d43435257a05747426740871e106aab27fe..05de66ddd1cff08c3240455a850bc2ca288df500 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_specbond_c = "$Id$";
+
 #include <ctype.h>
 #include <math.h>
 #include "typedefs.h"
@@ -54,7 +54,7 @@ bool yesno(void)
 
 t_specbond *get_specbonds(int *nspecbond)
 {
-  static char  *sbfile="specbond.dat";
+  const char  *sbfile="specbond.dat";
   
   t_specbond *sb=NULL;
   char   r1buf[32],r2buf[32],a1buf[32],a2buf[32],nr1buf[32],nr2buf[32];
index 7a07a98cc12dafa08a5b384de8fb5e08c7d70224..c901e5347adc7258f3bed26acc03f19dcb0575e6 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _specbond_h
 #define _specbond_h
 
-static char *SRCID_specbond_h = "$Id$";
 #include "pdb2top.h"
 
 extern int mk_specbonds(t_atoms *pdba,rvec x[],bool bInteractive,
index e8399c1ed97617a4fbdc74f9070c50da92d8e93b..90a4a91f7154116bd56ba2a2455d1a36ecdbb37d 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_splitter_c = "$Id$";
+
 #include <stdio.h>
 #include "sysstuff.h"
 #include "assert.h"
@@ -332,8 +332,8 @@ static void split_blocks(bool bVerbose,int nnodes,
   atom_id *shknum,*cgsnum;
   
   if (debug) {
-    pr_block(debug,0,"cgs",cgs);
-    pr_block(debug,0,"sblock",sblock);
+    pr_block(debug,0,"cgs",cgs,TRUE);
+    pr_block(debug,0,"sblock",sblock,TRUE);
   }
 
   shknum = make_invblock(sblock,cgs->nra+1);
@@ -423,8 +423,6 @@ static int sid_comp(const void *a,const void *b)
     return dd;
 }
 
-typedef enum { egcolWhite, egcolGrey, egcolBlack, egcolNR } egCol;
-
 static int mk_grey(int nnodes,egCol egc[],t_graph *g,int *AtomI,
                   t_sid sid[])
 {
@@ -476,7 +474,7 @@ static int mk_sblocks(bool bVerbose,t_graph *g,t_sid sid[])
   int    ng,nnodes;
   int    nW,nG,nB;             /* Number of Grey, Black, White */
   int    fW,fG;                        /* First of each category       */
-  static egCol *egc=NULL;      /* The colour of each node      */
+  egCol  *egc=NULL;            /* The colour of each node      */
   int    g0,nblock;
   
   if (!g->nbound) 
index cd77598d3cb35ad2806086de4e1a7dc402df0006..c3a0f0bea408b5dfa611602d18062f1b921d582c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_splitter_h = "$Id$";
+
 extern void split_top(bool bVerbose,int nnodes,t_topology *top,real *capacity);
 /* Split the topology (blocks and forces, based on charge groups 
  * and shake blocks.
index 938a486a60fc55863830b4b3b2cda7df6182ca2e..d778199fc32abca433cd8971c927edb3c10e6b6c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_ter_db_c = "$Id$";
+
 #include "sysstuff.h"
 #include "smalloc.h"
 #include "typedefs.h"
index bbe8e3b714a5d16c3e2e4c637dadd7da1baba067..bdb715734c991b2e0dfdb95816cc7493de65d7d6 100644 (file)
 #ifndef _ter_db_h
 #define _ter_db_h
 
-static char *SRCID_ter_db_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) ter_db.h 1.16 9/30/97"
-#endif /* HAVE_IDENT */
 
 #include "sysstuff.h"
 #include "hackblock.h"
index 5757cadf7c46dba8df13837d429b0f0010566b4d..f2bd2c39cbd15e0fc2a24c44fd89d7222fd58051 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_tomorse_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
 #include <stdlib.h>
 #include <math.h>
 #include <ctype.h>
index 9b19a73d9ab3898898ad32b5e37ab4de704d712f..13e9aff8df178f2c6d60b917f0420ec81dc1d64b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_topcat_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "smalloc.h"
index 5e2264b23162067caf9243adf07a5857870e9a1f..fa04fe35eee72291d8a98557df6e9004a5252b91 100644 (file)
 #ifndef _topcat_h
 #define _topcat_h
 
-static char *SRCID_topcat_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) topcat.h 1.23 9/30/97"
-#endif /* HAVE_IDENT */
-
 #include "typedefs.h"
 
 extern void topcat(t_molinfo *dest,int nsrc,t_molinfo src[],
index a16b057317f980921c542b8a3e1746c5631f8309..e217c1166f5639f47d283fbfc76793586d49fc6a 100644 (file)
 #ifndef _topdef_h
 #define _topdef_h
 
-static char *SRCID_topdef_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) topdef.h 1.9 11/23/92"
-#endif /* HAVE_IDENT */
 
 /* These are the indices for combination rule selection        */
 #define COMB_GROMOS    1       /* Gromos rules                 */
index d5338a78dad57e70f8560eb531257ad377dd0691..1c7fdadfd2d81ffd07fae3b6c01bccf7b669c163 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_topdirs_c = "$Id$";
+
 #include <stdio.h>
 #include <stdarg.h>
 
@@ -78,6 +78,10 @@ int ifunc_index(directive d,int type)
       return F_IDIHS;
     case 3:
       return F_RBDIHS;
+    case 4:  
+      return F_PIDIHS;
+    case 5:
+      return F_FOURDIHS;
     default:
       fatal_error(0,"Invalid dihedral type %d",type);
     }
@@ -133,6 +137,8 @@ int ifunc_index(directive d,int type)
     return F_DISRES;
   case d_orientation_restraints:
     return F_ORIRES;
+  case d_dihedral_restraints:
+    return F_DIHRES;
   default:
     fatal_error(0,"invalid directive %s in ifunc_index (%s:%s)",
                dir2str(d),__FILE__,__LINE__);
@@ -211,6 +217,7 @@ void DS_Init(DirStack **DS)
     set_nec(&(necessary[d_angle_restraints_z]),d_atoms,d_none);
     set_nec(&(necessary[d_distance_restraints]),d_atoms,d_none);
     set_nec(&(necessary[d_orientation_restraints]),d_atoms,d_none);
+    set_nec(&(necessary[d_dihedral_restraints]),d_atoms,d_none);
     for(i=0; (i<d_maxdir); i++) {
       if (debug)
        fprintf(debug,"%20s:  ",dir2str((directive)i));
index 00d310756b1c73ff7df385e54bc56e0d5b89c8ad..b03917715022a72f58e46a8894a42bef2a691dbe 100644 (file)
 #ifndef _topdirs_h
 #define _topdirs_h
 
-static char *SRCID_topdirs_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) topdirs.h 1.30 9/30/97"
-#endif /* HAVE_IDENT */
 
 #include "grompp.h"
 
index f2db5c2e6f33ed4c7af267bea65fc5136031ec9e..c0cfaefd41666f22d135f2fd790372ba78854b65 100644 (file)
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_topexcl_c = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) topexcl.c 1.38 2/2/97"
-#endif
 
+/* This file is completely threadsafe - keep it that way! */
 #include "assert.h"
 #include "sysstuff.h"
 #include "smalloc.h"
index 3caaa6904cea8271d122967981f35dc5bec78bac..0ca02db89859b928a645adfee73592564428e279 100644 (file)
 #ifndef _topexcl_h
 #define _topexcl_h
 
-static char *SRCID_topexcl_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) topexcl.h 1.11 11/23/92"
-#endif /* HAVE_IDENT */
 
 #include "topio.h"
 
index a3bffdc44afcbb8d906b0d7e1f68088c9462309c..0a807c62b8f19242ec6aa943da5834db79e3b97e 100644 (file)
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_topio_c = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) topio.c 1.87 9/30/97"
-#endif
-
 #include <math.h>
 #include <sys/types.h>
 #include <stdio.h>
@@ -182,24 +177,20 @@ void preprocess(char *infile,char *outfile,
                char *cpp,char *define,
                char *include)
 {
-  static char libdir[1024];
-  static bool bFirst=TRUE;
+  char libdir[1024];
   char *lib;
   char command[2048];
   int  error;
 
-  if (bFirst) {
-    lib=getenv("GMXLIB");
-    if (lib!=NULL) {
-      strcpy(libdir,lib);
-    } 
-    else {
-      if(!get_libdir(libdir))
-       strcpy(libdir,GMXLIBDIR);
-    }
-    bFirst=FALSE;
+  lib=getenv("GMXLIB");
+  if (lib!=NULL) {
+    strcpy(libdir,lib);
+  } 
+  else {
+    if(!get_libdir(libdir))
+      strcpy(libdir,GMXLIBDIR);
   }
-
+  
   /* build the command line. Second output name is not supported 
    * on OS X it seems, so we use redirection instead in that case.
    */
@@ -213,7 +204,7 @@ void preprocess(char *infile,char *outfile,
   
   if (debug)
     fprintf(debug,"Command line for cpp:\n\t%s\n",command);
-
+  
   /* execute preprocessor */
   error=system(command);
   if (error) {
@@ -294,6 +285,7 @@ static char **read_topol(char        *infile,
   bool       bReadDefaults,bReadMolType,bGenPairs;
   double     qt=0,qBt=0; /* total charge */
   t_bond_atomtype *batype;
+  int        lastcg=-1;
   
   /* open input and output file */
   if ((in = fopen(infile,"r")) == NULL)
@@ -460,14 +452,15 @@ static char **read_topol(char        *infile,
                                  atype->nr);
            fprintf(stderr,"Generated %d of the %d non-bonded parameter combinations\n",ncombs-ncopy,ncombs);
            free_nbparam(nbparam,atype->nr);
-           
-           if (bGenPairs) {
+           if (bGenPairs) {
              gen_pairs(&(plist[nb_funct]),&(plist[F_LJ14]),fudgeLJ,bVerbose);
              ncopy = copy_nbparams(pair,nb_funct,&(plist[F_LJ14]),
                                    atype->nr);
              fprintf(stderr,"Generated %d of the %d 1-4 parameter combinations\n",ncombs-ncopy,ncombs);
              free_nbparam(pair,atype->nr);
            }
+           /* Copy GBSA parameters to atomtype array */
+           
            bReadMolType = TRUE;
          }
          
@@ -482,7 +475,7 @@ static char **read_topol(char        *infile,
          break;
        }
        case d_atoms: 
-         push_atom(symtab,&(mi0->cgs),&(mi0->atoms),atype,pline);
+         push_atom(symtab,&(mi0->cgs),&(mi0->atoms),atype,pline,&lastcg);
          break;
          
        case d_pairs: 
@@ -501,6 +494,7 @@ static char **read_topol(char        *infile,
        case d_angle_restraints_z:
        case d_distance_restraints: 
        case d_orientation_restraints:
+       case d_dihedral_restraints:
        case d_dihedrals:
          push_bond(d,plist,mi0->plist,&(mi0->atoms),atype,pline,TRUE,bGenPairs);
          break;
index ddb89c3b3c20826e146ac5482dcf02e26b518325..8701b5ff4e9bbe49d54ffb932d479a72718430e0 100644 (file)
 #ifndef _topio_h
 #define _topio_h
 
-static char *SRCID_topio_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) topio.h 1.46 9/30/97"
-#endif /* HAVE_IDENT */
 
 #include "typedefs.h"
 #include "readir.h"
index 724f6f5ea33ead51d80b3a45ad2bf0a31fda0719..b74bc229dbce1fe71b341221b37d60147d86712d 100644 (file)
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_toppush_c = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) toppush.c 1.72 9/30/97"
-#endif
 
 #include <math.h>
 
@@ -48,7 +44,6 @@ static char *SRCID_toppush_c = "$Id$";
 #include "symtab.h"
 #include "fatal.h"
 
-static char  errbuf[256];
 
 void generate_nbparams(int comb,int ftype,t_params *plist,t_atomtype *atype,
                       real npow)
@@ -56,6 +51,7 @@ void generate_nbparams(int comb,int ftype,t_params *plist,t_atomtype *atype,
   int   i,j,k=-1,nf;
   int   nr,nrfp;
   real  c,sig6,sigma_ij,eps_ij,bi,bj;
+  char  errbuf[256];
 
   /* Lean mean shortcuts */
   nr   = atype->nr;
@@ -147,42 +143,75 @@ void push_at (t_symtab *symtab, t_atomtype *at, t_bond_atomtype *bat,char *line,
   };
   
   int    nr,i,nfields,j,pt,nfp0=-1;
-  int    batype_nr;
+  int    batype_nr,nread;
   char   type[STRLEN],btype[STRLEN],ptype[STRLEN];
   double m,q;
   double c[MAXFORCEPARAM];
-  char   tmpfield[10][100]; /* Max 10 fields of width 100 */
-
+  double radius,vol,surftens;
+  char   tmpfield[12][100]; /* Max 12 fields of width 100 */
+  char  errbuf[256];
+  
   /* First assign input line to temporary array */
-  nfields=sscanf(line,"%s%s%s%s%s%s%s%s%s%s",
-                tmpfield[0],tmpfield[1],tmpfield[2],tmpfield[3],tmpfield[4],
-                tmpfield[5],tmpfield[6],tmpfield[7],tmpfield[8],tmpfield[9]);
-
+  nfields=sscanf(line,"%s%s%s%s%s%s%s%s%s%s%s%s",
+                tmpfield[0],tmpfield[1],tmpfield[2],tmpfield[3],tmpfield[4],tmpfield[5],
+                tmpfield[6],tmpfield[7],tmpfield[8],tmpfield[9],tmpfield[10],tmpfield[11]);
+  
   switch (nb_funct) {
   case F_LJ:
     nfp0 = 2;
-    /* If the 5th field is a particletype and we have 7 fields in total there
-     * is a bond_atomtype in field 2, otherwise not (set it identical to atomtype then) */
-    if(nfields==7 && strlen(tmpfield[4])==1 && isalpha(tmpfield[4][0])) 
-      sscanf (line,"%s%s%lf%lf%s%lf%lf",type,btype,&m,&q,ptype,&c[0],&c[1]);
-    else if (nfields==6) {
-      sscanf (line,"%s%lf%lf%s%lf%lf",type,&m,&q,ptype,&c[0],&c[1]);
+    /* If the 5th field is a particletype, then there is a bond_atomtype 
+     *iin field 2, otherwise not (set it identical to atomtype then) */
+    if(nfields>=7 && strlen(tmpfield[4])==1 && isalpha(tmpfield[4][0])) {
+      nread = sscanf (line,"%s%s%lf%lf%s%lf%lf%lf%lf%lf",
+                     type,btype,&m,&q,ptype,&c[0],&c[1],&radius,&vol,&surftens);
+      if(nread<10)
+       surftens = -1;
+      if(nread<9)
+       vol = 0;
+      if(nread<8)
+       radius = 0;
+    }
+    else if (nfields>=6) {
+      nread = sscanf (line,"%s%lf%lf%s%lf%lf%lf%lf%lf",
+                     type,&m,&q,ptype,&c[0],&c[1],&radius,&vol,&surftens);
+      if(nread<9)
+       surftens = -1;
+      if(nread<8)
+       vol = 0;
+      if(nread<7)
+       radius = 0;
       strcpy(btype,type);
+
     } else {
       too_few();
       return;
-    }
+    } 
     break;
 
   case F_BHAM:
     nfp0 = 3;
     /* If the 5th field is a particletype and we have 8 fields in total there
      * is a bond_atomtype in field 2, otherwise not (set it identical to atomtype then) */
-    if(nfields==8 && strlen(tmpfield[4])==1 && isalpha(tmpfield[4][0])) 
-      sscanf (line,"%s%s%lf%lf%s%lf%lf%lf",type,btype,&m,&q,ptype,&c[0],&c[1],&c[2]);
-    else if (nfields==7) {
-      sscanf (line,"%s%lf%lf%s%lf%lf%lf",type,&m,&q,ptype,&c[0],&c[1],&c[2]);
+    if(nfields>=8 && strlen(tmpfield[4])==1 && isalpha(tmpfield[4][0])) {
+      nread = sscanf (line,"%s%s%lf%lf%s%lf%lf%lf%lf%lf%lf",
+                     type,btype,&m,&q,ptype,&c[0],&c[1],&c[2],&radius,&vol,&surftens);
+      if(nread<11)
+       surftens = -1;
+      if(nread<10)
+       vol = 0;
+      if(nread<9)
+       radius = 0;
+    }
+    else if (nfields>=7) {
+      nread = sscanf (line,"%s%lf%lf%s%lf%lf%lf%lf%lf%lf",
+                     type,&m,&q,ptype,&c[0],&c[1],&c[2],&radius,&vol,&surftens);
       strcpy(btype,type);
+      if(nread<10)
+       surftens = -1;
+      if(nread<9)
+       vol = 0;
+      if(nread<8)
+       radius = 0;
     } else {
       too_few();
       return;
@@ -235,6 +264,9 @@ void push_at (t_symtab *symtab, t_atomtype *at, t_bond_atomtype *bat,char *line,
     srenew(at->atomname,nr+1);
     srenew(at->bondatomtype,nr+1);
     srenew(at->nb,nr+1);
+    srenew(at->radius,nr+1);
+    srenew(at->vol,nr+1);
+    srenew(at->surftens,nr+1);
     at->nr++;
     /* Add space in the non-bonded parameters matrix */
     srenew(*nbparam,at->nr);
@@ -248,14 +280,18 @@ void push_at (t_symtab *symtab, t_atomtype *at, t_bond_atomtype *bat,char *line,
     sprintf(errbuf,"Overriding atomtype %s",type);
     warning(errbuf);
     nr = i;
-  }
+  } 
+
   /* fill the arrays */
   at->atomname[nr] = put_symtab(symtab,type);
   at->bondatomtype[nr] = batype_nr;
   at->atom[nr].ptype = pt;
   at->atom[nr].m = m;
   at->atom[nr].q = q;
-  
+  at->radius[nr] = radius;
+  at->vol[nr] = vol;
+  at->surftens[nr] = surftens;
+
   for (i=0; (i<MAXFORCEPARAM); i++)
     at->nb[nr].c[i] = c[i];
 }
@@ -267,6 +303,7 @@ static void push_bondtype(t_params *bt,t_param *b,int nral,int ftype,
   bool bTest,bFound,bId;
   int  nr   = bt->nr;
   int  nrfp = NRFP(ftype);
+  char  errbuf[256];
 
   /* Check if this entry overwrites another */
   bFound=FALSE;
@@ -317,7 +354,7 @@ static void push_bondtype(t_params *bt,t_param *b,int nral,int ftype,
 
 void push_bt(directive d,t_params bt[],int nral,char ***typenames, int ntypes,char *line)
 {
-  static   char *formal[MAXATOMLIST+1] = {
+  const char *formal[MAXATOMLIST+1] = {
     "%s",
     "%s%s",
     "%s%s%s",
@@ -325,7 +362,7 @@ void push_bt(directive d,t_params bt[],int nral,char ***typenames, int ntypes,ch
     "%s%s%s%s%s",
     "%s%s%s%s%s%s"
   };
-  static   char *formnl[MAXATOMLIST+1] = {
+  const char *formnl[MAXATOMLIST+1] = {
     "%*s",
     "%*s%*s",
     "%*s%*s%*s",
@@ -333,7 +370,7 @@ void push_bt(directive d,t_params bt[],int nral,char ***typenames, int ntypes,ch
     "%*s%*s%*s%*s%*s",
     "%*s%*s%*s%*s%*s%*s"
   };
-  static   char *formlf[MAXFORCEPARAM] = {
+  const char *formlf[MAXFORCEPARAM] = {
     "%lf",
     "%lf%lf",
     "%lf%lf%lf",
@@ -352,7 +389,8 @@ void push_bt(directive d,t_params bt[],int nral,char ***typenames, int ntypes,ch
   char     alc[MAXATOMLIST+1][20];
   double   c[MAXFORCEPARAM];
   t_param  p;
-  
+  char  errbuf[256];
+
   /* Make format string (nral ints+functype) */
   if ((nn=sscanf(line,formal[nral],
                 alc[0],alc[1],alc[2],alc[3],alc[4],alc[5])) != nral+1) {
@@ -381,7 +419,7 @@ void push_bt(directive d,t_params bt[],int nral,char ***typenames, int ntypes,ch
 
 void push_dihedraltype(directive d,t_params bt[],char ***typenames,int ntypes,char *line)
 {
-  static   char *formal[MAXATOMLIST+1] = {
+  const char *formal[MAXATOMLIST+1] = {
     "%s",
     "%s%s",
     "%s%s%s",
@@ -389,7 +427,7 @@ void push_dihedraltype(directive d,t_params bt[],char ***typenames,int ntypes,ch
     "%s%s%s%s%s",
     "%s%s%s%s%s%s"
   };
-  static   char *formnl[MAXATOMLIST+1] = {
+  const char *formnl[MAXATOMLIST+1] = {
     "%*s",
     "%*s%*s",
     "%*s%*s%*s",
@@ -397,7 +435,7 @@ void push_dihedraltype(directive d,t_params bt[],char ***typenames,int ntypes,ch
     "%*s%*s%*s%*s%*s",
     "%*s%*s%*s%*s%*s%*s"
   };
-  static   char *formlf[MAXFORCEPARAM] = {
+  const char *formlf[MAXFORCEPARAM] = {
     "%lf",
     "%lf%lf",
     "%lf%lf%lf",
@@ -416,6 +454,7 @@ void push_dihedraltype(directive d,t_params bt[],char ***typenames,int ntypes,ch
   char     alc[MAXATOMLIST+1][20];
   double   c[MAXFORCEPARAM];
   t_param  p;
+  char  errbuf[256];
 
   /* This routine accepts dihedraltypes defined from either 2 or 4 atoms.
    *
@@ -481,8 +520,8 @@ void push_nbt(directive d,t_nbparam **nbt,t_atomtype *atype,
              char *pline,int nb_funct)
 {
   /* swap the atoms */
-  static char *form2="%*s%*s%*s%lf%lf";
-  static char *form3="%*s%*s%*s%lf%lf%lf";
+  const char *form2="%*s%*s%*s%lf%lf";
+  const char *form3="%*s%*s%*s%lf%lf%lf";
   char    a0[80],a1[80];
   int     i,f,k,ftype,atnr,nrfp;
   double  c[3];
@@ -490,7 +529,8 @@ void push_nbt(directive d,t_nbparam **nbt,t_atomtype *atype,
   atom_id ai,aj;
   t_nbparam *nbp;
   bool    bId;
-  
+  char  errbuf[256];
+
   if (sscanf (pline,"%s%s%d",a0,a1,&f) != 3) {
     too_few();
     return;
@@ -615,10 +655,9 @@ void push_cg(t_block *block, int *lastindex, int index, int a)
 }
 
 void push_atom(t_symtab *symtab,t_block *cgs,
-              t_atoms *at,t_atomtype *atype,char *line)
+              t_atoms *at,t_atomtype *atype,char *line,int *lastcg)
 {
   int          nr,ptype;
-  static int    lastcg;
   int          resnumber,cgnumber,atomnr,type,typeB,nscan;
   char                 id[STRLEN],ctype[STRLEN],ctypeB[STRLEN],
                        resname[STRLEN],name[STRLEN];
@@ -669,7 +708,7 @@ void push_atom(t_symtab *symtab,t_block *cgs,
   if (debug) 
     fprintf(debug,"mB=%g, qB=%g, typeB=%d\n",mB,qB,typeB);
   
-  push_cg(cgs,&lastcg,cgnumber,nr);
+  push_cg(cgs,lastcg,cgnumber,nr);
 
   push_atom_now(symtab,at,atomnr,type,ctype,ptype,resnumber,cgnumber,
                resname,name,m0,q0,typeB,
@@ -839,21 +878,21 @@ void push_bondnow(t_params *bond, t_param *b)
 void push_bond(directive d,t_params bondtype[],t_params bond[],
               t_atoms *at,t_atomtype *atype,char *line,bool bBonded,bool bGenPairs)
 {
-  static char *aaformat[MAXATOMLIST]= {
+  const char *aaformat[MAXATOMLIST]= {
     "%d%d",
     "%d%d%d",
     "%d%d%d%d",
     "%d%d%d%d%d",
     "%d%d%d%d%d%d"
   };
-  static char *asformat[MAXATOMLIST]= {
+  const char *asformat[MAXATOMLIST]= {
     "%*s%*s",
     "%*s%*s%*s",
     "%*s%*s%*s%*s",
     "%*s%*s%*s%*s%*s",
     "%*s%*s%*s%*s%*s%*s"
   };
-  static char *ccformat[MAXFORCEPARAM+1]= {
+  const char *ccformat[MAXFORCEPARAM+1]= {
     "",
     "%lf",
     "%lf%lf",
@@ -874,7 +913,8 @@ void push_bond(directive d,t_params bondtype[],t_params bond[],
   int      aa[MAXATOMLIST+1];
   t_param  param,paramB;
   bool     bFoundA,bFoundB,bDef,bPert,bSwapParity=FALSE;
-  
+  char  errbuf[256];
+
   ftype = ifunc_index(d,1);
   nral  = NRAL(ftype);
   for(j=0; j<MAXATOMLIST; j++)
index f012614a33c2b1bd53152739309eb97f755b0fc5..3f7eb4d18b1f2c1e17b5cfdadbb437859b26d727 100644 (file)
 #ifndef _toppush_h
 #define _toppush_h
 
-static char *SRCID_toppush_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) toppush.h 1.31 9/30/97"
-#endif /* HAVE_IDENT */
 
 #include "typedefs.h"
 #include "toputil.h"
@@ -68,7 +64,8 @@ extern void push_atom(t_symtab   *symtab,
                      t_block    *cgs,
                      t_atoms    *at,
                      t_atomtype *atype,
-                     char       *line);
+                     char       *line,
+                     int        *lastcg);
 
 extern void push_bondnow (t_params *bond, t_param *b);
 
index 629adc32a56c5b24a2b088d219d2881b213400e9..2221c93a7424b63a16919a5b4dd16d5a7f75550d 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_topshake_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
 #include <ctype.h>
 
 #include "sysstuff.h"
index 97067b63b508f43bd21f0bb838aff77061ab3736..63772f4b454ce2db5c4402d5453cceb4209f251c 100644 (file)
 #ifndef _topshake_h
 #define _topshake_h
 
-static char *SRCID_topshake_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) topshake.h 1.19 9/30/97"
-#endif /* HAVE_IDENT */
 
 #include "topio.h"
 
index 3f715ec64e33ba80397d23e863930513447ac9e6..e81b6d0b4fb418f81cce7f6b15b1751ffc7d5925 100644 (file)
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_toputil_c = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) toputil.c 1.68 9/30/97"
-#endif
 
 #include "assert.h"
 #include "smalloc.h"
@@ -130,6 +126,10 @@ void init_atomtype (t_atomtype *at)
   at->atomname = NULL;
   at->nb       = NULL;
   at->bondatomtype = NULL;
+  at->radius   = NULL;
+  at->vol      = NULL;
+  at->surftens = NULL;
+  
 }
 
 void init_bond_atomtype (t_bond_atomtype *bat)
@@ -238,7 +238,7 @@ void print_bt(FILE *out, directive d, t_atomtype *at,
   /* This dihp is a DIRTY patch because the dih-types do not use
    * all four atoms to determine the type.
    */
-  static int dihp[2][2] = { { 1,2 }, { 0,3 } };
+  const int dihp[2][2] = { { 1,2 }, { 0,3 } };
   t_params *bt;
   int      i,j,f,nral,nrfp;
   bool     bDih=FALSE,bSwapParity;
@@ -268,6 +268,7 @@ void print_bt(FILE *out, directive d, t_atomtype *at,
     break;
   case F_PDIHS:
   case F_RBDIHS:
+  case F_FOURDIHS:
     bDih=TRUE;
     break;
   case F_IDIHS:
index 03fa46f98d95c11d56d4212eabf675cd6cdb0b84..b97ba642ab0d49159cde12cbf16f652a7768f600 100644 (file)
 #ifndef _toputil_h
 #define _toputil_h
 
-static char *SRCID_toputil_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) toputil.h 1.25 19 Nov 1995"
-#endif /* HAVE_IDENT */
 
 #include "grompp.h"
 
index 7795168e6962eb6212337ce2fe94e2024b0cd4ce..e417be516ef0503e2b30fec414f9f6f21c18d68a 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_tpbcmp_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
 #include <math.h>
 #include <stdio.h>
 #include <string.h>
@@ -195,7 +196,7 @@ static void cmp_idef(FILE *fp,t_idef *id1,t_idef *id2,real ftol)
     cmp_ilist(fp,i,&(id1->il[i]),&(id2->il[i]));
 }
 
-static void cmp_block(FILE *fp,t_block *b1,t_block *b2,char *s)
+static void cmp_block(FILE *fp,t_block *b1,t_block *b2,const char *s)
 {
   int i,j,k;
   char buf[32];
@@ -261,7 +262,8 @@ static void cmp_rvecs(FILE *fp,char *title,int n,rvec x1[],rvec x2[],real ftol)
 
 static void cmp_grpopts(FILE *fp,t_grpopts *opt1,t_grpopts *opt2,real ftol)
 {
-  int i;
+  int i,j;
+  char buf1[256],buf2[256];
   
   cmp_int(fp,"inputrec->grpopts.ngtc",0,  opt1->ngtc,opt2->ngtc);
   cmp_int(fp,"inputrec->grpopts.ngacc",0, opt1->ngacc,opt2->ngacc);
@@ -271,6 +273,17 @@ static void cmp_grpopts(FILE *fp,t_grpopts *opt1,t_grpopts *opt2,real ftol)
     cmp_real(fp,"inputrec->grpopts.nrdf",i,opt1->nrdf[i],opt2->nrdf[i],ftol);
     cmp_real(fp,"inputrec->grpopts.ref_t",i,opt1->ref_t[i],opt2->ref_t[i],ftol);
     cmp_real(fp,"inputrec->grpopts.tau_t",i,opt1->tau_t[i],opt2->tau_t[i],ftol);
+    cmp_int(fp,"inputrec->grpopts.annealing",i,opt1->annealing[i],opt2->annealing[i]);
+    cmp_int(fp,"inputrec->grpopts.anneal_npoints",i,
+           opt1->anneal_npoints[i],opt2->anneal_npoints[i]);
+    if(opt1->anneal_npoints[i]==opt2->anneal_npoints[i]) {
+      sprintf(buf1,"inputrec->grpopts.anneal_time[%d]",i);
+      sprintf(buf2,"inputrec->grpopts.anneal_temp[%d]",i);
+      for(j=0;j<opt1->anneal_npoints[i];j++) {
+       cmp_real(fp,buf1,j,opt1->anneal_time[i][j],opt2->anneal_time[i][j],ftol);
+       cmp_real(fp,buf2,j,opt1->anneal_temp[i][j],opt2->anneal_temp[i][j],ftol);
+      }
+    }
   }
   for(i=0; (i<min(opt1->ngacc,opt2->ngacc)); i++)
     cmp_rvec(fp,"inputrec->grpopts.acc",i,opt1->acc[i],opt2->acc[i],ftol);
@@ -306,6 +319,7 @@ static void cmp_inputrec(FILE *fp,t_inputrec *ir1,t_inputrec *ir2,real ftol)
    */
   cmp_int(fp,"inputrec->eI",0,ir1->eI,ir2->eI);
   cmp_int(fp,"inputrec->nsteps",0,ir1->nsteps,ir2->nsteps);
+  cmp_int(fp,"inputrec->init_step",0,ir1->init_step,ir2->init_step);
   cmp_int(fp,"inputrec->ePBC",0,ir1->ePBC,ir2->ePBC);
   cmp_int(fp,"inputrec->ns_type",0,ir1->ns_type,ir2->ns_type);
   cmp_int(fp,"inputrec->nstlist",0,ir1->nstlist,ir2->nstlist);
@@ -313,6 +327,7 @@ static void cmp_inputrec(FILE *fp,t_inputrec *ir1,t_inputrec *ir2,real ftol)
   cmp_int(fp,"inputrec->bDomDecomp",0,ir1->bDomDecomp,ir2->bDomDecomp);
   cmp_int(fp,"inputrec->decomp_dir",0,ir1->decomp_dir,ir2->decomp_dir);
   cmp_int(fp,"inputrec->nstcomm",0,ir1->nstcomm,ir2->nstcomm);
+  cmp_int(fp,"inputrec->nstcheckpoint",0,ir1->nstcheckpoint,ir2->nstcheckpoint);
   cmp_int(fp,"inputrec->nstlog",0,ir1->nstlog,ir2->nstlog);
   cmp_int(fp,"inputrec->nstxout",0,ir1->nstxout,ir2->nstxout);
   cmp_int(fp,"inputrec->nstvout",0,ir1->nstvout,ir2->nstvout);
@@ -342,8 +357,7 @@ static void cmp_inputrec(FILE *fp,t_inputrec *ir1,t_inputrec *ir2,real ftol)
   cmp_rvec(fp,"inputrec->compress(x)",0,ir1->compress[XX],ir2->compress[XX],ftol);
   cmp_rvec(fp,"inputrec->compress(y)",0,ir1->compress[YY],ir2->compress[YY],ftol);
   cmp_rvec(fp,"inputrec->compress(z)",0,ir1->compress[ZZ],ir2->compress[ZZ],ftol);
-  cmp_int(fp,"inputrec->bSimAnn",0,ir1->bSimAnn,ir2->bSimAnn);
-  cmp_real(fp,"inputrec->zero_temp_time",0,ir1->zero_temp_time,ir2->zero_temp_time,ftol);
+  cmp_int(fp,"inputrec->andersen_seed",0,ir1->andersen_seed,ir2->andersen_seed);
   cmp_real(fp,"inputrec->rlist",0,ir1->rlist,ir2->rlist,ftol);
   cmp_int(fp,"inputrec->coulombtype",0,ir1->coulombtype,ir2->coulombtype);
   cmp_real(fp,"inputrec->rcoulomb_switch",0,ir1->rcoulomb_switch,ir2->rcoulomb_switch,ftol);
@@ -352,6 +366,11 @@ static void cmp_inputrec(FILE *fp,t_inputrec *ir1,t_inputrec *ir2,real ftol)
   cmp_real(fp,"inputrec->rvdw_switch",0,ir1->rvdw_switch,ir2->rvdw_switch,ftol);
   cmp_real(fp,"inputrec->rvdw",0,ir1->rvdw,ir2->rvdw,ftol);
   cmp_real(fp,"inputrec->epsilon_r",0,ir1->epsilon_r,ir2->epsilon_r,ftol);
+  cmp_int(fp,"inputrec->gb_algorithm",0,ir1->gb_algorithm,ir2->gb_algorithm);
+  cmp_int(fp,"inputrec->nstgbradii",0,ir1->nstgbradii,ir2->nstgbradii);
+  cmp_real(fp,"inputrec->rgbradii",0,ir1->rgbradii,ir2->rgbradii,ftol);
+  cmp_real(fp,"inputrec->gb_saltconc",0,ir1->gb_saltconc,ir2->gb_saltconc,ftol);
+  cmp_int(fp,"inputrec->implicit_solvent",0,ir1->implicit_solvent,ir2->implicit_solvent);
   cmp_int(fp,"inputrec->eDispCorr",0,ir1->eDispCorr,ir2->eDispCorr);
   cmp_real(fp,"inputrec->shake_tol",0,ir1->shake_tol,ir2->shake_tol,ftol);
   cmp_real(fp,"inputrec->fudgeQQ",0,ir1->fudgeQQ,ir2->fudgeQQ,ftol);
@@ -368,6 +387,9 @@ static void cmp_inputrec(FILE *fp,t_inputrec *ir1,t_inputrec *ir2,real ftol)
   cmp_real(fp,"inputrec->orires_fc",0,ir1->orires_fc,ir2->orires_fc,ftol);
   cmp_real(fp,"inputrec->orires_tau",0,ir1->orires_tau,ir2->orires_tau,ftol);
   cmp_int(fp,"inputrec->nstorireout",0,ir1->nstorireout,ir2->nstorireout);
+  cmp_real(fp,"inputrec->dihre_fc",0,ir1->dihre_fc,ir2->dihre_fc,ftol);
+  cmp_int(fp,"inputrec->nstdihreout",0,ir1->nstdihreout,ir2->nstdihreout);
+  cmp_real(fp,"inputrec->dihre_tau",0,ir1->dihre_tau,ir2->dihre_tau,ftol);
   cmp_real(fp,"inputrec->em_stepsize",0,ir1->em_stepsize,ir2->em_stepsize,ftol);
   cmp_real(fp,"inputrec->em_tol",0,ir1->em_tol,ir2->em_tol,ftol);
   cmp_int(fp,"inputrec->niter",0,ir1->niter,ir2->niter);
@@ -376,6 +398,7 @@ static void cmp_inputrec(FILE *fp,t_inputrec *ir1,t_inputrec *ir2,real ftol)
   cmp_int(fp,"inputrec->eConstrAlg",0,ir1->eConstrAlg,ir2->eConstrAlg);
   cmp_int(fp,"inputrec->nProjOrder",0,ir1->nProjOrder,ir2->nProjOrder);
   cmp_real(fp,"inputrec->LincsWarnAngle",0,ir1->LincsWarnAngle,ir2->LincsWarnAngle,ftol);
+  cmp_int(fp,"inputrec->nLincsIter",0,ir1->nLincsIter,ir2->nLincsIter);
   cmp_real(fp,"inputrec->bd_temp",0,ir1->bd_temp,ir2->bd_temp,ftol);
   cmp_real(fp,"inputrec->bd_fric",0,ir1->bd_fric,ir2->bd_fric,ftol);
   cmp_int(fp,"inputrec->ld_seed",0,ir1->ld_seed,ir2->ld_seed);
@@ -407,7 +430,7 @@ void comp_tpx(char *fn1,char *fn2,real ftol)
   ff[0]=fn1;
   ff[1]=fn2;
   for(i=0; (i<2); i++) {
-    read_tpxheader(ff[i],&(sh[i]));
+    read_tpxheader(ff[i],&(sh[i]),FALSE,NULL,NULL);
     snew(xx[i],sh[i].natoms);
     snew(vv[i],sh[i].natoms);
     read_tpx(ff[i],&step,&t,&lambda,&(ir[i]),box[i],&natoms,
index 727d3b033478b7b3f668084e0f28ab018c59cc2b..e94a6470cbce9b0a8201d94d11f7ac8034463d4f 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _tpbcmp_h
 #define _tpbcmp_h
 
-static char *SRCID_tpbcmp_h = "$Id$";
+
 extern void comp_tpx(char *fn1,char *fn2,real ftol);
 /* Compare two binary topology files */
 
index 1246fb4e5193602849c8831305bb82bb88edbc77..09c61e4c3b3001ff01a46711688ff1b168216238 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_tpbconv_c = "$Id$";
+
 #include <math.h>
 #include "rdgroup.h"
 #include "fatal.h"
@@ -78,7 +78,7 @@ static atom_id *invind(int gnx,int natoms,atom_id index[])
 }
 
 static void reduce_block(atom_id invindex[],bool bKeep[],t_block *block,
-                        char *name,bool bExcl)
+                        const char *name,bool bExcl)
 {
   atom_id *index,*a;
   int i,j,k,newi,newj;
@@ -301,7 +301,7 @@ int main (int argc, char *argv[])
   top_fn = ftp2fn(efTPX,NFILE,fnm);
   fprintf(stderr,"Reading toplogy and shit from %s\n",top_fn);
   
-  read_tpxheader(top_fn,&tpx);
+  read_tpxheader(top_fn,&tpx,FALSE,NULL,NULL);
   snew(x,tpx.natoms);
   snew(v,tpx.natoms);
   snew(ir,1);
index bb76fa2ecec0352ab771d39574b9f7e0e568e27c..23bc64d2d7ad0c4c783a8f51e96b14efa1c31069 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_x2top_c = "$Id$";
+
 #include "maths.h"
 #include "macros.h"
 #include "copyrite.h"
@@ -394,7 +394,7 @@ int main(int argc, char *argv[])
   t_nextnb   nnb;
   t_nm2type  *nm2t;
   t_mols     mymol;
-  char       *ff;
+  char       ff[256];
   int        nnm;
   char       title[STRLEN];
   rvec       *x;        /* coordinates? */
@@ -475,7 +475,7 @@ int main(int argc, char *argv[])
 
   read_stx_conf(opt2fn("-f",NFILE,fnm),title,atoms,x,NULL,box);
 
-  ff = choose_ff();
+  choose_ff(ff,255);
   
   snew(nbonds,atoms->nr);
   
index 91563d69c176d01724b525215d53bdeda2d3562c..ef49ddd15c8d140d0c99a820e7f154b1861d2360 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _x2top_h
 #define _x2top_h
 
-static char *SRCID_x2top_h = "$Id$";
        
 #include <stdio.h>
        
index 3ea0d7f93c7afed633f4e4888184fafcc188bd7b..a996c7bc850d83a88e5ad455bdc72b02727dd185 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_xlate_c = "$Id$";
+
 #include <ctype.h>
 #include <string.h>
 #include "typedefs.h"
@@ -47,7 +47,7 @@ typedef struct {
 
 static t_xlate_atom *get_xlatoms(int *nxlatom)
 {
-  static char  *xlfile="xlateat.dat";
+  const char  *xlfile="xlateat.dat";
   
   t_xlate_atom *xl=NULL;
   char rbuf[32],abuf[32],repbuf[32];
index 4cef053b07232170751dde510a86a0e3051eb77c..a43662dc51e441c233dff0dea6794dc6fe92e2f2 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _xlate_h
 #define _xlate_h
 
-static char *SRCID_xlate_h = "$Id$";
+
 extern void rename_atoms(t_atoms *atoms,t_symtab *symtab);
 
 #endif
index c8f7cc5fa020cf73c91150cdff44981b7b14bc09..dd6e767ef714ce747e7e787526e2f73e5c623d49 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _xmdrun_h
 #define _xmdrun_h
 
-static char *SRCID_xmdrun_h = "$Id$";
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index a525b94b0732ab1d274bf68cf7c67a975ff08600..e301e73c1b6bc70c8a5cc5f6208aea69c56beb28 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_xutils_c = "$Id$";
+
 
 #include "typedefs.h"
 #include "smalloc.h"
index fe02298bae06f926d419ffbc831f902b66afe23a..c702a9b63d2c4fdcc4b79b02e222a440cef35259 100644 (file)
@@ -17,13 +17,13 @@ libmd@LIBSUFFIX@_la_SOURCES = \
        force.c         ghat.c          init.c          \
        mdatom.c        mdebin.c        minimize.c      \
        ns.c            nsb.c           nsgrid.c        \
-       pme.c           poisson.c       pppm.c          \
-       psgather.c      pull.c          pullinit.c      \
-       pullio.c        pullutil.c      pssolve.c       \
-       psspread.c      shakef.c        sim_util.c      \
+       pme.c           pppm.c          \
+       pull.c          pullinit.c      \
+       pullio.c        pullutil.c      \
+       shakef.c        sim_util.c      \
        splittop.c      tables.c        tgroup.c        \
        update.c        vcm.c           wnblist.c       \
-       poisson.h       splittop.h      wnblist.h       \
+       splittop.h      wnblist.h       \
        pull_internal.h
 
 EXTRA_libmd@LIBSUFFIX@_la_SOURCES = \
index 007a87a10af6be64814e4a0e3be29c987dd62610..c3d29bebb1454b2181a45268bc160e0b1faf3ded 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_calcmu_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <stdio.h>
 #include <stdlib.h>
 #include "typedefs.h"
index fbf6aa2567ebe10d15bfe0002f5032922ba33c8a..3fbd6400b96dae4abceaebb26ec2b8d9f39ece91 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_calcvir_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include "sysstuff.h"
 #include "force.h"
 #include "assert.h"
index 06216499fd976819e04752108605725da255b9d6..39225700bdaab6138b7f69c8ee81fe1c5a1ba179 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_callf77_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include "callf77.h"
 #include "fatal.h"
 
index ec1bc85bf73d4356ab564739041364d9f63f1b13..289c5eb26b4b6b69d415e6ab2ee8d12d2cbc8009 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_clincs_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <math.h>
 #include "main.h"
 #include "constr.h"
index 8f2f936a1c87a5d18f6d847e0df89699c941f8cc..3dbad75dea231b20e4ae9c7c6bac5c0e85984440 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_compnl_c = "$Id$";
+
 #include "ns.h"
 #include "smalloc.h"
 #include "wnblist.h"
index cf8c70debbff9f96134ef9fde08b9dfed38cea94..4eacfa3bb2673405e1941def2e711d083fa1a617 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_constr_c = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -268,7 +268,6 @@ static bool constrain_lincs(FILE *log,t_topology *top,t_inputrec *ir,
   static real      *bllen,*blc,*blcc,*blm,*tmp1,*tmp2,*tmp3,*lincslam,
                    *bllen0,*ddist;
   static int       nc;
-  static bool      bItEqOrder;
 
   char             buf[STRLEN];
   int              b,i,j,nit,warn,p_imax,error;
@@ -284,7 +283,6 @@ static bool constrain_lincs(FILE *log,t_topology *top,t_inputrec *ir,
               &r,&bla1,&bla2,&blnr,&blbnb,
               &bllen,&blc,&blcc,&blm,&tmp1,&tmp2,&tmp3,&lincslam,
               &bllen0,&ddist);
-    bItEqOrder = (getenv("GMX_ACCURATE_LINCS") != NULL);
   } 
   else if (nc != 0) {
     /* If there are any constraints */
@@ -311,13 +309,8 @@ static bool constrain_lincs(FILE *log,t_topology *top,t_inputrec *ir,
       
       if (do_per_step(step,ir->nstlog) || step<0)
        cconerr(&p_max,&p_rms,&p_imax,xprime,nc,bla1,bla2,bllen);
-      
-      if ((ir->eI == eiSteep) || (ir->eI == eiCG) || bItEqOrder)
-       /* Use more iterations when doing energy minimization, *
-        * because we need very accurate positions and forces. */
-       nit = ir->nProjOrder;
-      else
-       nit = 1;
+
+      nit = ir->nLincsIter;
       
 #ifdef USE_FORTRAN
       F77_FUNC(flincs,FLINCS)(x[0],xprime[0],&nc,bla1,bla2,blnr,blbnb,
index c8b46eb5d39536b1a2599751cb966536e14e94ea..74dd0b181f46564274213db8aacaaaa7e2dbf7aa 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_coupling_c = "$Id$";
+
 #include "typedefs.h"
 #include "smalloc.h"
 #include "update.h"
@@ -124,22 +124,19 @@ void parrinellorahman_pcoupl(t_inputrec *ir,int step,tensor pres,
    */
   
   int    d,n;
-  static tensor winv;
-  static bool bFirst=TRUE;
+  tensor winv;
   real   vol=box[XX][XX]*box[YY][YY]*box[ZZ][ZZ];
   real   fac=vol/PRESFAC;
   real   atot,arel,change,maxchange,xy_pressure;
   tensor invbox,pdiff,t1,t2;
 
-  if(bFirst) {
-    real maxl;
-    maxl=max(box[XX][XX],box[YY][YY]);
-    maxl=max(maxl,box[ZZ][ZZ]);
-    for(d=0;d<DIM;d++)
-      for(n=0;n<DIM;n++)
-       winv[d][n]=(4*M_PI*M_PI*ir->compress[d][n])/(3*ir->tau_p*ir->tau_p*maxl);
-    bFirst=FALSE;
-  }
+  real maxl;
+  maxl=max(box[XX][XX],box[YY][YY]);
+  maxl=max(maxl,box[ZZ][ZZ]);
+  for(d=0;d<DIM;d++)
+    for(n=0;n<DIM;n++)
+      winv[d][n]=(4*M_PI*M_PI*ir->compress[d][n])/(3*ir->tau_p*ir->tau_p*maxl);
+
   
   m_inv(box,invbox);
   m_sub(pres,ir->ref_p,pdiff);
@@ -337,17 +334,18 @@ void berendsen_pcoupl(t_inputrec *ir,int step,tensor pres,
     }
 }
 
-void berendsen_tcoupl(t_grpopts *opts,t_groups *grps,
-                     real dt,real SAfactor)
+void berendsen_tcoupl(t_grpopts *opts,t_groups *grps,real dt)
 {
   int    i;
+  
   real   T,reft=0,lll; 
 
   for(i=0; (i<opts->ngtc); i++) {
     T = grps->tcstat[i].T;
     
     if ((opts->tau_t[i] > 0) && (T > 0.0)) {
-      reft = max(0.0,opts->ref_t[i]*SAfactor);
+      reft = max(0.0,opts->ref_t[i]);
       lll  = sqrt(1.0 + (dt/opts->tau_t[i])*(reft/T-1.0));
       grps->tcstat[i].lambda = max(min(lll,1.25),0.8);
     }
@@ -360,28 +358,58 @@ void berendsen_tcoupl(t_grpopts *opts,t_groups *grps,
   }
 }
 
-void nosehoover_tcoupl(t_grpopts *opts,t_groups *grps,
-                      real dt,real SAfactor)
+void nosehoover_tcoupl(t_grpopts *opts,t_groups *grps,real dt)
 {
-  static real *Qinv=NULL;
-  int    i;
-  real   reft=0,xit,oldxi;
-
-  if (Qinv == NULL) {
-    snew(Qinv,opts->ngtc);
-    
-    /* Use inputrec ref_t - Q shouldnt change during the run. */
-    for(i=0;i<opts->ngtc;i++) {
-      if ((opts->tau_t[i] > 0) && (opts->ref_t[i] > 0))
-       Qinv[i]=1.0/(opts->tau_t[i]*opts->tau_t[i]*opts->ref_t[i])/(4*M_PI*M_PI);
-      else
-       Qinv[i]=0.0;
-    }
-  }
+  real  Qinv;
+  int   i;
+  real  reft=0,xit,oldxi;
 
   for(i=0; (i<opts->ngtc); i++) {
-    reft = max(0.0,opts->ref_t[i]*SAfactor);
-    grps->tcstat[i].xi += dt*Qinv[i]*(grps->tcstat[i].T-reft);
+    if ((opts->tau_t[i] > 0) && (opts->ref_t[i] > 0))
+      Qinv=1.0/(opts->tau_t[i]*opts->tau_t[i]*opts->ref_t[i])/(4*M_PI*M_PI);
+    else
+      Qinv=0.0;
+    reft = max(0.0,opts->ref_t[i]);
+    grps->tcstat[i].xi += dt*Qinv*(grps->tcstat[i].T-reft);
   }
 }
   
+/* set target temperatures if we are annealing */
+void 
+update_annealing_target_temp(t_grpopts *opts,real t)
+{
+  int i,j,n;
+  real pert,thist,x;
+
+  for(i=0;i<opts->ngtc;i++) {
+    if(opts->annealing[i] == eannNO)
+      continue;
+    else if(opts->annealing[i] == eannPERIODIC) {
+      /* calculate time modulo the period */
+      pert = opts->anneal_time[i][opts->anneal_npoints[i]-1];
+      n = t / pert;
+      thist = t - n*pert; /* modulo time */
+      /* Make sure rounding didn't get us outside the interval */
+      if(fabs(thist-pert)<GMX_REAL_EPS*100)
+       thist=0;
+    } else /* nonperiodic annealing run */ {
+      thist = t;
+    }
+    /* We are doing annealing for this group if we got here, 
+     * and we have the (relative) time as thist.
+     * calculate target temp */
+    j=0;
+    while(thist>(opts->anneal_time[i][j+1]))
+      j++;
+    /* Found our position between points j and j+1. 
+     * Interpolate: x is the amount from j+1, (1-x) from point j 
+     * First treat possible jumps in temperature as a special case.
+     */
+    if((opts->anneal_time[i][j+1]-opts->anneal_time[i][j])<GMX_REAL_EPS*100)
+      opts->ref_t[i]=opts->anneal_temp[i][j+1];
+    else {
+      x=(thist-opts->anneal_time[i][j])/(opts->anneal_time[i][j+1]-opts->anneal_time[i][j]);
+      opts->ref_t[i]=x*opts->anneal_temp[i][j+1]+(1-x)*opts->anneal_temp[i][j];
+    }
+  }
+}
index 1e1064c00b68086c46a01bc0321c1f3fd6b6e834..0014d1f08c9258cf46904cf05d99de941f86f7b8 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_csettle_c = "$Id$";
+
 #include <math.h>
 #include <stdio.h>
 #include "vec.h"
@@ -52,6 +52,91 @@ static void check_cons(FILE *fp,char *title,real x[],int OW1,int HW2,int HW3)
 }
 #endif
 
+
+/* Our local shake routine to be used when settle breaks down due to a zero determinant */
+static int xshake(real b4[], real after[], real dOH, real dHH, real mO, real mH) 
+{  
+  real bondsq[3];
+  real bond[9];
+  real invmass[3];
+  real M2[3];
+  int iconv;
+  int iatom[3]={0,0,1};
+  int jatom[3]={1,2,2};
+  real rijx,rijy,rijz,tx,ty,tz,im,jm,acor,rp,diff;
+  int i,ll,ii,jj,l3,ix,iy,iz,jx,jy,jz,conv;
+
+  invmass[0]=1.0/mO;
+  invmass[1]=1.0/mH;
+  invmass[2]=1.0/mH;
+
+  bondsq[0]=dOH*dOH;
+  bondsq[1]=bondsq[0];
+  bondsq[2]=dHH*dHH;
+  
+  M2[0]=1.0/(2.0*(invmass[0]+invmass[1]));
+  M2[1]=M2[0];
+  M2[2]=1.0/(2.0*(invmass[1]+invmass[2]));
+
+  for(ll=0;ll<3;ll++) {
+    l3=3*ll;
+    ix=3*iatom[ll];
+    jx=3*jatom[ll];
+    for(i=0;i<3;i++) 
+      bond[l3+i]= b4[ix+i] - b4[jx+i];
+  }
+
+  for(i=0,iconv=0;i<1000 && iconv<3; i++) {
+    for(ll=0;ll<3;ll++) {
+      ii = iatom[ll];
+      jj = jatom[ll];
+      l3 = 3*ll;
+      ix = 3*ii;
+      jx = 3*jj;
+      iy = ix+1;
+      jy = jx+1;
+      iz = ix+2;
+      jz = jx+2;
+
+      rijx = bond[l3];
+      rijy = bond[l3+1];
+      rijz = bond[l3+2];  
+
+      
+      tx   = after[ix]-after[jx];
+      ty   = after[iy]-after[jy];
+      tz   = after[iz]-after[jz];
+      
+      rp   = tx*tx+ty*ty+tz*tz;
+      diff = bondsq[ll] - rp;
+
+      if(fabs(diff)<1e-8) {
+       iconv++;
+      } else {
+       rp = rijx*tx+rijy*ty+rijz*tz;
+       if(rp<1e-8) {
+         printf("SHITSHITSHIT\n");
+         return -1;
+       }
+       acor = diff*M2[ll]/rp;
+       im           = invmass[ii];
+       jm           = invmass[jj];
+       tx           = rijx*acor;
+       ty           = rijy*acor;
+       tz           = rijz*acor;
+       after[ix] += tx*im;
+       after[iy] += ty*im;
+       after[iz] += tz*im;
+       after[jx] -= tx*jm;
+       after[jy] -= ty*jm;
+       after[jz] -= tz*jm;
+      }
+    }
+  }
+  return 0;
+}
+
+
 void csettle(FILE *fp,int nshake, int owptr[],real b4[], real after[],
             real dOH,real dHH,real mO,real mH,int *error)
 {
@@ -87,8 +172,10 @@ void csettle(FILE *fp,int nshake, int owptr[],real b4[], real after[],
     za1d, xb1d, yb1d, zb1d, xc1d, yc1d, zc1d, ya2d, xb2d, yb2d, yc2d, 
     xa3d, ya3d, za3d, xb3d, yb3d, zb3d, xc3d, yc3d, zc3d;
   real t1,t2;
+
+  int doshake;
   
-  int i, ow1, hw2, hw3;
+  int i, shakeret, ow1, hw2, hw3;
 
   *error=-1;
   if (bFirst) {
@@ -116,6 +203,7 @@ void csettle(FILE *fp,int nshake, int owptr[],real b4[], real after[],
 #pragma ivdep
 #endif
   for (i = 0; i < nshake; ++i) {
+    doshake = 0;
     /*    --- Step1  A1' ---      */
     ow1 = owptr[i] * 3;
     hw2 = ow1 + 3;
@@ -191,6 +279,7 @@ void csettle(FILE *fp,int nshake, int owptr[],real b4[], real after[],
     tmp    = rone - sinphi * sinphi;
     if (tmp <= 0) {
       *error = i;
+      doshake = 1;
       cosphi = 0;
     }
     else
@@ -199,65 +288,71 @@ void csettle(FILE *fp,int nshake, int owptr[],real b4[], real after[],
     tmp2   = rone - sinpsi * sinpsi;
     if (tmp2 <= 0) {
       *error = i;
+      doshake = 1;
       cospsi = 0;
     }
     else
       cospsi = tmp2*invsqrt(tmp2);
     /* 46 flops */
     
-    ya2d =  ra * cosphi;
-    xb2d = -rc * cospsi;
-    t1   = -rb * cosphi;
-    t2   =  rc * sinpsi * sinphi;
-    yb2d =  t1 - t2;
-    yc2d =  t1 + t2;
-    /* 7 flops */
-        
-    /*     --- Step3  al,be,ga                       --- */
-    alpa   = xb2d * (xb0d - xc0d) + yb0d * yb2d + yc0d * yc2d;
-    beta   = xb2d * (yc0d - yb0d) + xb0d * yb2d + xc0d * yc2d;
-    gama   = xb0d * yb1d - xb1d * yb0d + xc0d * yc1d - xc1d * yc0d;
-    al2be2 = alpa * alpa + beta * beta;
-    tmp2   = (al2be2 - gama * gama);
-    sinthe = (alpa * gama - beta * tmp2*invsqrt(tmp2)) / al2be2;
-    /* 47 flops */
-    
-    /*  --- Step4  A3' --- */
-    tmp2  = rone - sinthe *sinthe;
-    costhe = tmp2*invsqrt(tmp2);
-    xa3d = -ya2d * sinthe;
-    ya3d = ya2d * costhe;
-    za3d = za1d;
-    xb3d = xb2d * costhe - yb2d * sinthe;
-    yb3d = xb2d * sinthe + yb2d * costhe;
-    zb3d = zb1d;
-    xc3d = -xb2d * costhe - yc2d * sinthe;
-    yc3d = -xb2d * sinthe + yc2d * costhe;
-    zc3d = zc1d;
-    /* 26 flops */
-    
-    /*    --- Step5  A3 --- */
-    xa3 = trns11 * xa3d + trns12 * ya3d + trns13 * za3d;
-    ya3 = trns21 * xa3d + trns22 * ya3d + trns23 * za3d;
-    za3 = trns31 * xa3d + trns32 * ya3d + trns33 * za3d;
-    xb3 = trns11 * xb3d + trns12 * yb3d + trns13 * zb3d;
-    yb3 = trns21 * xb3d + trns22 * yb3d + trns23 * zb3d;
-    zb3 = trns31 * xb3d + trns32 * yb3d + trns33 * zb3d;
-    xc3 = trns11 * xc3d + trns12 * yc3d + trns13 * zc3d;
-    yc3 = trns21 * xc3d + trns22 * yc3d + trns23 * zc3d;
-    zc3 = trns31 * xc3d + trns32 * yc3d + trns33 * zc3d;
-    /* 45 flops */
-    
-    after[ow1] = xcom + xa3;
-    after[ow1 + 1] = ycom + ya3;
-    after[ow1 + 2] = zcom + za3;
-    after[hw2] = xcom + xb3;
-    after[hw2 + 1] = ycom + yb3;
-    after[hw2 + 2] = zcom + zb3;
-    after[hw3] = xcom + xc3;
-    after[hw3 + 1] = ycom + yc3;
-    after[hw3 + 2] = zcom + zc3;
+    if(!doshake) {
+      ya2d =  ra * cosphi;
+      xb2d = -rc * cospsi;
+      t1   = -rb * cosphi;
+      t2   =  rc * sinpsi * sinphi;
+      yb2d =  t1 - t2;
+      yc2d =  t1 + t2;
+      /* 7 flops */
+      
+      /*     --- Step3  al,be,ga                     --- */
+      alpa   = xb2d * (xb0d - xc0d) + yb0d * yb2d + yc0d * yc2d;
+      beta   = xb2d * (yc0d - yb0d) + xb0d * yb2d + xc0d * yc2d;
+      gama   = xb0d * yb1d - xb1d * yb0d + xc0d * yc1d - xc1d * yc0d;
+      al2be2 = alpa * alpa + beta * beta;
+      tmp2   = (al2be2 - gama * gama);
+      sinthe = (alpa * gama - beta * tmp2*invsqrt(tmp2)) / al2be2;
+      /* 47 flops */
+      
+      /*  --- Step4  A3' --- */
+      tmp2  = rone - sinthe *sinthe;
+      costhe = tmp2*invsqrt(tmp2);
+      xa3d = -ya2d * sinthe;
+      ya3d = ya2d * costhe;
+      za3d = za1d;
+      xb3d = xb2d * costhe - yb2d * sinthe;
+      yb3d = xb2d * sinthe + yb2d * costhe;
+      zb3d = zb1d;
+      xc3d = -xb2d * costhe - yc2d * sinthe;
+      yc3d = -xb2d * sinthe + yc2d * costhe;
+      zc3d = zc1d;
+      /* 26 flops */
+      
+      /*    --- Step5  A3 --- */
+      xa3 = trns11 * xa3d + trns12 * ya3d + trns13 * za3d;
+      ya3 = trns21 * xa3d + trns22 * ya3d + trns23 * za3d;
+      za3 = trns31 * xa3d + trns32 * ya3d + trns33 * za3d;
+      xb3 = trns11 * xb3d + trns12 * yb3d + trns13 * zb3d;
+      yb3 = trns21 * xb3d + trns22 * yb3d + trns23 * zb3d;
+      zb3 = trns31 * xb3d + trns32 * yb3d + trns33 * zb3d;
+      xc3 = trns11 * xc3d + trns12 * yc3d + trns13 * zc3d;
+      yc3 = trns21 * xc3d + trns22 * yc3d + trns23 * zc3d;
+      zc3 = trns31 * xc3d + trns32 * yc3d + trns33 * zc3d;
+      /* 45 flops */
+      after[ow1] = xcom + xa3;
+      after[ow1 + 1] = ycom + ya3;
+      after[ow1 + 2] = zcom + za3;
+      after[hw2] = xcom + xb3;
+      after[hw2 + 1] = ycom + yb3;
+      after[hw2 + 2] = zcom + zb3;
+      after[hw3] = xcom + xc3;
+      after[hw3 + 1] = ycom + yc3;
+      after[hw3 + 2] = zcom + zc3;
     /* 9 flops */
+    } else {
+      /* If we couldn't settle this water, try a simplified iterative shake instead */
+      if(xshake(b4+ow1,after+ow1,dOH,dHH,mO,mH)!=0)
+       *error=i;
+    }
 #ifdef DEBUG
     check_cons(fp,"settle",after,ow1,hw2,hw3);
 #endif
index 205116ee2dd0f6392076faa39a16894ef0148c8e..95068e4f79b77a649169da317621e1d8554d0fec 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_dummies_c = "$Id$";
+
 #include <stdio.h>
 #include "typedefs.h"
 #include "assert.h"
index 4c1964d39ddcedbac7318a3239593918a88efb7f..28f57d8cc754b366937959079cdd8c7dba04fc6f 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_ebin_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <math.h>
 #include <string.h>
 #include "sysstuff.h"
index 69b51a09ce16f7c723ad4e88db3e8a12e1509b8b..88ce2806867d21d953bfa0c36471feba05b1209f 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_edsam_c = "$Id$";
+
 #include <stdio.h>
 #include <time.h>
 #include "typedefs.h"
index e65b0690659c9062ea9394ff716e0fb5cb6cf519..9b52e83c8bacb78297408198607a30bd8efd0f61 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_ewald_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "typedefs.h"
index d0a232638a019b476f698b08d878ceae64dc8ade..60c8065ac41b1caabf414e2f0a6ef03ef8085df9 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_fftgrid_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include "assert.h"
 #include "typedefs.h"
 #include "futil.h"
index 552f7f67f752b697ce609bf6282a982d338f2d25..4aa08272c2f247b184b4c1115af0e83ddbf53f0f 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_force_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "typedefs.h"
@@ -55,7 +55,6 @@ static char *SRCID_force_c = "$Id$";
 #include "ewald_util.h"
 #include "shift_util.h"
 #include "pppm.h"
-#include "poisson.h"
 #include "ewald.h"
 #include "pme.h"
 #include "mdrun.h"
@@ -677,7 +676,20 @@ void init_forcerec(FILE *fp,
     set_avcsix(fp,fr,mdatoms);
   if (fr->bBHAM)
     set_bham_b_max(fp,fr,mdatoms);
-  
+
+  /* Copy the GBSA data (radius, volume and surftens for each
+   * atomtype) from the topology atomtype section to forcerec.
+   */
+  snew(fr->atype_radius,fr->ntype);
+  snew(fr->atype_vol,fr->ntype);
+  snew(fr->atype_surftens,fr->ntype);
+  for(i=0;i<fr->ntype;i++)
+    fr->atype_radius[i]=top->atomtypes.radius[i];
+  for(i=0;i<fr->ntype;i++)
+    fr->atype_vol[i]=top->atomtypes.vol[i];
+  for(i=0;i<fr->ntype;i++)
+    fr->atype_surftens[i]=top->atomtypes.surftens[i];
+    
   /* Now update the rest of the vars */
   update_forcerec(fp,fr,box);
   /* if we are using LR electrostatics, and they are tabulated,
@@ -922,10 +934,6 @@ void force(FILE       *fp,     int        step,
       Vlr = do_pppm(fp,FALSE,x,fr->f_pme,md->chargeT,
                    box_size,fr->phi,cr,nsb,nrnb);
       break;
-    case eelPOISSON:
-      Vlr = do_poisson(fp,FALSE,ir,md->nr,x,fr->f_pme,md->chargeT,
-                      box_size,fr->phi,cr,nrnb,&nit,TRUE);
-      break;
     case eelPME:
       Vlr = do_pme(fp,FALSE,ir,x,fr->f_pme,md->chargeT,
                   box,cr,nsb,nrnb,lr_vir,fr->ewaldcoeff,bGatherOnly);
index 95fca674f9b36a49f79ad6f8e0421c5c03da366b..fa367a91e24b48030cab7378405cb75b0ec53bb2 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_ghat_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include <stdio.h>
 #include "typedefs.h"
 #include "futil.h"
index ec5166e799546085b42983c36633c9cbb59f8291..bd48b4894fd5e4cb236331f063ce464f1f0f0755 100644 (file)
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_init_c = "$Id$";
+
 #include <stdio.h>
 #include "typedefs.h"
 #include "tpxio.h"
 #include "smalloc.h"
 #include "vec.h"
-#include "vveclib.h"
 #include "main.h"
 #include "mvdata.h"
 #include "fatal.h"
@@ -65,11 +64,9 @@ void check_nnodes_top(char *fn,t_topology *top,int nnodes)
                fn,np,ShortProgram(),nnodes);
 }
 
-static char *int_title(char *title,int nodeid)
+static char *int_title(char *title,int nodeid,char buf[], int size)
 {
-  static char buf[BUFSIZE];
-
-  sprintf(buf,"%s (%d)",title,nodeid);
+  snprintf(buf,size-1,"%s (%d)",title,nodeid);
   return buf;
 }
 
@@ -109,7 +106,7 @@ void init_single(FILE *log,t_parm *parm,
 
   snew(tpx,1);
   
-  read_tpxheader(tpxfile,tpx);
+  read_tpxheader(tpxfile,tpx,FALSE,NULL,NULL);
   snew(*x,tpx->natoms);
   snew(*v,tpx->natoms);
   
@@ -139,7 +136,7 @@ void distribute_parts(int left,int right,int nodeid,int nnodes,t_parm *parm,
   t_nsborder  nsb;
   rvec        *x,*v;
   
-  read_tpxheader(tpxfile,&tpx);
+  read_tpxheader(tpxfile,&tpx,FALSE,NULL,NULL);
   snew(x,tpx.natoms);
   snew(v,tpx.natoms);
   read_tpx(tpxfile,&step,&t,&lambda,&parm->ir,parm->box,
@@ -159,6 +156,8 @@ void init_parts(FILE *log,t_commrec *cr,
                t_nsborder *nsb,int list, bool *bParallelDummies,
                t_comm_dummies *dummycomm)
 {
+  char buf[256];
+  
   ld_data(cr->left,cr->right,parm,nsb,top,x,v);
   if (cr->nodeid != 0)
     mv_data(cr->left,cr->right,parm,nsb,top,*x,*v);
@@ -174,11 +173,11 @@ void init_parts(FILE *log,t_commrec *cr,
     if (list&LIST_PARM)
       write_parm(log,"parameters of the run",cr->nodeid,parm);
     if (list&LIST_X)
-      pr_rvecs(log,0,int_title("x",0),*x,nsb->natoms);
+      pr_rvecs(log,0,int_title("x",0,buf,255),*x,nsb->natoms);
     if (list&LIST_V)
-      pr_rvecs(log,0,int_title("v",0),*v,nsb->natoms);
+      pr_rvecs(log,0,int_title("v",0,buf,255),*v,nsb->natoms);
     if (list&LIST_TOP)
-      pr_top(log,0,int_title("topology",cr->nodeid),top);
+      pr_top(log,0,int_title("topology",cr->nodeid,buf,255),top,TRUE);
     fflush(log);
   }
   *mdatoms=atoms2md(log,&(top->atoms),parm->ir.opts.nFreeze,
index c6d5c2c96743d05f614145c7d21b47c22b37ed39..cdf5aeba635c1c23b05f2cbe41b1143c3b69a6bf 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_mdatom_c = "$Id$";
+
 #include "typedefs.h"
 #include "mdatoms.h"
 #include "smalloc.h"
@@ -187,35 +187,21 @@ void md2atoms(t_mdatoms *md,t_atoms *atoms,bool bFree)
   }
 }
 
-void init_mdatoms(t_mdatoms *md,real lambda,bool bFirst)
+void update_mdatoms(t_mdatoms *md,real lambda, bool bFirst)
 {
-  static real lambda0;
   int    i,end;
   real   L1=1.0-lambda;
   
-  if (bFirst)
-    lambda0 = lambda;
   end=md->nr;
-  
-  /* Only do this loop the first time, or when lambda has changed.
-   * One could also check whether there is any perturbed atom at all,
-   * but if you don't have perturbed atoms, it does not make sense to modify lambda.
-   * In principle this has to be parallellized, although it would mean extra 
-   * communication. Basically only the charges are used on other nodes...
-   */
-  if (bFirst || (lambda0 != lambda)) {
-    for(i=0; (i<end); i++) {
-      if (md->bPerturbed[i] || bFirst) {
-       md->massT[i]=L1*md->massA[i]+lambda*md->massB[i];
-       if (md->invmass[i] > 1.1*ALMOST_ZERO)
-         md->invmass[i]=1.0/md->massT[i];
-       md->chargeT[i]=L1*md->chargeA[i]+lambda*md->chargeB[i];
-      }
+
+  for(i=0; (i<end); i++) {
+    if (md->bPerturbed[i] || bFirst) {
+      md->massT[i]=L1*md->massA[i]+lambda*md->massB[i];
+      if (md->invmass[i] > 1.1*ALMOST_ZERO)
+       md->invmass[i]=1.0/md->massT[i];
+      md->chargeT[i]=L1*md->chargeA[i]+lambda*md->chargeB[i];
     }
   }
-  lambda0 = lambda;
 }
 
 
-
-
index 050f2b36b80b2fa26fc5ff630fb691d0d761b258..d43a4cfba10b8961c4a0689cb686d601600bbab6 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_mdebin_c = "$Id$";
+
 #include <string.h>
 #include "typedefs.h"
 #include "string2.h"
@@ -403,16 +403,16 @@ static void pprint(FILE *log,char *s)
   fprintf(log,"  ======>\n\n");
 }
 
-void print_ebin_header(FILE *log,int steps,real time,real lamb,real SAfactor)
+void print_ebin_header(FILE *log,int steps,real time,real lamb)
 {
-  fprintf(log,"   %12s   %12s   %12s   %12s\n"
-         "   %12d   %12.5f   %12.5f   %12.5f\n\n",
-         "Step","Time","Lambda","Annealing",steps,time,lamb,SAfactor);
+  fprintf(log,"   %12s   %12s   %12s\n"
+         "   %12d   %12.5f   %12.5f\n\n",
+         "Step","Time","Lambda",steps,time,lamb);
 }
 
-void print_ebin(int fp_ene,bool bEne,bool bDR,bool bOR,
+void print_ebin(int fp_ene,bool bEne,bool bDR,bool bOR,bool bDihR,
                FILE *log,int steps,real time,int mode,bool bCompact,
-               t_mdebin *md,t_fcdata *fcd,t_atoms *atoms)
+               t_mdebin *md,t_fcdata *fcd,t_atoms *atoms, t_grpopts *opts)
 {
   static char **grpnms=NULL;
   static char *kjm="(kJ/mol)";
@@ -421,7 +421,7 @@ void print_ebin(int fp_ene,bool bEne,bool bDR,bool bOR,
   int         nr[enxNR];
   real        *block[enxNR];
   t_enxframe  fr;
-
+  
   switch (mode) {
   case eprNORMAL:
     fr.t          = time;
@@ -456,6 +456,11 @@ void print_ebin(int fp_ene,bool bEne,bool bDR,bool bOR,
   }
   
   if (log) {
+    for(i=0;i<opts->ngtc;i++)
+      if(opts->annealing[i]!=eannNO)
+       fprintf(log,"Current ref_t for group %s: %8.1f\n",
+               *(atoms->grpname[atoms->grps[egcTC].nm_ind[i]]),opts->ref_t[i]);
+  
     if (mode==eprNORMAL && fcd->orires.nr>0)
       print_orires_log(log,fcd);
 
index 06cdccea981233ccee9eb1a511f8436a454a092e..1c519e836fc5cefe919ff6c4c2796ec550a353bb 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the papers on the package - you can find them in the top README file.
  * 
+
  * For more info, check our website at http://www.gromacs.org
  * 
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_minimize_c = "$Id$";
+
 #include <string.h>
 #include <time.h>
 #include <math.h>
@@ -60,7 +61,7 @@ static char *SRCID_minimize_c = "$Id$";
 #include "dummies.h"
 #include "mdrun.h"
 
-static void sp_header(FILE *out,char *minimizer,real ftol,int nsteps)
+static void sp_header(FILE *out,const char *minimizer,real ftol,int nsteps)
 {
   fprintf(out,"%s:\n",minimizer);
   fprintf(out,"   Tolerance         = %12.5e\n",ftol);
@@ -78,7 +79,7 @@ static void warn_step(FILE *fp,real ustep,real ftol,bool bConstrain)
            "off constraints alltogether (set constraints = none in mdp file)\n");
 }
 
-static void print_converged(FILE *fp,char *alg,real ftol,int count,bool bDone,
+static void print_converged(FILE *fp,const char *alg,real ftol,int count,bool bDone,
                            int nsteps,real epot,real fmax)
 {
   if (bDone)
@@ -154,7 +155,7 @@ static real f_norm(t_commrec *cr,
   return sqrt(fnorm2); 
 } 
 
-static void init_em(FILE *log,char *title,
+static void init_em(FILE *log,const char *title,
                    t_parm *parm,real *lambda,t_nrnb *mynrnb,rvec mu_tot,rvec box_size,
                    t_forcerec *fr,t_mdatoms *mdatoms,t_topology *top,t_nsborder *nsb,
                    t_commrec *cr,t_vcm **vcm,int *start,int *end)
@@ -176,7 +177,7 @@ static void init_em(FILE *log,char *title,
   *end   = nsb->homenr[cr->nodeid] + *start;
 
   /* Set initial values for invmass etc. */
-  init_mdatoms(mdatoms,*lambda,TRUE);
+  update_mdatoms(mdatoms,*lambda,TRUE);
 
   *vcm = init_vcm(log,top,cr,mdatoms,
                  *start,HOMENR(nsb),parm->ir.nstcomm);
@@ -191,7 +192,7 @@ time_t do_cg(FILE *log,int nfile,t_filenm fnm[],
             t_commrec *cr,t_commrec *mcr,t_graph *graph,
             t_forcerec *fr,rvec box_size)
 {
-  static char *CG="Conjugate Gradients";
+  const char *CG="Conjugate Gradients";
   double gpa,gpb;
   double EpotA=0.0,EpotB=0.0,a=0.0,b,beta=0.0,zet,w;
   real   lambda,fmax,testf,smin;
@@ -289,9 +290,9 @@ time_t do_cg(FILE *log,int nfile,t_filenm fnm[],
               force_vir,parm->vir,parm->pres,grps,mu_tot,
               (parm->ir.etc==etcNOSEHOOVER));
     
-    print_ebin_header(log,count,count,lambda,0.0);
-    print_ebin(fp_ene,TRUE,FALSE,FALSE,log,count,count,eprNORMAL,
-              TRUE,mdebin,fcd,&(top->atoms));
+    print_ebin_header(log,count,count,lambda);
+    print_ebin(fp_ene,TRUE,FALSE,FALSE,FALSE,log,count,count,eprNORMAL,
+              TRUE,mdebin,fcd,&(top->atoms),&(parm->ir.opts));
   }
   where();
   
@@ -492,9 +493,9 @@ time_t do_cg(FILE *log,int nfile,t_filenm fnm[],
                 force_vir,parm->vir,parm->pres,grps,mu_tot,
                 (parm->ir.etc==etcNOSEHOOVER));
       /* Print the energies allways when we should be verbose */
-      print_ebin_header(log,count,count,lambda,0.0);
-      print_ebin(fp_ene,TRUE,FALSE,FALSE,log,count,count,eprNORMAL,
-                TRUE,mdebin,fcd,&(top->atoms));
+      print_ebin_header(log,count,count,lambda);
+      print_ebin(fp_ene,TRUE,FALSE,FALSE,FALSE,log,count,count,eprNORMAL,
+                TRUE,mdebin,fcd,&(top->atoms),&(parm->ir.opts));
     }
     
     /* Stop when the maximum force lies below tolerance */
@@ -538,7 +539,7 @@ time_t do_steep(FILE *log,int nfile,t_filenm fnm[],
                t_commrec *cr,t_commrec *mcr,t_graph *graph,
                t_forcerec *fr,rvec box_size) 
 { 
-  static char *SD="Steepest Descents"; 
+  const char *SD="Steepest Descents"; 
   real   stepsize,constepsize,lambda,fmax; 
   rvec   *pos[2],*force[2],*xcf=NULL; 
   rvec   *xx,*ff; 
@@ -678,7 +679,7 @@ time_t do_steep(FILE *log,int nfile,t_filenm fnm[],
     sum_epot(&(parm->ir.opts),grps,ener); 
 
     if (MASTER(cr))
-      print_ebin_header(log,count,count,lambda,0.0);
+      print_ebin_header(log,count,count,lambda);
 
     if (bConstrain) {
       fmax=f_max(cr->left,cr->right,nsb->nnodes,&(parm->ir.opts),mdatoms,start,end,
@@ -729,7 +730,8 @@ time_t do_steep(FILE *log,int nfile,t_filenm fnm[],
        print_ebin(fp_ene,TRUE,
                   do_per_step(steps_accepted,parm->ir.nstdisreout),
                   do_per_step(steps_accepted,parm->ir.nstorireout),
-                  log,count,count,eprNORMAL,TRUE,mdebin,fcd,&(top->atoms));
+                  do_per_step(steps_accepted,parm->ir.nstdihreout),
+                  log,count,count,eprNORMAL,TRUE,mdebin,fcd,&(top->atoms),&(parm->ir.opts));
        fflush(log);
       }
     } 
@@ -881,12 +883,11 @@ time_t do_nm(FILE *log,t_commrec *cr,int nfile,t_filenm fnm[],
                     bBHAM,b14,parm->ir.efep!=efepNO,parm->ir.epc,
                     parm->ir.eDispCorr,TRICLINIC(parm->ir.compress),(parm->ir.etc==etcNOSEHOOVER),cr);
 
-  /* Calculate Temperature coupling parameters lambda */
-  ener[F_TEMP]=sum_ekin(&(parm->ir.opts),grps,parm->ekin,bTYZ);
+   ener[F_TEMP]=sum_ekin(&(parm->ir.opts),grps,parm->ekin,bTYZ);
   if(parm->ir.etc==etcBERENDSEN)
-    berendsen_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t,lam0);
+    berendsen_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t);
   else if(parm->ir.etc==etcNOSEHOOVER)
-    nosehoover_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t,lam0);
+    nosehoover_tcoupl(&(parm->ir.opts),grps,parm->ir.delta_t);
 
   where();
   
@@ -998,10 +999,10 @@ time_t do_nm(FILE *log,t_commrec *cr,int nfile,t_filenm fnm[],
   lambda=lam0+step*parm->ir.delta_lambda;
   
   if (MASTER(cr)) {
-    print_ebin(-1,FALSE,FALSE,FALSE,log,step,t,eprAVER,
-              FALSE,mdebin,fcd,&(top->atoms));
-    print_ebin(-1,FALSE,FALSE,FALSE,log,step,t,eprRMS,
-              FALSE,mdebin,fcd,&(top->atoms));
+    print_ebin(-1,FALSE,FALSE,FALSE,FALSE,log,step,t,eprAVER,
+              FALSE,mdebin,fcd,&(top->atoms),&(parm->ir.opts));
+    print_ebin(-1,FALSE,FALSE,FALSE,FALSE,log,step,t,eprRMS,
+              FALSE,mdebin,fcd,&(top->atoms),&(parm->ir.opts));
   }
   
   /* Construct dummy particles, for last output frame */
index 290a258746c153171c4e6020721ca25fd1540e54..4acc1daf6a929672668a335bdc1515fc5a015b25 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_ns_c = "$Id$";
+
 #ifdef USE_THREADS
 #include <pthread.h> /* must come first */
 #endif
@@ -1754,7 +1754,7 @@ int search_neighbours(FILE *log,t_forcerec *fr,
       }
     }
     if (debug) 
-      pr_ivec(debug,0,"bHaveLJ",bHaveLJ,fr->ntype);
+      pr_ivec(debug,0,"bHaveLJ",bHaveLJ,fr->ntype,TRUE);
     
     bFirst=FALSE;
   }
index faf1e5baf6f5a297eb81cdf9974c17b22e0d1526..8ccb2645da46da9a38ecc6c0a992078abb69aca5 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Getting the Right Output Means no Artefacts in Calculating Stuff
  */
-static char *SRCID_nsb_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include "sysstuff.h"
 #include "assert.h"
 #include "typedefs.h"
index 15e4161b32d4cecb6fdb88641f21cc2584a8fece..2ad572e721a0c52c60287c432dc8ee413cccd68a 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_nsgrid_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
 #include "assert.h"
 #include "sysstuff.h"
 #include "typedefs.h"
index aa296c50190313ef3998409032e82a49ad09cbeb..bbda084cc4d126a1b30b03c70259d61cbf504389 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_pme_c = "$Id$";
+
 /* IMPORTANT FOR DEVELOPERS:
  *
  * Triclinic pme stuff isn't entirely trivial, and we've experienced
index 32e751545c64f0fd99f5a3ad6dbe01a2283ca720..7d3ae02fc68dff3a017189426a1790dbd36a6e4d 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_pppm_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "assert.h"
@@ -521,9 +521,9 @@ void init_pppm(FILE *log,t_commrec *cr,t_nsborder *nsb,
     /* Check whether boxes correspond */
     for(m=0; (m<DIM); m++)
       if (fabs(box[m]-grids[m]*spacing[m]) > tol) {
-       pr_rvec(log,0,"box",box,DIM);
-       pr_rvec(log,0,"grid-spacing",spacing,DIM);
-       pr_ivec(log,0,"grid size",grids,DIM);
+       pr_rvec(log,0,"box",box,DIM,TRUE);
+       pr_rvec(log,0,"grid-spacing",spacing,DIM,TRUE);
+       pr_ivec(log,0,"grid size",grids,DIM,TRUE);
        fflush(log);
        fatal_error(0,"Box sizes in tpb file and Ghat file %s do not match\n"
                    "Check your log file!",ghatfn);
index f730d1feb2fc4ee8d1347c8566489d9a98a7a3e7..a94a08c6fe6897f2e02f88e01f84e2c043f9d005 100644 (file)
@@ -33,7 +33,7 @@
  * And Hey:
  * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
  */
-static char *SRCID_pull_c = "$Id$";
+
 #include "futil.h"
 #include "rdgroup.h"
 #include "statutil.h"
index 39955d775ce15ddb956571bd60e0ee60ae767c93..fce3933c1012c91b2173b038d395f404edf3187d 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_pull_internal_h = "$Id$";
+
 
 #ifndef _pull_internal_h
 #define _pull_internal_h
index 3fd3335ce47eb242fed62d9ed8b527519f4288eb..644330c884f17fe21d0c54509a93061556f6e4df 100644 (file)
@@ -33,7 +33,9 @@
  * And Hey:
  * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
  */
-static char *SRCID_pullinit_c = "$Id$";
+
+/* This file is threadsafe - keep it that way */
+
 #include <string.h>
 #include "princ.h"
 #include <stdlib.h>
index fb37da0591f1f99f47bbf7b637a0ad2d09354e26..9311b5ecd03a124657c740778c1d1f2ca5df6c4c 100644 (file)
@@ -33,7 +33,7 @@
  * And Hey:
  * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
  */
-static char *SRCID_pullio_c = "$Id$";
+
 #include <string.h>
 #include <stdlib.h>
 #include "sysstuff.h"
@@ -196,25 +196,25 @@ void read_pullparams(t_pull *pull, char *infile, char *outfile)
   enum {
     erunSTART, erunAFM, erunConstraint, erunUmbrella, erunTest, erunNR
   };
-  static char *runtypes[erunNR+1] = { 
+  static const char *runtypes[erunNR+1] = { 
     "start", "afm", "constraint", "umbrella", "test", NULL
   };
   enum {
     erefCom, erefComT0, erefDyn, erefDynT0, erefNR
   };
-  static char *reftypes[erefNR+1] = {
+  static const char *reftypes[erefNR+1] = {
     "com", "com_t0", "dynamic", "dynamic_t0", NULL
   };
   enum {
     ereverseTO_REF, ereverseFROM_REF, ereverseNR
   };
-  static char *reversetypes[ereverseNR+1] = {
+  static const char *reversetypes[ereverseNR+1] = {
     "from_reference", "to_reference", NULL
   };
   enum {
     everboseYES, everboseNO, everboseNR
   };
-  static char *verbosetypes[erefNR+1] = {
+  static const char *verbosetypes[erefNR+1] = {
     "no", "yes", NULL
   };
   int nerror = 0;
index a4378747bc788246a98abdaa0da608f8b6d7d35e..6198a12313aba49693ee5bdef55dd06b91eba1b7 100644 (file)
@@ -33,7 +33,7 @@
  * And Hey:
  * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
  */
-static char *SRCID_pullutil_c = "$Id$";
+
 #include <stdlib.h>
 #include "sysstuff.h"
 #include "princ.h"
index 168a41ce60d2f6d5419d8ea9c2cf3878d6aa088c..65e2494ef70d4404f83f01285dd4fecea61ce074 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_shakef_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "typedefs.h"
index 0f470bb5a03c0661acf4522ee5c7483b626487d2..fb05cf7ec9616bdb971572d9467cbec68db57b28 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_sim_util_c = "$Id$";
+
 #include <stdio.h>
 #include <time.h>
 #include "typedefs.h"
@@ -414,7 +414,7 @@ void do_shakefirst(FILE *log,bool bTYZ,real lambda,real ener[],
     fprintf(log,"\nConstraining the starting coordinates (step %d)\n",step);
     clear_mat(shake_vir);
     update(nsb->natoms,start,homenr,step,lambda,&ener[F_DVDL],
-          parm,1.0,md,x,graph,
+          parm,md,x,graph,
           NULL,NULL,vold,NULL,x,top,grps,shake_vir,cr,nrnb,bTYZ,
           FALSE,edyn,pulldata,FALSE);
     /* Compute coordinates at t=-dt, store them in buf */
@@ -433,7 +433,7 @@ void do_shakefirst(FILE *log,bool bTYZ,real lambda,real ener[],
     fprintf(log,"\nConstraining the coordinates at t0-dt (step %d)\n",step);
     clear_mat(shake_vir);
     update(nsb->natoms,start,homenr,
-          step,lambda,&ener[F_DVDL],parm,1.0,md,f,graph,
+          step,lambda,&ener[F_DVDL],parm,md,f,graph,
           NULL,NULL,vold,NULL,buf,top,grps,shake_vir,cr,nrnb,bTYZ,FALSE,
           edyn,pulldata,FALSE);
     
@@ -569,18 +569,19 @@ void finish_run(FILE *log,t_commrec *cr,char *confout,
 }
 
 void init_md(t_commrec *cr,t_inputrec *ir,tensor box,real *t,real *t0,
-            real *lambda,real *lam0,real *SAfactor,
+            real *lambda,real *lam0,
             t_nrnb *mynrnb,bool *bTYZ,t_topology *top,
             int nfile,t_filenm fnm[],char **traj,
             char **xtc_traj,int *fp_ene,
             FILE **fp_dgdl,t_mdebin **mdebin,t_groups *grps,
             tensor force_vir,tensor pme_vir,
             tensor shake_vir,t_mdatoms *mdatoms,rvec mu_tot,
-            bool *bNEMD,t_vcm **vcm,t_nsborder *nsb)
+            bool *bNEMD,bool *bSimAnn,t_vcm **vcm,t_nsborder *nsb)
 {
   bool bBHAM,b14,bLR,bLJLR;
-  int  i;
-  
+  int  i,j,n;
+  real tmpt,mod;
+
   /* Initial values */
   *t = *t0       = ir->init_t;
   if (ir->efep != efepNO) {
@@ -589,13 +590,16 @@ void init_md(t_commrec *cr,t_inputrec *ir,tensor box,real *t,real *t0,
   else {
     *lambda = *lam0   = 0.0;
   } 
-  if (ir->bSimAnn) {
-    *SAfactor = 1.0 - *t0/ir->zero_temp_time;
-    if (*SAfactor < 0) 
-      *SAfactor = 0;
-  } else
-    *SAfactor     = 1.0;
-    
+  *bSimAnn=FALSE;
+  for(i=0;i<ir->opts.ngtc;i++) {
+    /* set bSimAnn if any group is being annealed */
+    if(ir->opts.annealing[i]!=eannNO)
+      *bSimAnn = *bSimAnn || TRUE;
+  }
+  if(*bSimAnn) 
+    update_annealing_target_temp(&(ir->opts),ir->init_t); 
+
   init_nrnb(mynrnb);
   
   /* Check Environment variables & other booleans */
@@ -630,7 +634,7 @@ void init_md(t_commrec *cr,t_inputrec *ir,tensor box,real *t,real *t0,
   clear_rvec(mu_tot);
   
   /* Set initial values for invmass etc. */
-  init_mdatoms(mdatoms,*lambda,TRUE);
+  update_mdatoms(mdatoms,*lambda,TRUE);
 
   *vcm = init_vcm(stdlog,top,cr,mdatoms,START(nsb),HOMENR(nsb),ir->nstcomm);
     
index 8c7e0eb32633ec694afac894404a3ef811209bfc..3f3ec7352762a4f1961698fdf26fd43fcaee6306 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_splittop_c = "$Id$";
+/* This file is completely threadsafe - keep it that way! */
+
 #include "sysstuff.h"
 #include "typedefs.h"
 #include "splittop.h"
index f4aabab57e111e7d8e062fb5eb258a997fc4cca0..2b7db728ccc6d601a86be4b88f0f17e77236daac 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_splittop_h = "$Id$";
+
 #include "dummies.h"
 
 extern void mdsplit_top(FILE *log,t_topology *top,t_commrec *cr,
index b4d9f20fab81e088fe6d4f4100e62bc468832b41..87bb452af052be7ade2b5f64fb7ad42948d4cd03 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_tables_c = "$Id$";
+
 #include <math.h>
 #include "typedefs.h"
 #include "names.h"
@@ -47,7 +47,7 @@ enum {
   etabRF,    etabCOUL, etabEwald, etabLJ6Switch, etabLJ12Switch,etabCOULSwitch, 
   etabEXPMIN,etabUSER, etabNR 
 };
-static char *tabnm[etabNR] = { 
+static const char *tabnm[etabNR] = { 
   "LJ6",   "LJ12", "LJ6Shift", "LJ12Shift", "Shift",
   "RF",    "COUL", "Ewald", "LJ6Switch", "LJ12Switch","COULSwitch", 
   "EXPMIN","USER" 
@@ -540,7 +540,7 @@ static void set_table_type(int tabsel[],t_forcerec *fr)
 
 void make_tables(FILE *out,t_forcerec *fr,bool bVerbose,char *fn)
 {
-  static char *fns[3] = { "ctab.xvg", "dtab.xvg", "rtab.xvg" };
+  const char *fns[3] = { "ctab.xvg", "dtab.xvg", "rtab.xvg" };
   FILE        *fp;
   t_tabledata *td;
   bool        bReadTab,bGenTab;
index 83eb9ce3881551e73bae61abce754f964d9ed74f..2ab354ee69f7c8ab62fbfb7a00ff13da52c31a32 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_tgroup_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
 #include <math.h>
 #include "macros.h"
 #include "main.h"
@@ -39,7 +40,6 @@ static char *SRCID_tgroup_c = "$Id$";
 #include "vec.h"
 #include "network.h"
 #include "smalloc.h"
-#include "vveclib.h"
 #include "update.h"
 #include "rbin.h"
 #include "assert.h"
index b3dbf44d5b1b7bddfeb0c70485612bc143fd5ed8..9ed5f6b51bffab08b4ba9f6be3535b8b0e0300ac 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_timefft_c = "$Id$";
+
 #include <math.h>
 #include <stdio.h>
 #include <time.h>
index bbe95f6acb9af79d7340733998f5af242e99787f..093ff2bc735a10e82be707f029076b8e7ac315ef 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROup of MAchos and Cynical Suckers
  */
-static char *SRCID_update_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 
@@ -40,7 +40,6 @@ static char *SRCID_update_c = "$Id$";
 #include "nrnb.h"
 #include "physics.h"
 #include "macros.h"
-#include "vveclib.h"
 #include "vec.h"
 #include "main.h"
 #include "confio.h"
@@ -68,11 +67,9 @@ typedef struct {
   real d;
 } t_sdconst;
 
-/* constants for a (bad) random number generator */
-const unsigned long im = 0xffff;
-const unsigned long ia = 1093;
-const unsigned long ic = 18257;
-const real inv_im      = 1.0/(0xffff);
+
+
+
 
 static t_sdconst *sdc;
 
@@ -233,22 +230,6 @@ static void do_update_visc(int start,int homenr,double dt,
   }
 }
 
-static real fgauss(unsigned long *jran)
-{
-  static real sqrt3 = 1.7320508075688772;
-  real jr;
-
-  *jran = (*jran*ia+ic) & im;
-  jr = (real)*jran;
-  *jran = (*jran*ia+ic) & im;
-  jr += (real)*jran;
-  *jran = (*jran*ia+ic) & im;
-  jr += (real)*jran;
-  *jran = (*jran*ia+ic) & im;
-  jr += (real)*jran;
-
-  return sqrt3*(jr*inv_im-2);
-}
 
 void init_sd_consts(int ngtc,real tau_t[],real dt)
 {
@@ -283,10 +264,10 @@ static void do_update_sd(int start,int homenr,
                          rvec accel[],ivec nFreeze[],
                          real invmass[],unsigned short ptype[],
                          unsigned short cFREEZE[],unsigned short cACC[],
-                         unsigned short cTC[],real SAfactor,
+                         unsigned short cTC[],
                          rvec x[],rvec xprime[],rvec v[],rvec vold[],rvec f[],
                          int ngtc,real tau_t[],real ref_t[],
-                         int *seed, bool bFirstHalf)
+                         t_Gaussdata gaussrand, bool bFirstHalf)
 {
   typedef struct {
     real V;
@@ -313,7 +294,7 @@ static void do_update_sd(int start,int homenr,
 
   if(bFirstHalf) {
     for(n=0; n<ngtc; n++) {
-      kT = BOLTZ*SAfactor*ref_t[n];
+      kT = BOLTZ*ref_t[n];
       /* The mass is encounted for later, since this differs per atom */
       sig[n].V  = sqrt(kT*(1-sdc[n].em));
       sig[n].X  = sqrt(kT*sqr(tau_t[n])*sdc[n].c);
@@ -322,8 +303,6 @@ static void do_update_sd(int start,int homenr,
     }
   }
 
-  jran = (unsigned long)((real)im*rando(seed));
-
   for(n=start; n<start+homenr; n++) {
     ism = sqrt(invmass[n]);
     gf  = cFREEZE[n];
@@ -339,11 +318,11 @@ static void do_update_sd(int start,int homenr,
         if(bFirstHalf) {
 
           if(bFirst)
-            X[n-start][d] = ism*sig[gt].X*fgauss(&jran);
+            X[n-start][d] = ism*sig[gt].X*gauss(gaussrand);
 
           Vmh = X[n-start][d]*sdc[gt].d/(tau_t[gt]*sdc[gt].c) 
-                + ism*sig[gt].Yv*fgauss(&jran);
-          V[n-start][d] = ism*sig[gt].V*fgauss(&jran);
+                + ism*sig[gt].Yv*gauss(gaussrand);
+          V[n-start][d] = ism*sig[gt].V*gauss(gaussrand);
 
           v[n][d] = vn*sdc[gt].em 
                     + (invmass[n]*f[n][d] + accel[ga][d])*tau_t[gt]*(1 - sdc[gt].em)
@@ -358,8 +337,8 @@ static void do_update_sd(int start,int homenr,
           (xprime[n][d] - x[n][d])/(tau_t[gt]*(sdc[gt].eph - sdc[gt].emh));  
 
           Xmh = V[n-start][d]*tau_t[gt]*sdc[gt].d/(sdc[gt].em-1) 
-                + ism*sig[gt].Yx*fgauss(&jran);
-          X[n-start][d] = ism*sig[gt].X*fgauss(&jran);
+                + ism*sig[gt].Yx*gauss(gaussrand);
+          X[n-start][d] = ism*sig[gt].X*gauss(gaussrand);
 
           xprime[n][d] += X[n-start][d] - Xmh;
 
@@ -383,7 +362,7 @@ static void do_update_bd(int start,int homenr,double dt,
                          rvec x[],rvec xprime[],rvec v[],rvec vold[],
                          rvec f[],real temp,real fr,
                          int ngtc,real tau_t[],real ref_t[],
-                         int *seed)
+                         t_Gaussdata gaussrand)
 {
   int    gf,gt;
   real   vn;
@@ -402,8 +381,6 @@ static void do_update_bd(int start,int homenr,double dt,
     for(n=0; n<ngtc; n++)
       rf[n]  = sqrt(2.0*BOLTZ*ref_t[n]);
 
-  jran = (unsigned long)((real)im*rando(seed));
-
   for(n=start; (n<start+homenr); n++) {
     gf = cFREEZE[n];
     gt = cTC[n];
@@ -411,11 +388,11 @@ static void do_update_bd(int start,int homenr,double dt,
       vold[n][d]     = v[n][d];
       if((ptype[n]!=eptDummy) && (ptype[n]!=eptShell) && !nFreeze[gf][d]) {
         if(fr)
-          vn         = invfr*f[n][d] + rfac*fgauss(&jran);
+          vn         = invfr*f[n][d] + rfac*gauss(gaussrand);
         else
           /* NOTE: invmass = 1/(mass*fric_const*dt) */
           vn         = invmass[n]*f[n][d]*dt 
-                       + sqrt(invmass[n])*rf[gt]*fgauss(&jran);
+                       + sqrt(invmass[n])*rf[gt]*gauss(gaussrand);
 
         v[n][d]      = vn;
         xprime[n][d] = x[n][d]+vn*dt;
@@ -581,7 +558,6 @@ void update(int          natoms,  /* number of atoms in simulation */
             real         lambda,
             real         *dvdlambda,    /* FEP stuff */
             t_parm       *parm,         /* input record and box stuff  */
-            real         SAfactor,      /* simulated annealing factor   */
             t_mdatoms    *md,
             rvec         x[],         /* coordinates of home particles */
             t_graph      *graph,  
@@ -612,7 +588,8 @@ void update(int          natoms,  /* number of atoms in simulation */
   int              i,n,m,g;
   matrix           M;
   t_inputrec       *ir=&(parm->ir);
-
+  t_Gaussdata      sd_gaussrand=NULL;
+  
   if(bFirst) {
     bHaveConstr = init_constraints(stdlog,top,&(parm->ir),md,start,homenr,
                                    ir->eI!=eiSteep,cr);
@@ -623,6 +600,10 @@ void update(int          natoms,  /* number of atoms in simulation */
       init_edsam(stdlog,top,md,start,homenr,x,parm->box,
                  edyn,&edpar);
 
+    /* Initiate random number generator for stochastic and brownian dynamic integrators */
+    if(ir->eI==eiSD || ir->eI==eiBD) 
+      sd_gaussrand=init_gauss(ir->ld_seed);
+    
     /* Allocate memory for xold, original atomic positions
      * and for xprime.
      */
@@ -631,7 +612,6 @@ void update(int          natoms,  /* number of atoms in simulation */
     /* Copy the pointer to the external acceleration in the opts */
     ngacc=ir->opts.ngacc;    
     ngtc=ir->opts.ngtc;    
-
     snew(lamb,ngtc);
 
     /* done with initializing */
@@ -683,10 +663,10 @@ void update(int          natoms,  /* number of atoms in simulation */
       do_update_sd(start,homenr,
                    ir->opts.acc,ir->opts.nFreeze,
                    md->invmass,md->ptype,
-                   md->cFREEZE,md->cACC,md->cTC,SAfactor,
+                   md->cFREEZE,md->cACC,md->cTC,
                    x,xprime,v,vold,force,
                    ir->opts.ngtc,ir->opts.tau_t,ir->opts.ref_t,
-                   &ir->ld_seed,TRUE);
+                   sd_gaussrand,TRUE);
       if(bHaveConstr) {
         for(n=start; n<start+homenr; n++)
           copy_rvec(xprime[n],x_unc[n-start]);
@@ -704,10 +684,10 @@ void update(int          natoms,  /* number of atoms in simulation */
       do_update_sd(start,homenr,
                    ir->opts.acc,ir->opts.nFreeze,
                    md->invmass,md->ptype,
-                   md->cFREEZE,md->cACC,md->cTC,SAfactor,
+                   md->cFREEZE,md->cACC,md->cTC,
                    x,xprime,v,vold,force,
                    ir->opts.ngtc,ir->opts.tau_t,ir->opts.ref_t,
-                   &ir->ld_seed,FALSE);
+                   sd_gaussrand,FALSE);
     } else if(ir->eI==eiBD)
       do_update_bd(start,homenr,dt,
                    ir->opts.nFreeze,md->invmass,md->ptype,
@@ -715,7 +695,7 @@ void update(int          natoms,  /* number of atoms in simulation */
                    x,xprime,v,vold,force,
                    ir->bd_temp,ir->bd_fric,
                    ir->opts.ngtc,ir->opts.tau_t,ir->opts.ref_t,
-                   &ir->ld_seed);
+                   sd_gaussrand);
     else
       fatal_error(0,"Don't know how to update coordinates");
 
index e16898a7c0f03462393a3337d152b20c30dc4bad..450761df2113f004815b38fb8292499bf04c5dcd 100644 (file)
@@ -29,7 +29,9 @@
  * And Hey:
  * Gromacs Runs On Most of All Computer Systems
  */
-static char *SRCID_vcm_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
+
 #include "macros.h"
 #include "vcm.h"
 #include "vec.h"
index 0de17fb597f2c2f18650b7cc09e2b00b4286765c..eb89df2b8f20f36873aa7909dcda1a0c76cc5486 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Gromacs Runs On Most of All Computer Systems
  */
-static char *SRCID_wnblist_c = "$Id$";
+
+/* This file is completely threadsafe - keep it that way! */
 #include <stdio.h>
 #include <string.h>
 #include "string2.h"
index 3b63cf313c39fbf5572731e9fc7c557bc5ac67d0..d39a1e7afa80b9f86ef1e2cbf336bccc2a05dd9d 100644 (file)
 #ifndef _wnblist_h
 #define _wnblist_h
 
-static char *SRCID_wnblist_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) wnblist.h 1.1 23 Oct 1994"
-#endif /* HAVE_IDENT */
+
 #include "stdio.h"
 #include "typedefs.h"
 
index c230b3f985b694a89d3b5863a50eeb7d593e7f2b..1a67d4899943e9f0540b225fcb7180ddf2f55fa7 100644 (file)
 #ifndef _Xstuff_h
 #define _Xstuff_h
 
-static char *SRCID_Xstuff_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) Xstuff.h 1.16 11/23/92"
-#endif /* HAVE_IDENT */
-
 /* The altivec extensions for ppc define some stupid overlapping
  * macros like pixel and vector - turn them off here, we only
  * need them in the inner loops.
index 9f3d5cc549582849cdbb4f670aa0047248ffd56f..77456df03908caf4d062a1daa33d994bf68184b4 100644 (file)
@@ -37,9 +37,6 @@
 #ifndef        _alert_bm
 #define        _alert_bm
 
-#ifdef HAVE_IDENT
-#ident "@(#) alert.bm 1.4 9/29/92"
-#endif /* HAVE_IDENT */
 
 #define alert_width 48
 #define alert_height 42
index 40bc982922b1dd1a1f888e63eaa9fabff731ee5d..12348e77589fbf31d120e86be77f049a8d819bb5 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs On Most of All Computer Systems
  */
-static char *SRCID_buttons_c = "$Id$";
+
 #include <sysstuff.h>
 #include <string.h>
 #include <smalloc.h>
index d996ea7dee34b051533543ec5521bab2e1efb5e4..0c4621c9e150c8720d8b086f3b3419bbefea64b2 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _buttons_h
 #define _buttons_h
 
-static char *SRCID_buttons_h = "$Id$";
+
 #include <xutil.h>
 
 enum { 
index 7412555865bc3cd2f9f9aa309439a7f1cdae33a4..bff83913e19c56d71a7138e7ca0a1fc7bd774e8e 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs On Most of All Computer Systems
  */
-static char *SRCID_dialogs_c = "$Id$";
+
 #include "smalloc.h"
 #include "sysstuff.h"
 #include "macros.h"
index cbd99b5daa8ae7587eba269bfd1a7e4afd578c5f..55f915db3dac31c27718d553518601de03c9261e 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _dialogs_h
 #define _dialogs_h
 
-static char *SRCID_dialogs_h = "$Id$";
+
 #include "xdlg.h"
 #include "pulldown.h"
 #include "manager.h"
index 93b0c97181d2abd895de0e3fff31523e0e42ca98..e660953db05de9adcba1f607f0b80e3c1ac86b4a 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs On Most of All Computer Systems
  */
-static char *SRCID_dlg_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <xdlghi.h>
index 9989ac3850285e3ce395746ebdf88c02e572299e..ee22199e276e318d3195c4fbb73c83640f2f85dd 100644 (file)
@@ -37,9 +37,6 @@
 #ifndef        _ff_bm
 #define        _ff_bm
 
-#ifdef HAVE_IDENT
-#ident "@(#) ff.bm 1.2 11/23/92"
-#endif /* HAVE_IDENT */
 #define ff_width 40
 #define ff_height 32
 static unsigned char ff_bits[] = {
index b71a3953dbf2336c6a829ce3bdd05db244738d13..0342954515fa1957e8fcc419d5b414f6c558a68e 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs On Most of All Computer Systems
  */
-static char *SRCID_fgrid_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index e6d03ce31020ed6d851488cc75b09bcfef03e743..e5de2e7be145c6e4c7c15c12b273237cdda5fc12 100644 (file)
 #ifndef _fgrid_h
 #define _fgrid_h
 
-static char *SRCID_fgrid_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) fgrid.h 1.3 9/29/92"
-#endif /* HAVE_IDENT */
-
 #include <typedefs.h>
 #include <xdlg.h>
 
index 222b5eee610c7ab8a58ae2ab8055edd4c953321f..22390902602e9f1a37fdbd28b3576b071de6b13e 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_filter_c = "$Id$";
+
 #include <string.h>
 #include "sysstuff.h"
 #include "futil.h"
index 36f00c3a5e7421f73649cf1cf943051bfe9cfbf5..658a42895473dc5cf25dc29df1c90e02ff227fd5 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_gmxlogo_c = "$Id$";
+
 #include "logo.h"
 
 void main(int argc, char *argv[])
index f680b1c299d0e5db007256941a27d1af1b3926d5..b60f3e84b75d5459d8db077cbb545f663a4027f6 100644 (file)
@@ -38,9 +38,6 @@
 #ifndef        _gromacs_bm
 #define        _gromacs_bm
 
-#ifdef HAVE_IDENT
-#ident "@(#) gromacs.bm 1.9 9/29/92"
-#endif /* HAVE_IDENT */
 
 #define gromacs_width 48
 #define gromacs_height 48
index dbec885342a18aabf3ae81620c846d5db1ad08bb..9f1ef9c3b2d959d3d8d3ac94c60cc547268a7db9 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_highway_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "futil.h"
index bfbc87814603f5c4a343b85845d1aa3df8883e96..ab6c44a73889598926fa68001277965e2ee4a8a4 100644 (file)
 #ifndef        _info_bm
 #define        _info_bm
 
-#ifdef HAVE_IDENT
-#ident "@(#) info.bm 1.4 9/29/92"
-#endif /* HAVE_IDENT */
-
 #define info_width 48
 #define info_height 48
 static unsigned char info_bits[] = {
index e27a00aa6559bcf7b16bd80d181dd55673a93410..9b6329d85e94749a73c6f86e76e6d62b9449dd26 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_logo_c = "$Id$";
+
 #include "sysstuff.h"
 #include "Xstuff.h"
 #include "xutil.h"
index db408e9e31398ecc67d54eed929db4e6205edece..817a717fad2ebbe0fbe46981a56db9792f2b5ab7 100644 (file)
 #ifndef _logo_h
 #define _logo_h
 
-static char *SRCID_logo_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) logo.h 1.15 9/30/97"
-#endif /* HAVE_IDENT */
 #include <x11.h>
 #include <xutil.h>
 
index c8c13460aef06bd1ce83c7d71b1eb4607d60b234..edaa8792e9d8dbd5c409359679feac13977a82e5 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_manager_c = "$Id$";
+
 #include <sysstuff.h>
 #include <string.h>
 #include <smalloc.h>
@@ -167,14 +167,14 @@ static void hide_label(t_x11 *x11,t_manager *man,int x,int y)
 
 void set_file(t_x11 *x11,t_manager *man,char *trajectory,char *status)
 {
-  char         buf[256];
+  char         buf[256],quote[256];
   t_tpxheader  sh;
   t_atoms      *at;
   bool         *bB;
   int          i,idum;
   real         rdum;
 
-  read_tpxheader(status,&sh);
+  read_tpxheader(status,&sh,TRUE,NULL,NULL);
   snew(man->ix,sh.natoms);
   snew(man->zz,sh.natoms);
   snew(man->col,sh.natoms);
@@ -201,7 +201,7 @@ void set_file(t_x11 *x11,t_manager *man,char *trajectory,char *status)
                "do not match",status,man->top.atoms.nr,
                trajectory,man->natom);
   
-  sprintf(buf,"%s: %s",*man->top.name,cool_quote());
+  sprintf(buf,"%s: %s",*man->top.name,cool_quote(quote,255,NULL));
   man->title.text = strdup(buf);
   man->view       = init_view(man->box);
   at=&(man->top.atoms);
index 8d733d41a4021a2d18b3734b38394d44e20ec7ec..9891b9d4559b7c6e1a14160b14fbecf1cc0f95e2 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _manager_h
 #define _manager_h
 
-static char *SRCID_manager_h = "$Id$";
 #include <stdio.h>
 #include "typedefs.h"
 #include "x11.h"
index e682985196497e2fb21c9b82db8894d8ba7ef29e..932e017946aa6df943f9af496e19a9456fc42899 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_molps_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "string.h"
@@ -46,7 +46,7 @@ static char *SRCID_molps_c = "$Id$";
 
 #define MSIZE 4
 
-static void ps_draw_atom(FILE *ps,atom_id ai,iv2 vec2[],char **atomnm[])
+static void ps_draw_atom(t_psdata ps,atom_id ai,iv2 vec2[],char **atomnm[])
 {
   int xi,yi;
   
@@ -86,7 +86,7 @@ static bool local_pbc_dx(rvec x1, rvec x2)
   return TRUE;
 }
 
-static void ps_draw_bond(FILE *ps,
+static void ps_draw_bond(t_psdata ps,
                         atom_id ai,atom_id aj,iv2 vec2[],
                         rvec x[],char **atomnm[],int size[],bool bBalls)
 {
@@ -124,7 +124,7 @@ static void ps_draw_bond(FILE *ps,
   }
 }
 
-void ps_draw_objects(FILE *ps,int nobj,t_object objs[],iv2 vec2[],rvec x[],
+void ps_draw_objects(t_psdata ps,int nobj,t_object objs[],iv2 vec2[],rvec x[],
                     char **atomnm[],int size[],bool bShowHydro,int bond_type,
                     bool bPlus)
 {
@@ -161,7 +161,7 @@ static void v4_to_iv2(vec4 x4,iv2 v2,int x0,int y0,real sx,real sy)
   v2[YY]=y0-sy*x4[YY]*inv_z;
 }
 
-static void draw_box(FILE *ps,t_3dview *view,matrix box,
+static void draw_box(t_psdata ps,t_3dview *view,matrix box,
                     int x0,int y0,real sx,real sy)
 {
   int  ivec[8][4] =  { 
@@ -191,7 +191,7 @@ static void draw_box(FILE *ps,t_3dview *view,matrix box,
            vec2[bonds[i][1]][XX],vec2[bonds[i][1]][YY]);
 }
 
-void ps_draw_mol(FILE *ps,t_manager *man)
+void ps_draw_mol(t_psdata ps,t_manager *man)
 {
   static char tstr[2][20];
   static int  ntime=0;
index e52ac4ca11e4d9478b5dad345fb89a05bf8dff8a..9afe0c597b242463d96f08d7a4ac621a1f921755 100644 (file)
 #ifndef _molps_h
 #define _molps_h
 
-static char *SRCID_molps_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) molps.h 1.10 9/30/97"
-#endif /* HAVE_IDENT */
 #include "sysstuff.h"
 #include "manager.h"
        
index b84d3a1ae0742949c019cd768639d21bc2f31f20..8d56efbaf1e6e6b0e07d5d6b48e72dc204b360e9 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_nener_c = "$Id$";
+
 #include <math.h>
 #include <smalloc.h>
 #include <macros.h>
index f09fcbed184b5d8982a79d06a119a8c2d7db6e42..2e40de370b45899297e8d09b63d25b37b4e00f79 100644 (file)
 #ifndef _nener_h
 #define _nener_h
 
-static char *SRCID_nener_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) nener.h 1.19 9/30/97"
-#endif /* HAVE_IDENT */
 #include "x11.h"
 #include "xutil.h"
 #include "popup.h"
index 3a97f22f77b9f4ea943cc5def3ac7a8dbdd0b4f9..36abbaddafd26949e1251e29b64692d340bbf661 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_ngmx_c = "$Id$";
+
 #include <ctype.h>
 #include <string.h>
 
@@ -65,7 +65,7 @@ static void dump_xw(char *dispname,Window w,char *fn)
 
 static void dump_it(t_manager *man)
 {
-  FILE *ps;
+  t_psdata ps;
   
   ps=ps_open("ngmx.ps",0,0,man->molw->wd.width,man->molw->wd.height);
   ps_draw_mol(ps,man);
@@ -343,7 +343,8 @@ void init_gmx(t_x11 *x11,char *program,int nfile,t_filenm fnm[])
   matrix               box;
   t_trxframe           fr;
   int                  status;
-
+  char                 quote[256];
+  
   snew(gmx,1);
   snew(gmx->wd,1);
 
@@ -357,7 +358,7 @@ void init_gmx(t_x11 *x11,char *program,int nfile,t_filenm fnm[])
   /* Creates a simple window */
   w0=DisplayWidth(x11->disp,x11->screen)-132;
   h0=DisplayHeight(x11->disp,x11->screen)-140;
-  InitWin(gmx->wd,0,0,w0,h0,3,bromacs());
+  InitWin(gmx->wd,0,0,w0,h0,3,bromacs(quote,255));
   gmx->wd->self=XCreateSimpleWindow(x11->disp,x11->root,
                                    gmx->wd->x, gmx->wd->y,
                                    gmx->wd->width,gmx->wd->height,
index c904b548a9c7118d489c2dac648145711d28f863..d5ad37171701b43f07679cea629173cce2245ce8 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_nleg_c = "$Id$";
+
 #include <ctype.h>
 #include <string.h>
 #include <smalloc.h>
index b26c6ae231fe4c66882c10d0319dd4ae88105b33..de1ffb1045ccffa4e7dfe2e795b30270b7ff62fa 100644 (file)
 #ifndef _nleg_h
 #define _nleg_h
 
-static char *SRCID_nleg_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) nleg.h 1.19 9/30/97"
-#endif /* HAVE_IDENT */
 #include "x11.h"
 #include "xutil.h"
 #include "writeps.h"
index 41c121dff2be1b62629150bb42d7cd3b1c9b1b5b..68a95e9f02ec805efe8eea143e767ac2e278f74f 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_nload_c = "$Id$";
+
 #include <math.h>
 #include <typedefs.h>
 #include <macros.h>
index 19da6ec16af147188f597111ac9e73e358f4ee8a..26bfb75361f8fdb6dc761db803cc7f098e928da8 100644 (file)
 #ifndef _nload_h
 #define _nload_h
 
-static char *SRCID_nload_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) nload.h 1.19 9/30/97"
-#endif /* HAVE_IDENT */
 #include "x11.h"
 #include "xutil.h"
 
index 5a967b857977e94dc5860fac3ace6f1ecbe77937..61c556ffb67a62ac347c4f76b85e6cb8023d1c43 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_nmol_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "string.h"
index 5876d46370e527a5a3485d9345eef8d670d93500..d68af231d18e44c1624a2090482938455ce6f6f9 100644 (file)
 #ifndef _nmol_h
 #define _nmol_h
 
-static char *SRCID_nmol_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) nmol.h 1.1 11/19/92"
-#endif /* HAVE_IDENT */
 
 #include "x11.h"
 #include "xutil.h"
index 81191b22b0814418b80eadda507406be3cd135c5..a3d0390f7170098d33fa18e6e89f9019077f24e9 100644 (file)
@@ -37,9 +37,6 @@
 #ifndef        _play_bm
 #define        _play_bm
 
-#ifdef HAVE_IDENT
-#ident "@(#) play.bm 1.2 11/23/92"
-#endif /* HAVE_IDENT */
 #define play_width 40
 #define play_height 32
 static unsigned char play_bits[] = {
index 96be044edb95c77c21012c781af9496986bd9e57..ba8ef010bd680c79c6ae382714460d473291ed2f 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_popup_c = "$Id$";
+
 #include <string.h>
 #include <math.h>
 #include <macros.h>
index 7c80d3b9e56ebd506561c45b387d49700af6373a..eafd26acf3d5c4629b8344e71fe637084ec0bdeb 100644 (file)
 #ifndef _popup_h
 #define _popup_h
 
-static char *SRCID_popup_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) popup.h 1.3 11/23/92"
-#endif /* HAVE_IDENT */
 #include "x11.h"
 #include "xutil.h"
 
index e3c482214a4089104d98926e2fa92c787c861d62..8ab022d808c97c1889071df71dac307196c8ec2e 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_pulldown_c = "$Id$";
+
 #include <string.h>
 #include <smalloc.h>
 #include <x11.h>
index 4ce0f8e790770617c7f12e10ad523b09ed0a444b..0f33c3e4baf0b697e054fdf470f0483db7a52a0a 100644 (file)
 #ifndef _pulldown_h
 #define _pulldown_h
 
-static char *SRCID_pulldown_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) pulldown.h 1.4 11/23/92"
-#endif /* HAVE_IDENT */
+
 #include "popup.h"
 
 typedef struct {
index aef848ede63e346411f021c1511bf8eed5587a1d..1dd21981fad418e2bbf44a17c0eee2d2fef23e5c 100644 (file)
@@ -36,9 +36,6 @@
 #ifndef        _rewind_bm
 #define        _rewind_bm
 
-#ifdef HAVE_IDENT
-#ident "@(#) rewind.bm 1.2 11/23/92"
-#endif /* HAVE_IDENT */
 #define rewind_width 40
 #define rewind_height 32
 static unsigned char rewind_bits[] = {
index cc6c6c833110a8f5b457d1d4bd0b864304f433c6..4a3a3f9cb9bbb8ca05128b25ae04553c1d14ecb8 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_scrollw_c = "$Id$";
+
 #include <sysstuff.h>
 #include <Xstuff.h>
 #include <xutil.h>
index 49c664d8955ac99b79e3821c076b5f97fd71321e..9700851f2e71c7465bfe3698c1664324d0d8a9c7 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_showcol_c = "$Id$";
+
 #include <math.h>
 #include <smalloc.h>
 #include <sysstuff.h>
index 91872a75a0a33c290ac121f3a62d5f1b1faaeaa8..c651500528c62fabf287bb6a019a190b58dcaa9d 100644 (file)
@@ -37,9 +37,6 @@
 #ifndef        _stop_bm
 #define        _stop_bm
 
-#ifdef HAVE_IDENT
-#ident "@(#) stop.bm 1.4 9/29/92"
-#endif /* HAVE_IDENT */
 
 #define stop_width 48
 #define stop_height 48
index 011249231df920b6712a6ca4c63c19b8a84c16be..a9123a34b65f7d4e2e0d092039d73719f00ba412 100644 (file)
@@ -37,9 +37,7 @@
 #ifndef        _stop_ani_bm
 #define        _stop_ani_bm
 
-#ifdef HAVE_IDENT
-#ident "@(#) stop_ani.bm 1.2 11/23/92"
-#endif /* HAVE_IDENT */
+
 #define stop_ani_width 40
 #define stop_ani_height 32
 static unsigned char stop_ani_bits[] = {
index 6e6be67cc09d61bb98ea71591051389c1ba8cf69..f2ca6047d66e89bc1798caf267d40de8618717d2 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_vbox_c = "$Id$";
+
 #include "x11.h"
 #include "nmol.h"
 
index 8968613b597716a04981f73762beefed8c1cb165..e8f475fd36ffd7981199ed95ec20c52e4dce9eda 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_x11_c = "$Id$";
+
 #include <Xstuff.h>
 #include <x11.h>
 #include "sysstuff.h"
index 3bb100621f76199eb109b0c24d2e0dd8f8919a98..d7c37d3fe5616a48f2708968c49101617cd90127 100644 (file)
 #ifndef _x11_h
 #define _x11_h
 
-static char *SRCID_x11_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) x11.h 1.6 12/16/92"
-#endif /* HAVE_IDENT */
-
 #include <stdio.h>
 #include "typedefs.h"
 #include "Xstuff.h"
index f9d7d81b4ce7eac94a8c44688ce9e6e486ce20cf..7a03acb1cb270677afac005bbcb6430480afded8 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_xdlg_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 666697b7bcee641f94dd9fd69c89382d1b2a2c7e..b9c7abbed360562f89a1288980d15c394cafc03e 100644 (file)
 #ifndef _xdlg_h
 #define _xdlg_h
 
-static char *SRCID_xdlg_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) xdlg.h 1.3 9/29/92"
-#endif /* HAVE_IDENT */
 
 #include <xdlgitem.h>
 
index c4726d9b1844a4f34d5121707baf098e850abdba..c25b3d8a7b6cbb3c9907a9ffb0a386e19e48457d 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_xdlghi_c = "$Id$";
+
 #include <assert.h>
 #include <string.h>
 
index 388cf11b5d745173d278a15dccef95326c428546..9091f275dbb4f73e71e8efed5430c3b348e98ece 100644 (file)
 #ifndef _xdlghi_h
 #define _xdlghi_h
 
-static char *SRCID_xdlghi_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) xdlghi.h 1.2 9/29/92"
-#endif /* HAVE_IDENT */
 
 #include <stdarg.h>
 #include "Xstuff.h"
index 1b98237e1a9dfd7218a1d302b42545e059482548..6987a1d754ef018b271db0fb8cbc808e8d799ef9 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_xdlgitem_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index fcbb55fbca054b08181279ab7510117555e68731..04cf1fca55078e2b433d754100fcea733e7bb429 100644 (file)
 #ifndef _xdlgitem_h
 #define _xdlgitem_h
 
-static char *SRCID_xdlgitem_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) xdlgitem.h 1.4 9/29/92"
-#endif /* HAVE_IDENT */
-
 #include <typedefs.h>
 #include <Xstuff.h>
 #include <xutil.h>
index eebfc73f5521a8b65ac1f7458aa46213658b8ffa..c07726adac028c0a6abf46588ab2fad41e22ba98 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_xmb_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 62b2d15fc06670a25946db2a4aea370a964b3629..3af1b45d2eef89c89f43f8d068c756ff444dc79a 100644 (file)
 #ifndef _xmb_h
 #define _xmb_h
 
-static char *SRCID_xmb_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) xmb.h 1.3 9/29/92"
-#endif /* HAVE_IDENT */
-
 #include <x11.h>
 
 #define MB_OK              1
index 5f3716635c6245718e88367995b45c503075ec21..df3a5db6cedb5ba3fe068b56006dc8e4712aa4cb 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_xrama_c = "$Id$";
+
 #include <stdlib.h>
 #include <math.h>
 #include <string.h>
@@ -309,6 +309,7 @@ int main(int argc,char *argv[])
   };
 
   t_x11     *x11;
+  t_topology *ramatop;
   t_app     *app;
   t_filenm  fnm[] = {
     { efTRX, "-f", NULL, ffREAD },
@@ -328,15 +329,16 @@ int main(int argc,char *argv[])
   XSetForeground(x11->disp,x11->gc,x11->fg);
   app=init_app(x11,argc,argv);
 
-  init_rama(ftp2fn(efTRX,NFILE,fnm),ftp2fn(efTPX,NFILE,fnm),app->xr);
+  ramatop = init_rama(ftp2fn(efTRX,NFILE,fnm),ftp2fn(efTPX,NFILE,fnm),app->xr);
   mk_gly(app);
   
   XMapWindow(x11->disp,app->wd.self);
   XMapSubwindows(x11->disp,app->wd.self);
   x11->MainLoop(x11);
   x11->CleanUp(x11);
-
+  
   thanx(stderr);
   
   return 0;
 }
index 2e76e16a687022f6a530ec27e43e48038aa510b1..ab063a9dfe4cef5f0dc44abba344fa51b3e8ff48 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_xstat_c = "$Id$";
+
 #include "sysstuff.h"
 #include "smalloc.h"
 #include "x11.h"
index e7146b6fb8a43dcbe0e4684e9bb84bf015d6a0a9..566c947cd81f8d68bd58ac08da65b73354f69115 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_xutil_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
index 89e3f408c578934745472729ca5bf374916a6771..40cbb7a7c9c7da9bb136c2a687c72e44d6d51547 100644 (file)
 #ifndef _xutil_h
 #define _xutil_h
 
-static char *SRCID_xutil_h = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) xutil.h 1.5 11/11/92"
-#endif /* HAVE_IDENT */
 
 #include "typedefs.h"
 #include "writeps.h"
index bab5d1dce6b7e3885885f6d9e5f949ad099c8dea..c9d5db74083fe7265cab252e5320031de9096fa8 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_addconf_c = "$Id$";
+
 #include <stdlib.h>
 #include <string.h>
 #include "vec.h"
index 83e3696d4cee70cb4ca2ad9b4dbd742c5c6b3f9e..ad676825ef225b96312087f3f18e0bfe67f5b060 100644 (file)
@@ -29,7 +29,6 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_addconf_h = "$Id$";
 #include "typedefs.h"
 
 extern 
index fe964711e6579595baf3873088e34c1009ca24ba..85544b9de729dfd5343b65ce460220efd96f3f13 100644 (file)
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_anadih_c = "$Id$";
+
 #include <math.h>
 #include <stdio.h>
+#include <string.h>
 #include "physics.h"
 #include "smalloc.h"
 #include "macros.h"
@@ -363,8 +364,8 @@ void get_chi_product_traj (real **dih,int nframes,int nangles, int nlist,
                           real core_frac, bool bAll, char *fnall) 
 {
 
-  bool bRotZero, bHaveChi; 
-  int  accum, index, i,j,k,Xi,n,b ; 
+  bool bRotZero, bHaveChi=FALSE
+  int  accum=0, index, i,j,k,Xi,n,b ; 
   real *chi_prtrj; 
   int  *chi_prhist; 
   int  nbin ; 
@@ -549,8 +550,8 @@ static void calc_angles(FILE *log,matrix box,
   if (debug) {
     fprintf(debug,"Angle[0]=%g, costh=%g, index0 = %d, %d, %d\n",
            ang[0],costh,index[0],index[1],index[2]);
-    pr_rvec(debug,0,"rij",r_ij,DIM);
-    pr_rvec(debug,0,"rkj",r_kj,DIM);
+    pr_rvec(debug,0,"rij",r_ij,DIM,TRUE);
+    pr_rvec(debug,0,"rkj",r_kj,DIM,TRUE);
     pr_rvecs(debug,0,"box",box,DIM);
   }
 }
index 07edad4a7dc51f998a69fb65b895517f48362f0a..109a3ae9eef8ca210afb9d43af9246c986ce1b7b 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _angstat_h
 #define _angstat_h
 
-static char *SRCID_angstat_h = "$Id$";
 #include <stdio.h>
 #include <typedefs.h>
 
index 7b8e5709bdc637e21d764008e7570f304d14f3d9..d9201f752a33d3e825bdcf1959d70b784323a965 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_autocorr_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "macros.h"
index e70679d4350f040c44afadc5e01d9f10c2351139..3e9979f378b2df61885af5e1d18232d14b95b430 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_average_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "string2.h"
index 050743d0ade42a17af442be94c09d165f3221e40..0da9535b44ee86141d76ca274804caa1348d11e4 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_bondlist_c = "$Id$";
+
 #include "cdist.h"
 
 typedef struct list {
index fa115d87c5ea6a0038ae1aa5ee16dfef07a9eafd..bc6d38c3c41db001ecd13841ad2588b7a0b56715 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_calcpot_c = "$Id$";
+
 #include "vec.h"
 #include "calcpot.h"
 #include "nrnb.h"
@@ -211,8 +211,8 @@ void init_calcpot(int nfile,t_filenm fnm[],t_topology *top,
                  t_forcerec **fr,real **pot,
                  matrix box)
 {
-  real     t,t0,lam,lam0,SAfac;
-  bool     bTYZ,bNEMD;
+  real     t,t0,lam,lam0;
+  bool     bTYZ,bNEMD,bSA;
   char     *traj,*xtc_traj;
   rvec     *v,mutot;
   t_nrnb   nrnb;
@@ -234,10 +234,10 @@ void init_calcpot(int nfile,t_filenm fnm[],t_topology *top,
 
   init_nrnb(&nrnb);
   init_single(stdlog,parm,ftp2fn(efTPX,nfile,fnm),top,x,&v,mdatoms,nsb);
-  init_md(cr,&(parm->ir),parm->box,&t,&t0,&lam,&lam0,&SAfac,
+  init_md(cr,&(parm->ir),parm->box,&t,&t0,&lam,&lam0,
          &nrnb,&bTYZ,top,-1,NULL,&traj,&xtc_traj,&fp_ene,NULL,
          &mdebin,grps,force_vir,pme_vir,
-         shake_vir,*mdatoms,mutot,&bNEMD,&vcm,nsb);
+         shake_vir,*mdatoms,mutot,&bNEMD,&bSA,&vcm,nsb);
   init_groups(stdlog,*mdatoms,&(parm->ir.opts),grps);  
 
   /* Calculate intramolecular shift vectors to make molecules whole again */
index fd864b4f4c2996faff84ab94bdf0d57884eaec79..435c173aaba651bb4346ff217681ddd5fe3d8b72 100644 (file)
@@ -29,7 +29,6 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_calcpot_h = "$Id$";
        
 extern void init_calcpot(int nfile,t_filenm fnm[],t_topology *top,
                         rvec **x,t_parm *parm,t_commrec *cr,
index 34144913300f927c75a76957cdb0d33d44d7650e..efd516e07eb9cd5f027b871dd0bd67ab57ca6f7a 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_cdist_c = "$Id$";
+
 #include <stdlib.h>
 #include <ctype.h>
 #include "assert.h"
index 23be7469a1e8f43176b280f4b60eb43a56c291a9..621686a7daaf7e5051cce8fa2b3f191433461a4a 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_cdist_h = "$Id$";
+
 #define HEAD_LOADED
 #include <stdio.h>
 #include <math.h>
index 39921b2bec49ba9b5983d044e88e3794a7d606c8..8de742613942abf2b2214406a71c21287c9940a1 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_cmat_c = "$Id$";
+
 #include "cmat.h"
 #include "smalloc.h"
 #include "macros.h"
index b60e4046b0aacf928e0413e4c8c5999a80558e13..aa4285bf04e93034371117ea85675b41874ee3d5 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _cmat_h
 #define _cmat_h
 
-static char *SRCID_cmat_h = "$Id$";
 #include "typedefs.h"
 
 typedef struct {
index 7c837dd048638dad788e2cad95ddb72f47b21856..f2feeb8b72a1adf0cb9f109d8ee30f0a1ce41b24 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_correct_c = "$Id$";
+
 #include <math.h>
 #include "assert.h"
 #include "vec.h"
index 77b279ff34309b33b55baf585e823defef1ef82b..8690bdcdbf9e3a34c668de7c59300b4743b38ee9 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_disco_c = "$Id$";
+
 #include "macros.h"
 #include "statutil.h"
 #include "pdbio.h"
index b7b2bdc77385d3ef05828f1cb81a1b25df306bdb..d411f29ff25488a62a067d400b2b9a90c5d1bce1 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_disco_h = "$Id$";
+
 #define _correct_h
 
 #include <stdio.h>
index 80332678034c0dae708fdc07274bbaef0f6506e9..bffc2651d55c035578b34caf349684b688b2656c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_discopar_c = "$Id$";
+
 #include "typedefs.h"
 #include "network.h"
 #include "smalloc.h"
index 9325b113685541fc69bf490972daecac40c9402e..7b675c7ecbe0d9352ef9fe3546f761728d9ea816 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_dlist_c = "$Id$";
+
 #include <stdlib.h>
 #include "string2.h"
 #include "smalloc.h"
index 7fab1eb31ad304a680ecc9367fdd0336fa1f4fe0..e1b5b0ea845aecc2eeb8140db14b44fb47716531 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_do_dssp_c = "$Id$";
+
 #include "sysstuff.h"
 #include "typedefs.h"
 #include "string2.h"
index c502ab5afe7541d48fca5a855f4175a0cd8a6b04..3825081ac44baf3d54167d5d9630cdb5b51d68cb 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_dtools_c = "$Id$";
+
 #include "smalloc.h"
 #include "strdb.h"
 #include "futil.h"
index 8123a18b2ba4926d1dba74e5617bf82fa1d582cf..cb997e4617f1c0514620ae58f072585aadcecc8b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_editconf_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include <ctype.h>
index c883e4e587b2f089b52a759777b7ef4ec4a3f460..4a4acbf4db8960f429f552139753c87d9cb1b49b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_edittop_c = "$Id$";
+
 #include "smalloc.h"
 #include "string2.h"
 #include "fatal.h"
index 02466019cd20c9de4fc94b3dd9850119adfd0ed7..a97cabbeca9839012f5e2a4c75c76b070d651a69 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_eigio_c = "$Id$";
+
 #include "smalloc.h"
 #include "vec.h"
 #include "eigio.h"
index 98a0ea0cb83809588197998e3197333a27857b5c..f11c757990e47555d8dcf9549a4509f7752885be 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _eigio_h
 #define _eigio_h
 
-static char *SRCID_eigio_h = "$Id$";
+
 #include "typedefs.h"
 
 enum { eWXR_NO, eWXR_YES, eWXR_NOFIT };
index 451fd243f484afe3c562a1bba25dff2e87a221fb..61e02ffdb8fba54563f9b7e3b68a816b5bc2eba0 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_eneconv_c = "$Id$";
+
 #include <string.h>
 #include <math.h>
 #include "string2.h"
index b9b389dc4e466d8860171012df8d541769fbed75..8eb2cbff884afc1cccd18e214caf8c6ec0dbe526 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_expfit_c = "$Id$";
+
 #include <sysstuff.h>
 #include <string.h>
 #include <math.h>
index 885ec0468df713d98eb91610fcd4980edf8707a6..02342b886397b09d81752cd0874526fb41c86392 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_fitahx_c = "$Id$";
+
 #include "fitahx.h"
 #include "vec.h"
 #include "do_fit.h"
index 57370a199571ae56d83a0c538f8ea74a7764ea89..76cccef023b486e04808e072021f93dff137cb07 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _fitahx_h
 #define _fitahx_h
 
-static char *SRCID_fitahx_h = "$Id$";
        
 #include "typedefs.h"
 #include "hxprops.h"
index 902cd495398d510d879e4065904115057b4a904c..fc27b251cc5a7c85476499012a1fd2ea7e643c80 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_anaeig_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "statutil.h"
index 0ecec5c56434117108847488654dbc78a44572bb..310d5585de5462dd554f1f4354f311a0cb9f5b68 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_analyze_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "statutil.h"
index c84bd3b51920ff5289e832ae1cfe388dc7184869..94aa8b099bbf6b862bba45b26340a2d8d42f571f 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_angle_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "sysstuff.h"
index e3ba270f8c4ff2814762f0d9214deab5c2c38ad7..0c3961c3bff05b5888aa26e2b472ebcdab435483 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_bond_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "sysstuff.h"
index 13801ad6753a179708db83402a747cdd19bdf63e..3df827dae78938d49160281c694477d75f960606 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_bundle_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "statutil.h"
index adbb546f51ac33f7c9c98498715a9a5dbdb69742..e960a0bdd3aed7202b07e99c94d9d6c227e0349e 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_chi_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "confio.h"
index 7d4e52997ec2acee84c1e9f45dfd352e81d80106..8661d6404b6d1c9e531da5de275c1e0688be9900 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_cluster_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include <ctype.h>
index 65ab7ce0d6527fcfc1a6331fb745e8d7108afe01..37b5ca3890aff2c76b57a82957dda56a9354b1b2 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_clustsize_c = "$Id$";
+
 #include <math.h>
 #include <ctype.h>
 #include "string2.h"
index 7fd330bcfe410e546ae15b5b091b6f5ebc99ee6e..a49d025a4497744c88234f04bf66dd1c197d2e3a 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_com_c = "$Id$";
+
 #include "sysstuff.h"
 #include "smalloc.h"
 #include "macros.h"
index ae25c9ac9a8fae4b81491d4f71410a67a6ea795b..2f0102e323f7b8a3be19b104ba66da78e2b4eb1e 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_confrms_c = "$Id$";
+
 #include "filenm.h"
 #include "smalloc.h"
 #include "macros.h"
index e229aecdbc3abf6f48f14f8d66d1a918dfe865cd..68bf34ebb46dbc3067db5fe911feacbc8ec801f8 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_covar_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include <time.h>
index e9f7dfae2bd6df3124870ec882ccbd8f25c95328..93e5db016eeefe55c92602aed8cfa1ad7bd6aa78 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_density_c = "$Id$";
+
 #include <math.h>
 #include <ctype.h>
 #include "sysstuff.h"
index 22da5ad132068cbc73826804e49b1e50712f9531..7190a076752e64bfd159fb5e03d343b2b98cbefb 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_dielectric_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <ctype.h>
index 78b224eb10f71522aefe8c191eae1a5a296b22eb..3e51b046788cf8bda9c72f5eb671521910c25795 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_dih_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "string2.h"
index 7faa8562411d8ab0fb2e439710e46cdfd8165cd1..7785693500bdb4132a80d3e567bcd60880a14908 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_dipoles_c = "$Id$";
+
 #include <string.h>
 #include <math.h>
 #include "macros.h"
@@ -331,7 +331,7 @@ void mol_quad(int k0,int k1,atom_id ma[],rvec x[],t_atom atom[],rvec quad)
   }
 
   if (debug)
-    pr_rvec(debug,0,"Quadrupole",quad,DIM);
+    pr_rvec(debug,0,"Quadrupole",quad,DIM,TRUE);
 
   /* clean-up */
   for(i=0; (i<DIM); i++) {
index c9edff63a42835926f4e63c3bf704736c0fab129..961c3193f93cd76981dbb2dfb45b6e2b981ec9bf 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_disre_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include <assert.h>
@@ -383,7 +383,7 @@ int main (int argc,char *argv[])
   if (ntop)
     init5(ntop);
   
-  read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&header);
+  read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&header,FALSE,NULL,NULL);
   snew(xtop,header.natoms);
   read_tpx(ftp2fn(efTPX,NFILE,fnm),&step,&t,&lambda,&ir,
           box,&ntopatoms,xtop,NULL,NULL,&top);
index afe06c9ce95cca03f37de56a18a44ce0f8e99c65..a1ca521d7b69f19abcb3cebc83571f11d846e315 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_dist_c = "$Id$";
+
 #include <typedefs.h>
 #include "smalloc.h"
 #include "macros.h"
index 238f15b58267132acdaf4014740ebcb81e3df2fd..cbbe89ee62fcb03a4e6f9fe07f237a48f5d6bdaf 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_dyndom_c = "$Id$";
+
 #include "3dview.h"
 #include "statutil.h"
 #include "smalloc.h"
index bf5f6bfaf97d3bed1552acc79dd2698ed0781fdf..86e0d1a38808a1181d045e5f8da488e0cfb461d6 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_enemat_c = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
index 389c649375d137a9a53d15eddfdc1f51787038ae..00ffa2aa2cc3adb75246df54d38d6e1309346b71 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_energy_c = "$Id$";
+
 #include <string.h>
 #include <math.h>
 #include "typedefs.h"
index e87b389369266db5e0358aa03c61725f9dc2f581..a4606ec217b6e94a7c704a829170a012a25cd7ae 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_gyrate_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "statutil.h"
index 024f8be2204bf96cfd946d6353673cbda77109d1..f1820da0a6e557f46a2b3e4f136624a84d5e58d5 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_h2order_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "string.h"
index c3a901f87e025f469b51833edbf943292d8dbe83..02c1904fc05b19d1462ec0732d3acb9fb940ec0d 100644 (file)
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_hbond_c = "$Id$";
-#ifdef HAVE_IDENT
-#ident "@(#) g_hbond.cc 1.29 9/30/97"
-#endif /* HAVE_IDENT */
 
 #include "statutil.h"
 #include "copyrite.h"
index 1a7ca76e14b6c67b5249bf9e7662088715c9bd44..baa945cb668509e899e71dcdba417ce28e959475 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_helix_c = "$Id$";
+
 #include <math.h>
 #include "confio.h"
 #include "copyrite.h"
index 00c71611c67dbc81aebcf21b52457e467241f2f1..18beaf3c85d510d530e397838265497a594778a1 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_lie_c = "$Id$";
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <math.h>
index f04387ccc39c558e876a57264d5fee7822ec8097..b4b619964acb228d601a0ffce3813e6e23b6ad34 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_mdmat_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "macros.h"
index 26f4c9a010ee3967a156a169015fc55d9ae13f1f..49344bc8c516f8e17f56e85cc2bf11ecaa4d2f5b 100644 (file)
@@ -29,7 +29,8 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_mindist_c = "$Id$";
+
+
 #include <math.h>
 #include <stdlib.h>
 #include "sysstuff.h"
@@ -210,8 +211,13 @@ void dist_plot(char *fn,char *afile,char *dfile,
   int          trxout;
   char         buf[256];
   char         **leg;
+<<<<<<< g_mindist.c
+  real         t,md,**mdist=NULL;
+  int          nd,status;
+=======
   real         t,dmin,dmax,**mindres,**maxdres;
   int          nmin,nmax,status;
+>>>>>>> 1.29
   int          i,j,k,natoms;
   int         min1,min2,max1,max2;
   atom_id      oindex[2];
@@ -359,7 +365,7 @@ void dist_plot(char *fn,char *afile,char *dfile,
 int find_residues(t_atoms *atoms, int n, atom_id index[], atom_id **resindex)
 {
   int i;
-  int nres,resnr, presnr;
+  int nres=0,resnr, presnr;
   int *residx;
   
   /* build index of first atom numbers for each residue */  
index 4eb140badeb03d8cc10770ce54c8709835c2ef1f..35983991780e9580f269996455e8882bc7bfd460 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_morph_c = "$Id$";
+
 #include "confio.h"
 #include "statutil.h"
 #include "smalloc.h"
index ee0fce8dd46d62a65221efa14d5a2820ada9a8a3..3ccc8609e4109e7105611ee7dee7cc7e7aae5791 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_msd_c = "$Id$";
+
  
 #include <string.h>
 #include <ctype.h>
index e6122176cfd70ac5ec37b38f3ee53231cadde7e3..eef647b4d51237d60f0cb1eeab85379ab2ee56ea 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_g_multipoles_c = "$Id$";
+
 #include <math.h>
 #include "statutil.h"
 #include "macros.h"
index 7dcfc49380a84703ec072012e07e4b889698c5a7..14d122bc35f9a5d719360d89364cd3743edf4cfa 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_nmeig_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "statutil.h"
index 7d50ef5de91bcde7e65b66a0ad7547c192f4f8be..b87bd193f39b7b9bb099f77b7510d629cd68d95c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_nmens_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "statutil.h"
index d9d9c0e46eba832935bbe91efa459bf64cf19a7b..87cc7a855a901cf89ab34486c44d00a4e3e844a4 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_order_c = "$Id$";
+
 #include <math.h>
 #include <ctype.h>
 #include "sysstuff.h"
index 07036cdbae510493c9a5b3d7d2f60470a9474acf..78bc0ca13baf38cd54844756b0ba395b8b7879bb 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_potential_c = "$Id$";
+
 #include <math.h>
 #include <ctype.h>
 #include "sysstuff.h"
index d7b7047f6242ff6ec5f89113c185368830a4d8c7..5463f4661b87f7b906ab90acaa579c531ccf831d 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_rama_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "string.h"
index c7ebdbd16c15b4d262df3e9353a64fba09985e4b..a962f1149756e17f0bde708d2aaa6334b324597b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_rdf_c = "$Id$";
+
 #include <math.h>
 #include <ctype.h>
 #include "string2.h"
index dadae21d2df3cc49d027a97c8c77623a8283aef2..b26514749a04485e7b356a28442044751b926cf2 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_relax_c = "$Id$";
+
 #include <math.h>
 #include <stdlib.h>
 #include "sysstuff.h"
index 96c124541dff5c021ac2e2d229c68c548af8b609..837312ac09a87d327c3a0121c3925da07e831381 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_rms_c = "$Id$";
+
 #include "smalloc.h"
 #include "math.h"
 #include "macros.h"
@@ -177,7 +177,7 @@ int main (int argc,char *argv[])
   int        maxframe=NFRAME,maxframe2=NFRAME;
   real       t,lambda,*w_rls,*w_rms,tmas,*w_rls_m=NULL,*w_rms_m=NULL;
   bool       bTruncOct,bNorm,bAv,bFreq2,bFile2,bMat,bBond,bDelta,bMirror,bMass;
-  bool       bFit,bReset;
+  bool       bFit=FALSE,bReset=FALSE;
   t_topology top;
   t_iatom    *iatom=NULL;
 
index 63f5a5c1fd0632d409b9102caa133f448a8a36a4..723b21f33d1877d686178a4128926614e9e8d7dd 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_rmsdist_c = "$Id$";
+
 #include <math.h>
 #include <ctype.h>
 #include "macros.h"
index c9d6a2c5ee719555daa382eb7bf7b8d84861d372..64bbbe75e9be93d5347fd1d028cf0bc3d2fb5d95 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_rmsf_c = "$Id$";
+
 #include "smalloc.h"
 #include "math.h"
 #include "macros.h"
index e09014d67dd54b9d1ba47dfc61e3764de345da8b..79692722edf0ad13de45c415792fa296cfb676bf 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_rotacf_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "sysstuff.h"
index 6d150c76d24d6e6c5dd970fe58d9b3d09159de44..e8cfd297a0a65ab2d1c4e3399261790102c3b0d2 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_run_rms_c = "$Id$";
+
 #include <math.h>
 #include "smalloc.h"
 #include "typedefs.h"
@@ -80,7 +80,6 @@ int main (int argc,char *argv[])
   real         t,lambda,*w_rls,*w_rms,tmas;
   int          status;
   t_tpxheader  header;
-  t_inputrec   ir;
   t_topology   top;
   matrix       box;
   rvec         **x,*xp,*v,xcm,*temp;
@@ -104,7 +103,7 @@ int main (int argc,char *argv[])
                    NFILE,fnm,asize(pa),pa,asize(desc),desc,0,NULL);
   snew(x,run_time+1);
 
-  read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&header);
+  read_tpxheader(ftp2fn(efTPX,NFILE,fnm),&header,TRUE);
   snew(xp,header.natoms);
   for(i=0;(i<run_time+1);i++)
     snew(x[i],header.natoms);
@@ -113,7 +112,7 @@ int main (int argc,char *argv[])
   snew(v,header.natoms);
   
   read_tpx(ftp2fn(efTPX,NFILE,fnm),
-          &step,&t,&lambda,&ir,
+          &step,&t,&lambda,NULL,
           box,&natom,xp,NULL,NULL,&top);
 
   /*set box type*/
index 11ad8e24fc4155b53e7feb25e6c308de1dacb280..363ce6710e79487a72a9ea95aeec5fc8ef470620 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_saltbr_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "macros.h"
index be2b9b01582a7f567602a8100b53b57572e6902c..01d9a1918027f8053d77a6c08a85610fab035e6c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_sas_c = "$Id$";
+
 #include <math.h>
 #include <stdlib.h>
 #include "sysstuff.h"
index 362e2c0971af87e10095da6ee4809909043a71ea..f45e7b95311f05cca528c0fdccc7c9bdf3060d9c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_sgangle_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "string.h"
index 72b7eccbcf4a1f5d4bfc2a050e53cdd58f9e4cfa..745dfcbd0907e2e18d5336520cf360e145c8bfa8 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_sorient_c = "$Id$";
+
 #include "macros.h"
 #include "statutil.h"
 #include "smalloc.h"
index caa8b67d5d32d854d5a1ce70da77f5d402089484..fe2b9bda80f7e7a61f870b0a75ead731e89e9481 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_tcaf_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "confio.h"
index 4bf9b1d5d42655125d46ff452c1ab998b43625f7..ebe2b069f126f205f066a23fa9bed36786e12d42 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_traj_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "statutil.h"
index 550193cb17470c848de12cf55fb429cb7bb747fd..dc45205396b698aaf96ee13a60d6cf218dfeb9c7 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_g_velacc_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "confio.h"
index 86f8759d778c40c4ef6e6f1c74521f8ec3064e44..ec7aa72fc5ae073d2f2b8a6b3d2664bca37fb400 100644 (file)
@@ -35,7 +35,7 @@
  */
 
 /* This line is only for CVS version info */
-static char *SRCID_template_c = "$Id$";
+
 static float Temperature=298.0;
 #include "statutil.h"
 #include "typedefs.h"
index b5de0c99d426e65c96724186cce720ca4a74408f..2d1b72c88b5350ab79cc0ea94158bd4957bd2e60 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_genbox_c = "$Id$";
+
 #include "sysstuff.h"
 #include "typedefs.h"
 #include "smalloc.h"
index 9b60aa731e0d9c51111b810abfee40b04b889991..bec1324a047f1a1c8db8f7fb62c4a26b93d1bca2 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_genconf_c = "$Id$";
+
 #include "maths.h"
 #include "macros.h"
 #include "copyrite.h"
index 91075e7fe70e51239a14e4161d5f6c6ecbb69758..5362d2f2fc49b8eb24d1f8de37e3aa953b65dc12 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_gendr_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include <string.h>
index acee58bf88252a55a38659edc92dfe25a3c24b2c..f1d1ad21a0df5ac5d29f715d12f03330e1999cd9 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_genion_c = "$Id$";
+
 #include <ctype.h>
 #include "copyrite.h"
 #include "string2.h"
index 1e092f2646aa3908c7fd188c6af99b3388c0b39a..9a16633840b242092e4f0f73456fe9ef4d5a03ed 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Gromacs Runs One Microsecond At Cannonball Speeds
  */
-static char *SRCID_genpr_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "statutil.h"
index 29d60e8b5c42f3196f729d03f7a36f92224ef713..caf9f8737fa8c6de1e9a49e5efe1bbef540880aa 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_hxprops_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "macros.h"
index b90e4f8f36896b82dbc769782f7a54422585402e..6aced223d69f0d8d3254feefbecacc32e8c6a516 100644 (file)
@@ -33,7 +33,7 @@
 #ifndef _hxprops_h
 #define _hxprops_h
 
-static char *SRCID_hxprops_h = "$Id$";
+
 #include <stdio.h>
 #include "typedefs.h"
 
index 6348a4d5cf3b0f0ca4f88eba1ee441249f6e8465..0e603515596e5919eb749e6ae4ab264858906654 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * GROtesk MACabre and Sinister
  */
-static char *SRCID_levenmar_c = "$Id$";
+
 #include <math.h>
 #include <stdio.h>
 #include <stdlib.h>
index 3f68392bd52fb2a040ff37f3b6861e2a38cc0eab..e3a92e9116f0bea00295d4a86e1d024bbd702fed 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_lsq_c = "$Id$";
+
 #include "typedefs.h"
 #include "gstat.h"
 #include "vec.h"
index 5ce98f14ff6669fff4f9f91430615e15e62170c7..766d5ed16affe346ef9da2e915db47cde99753ea 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_luck_c = "$Id$";
+
 #include <stdio.h>
 #include "copyrite.h"
 #include "string.h"
index bbcfc15cdac832fc0d05bcc53bd450402367d739..3eb4d287bbb83f3fdd9f65800628129b8479bc31 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_make_ndx_c = "$Id$";
+
 #include <ctype.h>
 #include "sysstuff.h"
 #include "strdb.h"
index a0f9471153dd65f4bebd3d9cdbe4ea07e404dd2e..b153ad6f99b75d3312ca82e08ec158ea55585d98 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_mcprop_c = "$Id$";
+
 #include <math.h>
 #include "typedefs.h"
 #include "random.h"
index 804aa3ae6ffac04c133decb51e9aaee72fbb97e3..2fe575dace14f6205b7f426e0c58d41efe1236b6 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_mcprop_h = "$Id$";
+
 #include "typedefs.h"
 
 typedef real t_propfunc(int nx,real x[]);
index 3e3242086e051b0ee9155d59e628271e456742c4..4defb9120e6eed13aaefa3d67d09cfeb050e80fe 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_mk_angndx_c = "$Id$";
+
 #include "typedefs.h"
 #include "smalloc.h"
 #include "copyrite.h"
index 5455afa111d844af051825b1f2c6c8b57a9b9f7e..e23f2de3ef95294449a7457523651d21dd834458 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_my_rdf_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "string.h"
index f0e0f64cca4b7db8c6e7e27630c6726a8098fee6..33df29630d307896eead4e1da27fbde1a31e16ad 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_nsc_c = "$Id$";
+
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
index 989aae68c4fda5570dbed53196622899e54854fc..47e1442d8e9d04b641b4c3c8794191441dca8e5e 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_nsc_h = "$Id$";
+
 #include "typedefs.h"
 
 #define FLAG_DOTS       01
index fc5921f1395ff7700905e6d3866700ab41e6f554..d3d8e906219d5779581624ebe28df0f24f6c63aa 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_orise_c = "$Id$";
+
 #include "typedefs.h"
 #include "maths.h"
 #include "string2.h"
index 469db0b5991e1c7356806b3f3122dcac8076059e..82b1e5ecc4e60cccd5a183c5460dd6bcc051f831 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_orise_h = "$Id$";
+
 #include "typedefs.h"
 #include "pinput.h"
        
index 712a604ac681aa2e53b8a10637ee689a94a3bc01..f100ac6b45c5e265a352073933032b52f8d7bc46 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_pinput_c = "$Id$";
+
 #include "paramio.h"
 #include "pinput.h"
 
index 78d4cadb9a5b1a884b2fb64089fb8f7ecbd973ca..546523715d5ca70171c6530e817227287414b1ca 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _pinput_h
 #define _pinput_h
 
-static char *SRCID_pinput_h = "$Id$";
 #include "typedefs.h"
 #include "string2.h"
 
index cca6a7eac77f7656ba59c746f3d719a272cd6fcc..312b4903ef3b4ba73f961323c80339e139419d49 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_polynomials_c = "$Id$";
+
 #include <stdio.h>
 #include <math.h>
 #include "typedefs.h"
index a0f555e524fbf74275ee8a2cdf47eb013d63a226..7866eb0da314dc3f8b822424c53c72367ee5c66c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_pp2shift_c = "$Id$";
+
 #include <stdlib.h>
 #include <math.h>
 #include "typedefs.h"
index 6ec63629d3d671e7bc14a3b7850ec4c4521f6ea7..c3e53694f5b770a540090e2bf5ca868ffa57e769 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_proptim_c = "$Id$";
+
 #include "typedefs.h"
 #include "maths.h"
 #include "string2.h"
index eea72e91d7d0db40962ae8ca0c9140731b4ae284..7bef8f03a0ce25a4392b1b5230fc5b11bdd9994b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_ql77_c = "$Id$";
+
 #include <math.h>
 #include "typedefs.h"
 #include "vec.h"
index 409e23e406b56bc8c7b3cfc18e168f46b5b2ed5c..d01e11ba70963933c82c43c5bf6ed25ed3c7f59c 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_ql77_h = "$Id$";
+
 extern void ql77 (int n,real *x,real *d);
 /* Determine the eigenvalues d[n] and eigenvectors   *
  * of the symmetric n x n matrix x. The eigenvectors *
index e76298582b51b9bdcc876c8ed1851c014076181b..b3835a49b3875826c99611557685246364aaabcd 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_readev_c = "$Id$";
+
 #include "readev.h"
 #include "futil.h"
 #include "smalloc.h"
index de2d7722003383de011c3f2fb67432038fa31204..90746873014f00d0c8b5d7676b5057d311d3e271 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_readev_h = "$Id$";
+
 #include "typedefs.h"
 
 #ifndef _readev_h
index ce827e3951ec8858b046a0886335ebccc22c4e4f..51e35a89fd4e3ab758b6e589c127b3005fba7cfa 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_recomb_c = "$Id$";
+
 #include "recomb.h"
 #include "futil.h"
 #include "wgms.h"
index 3e8e58fd9868b07db97049939f446b5f8f36b7e0..890fe3d9e93e59e3dcfb99bdd369a094461e4a87 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef _recomb_h
 #define _recomb_h
 
-static char *SRCID_recomb_h = "$Id$";
        
 #include "typedefs.h"
        
index c6006923604cc09207e939a8bfcdd9aaa81b8bee..0235001286f1a1997ba48c4c0e1c9a7f2ea9284f 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_residues_c = "$Id$";
+
 #include <math.h>
 #include "assert.h"
 #include "cdist.h"
index 62416114b843d21f4cfc30ca7dfb44665ba30bf3..25b497f835319f81cf984964826d88cd9849f9d8 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_sas2mat_c = "$Id$";
+
 #include <string.h>
 #include "sysstuff.h"
 #include "matio.h"
index 8b9c1c78f323fbb50c08fa2081a8b330cb4ccbec..a1305d481c28a4411cf1e7fc0df7d051c40255bc 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_smooth_c = "$Id$";
+
 #include "cdist.h"
 
 #define NMRLEN  99.9
index 9930e652a4a0a588ce9b34b5d0e5e128fe8e448c..056443477ab3eeb1ddc3d433bcf9ebcecc1a088a 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_testacf_c = "$Id$";
+
 #include <math.h>
 #include "typedefs.h"
 #include "xvgr.h"
index 680261268579f1525a9316e9445876469b73ab19..79c1edbc6c7471b86651a242349a3767fcf56f38 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Glycine aRginine prOline Methionine Alanine Cystine Serine
  */
-static char *SRCID_trjcat_c = "$Id$";
+
 #include <string.h>
 #include <math.h>
 #include "macros.h"
@@ -52,7 +52,6 @@ static char *SRCID_trjcat_c = "$Id$";
 #include "rmpbc.h"
 #include "wgms.h"
 #include "magic.h"
-#include "binio.h"
 #include "pbc.h"
 
 #define TIME_EXPLICIT 0
index 4bae0ff014702e500cb144dac7322b6f957c47e7..77f631254893e13b7ff63bd2bb883afd7c59e52f 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_trjconv_c = "$Id$";
+
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
@@ -56,7 +56,6 @@ static char *SRCID_trjconv_c = "$Id$";
 #include "rmpbc.h"
 #include "wgms.h"
 #include "magic.h"
-#include "binio.h"
 #include "pbc.h"
 #include "viewit.h"
 
@@ -377,7 +376,7 @@ int main(int argc,char *argv[])
       "Start writing new file when t MOD split = first time (%t)" },
     { "-sep", FALSE,  etBOOL, {&bSeparate},
       "Write each frame to a separate .gro, .g96 or .pdb file"},
-    { "-ter", FALSE, etBOOL, &bTer,
+    { "-ter", FALSE, etBOOL, {&bTer},
       "Use 'TER' in pdb file as end of frame in stead of default 'ENDMDL'" }
   };
       
index c69dfc84760a45683d6ae1163d1358966e9945a0..1068fc5afd4daaa9a3144ce53c03d2385306294d 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_trjorder_c = "$Id$";
+
 #include <math.h>
 #include <string.h>
 #include "statutil.h"
index 85b21c5b98ffc0734e99a9289a6901fda0b0cdc1..2cc918c6211117f4e0128578141429bc8554705b 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_wheel_c = "$Id$";
+
 #include <math.h>
 #include "sysstuff.h"
 #include "physics.h"
@@ -74,7 +74,7 @@ void wheel(char *fn,int nres,char *resnm[],int r0,real rot0,char *title)
   const real fontasp   = 0.6;
   const real fontwidth = fontsize*fontasp;
   
-  FILE *out;
+  t_psdata out;
   int  i,sl,slen;
   real ring,inner,outer;
   real xc,yc,box;
index 60c0ab807a18bdfe42f3eecec1d9a6f498579600..534e382ed43d21019eca213a41e5ff0a6733a044 100644 (file)
@@ -29,7 +29,7 @@
  * And Hey:
  * Green Red Orange Magenta Azure Cyan Skyblue
  */
-static char *SRCID_xpm2ps_c = "$Id$";
+
 #include <math.h>
 #include "string2.h"
 #include "copyrite.h"
@@ -93,9 +93,9 @@ enum { ecSel, ecHalves, ecAdd, ecSub, ecMult, ecDiv, ecNR };
 
   void get_params(char *mpin,char *mpout,t_psrec *psr)
 {
-  static char *bools[BOOL_NR+1]  = { "no", "yes", NULL };
+  static const char *bools[BOOL_NR+1]  = { "no", "yes", NULL };
   /* this must correspond to t_rgb *linecolors[] below */
-  static char *colors[] = { "none", "black", "white", NULL };
+  static const char *colors[] = { "none", "black", "white", NULL };
   t_inpfile *inp;
   char      *tmp;
   int       ninp;
@@ -181,7 +181,7 @@ bool diff_maps(int nmap1,t_mapping *map1,int nmap2,t_mapping *map2)
   return bDiff;
 }
   
-void leg_discrete(FILE *ps,real x0,real y0,char *label,
+void leg_discrete(t_psdata ps,real x0,real y0,char *label,
                  real fontsize,char *font,int nmap,t_mapping map[])
 {
   int   i;
@@ -208,7 +208,7 @@ void leg_discrete(FILE *ps,real x0,real y0,char *label,
   }
 }
 
-void leg_continuous(FILE *ps,real x0,real x,real y0,char *label,
+void leg_continuous(t_psdata ps,real x0,real x,real y0,char *label,
                    real fontsize,char *font,
                    int nmap,t_mapping map[])
 {
@@ -241,7 +241,7 @@ void leg_continuous(FILE *ps,real x0,real x,real y0,char *label,
   ps_ctext(ps,xx0+(nmap*boxxh)-boxxh/2,yhh,map[nmap-1].desc,eXCenter);
 }
 
-void leg_bicontinuous(FILE *ps,real x0,real x,real y0,char *label1,char *label2,
+void leg_bicontinuous(t_psdata ps,real x0,real x,real y0,char *label1,char *label2,
                      real fontsize,char *font,
                      int nmap1,t_mapping map1[],int nmap2,t_mapping map2[])
 {
@@ -290,7 +290,7 @@ static bool box_do_all_x_min_ticks(t_psrec *psr)
   return (psr->boxspacing>(1.5*psr->X.minorticklen));
 }
 
-static void draw_boxes(FILE *out,real x0,real y0,real w,
+static void draw_boxes(t_psdata ps,real x0,real y0,real w,
                       int nmat,t_matrix mat[],t_psrec *psr)
 {
   char   buf[12];
@@ -304,17 +304,17 @@ static void draw_boxes(FILE *out,real x0,real y0,real w,
   strlength = 0;
   
   /* Draw the box */
-  ps_rgb(out,BLACK);
-  ps_linewidth(out,psr->boxlinewidth);
+  ps_rgb(ps,BLACK);
+  ps_linewidth(ps,psr->boxlinewidth);
   yy00=y0;
   for(i=0; (i<nmat); i++) {
     dy=box_height(&(mat[i]),psr);
-    ps_box(out,x0-1,yy00-1,x0+w+1,yy00+dy+1);
+    ps_box(ps,x0-1,yy00-1,x0+w+1,yy00+dy+1);
     yy00+=dy+box_dh(psr)+box_dh_top(IS_ONCE,psr);
   }
   
   /* Draw the ticks on the axes */
-  ps_linewidth(out,psr->ticklinewidth);
+  ps_linewidth(ps,psr->ticklinewidth);
   xx00=x0-1;
   yy00=y0-1;
   for (i=0; (i<nmat); i++) {
@@ -323,29 +323,29 @@ static void draw_boxes(FILE *out,real x0,real y0,real w,
       sprintf(buf,"%g",mat[i].axis_x[j]);
       xtick[j]=strdup(buf);
     }
-    ps_strfont(out,psr->X.tickfont,psr->X.tickfontsize);
+    ps_strfont(ps,psr->X.tickfont,psr->X.tickfontsize);
     for(x=0; (x<mat[i].nx); x++) {
       xx=xx00+(x+0.7)*psr->xboxsize;
       if ( ( bRmod(mat[i].axis_x[x] - psr->X.offset, psr->X.major) || 
             (psr->X.first && (x==0))) &&
           ( (i == 0) || box_do_all_x_maj_ticks(psr) ) ) {
        /* Longer tick marks */
-       ps_line (out,xx,yy00,xx,yy00-psr->X.majorticklen);
+       ps_line (ps,xx,yy00,xx,yy00-psr->X.majorticklen);
        /* Plot label on lowest graph only */
        if (i == 0)
-         ps_ctext(out,xx,
+         ps_ctext(ps,xx,
                   yy00-DDD-psr->X.majorticklen-psr->X.tickfontsize*0.8,
                   xtick[x],eXCenter);
       } else if ( bRmod(mat[i].axis_x[x] - psr->X.offset, psr->X.minor) &&
                ( (i == 0) || box_do_all_x_min_ticks(psr) ) ){
        /* Shorter tick marks */
-       ps_line(out,xx,yy00,xx,yy00-psr->X.minorticklen);
+       ps_line(ps,xx,yy00,xx,yy00-psr->X.minorticklen);
       } else if ( bRmod(mat[i].axis_x[x] - psr->X.offset, psr->X.major) ) {
        /* Even shorter marks, only each X.major */
-       ps_line(out,xx,yy00,xx,yy00-(psr->boxspacing/2));
+       ps_line(ps,xx,yy00,xx,yy00-(psr->boxspacing/2));
       }
     }
-    ps_strfont(out,psr->Y.tickfont,psr->Y.tickfontsize);
+    ps_strfont(ps,psr->Y.tickfont,psr->Y.tickfontsize);
     snew(ytick,mat[i].ny);
     for(j=0; (j<mat[i].ny); j++) {
       sprintf(buf,"%g",mat[i].axis_y[j]);
@@ -358,13 +358,13 @@ static void draw_boxes(FILE *out,real x0,real y0,real w,
           (psr->Y.first && (y==0))) {
        /* Major ticks */
        strlength=max(strlength,(int)strlen(ytick[y]));
-       ps_line (out,xx00,yy,xx00-psr->Y.majorticklen,yy);
-       ps_ctext(out,xx00-psr->Y.majorticklen-DDD,
+       ps_line (ps,xx00,yy,xx00-psr->Y.majorticklen,yy);
+       ps_ctext(ps,xx00-psr->Y.majorticklen-DDD,
                 yy-psr->Y.tickfontsize/3.0,ytick[y],eXRight);
       }
       else if ( bRmod(mat[i].axis_y[y] - psr->Y.offset, psr->Y.minor) ) {
        /* Minor ticks */
-       ps_line(out,xx00,yy,xx00-psr->Y.minorticklen,yy);
+       ps_line(ps,xx00,yy,xx00-psr->Y.minorticklen,yy);
       }
     }
     sfree(xtick);
@@ -377,13 +377,12 @@ static void draw_boxes(FILE *out,real x0,real y0,real w,
       else
        mylab = mat[i].label_y;
       if (strlen(mylab) > 0) {
-       fprintf(out,"%%%% Printing Y-label\n");
-       ps_strfont(out,psr->Y.font,psr->Y.fontsize);
-       ps_rotate(out,TRUE);
+       ps_strfont(ps,psr->Y.font,psr->Y.fontsize);
+       ps_rotate(ps,TRUE);
        xxx=x0-psr->X.majorticklen-psr->X.tickfontsize*strlength-DDD;
-       ps_ctext(out,yy00+box_height(&mat[i],psr)/2.0,612.5-xxx,
+       ps_ctext(ps,yy00+box_height(&mat[i],psr)/2.0,612.5-xxx,
                 mylab,eXCenter);
-       ps_rotate(out,FALSE);
+       ps_rotate(ps,FALSE);
       }
     }
     
@@ -395,14 +394,13 @@ static void draw_boxes(FILE *out,real x0,real y0,real w,
   else
     mylab = mat[0].label_x;
   if (strlen(mylab) > 0) {
-    fprintf(out,"%%%% Printing X-label\n");
-    ps_strfont(out,psr->X.font,psr->X.fontsize);
-    ps_ctext(out,x0+w/2,y0-DDD-psr->X.majorticklen-psr->X.tickfontsize*FUDGE-
+    ps_strfont(ps,psr->X.font,psr->X.fontsize);
+    ps_ctext(ps,x0+w/2,y0-DDD-psr->X.majorticklen-psr->X.tickfontsize*FUDGE-
             psr->X.fontsize,mylab,eXCenter);
   }
 }
 
-static void draw_zerolines(FILE *out,real x0,real y0,real w,
+static void draw_zerolines(t_psdata out,real x0,real y0,real w,
                           int nmat,t_matrix mat[],t_psrec *psr)
 {
   real   xx,yy,dy,xx00,yy00;
@@ -615,7 +613,7 @@ void ps_mat(char *outf,int nmat,t_matrix mat[],t_matrix mat2[],
            int elegend,real boxx,real boxy,char *m2p,char *m2pout)
 {
   char   *libm2p,buf[256],*legend;
-  FILE   *out;
+  t_psdata out;
   t_psrec  psrec,*psr;
   int    W,H;
   int    i,j,x,y,col,leg=0;