[Debichem-commits] r2764 - in /unstable/gromacs/debian: changelog patches/00list patches/30_git_release-4.5-patches.dpatch

nbreen-guest at users.alioth.debian.org nbreen-guest at users.alioth.debian.org
Mon Apr 25 18:58:40 UTC 2011


Author: nbreen-guest
Date: Mon Apr 25 18:58:31 2011
New Revision: 2764

URL: http://svn.debian.org/wsvn/debichem/?sc=1&rev=2764
Log:
patches/30_git_release-4.5-patches.dpatch: Routine update from upstream git, to commit 873563ef of 22 April 2011.


Added:
    unstable/gromacs/debian/patches/30_git_release-4.5-patches.dpatch   (with props)
Modified:
    unstable/gromacs/debian/changelog
    unstable/gromacs/debian/patches/00list

Modified: unstable/gromacs/debian/changelog
URL: http://svn.debian.org/wsvn/debichem/unstable/gromacs/debian/changelog?rev=2764&op=diff
==============================================================================
--- unstable/gromacs/debian/changelog (original)
+++ unstable/gromacs/debian/changelog Mon Apr 25 18:58:31 2011
@@ -1,9 +1,11 @@
-gromacs (4.5.4-2) UNRELEASED; urgency=low
+gromacs (4.5.4-2) unstable; urgency=low
 
   * control: remove obsolete Build-Depends and Suggests on libice-dev,
     libsm-dev, libxext-dev, libxp-dev, libxt-dev.
-
- -- Nicholas Breen <nbreen at ofb.net>  Thu, 21 Apr 2011 18:02:47 -0700
+  * patches/30_git_release-4.5-patches.dpatch: Routine update from upstream
+    git, to commit 873563ef of 22 April 2011.
+
+ -- Nicholas Breen <nbreen at ofb.net>  Mon, 25 Apr 2011 11:56:25 -0700
 
 gromacs (4.5.4-1) unstable; urgency=low
 

Modified: unstable/gromacs/debian/patches/00list
URL: http://svn.debian.org/wsvn/debichem/unstable/gromacs/debian/patches/00list?rev=2764&op=diff
==============================================================================
--- unstable/gromacs/debian/patches/00list (original)
+++ unstable/gromacs/debian/patches/00list Mon Apr 25 18:58:31 2011
@@ -1,1 +1,2 @@
 11_readme.dpatch
+30_git_release-4.5-patches.dpatch

Added: unstable/gromacs/debian/patches/30_git_release-4.5-patches.dpatch
URL: http://svn.debian.org/wsvn/debichem/unstable/gromacs/debian/patches/30_git_release-4.5-patches.dpatch?rev=2764&op=file
==============================================================================
--- unstable/gromacs/debian/patches/30_git_release-4.5-patches.dpatch (added)
+++ unstable/gromacs/debian/patches/30_git_release-4.5-patches.dpatch Mon Apr 25 18:58:31 2011
@@ -1,0 +1,22975 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 30_git_release-4.5-patches.dpatch by Nicholas Breen <nbreen at ofb.net>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Routine update from upstream git 'release-4.5-patches' branch.
+## Current to commit 873563ef, 22 April 2011.
+
+ at DPATCH@
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 011efe9..aacbf39 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -444,6 +444,10 @@ if(APPLE)
+    list(APPEND GMX_EXTRA_LIBRARIES ${ACCELERATE_FRAMEWORK})
+ endif(APPLE)
+ 
++if(CYGWIN)
++    set(GMX_CYGWIN 1)
++endif(CYGWIN)
++
+ # only bother with finding git and using version.h if the source is a git repo
+ if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
+     if(USE_VERSION_H)
+diff --git a/admin/programs.txt b/admin/programs.txt
+index 23d1d94..049c549 100644
+--- a/admin/programs.txt
++++ b/admin/programs.txt
+@@ -1,163 +1,164 @@
+ HEAD|Generating topologies and coordinates
+-pdb2gmx|converts pdb files to topology and coordinate files
+-g_x2top|generates a primitive topology from coordinates 
+ editconf|edits the box and writes subgroups 
++g_protonate|protonates structures
++g_x2top|generates a primitive topology from coordinates 
+ genbox|solvates a system
+-genion|generates mono atomic ions on energetically favorable positions
+ genconf|multiplies a conformation in 'random' orientations
++genion|generates mono atomic ions on energetically favorable positions
+ genrestr|generates position restraints or distance restraints for index groups
+-g_protonate|protonates structures
++pdb2gmx|converts coordinate files to topology and FF-compliant coordinate files
+ END
+ 
+ HEAD|Running a simulation
+ grompp|makes a run input file
+-tpbconv|makes a run input file for restarting a crashed run
+ mdrun|performs a simulation, do a normal mode analysis or an energy minimization
++tpbconv|makes a run input file for restarting a crashed run
+ END
+ 
+ HEAD|Viewing trajectories
+-ngmx|displays a trajectory
+ g_nmtraj|generate a virtual trajectory from an eigenvector
++ngmx|displays a trajectory
+ END
+ 
+ HEAD|Processing energies
+-g_energy|writes energies to xvg files and displays averages
+ g_enemat|extracts an energy matrix from an energy file
++g_energy|writes energies to xvg files and displays averages
+ mdrun|with -rerun (re)calculates energies for trajectory frames
+ END
+ 
+ HEAD|Converting files
+ editconf|converts and manipulates structure files
+-trjconv|converts and manipulates trajectory files
+-trjcat|concatenates trajectory files
+ eneconv|converts energy files
+-xpm2ps|converts XPM matrices to encapsulated postscript (or XPM)
+ g_sigeps|convert c6/12 or c6/cn combinations to and from sigma/epsilon
++trjcat|concatenates trajectory files
++trjconv|converts and manipulates trajectory files
++xpm2ps|converts XPM matrices to encapsulated postscript (or XPM)
+ END
+ 
+ HEAD|Tools
+-make_ndx|makes index files
+-mk_angndx|generates index files for g_angle
+-gmxcheck|checks and compares files
+-gmxdump|makes binary files human readable
+-g_traj|plots x, v and f of selected atoms/groups (and more) from a trajectory
+ g_analyze|analyzes data sets
+-trjorder|orders molecules according to their distance to a group
++g_dyndom|interpolate and extrapolate structure rotations
+ g_filter|frequency filters trajectories, useful for making smooth movies
+ g_lie|free energy estimate from linear combinations
+-g_dyndom|interpolate and extrapolate structure rotations
+ g_morph|linear interpolation of conformations 
+-g_wham|weighted histogram analysis after umbrella sampling
+-xpm2ps|convert XPM (XPixelMap) file to postscript
++g_pme_error|estimates the error of using PME with a given input file
++g_select|selects groups of atoms based on flexible textual selections
+ g_sham|read/write xmgr and xvgr data sets
+ g_spatial|calculates the spatial distribution function
+-g_select|selects groups of atoms based on flexible textual selections
+-g_pme_error|estimates the error of using PME with a given input file
++g_traj|plots x, v and f of selected atoms/groups (and more) from a trajectory
+ g_tune_pme|time mdrun as a function of PME nodes to optimize settings
++g_wham|weighted histogram analysis after umbrella sampling
++gmxcheck|checks and compares files
++gmxdump|makes binary files human readable
++make_ndx|makes index files
++mk_angndx|generates index files for g_angle
++trjorder|orders molecules according to their distance to a group
++xpm2ps|convert XPM (XPixelMap) file to postscript
+ END
+ 
+ HEAD|Distances between structures
+-g_rms|calculates rmsd's with a reference structure and rmsd matrices
+-g_confrms|fits two structures and calculates the rmsd 
+ g_cluster|clusters structures
++g_confrms|fits two structures and calculates the rmsd 
++g_rms|calculates rmsd's with a reference structure and rmsd matrices
+ g_rmsf|calculates atomic fluctuations
+ END
+ 
+ HEAD|Distances in structures over time
+-g_mindist|calculates the minimum distance between two groups
+-g_dist|calculates the distances between the centers of mass of two groups
+ g_bond|calculates distances between atoms
++g_dist|calculates the distances between the centers of mass of two groups
++g_mindist|calculates the minimum distance between two groups
+ g_mdmat|calculates residue contact maps
+ g_polystat|calculates static properties of polymers
+ g_rmsdist|calculates atom pair distances averaged with power -2, -3 or -6
+ END
+ 
+ HEAD|Mass distribution properties over time
+-g_traj|plots x, v, f, box, temperature and rotational energy
+ g_gyrate|calculates the radius of gyration
+ g_msd|calculates mean square displacements
+ g_polystat|calculates static properties of polymers
+-g_rotacf|calculates the rotational correlation function for molecules
+ g_rdf|calculates radial distribution functions
++g_rotacf|calculates the rotational correlation function for molecules
+ g_rotmat|plots the rotation matrix for fitting to a reference structure
++g_traj|plots x, v, f, box, temperature and rotational energy
+ g_vanhove|calculates Van Hove displacement functions
+ END
+ 
+ HEAD|Analyzing bonded interactions
+-g_bond|calculates bond length distributions
+-mk_angndx|generates index files for g_angle
+ g_angle|calculates distributions and correlations for angles and dihedrals
++g_bond|calculates bond length distributions
+ g_dih|analyzes dihedral transitions
++mk_angndx|generates index files for g_angle
+ END
+ 
+ HEAD|Structural properties
++g_anadock|cluster structures from Autodock runs
++g_bundle|analyzes bundles of axes, e.g. helices
++g_clustsize|calculate size distributions of atomic clusters
++g_disre|analyzes distance restraints
+ g_hbond|computes and analyzes hydrogen bonds
+-g_saltbr|computes salt bridges
+-g_sas|computes solvent accessible surface area
+ g_order|computes the order parameter per atom for carbon tails
+ g_principal|calculates axes of inertia for a group of atoms
+ g_rdf|calculates radial distribution functions
++g_saltbr|computes salt bridges
++g_sas|computes solvent accessible surface area
+ g_sgangle|computes the angle and distance between two groups
+ g_sorient|analyzes solvent orientation around solutes
+ g_spol|analyzes solvent dipole orientation and polarization around solutes
+-g_bundle|analyzes bundles of axes, e.g. helices
+-g_disre|analyzes distance restraints
+-g_clustsize|calculate size distributions of atomic clusters
+-g_anadock|cluster structures from Autodock runs
+ END
+ 
+ HEAD|Kinetic properties
+-g_traj|plots x, v, f, box, temperature and rotational energy
+-g_velacc|calculates velocity autocorrelation functions
+-g_tcaf|calculates viscosities of liquids
+ g_bar|calculates free energy difference estimates through Bennett's acceptance ratio
+ g_current|calculate current autocorrelation function of system
+-g_vanhove|compute Van Hove correlation function
+ g_principal|calculate principal axes of inertion for a group of atoms
++g_tcaf|calculates viscosities of liquids
++g_traj|plots x, v, f, box, temperature and rotational energy
++g_vanhove|compute Van Hove correlation function
++g_velacc|calculates velocity autocorrelation functions
+ END
+ 
+ HEAD|Electrostatic properties
+-genion|generates mono atomic ions on energetically favorable positions
+-g_potential|calculates the electrostatic potential across the box
+-g_dipoles|computes the total dipole plus fluctuations
+-g_dielectric|calculates frequency dependent dielectric constants
+ g_current|calculates dielectric constants for charged systems
++g_dielectric|calculates frequency dependent dielectric constants
++g_dipoles|computes the total dipole plus fluctuations
++g_potential|calculates the electrostatic potential across the box
+ g_spol|analyze dipoles around a solute
++genion|generates mono atomic ions on energetically favorable positions
+ END
+ 
+-HEAD|Protein specific analysis
++HEAD|Protein-specific analysis
+ do_dssp|assigns secondary structure and calculates solvent accessible surface area
+ g_chi|calculates everything you want to know about chi and other dihedrals
+ g_helix|calculates basic properties of alpha helices
+ g_helixorient|calculates local pitch/bending/rotation/orientation inside helices
+ g_rama|computes Ramachandran plots
+-g_xrama|shows animated Ramachandran plots
+ g_wheel|plots helical wheels
++g_xrama|shows animated Ramachandran plots
+ END
+ 
+ HEAD|Interfaces
+-g_potential|calculates the electrostatic potential across the box
++g_bundle|analyzes bundles of axes, e.g. transmembrane helices
+ g_density|calculates the density of the system
+ g_densmap|calculates 2D planar or axial-radial density maps
+-g_order|computes the order parameter per atom for carbon tails
++g_densorder|calculate surface fluctuations
+ g_h2order|computes the orientation of water molecules
+-g_bundle|analyzes bundles of axes, e.g. transmembrane helices
++g_hydorder|computes tetrahedrality parameters around a given atom
++g_order|computes the order parameter per atom for carbon tails
+ g_membed|embeds a protein into a lipid bilayer
++g_potential|calculates the electrostatic potential across the box
+ END
+ 
+ 
+ HEAD|Covariance analysis
+-g_covar|calculates and diagonalizes the covariance matrix
+ g_anaeig|analyzes the eigenvectors
++g_covar|calculates and diagonalizes the covariance matrix
+ make_edi|generate input files for essential dynamics sampling
+ END
+ 
+ HEAD|Normal modes
+-grompp|makes a run input file
+-mdrun|finds a potential energy minimum
+-mdrun|calculates the Hessian
++g_anaeig|analyzes the normal modes
+ g_nmeig|diagonalizes the Hessian 
+ g_nmtraj|generate oscillating trajectory of an eigenmode
+-g_anaeig|analyzes the normal modes
+ g_nmens|generates an ensemble of structures from the normal modes
++grompp|makes a run input file
++mdrun|finds a potential energy minimum and calculates the Hessian
+ END
+diff --git a/cmake/ThreadMPI.cmake b/cmake/ThreadMPI.cmake
+index 8533727..19e90c1 100644
+--- a/cmake/ThreadMPI.cmake
++++ b/cmake/ThreadMPI.cmake
+@@ -37,10 +37,9 @@ if (CMAKE_USE_PTHREADS_INIT)
+         thread_mpi/event.c         thread_mpi/reduce_fast.c
+         thread_mpi/gather.c        thread_mpi/scatter.c
+         thread_mpi/group.c         thread_mpi/tmpi_init.c
+-        thread_mpi/hwinfo.c        thread_mpi/topology.c
+-        thread_mpi/list.c          thread_mpi/type.c
+-        thread_mpi/lock.c          
+-        thread_mpi/once.c)
++        thread_mpi/topology.c      thread_mpi/list.c          
++        thread_mpi/type.c          thread_mpi/lock.c
++        thread_mpi/numa_malloc.c   thread_mpi/once.c)
+     set(THREAD_LIB ${CMAKE_THREAD_LIBS_INIT})
+ else (CMAKE_USE_PTHREADS_INIT)
+     if (CMAKE_USE_WIN32_THREADS_INIT)
+@@ -56,10 +55,10 @@ else (CMAKE_USE_PTHREADS_INIT)
+             thread_mpi/event.c         thread_mpi/reduce_fast.c
+             thread_mpi/gather.c        thread_mpi/scatter.c
+             thread_mpi/group.c         thread_mpi/tmpi_init.c
+-            thread_mpi/hwinfo.c        thread_mpi/topology.c
+-            thread_mpi/list.c          thread_mpi/type.c
+-            thread_mpi/lock.c          thread_mpi/winthreads.c
+-            thread_mpi/once.c)
++            thread_mpi/topology.c      thread_mpi/list.c
++            thread_mpi/type.c          thread_mpi/lock.c
++            thread_mpi/winthreads.c    thread_mpi/once.c
++            thread_mpi/numa_malloc.c)
+         set(THREAD_LIBRARY )
+     endif (CMAKE_USE_WIN32_THREADS_INIT)
+ endif (CMAKE_USE_PTHREADS_INIT)
+@@ -93,6 +92,45 @@ else (THREAD_MPI_PROFILING)
+     add_definitions()
+ endif (THREAD_MPI_PROFILING)
+ 
++include(CheckCSourceCompiles)
++
++# Windows NUMA allocator
++if (THREAD_WINDOWS)
++	check_c_source_compiles(
++	"#include <windows.h>
++	int main(void) { PROCESSOR_NUMBER a; return 0; }"
++	HAVE_PROCESSOR_NUMBER)
++	if(HAVE_PROCESSOR_NUMBER)
++            #add_definitions(-DTMPI_WINDOWS_NUMA_API)
++            set(TMPI_WINDOWS_NUMA_API 1)
++	endif(HAVE_PROCESSOR_NUMBER)
++endif(THREAD_WINDOWS)
++
++
++
++include(CheckFunctionExists)
++if (THREAD_PTHREADS)
++    set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_THREAD_LIBS_INIT})
++    # check for sched_setaffinity
++    check_c_source_compiles(
++        "#define _GNU_SOURCE
++#include <pthread.h>
++#include <stdlib.h>
++#include <stdio.h>
++#include <errno.h>
++int main(void) { cpu_set_t set;
++    CPU_ZERO(&set);
++    CPU_SET(0, &set);
++    pthread_setaffinity_np(pthread_self(), sizeof(set), &set);
++    return 0;
++}"
++        PTHREAD_SETAFFINITY
++    )
++    if (PTHREAD_SETAFFINITY)
++        set(HAVE_PTHREAD_SETAFFINITY 1)
++    endif (PTHREAD_SETAFFINITY)
++endif (THREAD_PTHREADS)
++
+ 
+ # this runs on POSIX systems
+ check_include_files(unistd.h        HAVE_UNISTD_H)
+diff --git a/configure.ac b/configure.ac
+index df26544..878fb5d 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -518,6 +518,30 @@ Atomics should work on all but the most obscure CPU+compiler combinations;
+ if your system is not obscure -- like, for example, x86 with gcc --  please
+ contact the developers.
+ ]); tmpi_atomics=no])
++
++
++  # pthread_setaffinity
++  AC_MSG_CHECKING(if pthread_setaffinity_np is available)
++  AC_COMPILE_IFELSE([#define _GNU_SOURCE
++#include <pthread.h>
++#include <stdlib.h>
++#include <stdio.h>
++#include <errno.h>
++int main(void)
++{
++    cpu_set_t set;
++    CPU_ZERO(&set);
++    CPU_SET(0, &set);
++    pthread_setaffinity_np(pthread_self(), sizeof(set), &set);
++    return 0;
++}],
++  [AC_MSG_RESULT(yes); pthread_setaffinity=yes],
++  [AC_MSG_RESULT(no); pthread_setaffinity=no] )
++
++  if test "x$pthread_setaffinity" = "xyes"; then
++    AC_DEFINE(HAVE_PTHREAD_SETAFFINITY,1,[pthread_setaffinity_np is available])
++  fi
++
+   CFLAGS="$CFLAGS_RET"
+   CXXFLAGS="$CXXFLAGS_RET"
+ 
+diff --git a/include/gmx_blas.h b/include/gmx_blas.h
+index f36d4d8..8bd6b42 100644
+--- a/include/gmx_blas.h
++++ b/include/gmx_blas.h
+@@ -37,6 +37,12 @@
+ 
+ #include "types/simple.h"
+ 
++/* Suppress Cygwin compiler warnings from using newlib version of
++ * ctype.h */
++#ifdef GMX_CYGWIN
++#undef toupper
++#endif
++
+ 
+ /** @file
+  *
+diff --git a/include/gmx_lapack.h b/include/gmx_lapack.h
+index 0a39c03..6ce5138 100644
+--- a/include/gmx_lapack.h
++++ b/include/gmx_lapack.h
+@@ -72,6 +72,11 @@ extern "C" {
+ 
+ #include "types/simple.h"
+ 
++/* Suppress Cygwin compiler warnings from using newlib version of
++ * ctype.h */
++#ifdef GMX_CYGWIN
++#undef toupper
++#endif
+ 
+ #ifndef F77_FUNC
+ #define F77_FUNC(name,NAME) name ## _
+diff --git a/include/gmxcomplex.h b/include/gmxcomplex.h
+index 0f70f0c..902f93f 100644
+--- a/include/gmxcomplex.h
++++ b/include/gmxcomplex.h
+@@ -1,4 +1,5 @@
+ /*
++ * $Id: gmxcomplex.h,v 1.5 2009/03/07 13:30:36 lindahl Exp $
+  * 
+  *                This source code is part of
+  * 
+@@ -32,8 +33,8 @@
+  * And Hey:
+  * Gromacs Runs On Most of All Computer Systems
+  */
+-#ifndef _complex_h
+-#define _complex_h
++#ifndef _gmxcomplex_h
++#define _gmxcomplex_h
+ 
+ #include <math.h>
+ #include "typedefs.h"
+@@ -107,6 +108,16 @@ static t_complex conjugate(t_complex c)
+   return d;
+ }
+ 
++static real cabs2(t_complex c)
++{
++real abs2;
++abs2=(c.re*c.re)+(c.im*c.im);
++
++return abs2;
++}
++
++
++
+ static t_complex cdiv(t_complex teller,t_complex noemer)
+ {
+   t_complex res,anoemer;
+diff --git a/include/gstat.h b/include/gstat.h
+index a9ac497..574892e 100644
+--- a/include/gstat.h
++++ b/include/gstat.h
+@@ -66,7 +66,7 @@ real LegendreP(real x,unsigned long m);
+ 
+ enum {
+   effnNONE, effnEXP1, effnEXP2, effnEXP3,   effnVAC, 
+-  effnEXP5, effnEXP7, effnEXP9, effnERREST, effnNR
++  effnEXP5, effnEXP7, effnEXP9, effnERF, effnERREST, effnNR
+ };
+ 
+ /* must correspond with 'leg' g_chi.c:727 */
+@@ -96,7 +96,7 @@ typedef struct {
+ 
+ } t_dlist;
+ 
+-extern int  nfp_ffn[effnNR];
++extern const int  nfp_ffn[effnNR];
+ 
+ extern const char *s_ffn[effnNR+2];
+ 
+diff --git a/include/mdrun.h b/include/mdrun.h
+index 7bf4434..d30fb0c 100644
+--- a/include/mdrun.h
++++ b/include/mdrun.h
+@@ -176,6 +176,8 @@ gmx_integrator_t do_md;
+ 
+ gmx_integrator_t do_md_openmm;
+ 
++
++
+ /* ROUTINES from minimize.c */
+ 
+ gmx_integrator_t do_steep;
+@@ -196,6 +198,39 @@ gmx_integrator_t do_tpi;
+ /* Do test particle insertion */
+ 
+ 
++/* ROUTINES from md_support.c */
++
++/* return the number of steps between global communcations */
++int check_nstglobalcomm(FILE *fplog,t_commrec *cr,
++                        int nstglobalcomm,t_inputrec *ir);
++
++/* check whether an 'nst'-style parameter p is a multiple of nst, and
++   set it to be one if not, with a warning. */
++void check_nst_param(FILE *fplog,t_commrec *cr,
++                     const char *desc_nst,int nst,
++                     const char *desc_p,int *p);
++
++/* check which of the multisim simulations has the shortest number of
++   steps and return that number of nsteps */
++gmx_large_int_t get_multisim_nsteps(const t_commrec *cr,
++                                    gmx_large_int_t nsteps);
++
++void rerun_parallel_comm(t_commrec *cr,t_trxframe *fr,
++                         gmx_bool *bNotLastFrame);
++
++/* get the conserved energy associated with the ensemble type*/
++real compute_conserved_from_auxiliary(t_inputrec *ir, t_state *state,           
++                                      t_extmass *MassQ);
++
++/* reset all cycle and time counters. */
++void reset_all_counters(FILE *fplog,t_commrec *cr,
++                        gmx_large_int_t step,
++                        gmx_large_int_t *step_rel,t_inputrec *ir,
++                        gmx_wallcycle_t wcycle,t_nrnb *nrnb,
++                        gmx_runtime_t *runtime);
++
++
++
+ /* ROUTINES from sim_util.c */
+ void do_pbc_first(FILE *log,matrix box,t_forcerec *fr,
+ 			 t_graph *graph,rvec x[]);
+@@ -206,6 +241,7 @@ void do_pbc_first_mtop(FILE *fplog,int ePBC,matrix box,
+ void do_pbc_mtop(FILE *fplog,int ePBC,matrix box,
+ 			gmx_mtop_t *mtop,rvec x[]);
+ 
++
+ 		     
+ /* ROUTINES from stat.c */
+ gmx_global_stat_t global_stat_init(t_inputrec *ir);
+@@ -333,7 +369,33 @@ void dynamic_load_balancing(gmx_bool bVerbose,t_commrec *cr,real capacity[],
+ /* Perform load balancing, i.e. split the particles over processors
+  * based on their coordinates in the "dimension" direction.
+  */
++
++int multisim_min(const gmx_multisim_t *ms,int nmin,int n);
++/* Set an appropriate value for n across the whole multi-simulation */
++
++int multisim_nstsimsync(const t_commrec *cr,
++			const t_inputrec *ir,int repl_ex_nst);
++/* Determine the interval for inter-simulation communication */
+ 				   
++void init_global_signals(globsig_t *gs,const t_commrec *cr,
++			 const t_inputrec *ir,int repl_ex_nst);
++/* Constructor for globsig_t */
++
++void copy_coupling_state(t_state *statea,t_state *stateb,
++			 gmx_ekindata_t *ekinda,gmx_ekindata_t *ekindb, t_grpopts* opts);
++/* Copy stuff from state A to state B */
++
++void compute_globals(FILE *fplog, gmx_global_stat_t gstat, t_commrec *cr, t_inputrec *ir,
++		     t_forcerec *fr, gmx_ekindata_t *ekind,
++		     t_state *state, t_state *state_global, t_mdatoms *mdatoms,
++		     t_nrnb *nrnb, t_vcm *vcm, gmx_wallcycle_t wcycle,
++		     gmx_enerdata_t *enerd,tensor force_vir, tensor shake_vir, tensor total_vir,
++		     tensor pres, rvec mu_tot, gmx_constr_t constr,
++		     globsig_t *gs,gmx_bool bInterSimGS,
++		     matrix box, gmx_mtop_t *top_global, real *pcurr,
++		     int natoms, gmx_bool *bSumEkinhOld, int flags);
++/* Compute global variables during integration */
++
+ int mdrunner(int nthreads_requested, FILE *fplog,t_commrec *cr,int nfile,
+              const t_filenm fnm[], const output_env_t oenv, gmx_bool bVerbose,
+              gmx_bool bCompact, int nstglobalcomm, ivec ddxyz,int dd_node_order,
+diff --git a/include/pbc.h b/include/pbc.h
+index bf92c8d..03bf49b 100644
+--- a/include/pbc.h
++++ b/include/pbc.h
+@@ -33,8 +33,8 @@
+  * Gromacs Runs On Most of All Computer Systems
+  */
+ 
+-#ifndef _pbc_h
+-#define _pbc_h
++#ifndef _types_pbc_h
++#define _types_pbc_h
+ 
+ #include "sysstuff.h"
+ #include "typedefs.h"
+diff --git a/include/pdbio.h b/include/pdbio.h
+index 77aa6c0..0924518 100644
+--- a/include/pdbio.h
++++ b/include/pdbio.h
+@@ -136,7 +136,7 @@ void gmx_conect_add(gmx_conect conect,int ai,int aj);
+ gmx_conect gmx_conect_generate(t_topology *top);
+ /* Generate a conect structure from a topology */
+ 
+-gmx_conect gmx_conect_init();
++gmx_conect gmx_conect_init(void);
+ /* Initiate data structure */
+ 
+ void gmx_conect_done(gmx_conect gc);
+diff --git a/include/string2.h b/include/string2.h
+index 184c822..4f1f49a 100644
+--- a/include/string2.h
++++ b/include/string2.h
+@@ -56,6 +56,21 @@
+ /*#include "typedefs.h"*/
+ #include "types/simple.h"
+ 
++/* Suppress Cygwin compiler warnings from using newlib version of
++ * ctype.h */
++#ifdef GMX_CYGWIN
++#undef isdigit
++#undef isstring
++#undef isspace
++#undef isalnum
++#undef isalpha
++#undef ispunct
++#undef isxdigit
++#undef isupper
++#undef islower
++#undef toupper
++#undef tolower
++#endif
+ 
+ #ifdef __cplusplus
+ extern "C" {
+diff --git a/include/thread_mpi.h b/include/thread_mpi.h
+index ab38d4f..7f95362 100644
+--- a/include/thread_mpi.h
++++ b/include/thread_mpi.h
+@@ -96,11 +96,11 @@ files.
+ 
+ #include "thread_mpi/atomic.h"
+ #include "thread_mpi/threads.h"
++#include "thread_mpi/numa_malloc.h"
+ #include "thread_mpi/barrier.h"
+ #include "thread_mpi/event.h"
+ #include "thread_mpi/lock.h"
+ #include "thread_mpi/tmpi.h"
+ #include "thread_mpi/collective.h"
+-#include "thread_mpi/hwinfo.h"
+ 
+ 
+diff --git a/include/thread_mpi/Makefile.am b/include/thread_mpi/Makefile.am
+index bd95011..2064502 100644
+--- a/include/thread_mpi/Makefile.am
++++ b/include/thread_mpi/Makefile.am
+@@ -9,7 +9,7 @@ pkgincludethread_mpidir = ${pkgincludedir}/thread_mpi
+ 
+ pkgincludethread_mpi_HEADERS = \
+ 	atomic.h       event.h        lock.h         tmpi.h \
+-	barrier.h      hwinfo.h       mpi_bindings.h wait.h \
+-	collective.h   list.h         threads.h
++	barrier.h      mpi_bindings.h wait.h \
++	collective.h   list.h         threads.h	     numa_malloc.h
+ 
+ 
+diff --git a/include/thread_mpi/atomic.h b/include/thread_mpi/atomic.h
+index fe8b0a4..deb5a60 100644
+--- a/include/thread_mpi/atomic.h
++++ b/include/thread_mpi/atomic.h
+@@ -630,6 +630,7 @@ static inline void tMPI_Spinlock_wait(tMPI_Spinlock_t *x)
+ /** Atomic swap operation.
+ 
+   Atomically swaps the data in the tMPI_Atomic_t operand with the value of b.
++  NOTE: DON'T USE YET! (This has no good asm counterparts on many architectures).
+ 
+   \param a  Pointer to atomic type
+   \param b  Value to swap 
+@@ -648,6 +649,7 @@ static inline int tMPI_Atomic_swap(tMPI_Atomic_t *a, int b)
+ 
+   Atomically swaps the pointer in the tMPI_Atomic_ptr_t operand with the 
+   value of b.
++  NOTE: DON'T USE YET! (This has no good asm counterparts on many architectures).
+ 
+   \param a  Pointer to atomic type
+   \param b  Value to swap 
+diff --git a/include/thread_mpi/numa_malloc.h b/include/thread_mpi/numa_malloc.h
+new file mode 100644
+index 0000000..7b0edc1
+--- /dev/null
++++ b/include/thread_mpi/numa_malloc.h
+@@ -0,0 +1,130 @@
++/*
++This source code file is part of thread_mpi.  
++Written by Sander Pronk, Erik Lindahl, and possibly others. 
++
++Copyright (c) 2009, Sander Pronk, Erik Lindahl.
++All rights reserved.
++
++Redistribution and use in source and binary forms, with or without
++modification, are permitted provided that the following conditions are met:
++1) Redistributions of source code must retain the above copyright
++   notice, this list of conditions and the following disclaimer.
++2) Redistributions in binary form must reproduce the above copyright
++   notice, this list of conditions and the following disclaimer in the
++   documentation and/or other materials provided with the distribution.
++3) Neither the name of the copyright holders nor the
++   names of its contributors may be used to endorse or promote products
++   derived from this software without specific prior written permission.
++
++THIS SOFTWARE IS PROVIDED BY US ''AS IS'' AND ANY
++EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
++DISCLAIMED. IN NO EVENT SHALL WE BE LIABLE FOR ANY
++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++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 should not
++be called official thread_mpi. Details are found in the README & COPYING
++files.
++*/
++
++
++#ifndef _TMPI_NUMA_MALLOC_H_
++#define _TMPI_NUMA_MALLOC_H_
++
++/*! \file numa_alloc.h
++  
++    \brief NUMA aware memory allocators.
++  
++    This file provides a NUMA aware version of malloc() and friends to 
++    force local allocation, preventing expensive 'remote' memory access. 
++  
++    Note that memory allocated with tMPI_Malloc_local(), etc. MUST be
++    freed with tMPI_Free_numa().
++   
++    Currently this is only implemented on Windows. Check for the presence
++    of these functions with
++    #ifdef TMPI_NUMA_MALLOC
++    ....
++    #endif
++ */
++
++
++
++#ifdef __cplusplus
++extern "C" 
++{  
++#endif
++#if 0
++} /* Avoids screwing up auto-indentation */
++#endif
++
++
++#if (defined(WIN32) || defined( _WIN32 ) || defined(WIN64) || defined( _WIN64 ) || defined (__CYGWIN__))
++
++#define TMPI_NUMA_MALLOC
++
++#endif
++
++
++/*! \brief Allocate local memory by size in bytes. 
++  
++    \see malloc()
++  
++    \param[in] size  = size in units of sizeof() of the memory to be allocated
++   
++    \return Pointer to allocated memory, or NULL in case of failure
++ */
++void *tMPI_Malloc_local(size_t size);
++
++
++/*! \brief Allocate local memory by array and element size. 
++  
++    \see calloc()
++  
++    \param[in] nmemb  = number of array members
++    \param[in] size  = size in units of sizeof() of a single array element
++    
++    \return Pointer to allocated memory, or NULL in case of failure
++ */
++void *tMPI_Calloc_local(size_t nmemb, size_t size);
++
++
++/*! \brief Re-allocate to local memory. 
++  
++    \see realloc()
++  
++    \param[in] ptr   = input pointer of originally allocated memory (can 
++                        be allocated with NUMA or non-NUMA malloc())
++    \param[in] size  = new size in units of sizeof(). 
++    
++    \return Pointer to allocated memory, or NULL in case of failure
++ */
++void *tMPI_Realloc_local(void *ptr, size_t size); 
++
++
++/*! \brief Free memory allocate with any of the NUMA-aware allocators
++  
++    \see calloc()
++  
++    \param[in] ptr = pointer to block of memory allocated with a NUMA allocator
++    
++    \return Returns debug info: 0 if the memory was allocated with a NUMA  
++            allocator, 1 if it was allocated by another allocator.
++ */
++int tMPI_Free_numa(void *ptr);
++
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif /* _TMPI_NUMA_MALLOC_H_ */
++
+diff --git a/include/thread_mpi/threads.h b/include/thread_mpi/threads.h
+index 143b3cb..d8dfe70 100644
+--- a/include/thread_mpi/threads.h
++++ b/include/thread_mpi/threads.h
+@@ -256,10 +256,20 @@ void tMPI_Fatal_error(const char *file, int line, const char *message, ...);
+ enum tMPI_Thread_support tMPI_Thread_support(void);
+ 
+ 
++/** Get the number of hardware threads that can be run simultaneously.
++
++    Returns the total number of cores and SMT threads that can run.
++
++    \ret The maximum number of threads that can run simulataneously. If this
++         number cannot be determined for the current architecture, 0 is 
++         returned. */
++int tMPI_Thread_get_hw_number(void);
++
+ 
+ /** Create a new thread
+  *
+  *  The new thread will call start_routine() with the argument arg.
++ *
+  *  Please be careful not to change arg after calling this function.
+  * 
+  *  \param thread          Pointer to opaque thread datatype
+@@ -268,9 +278,34 @@ enum tMPI_Thread_support tMPI_Thread_support(void);
+  *  
+  *  \return Status - 0 on success, or an error code.
+  */
+-int tMPI_Thread_create   (tMPI_Thread_t *   thread,
+-                          void *            (*start_routine)(void *),
+-                          void *            arg);
++int tMPI_Thread_create(tMPI_Thread_t *thread,
++                      void* (*start_routine)(void *),
++                      void* arg);
++
++/** Create a new thread with processor affinity 
++ *
++ *  The new thread will call start_routine() with the argument arg.
++ * 
++ *  The new thread will have processor affinity assigned in a 
++ *  round-robin way, starting at processor 1.  The first thread to call 
++ *  this function will be assigned to processor 0.
++ *
++ *  This means that this funtion should ONLY be called when starting a
++ *  thread on each processor: in any other case, this will lead to 
++ *  imbalances because processors 0 and 1 will be oversubscribed.
++ *
++ *  Please be careful not to change arg after calling this function.
++ * 
++ *  \param thread          Pointer to opaque thread datatype
++ *  \param start_routine   The function to call in the new thread
++ *  \param arg             Argument to call with
++ *  
++ *  \return Status - 0 on success, or an error code.
++ */
++int tMPI_Thread_create_aff(tMPI_Thread_t *thread,
++                           void *(*start_routine)(void *),
++                           void *arg);
++
+ 
+ 
+ 
+@@ -285,8 +320,7 @@ int tMPI_Thread_create   (tMPI_Thread_t *   thread,
+  *  
+  *  \return 0 if the join went ok, or a non-zero error code.
+  */
+-int tMPI_Thread_join     (tMPI_Thread_t     thread,
+-                          void **           value_ptr);
++int tMPI_Thread_join(tMPI_Thread_t thread, void **value_ptr);
+ 
+ 
+ 
+@@ -430,7 +464,7 @@ int tMPI_Thread_once(tMPI_Thread_once_t *once_data,
+  *  \param cond  Pointer to previously allocated condition variable
+  *  \return      0 or a non-zero error message.
+  */
+-int tMPI_Thread_cond_init(tMPI_Thread_cond_t *     cond);
++int tMPI_Thread_cond_init(tMPI_Thread_cond_t *cond);
+ 
+ 
+ 
+@@ -443,7 +477,7 @@ int tMPI_Thread_cond_init(tMPI_Thread_cond_t *     cond);
+  *  \param cond Pointer to condition variable.
+  *  \return 0 or a non-zero error message.
+  */
+-int tMPI_Thread_cond_destroy(tMPI_Thread_cond_t *    cond);
++int tMPI_Thread_cond_destroy(tMPI_Thread_cond_t *cond);
+ 
+ 
+ 
+@@ -462,8 +496,8 @@ int tMPI_Thread_cond_destroy(tMPI_Thread_cond_t *    cond);
+  *
+  *  \return 0 or a non-zero error message.
+  */
+-int tMPI_Thread_cond_wait(tMPI_Thread_cond_t *    cond,
+-                          tMPI_Thread_mutex_t *   mtx);
++int tMPI_Thread_cond_wait(tMPI_Thread_cond_t *cond,
++                          tMPI_Thread_mutex_t *mtx);
+ 
+ 
+ 
+@@ -478,7 +512,7 @@ int tMPI_Thread_cond_wait(tMPI_Thread_cond_t *    cond,
+  *
+  *  \return 0 or a non-zero error message.
+  */
+-int tMPI_Thread_cond_signal(tMPI_Thread_cond_t *  cond);
++int tMPI_Thread_cond_signal(tMPI_Thread_cond_t *cond);
+ 
+ 
+ /** Unblock all waiting threads
+@@ -491,7 +525,7 @@ int tMPI_Thread_cond_signal(tMPI_Thread_cond_t *  cond);
+ *
+ *  \return 0 or a non-zero error message.
+ */
+-int tMPI_Thread_cond_broadcast(tMPI_Thread_cond_t *  cond);
++int tMPI_Thread_cond_broadcast(tMPI_Thread_cond_t *cond);
+ 
+ 
+ 
+@@ -504,7 +538,7 @@ int tMPI_Thread_cond_broadcast(tMPI_Thread_cond_t *  cond);
+  *                     join them can read this value if they try.
+  *  \return 
+  */
+-void tMPI_Thread_exit(void *      value_ptr);
++void tMPI_Thread_exit(void *value_ptr);
+ 
+ 
+ 
+@@ -516,7 +550,7 @@ void tMPI_Thread_exit(void *      value_ptr);
+  *  \param thread     Handle to thread we want to see dead.
+  *  \return 0 or a non-zero error message.
+  */
+-int tMPI_Thread_cancel(tMPI_Thread_t      thread);
++int tMPI_Thread_cancel(tMPI_Thread_t thread);
+ 
+ 
+ 
+diff --git a/include/tmpi.h b/include/tmpi.h
+index 1a660bc..9d90f07 100644
+--- a/include/tmpi.h
++++ b/include/tmpi.h
+@@ -118,13 +118,13 @@ files.
+ 
+ 
+ #include "thread_mpi/atomic.h"
++#include "thread_mpi/numa_malloc.h"
+ #include "thread_mpi/threads.h"
+ #include "thread_mpi/barrier.h"
+ #include "thread_mpi/event.h"
+ #include "thread_mpi/lock.h"
+ #include "thread_mpi/tmpi.h"
+ #include "thread_mpi/collective.h"
+-#include "thread_mpi/hwinfo.h"
+ 
+ #include "thread_mpi/mpi_bindings.h"
+ 
+diff --git a/include/typedefs.h b/include/typedefs.h
+index 4d0e39c..7c766b7 100644
+--- a/include/typedefs.h
++++ b/include/typedefs.h
+@@ -71,6 +71,9 @@
+ #include "types/constr.h"
+ #include "types/matrix.h"
+ #include "types/oenv.h"
++#include "types/globsig.h"
++#include "types/nlistheuristics.h"
++#include "types/iteratedconstraints.h"
+ 
+ #ifdef __cplusplus
+ extern "C" {
+diff --git a/include/types/atoms.h b/include/types/atoms.h
+index 8c73a84..ea31d9d 100644
+--- a/include/types/atoms.h
++++ b/include/types/atoms.h
+@@ -48,12 +48,12 @@ enum {
+ /* The particle type */
+  
+ typedef struct {
+-  real 		m,q;		/* Mass and charge			*/
+-  real 		mB,qB;		/* Mass and charge for Free Energy calc */
+-  unsigned short type;		/* Atom type				*/
+-  unsigned short typeB;		/* Atom type for Free Energy calc	*/
+-  int           ptype;		/* Particle type			*/
+-  int 		resind;		/* Index into resinfo in t_atoms)       */
++  real          m,q;            /* Mass and charge                      */
++  real          mB,qB;          /* Mass and charge for Free Energy calc */
++  unsigned short type;          /* Atom type                            */
++  unsigned short typeB;         /* Atom type for Free Energy calc       */
++  int           ptype;          /* Particle type                        */
++  int           resind;         /* Index into resinfo (in t_atoms)      */
+   int           atomnumber;     /* Atomic Number or NOTSET              */
+   char          elem[4];        /* Element name                         */
+ } t_atom;
+@@ -74,40 +74,39 @@ typedef struct {
+   char atomnm[6];               /* True atom name including spaces      */
+   real occup;                   /* Occupancy                            */
+   real bfac;                    /* B-factor                             */
+-  gmx_bool bAnisotropic;            /* (an)isotropic switch                 */
++  gmx_bool bAnisotropic;        /* (an)isotropic switch                 */
+   int  uij[6];                  /* Anisotropic B-factor                 */
+ } t_pdbinfo;
+ 
+ typedef struct {
+-  int  nr;			/* Number of different groups		*/
++  int  nr;                      /* Number of different groups           */
+   int  *nm_ind;                 /* Index in the group names             */
+ } t_grps;
+ 
+ typedef struct {
+   int           nr;             /* Nr of atoms                          */
+-  t_atom	*atom;		/* Array of atoms (dim: nr)		*/
+-				/* The following entries will not 	*/
+-				/* allways be used (nres==0)	 	*/
+-  char		***atomname;	/* Array of pointers to atom name	*/
+-				/* use: (*(atomname[i]))		*/
+-  char		***atomtype;	/* Array of pointers to atom types	*/
+-				/* use: (*(atomtype[i]))		*/
+-  char		***atomtypeB;	/* Array of pointers to B atom types	*/
+-				/* use: (*(atomtypeB[i]))		*/
+-  int		nres;		/* The number of resinfo entries	*/
++  t_atom        *atom;	        /* Array of atoms (dim: nr)             */
++                                /* The following entries will not       */
++                                /* always be used (nres==0)             */
++  char	        ***atomname;    /* Array of pointers to atom name       */
++                                /* use: (*(atomname[i]))                */
++  char          ***atomtype;    /* Array of pointers to atom types      */
++                                /* use: (*(atomtype[i]))                */
++  char          ***atomtypeB;   /* Array of pointers to B atom types    */
++                                /* use: (*(atomtypeB[i]))               */
++  int           nres;           /* The number of resinfo entries        */
+   t_resinfo     *resinfo;       /* Array of residue names and numbers   */
+   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 */
+-  real         *gb_radius;      /* GB radius for each atom type */
+-  real         *S_hct;          /* Overlap factors for HCT/OBC GB models */
+-
+-  int          *atomnumber;     /* Atomic number, used for QM/MM */
++  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  */
++  real         *gb_radius;      /* GB radius for each atom type                 */
++  real         *S_hct;          /* Overlap factors for HCT/OBC GB models        */
++  int          *atomnumber;     /* Atomic number, used for QM/MM                */
+ } t_atomtypes;
+ 
+ 
+diff --git a/include/types/globsig.h b/include/types/globsig.h
+new file mode 100644
+index 0000000..29c634c
+--- /dev/null
++++ b/include/types/globsig.h
+@@ -0,0 +1,64 @@
++/*
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.2.0
++ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
++ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
++ * Copyright (c) 2001-2004, The GROMACS development team,
++ * check out http://www.gromacs.org for more information.
++
++ * 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:
++ * GRoups of Organic Molecules in ACtion for Science
++ */
++#ifndef _globsig_h
++#define _globsig_h
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#if 0
++}
++/* Hack to make automatic indenting work */
++#endif
++
++/* simulation conditions to transmit. Keep in mind that they are 
++   transmitted to other nodes through an MPI_Reduce after
++   casting them to a real (so the signals can be sent together with other 
++   data). This means that the only meaningful values are positive, 
++   negative or zero. */
++enum { eglsNABNSB, eglsCHKPT, eglsSTOPCOND, eglsRESETCOUNTERS, eglsNR };
++
++typedef struct {
++    int nstms;       /* The frequency for intersimulation communication */
++    int sig[eglsNR]; /* The signal set by one process in do_md */
++    int set[eglsNR]; /* The communicated signal, equal for all processes */
++} globsig_t;
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
+diff --git a/include/types/iteratedconstraints.h b/include/types/iteratedconstraints.h
+new file mode 100644
+index 0000000..501c274
+--- /dev/null
++++ b/include/types/iteratedconstraints.h
+@@ -0,0 +1,70 @@
++/*
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.2.0
++ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
++ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
++ * Copyright (c) 2001-2004, The GROMACS development team,
++ * check out http://www.gromacs.org for more information.
++
++ * 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:
++ * GRoups of Organic Molecules in ACtion for Science
++ */
++#ifndef _iteratedconstraints_h
++#define _iteratedconstraints_h
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#if 0
++}
++/* Hack to make automatic indenting work */
++#endif
++
++/* Definitions for convergence of iterated constraints */
++
++/* iterate constraints up to 50 times  */
++#define MAXITERCONST       50
++
++/* data type */
++typedef struct
++{
++    real f,fprev,x,xprev;  
++    int iter_i;
++    gmx_bool bIterate;
++    real allrelerr[MAXITERCONST+2];
++    int num_close; /* number of "close" violations, caused by limited precision. */
++} gmx_iterate_t;
++
++void gmx_iterate_init(gmx_iterate_t *iterate,gmx_bool bIterate);
++
++gmx_bool done_iterating(const t_commrec *cr,FILE *fplog, int nsteps, gmx_iterate_t *iterate, gmx_bool bFirstIterate, real fom, real *newf);
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
+diff --git a/include/types/nlistheuristics.h b/include/types/nlistheuristics.h
+new file mode 100644
+index 0000000..b240bac
+--- /dev/null
++++ b/include/types/nlistheuristics.h
+@@ -0,0 +1,74 @@
++/*
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.2.0
++ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
++ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
++ * Copyright (c) 2001-2004, The GROMACS development team,
++ * check out http://www.gromacs.org for more information.
++
++ * 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:
++ * GRoups of Organic Molecules in ACtion for Science
++ */
++#ifndef _nlistheuristics_h
++#define _nlistheuristics_h
++
++#ifdef __cplusplus
++extern "C" {
++#endif
++
++#if 0
++}
++/* Hack to make automatic indenting work */
++#endif
++
++typedef struct {
++    gmx_bool       bGStatEveryStep;
++    gmx_large_int_t step_ns;
++    gmx_large_int_t step_nscheck;
++    gmx_large_int_t nns;
++    matrix     scale_tot;
++    int        nabnsb;
++    double     s1;
++    double     s2;
++    double     ab;
++    double     lt_runav;
++    double     lt_runav2;
++} gmx_nlheur_t;
++
++void reset_nlistheuristics(gmx_nlheur_t *nlh,gmx_large_int_t step);
++
++void init_nlistheuristics(gmx_nlheur_t *nlh,
++			  gmx_bool bGStatEveryStep,gmx_large_int_t step);
++
++void update_nliststatistics(gmx_nlheur_t *nlh,gmx_large_int_t step);
++
++void set_nlistheuristics(gmx_nlheur_t *nlh,gmx_bool bReset,gmx_large_int_t step);
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
+diff --git a/include/types/pbc.h b/include/types/pbc.h
+index a58e9ac..b94f77d 100644
+--- a/include/types/pbc.h
++++ b/include/types/pbc.h
+@@ -32,8 +32,8 @@
+  * And Hey:
+  * GRoups of Organic Molecules in ACtion for Science
+  */
+-#ifndef _matrix_h
+-#define _matrix_h
++#ifndef _pbc_h
++#define _pbc_h
+ 
+ 
+ #include "simple.h"
+diff --git a/include/types/topology.h b/include/types/topology.h
+index 5fa9dee..cf8be0e 100644
+--- a/include/types/topology.h
++++ b/include/types/topology.h
+@@ -52,7 +52,7 @@ enum {
+ 
+ typedef struct {
+   char          **name;         /* Name of the molecule type  	        */
+-  t_atoms	atoms;		/* The atoms		       	        */
++  t_atoms       atoms;          /* The atoms                  	        */
+   t_ilist       ilist[F_NRE];
+   t_block       cgs;            /* The charge groups                    */
+   t_blocka      excls;          /* The exclusions                       */
+@@ -71,9 +71,9 @@ typedef struct {
+ typedef struct {
+   t_grps         grps[egcNR];   /* Groups of things                     */
+   int            ngrpname;      /* Number of groupnames                 */
+-  char           ***grpname;	/* Names of the groups		        */
++  char           ***grpname;    /* Names of the groups                  */
+   int            ngrpnr[egcNR];
+-  unsigned char  *grpnr[egcNR]; /* Group numbers or NULL		*/
++  unsigned char  *grpnr[egcNR]; /* Group numbers or NULL                */
+ } gmx_groups_t;
+ 
+ /* This macro gives the group number of group type egc for atom i.
+@@ -85,7 +85,7 @@ typedef struct {
+ /* The global, complete system topology struct, based on molecule types.
+    This structure should contain no data that is O(natoms) in memory. */
+ typedef struct {
+-  char           **name;	/* Name of the topology	       	        */
++  char           **name;        /* Name of the topology                 */
+   gmx_ffparams_t ffparams;
+   int            nmoltype;
+   gmx_moltype_t  *moltype;
+@@ -97,12 +97,12 @@ typedef struct {
+   t_atomtypes    atomtypes;     /* Atomtype properties                  */
+   t_block        mols;          /* The molecules                        */
+   gmx_groups_t   groups;
+-  t_symtab	 symtab;        /* The symbol table			*/
++  t_symtab       symtab;        /* The symbol table                     */
+ } gmx_mtop_t;
+ 
+ /* The mdrun node-local topology struct, completely written out */
+ typedef struct {
+-  t_idef	idef;		/* The interaction function definition	*/
++  t_idef        idef;           /* The interaction function definition	*/
+   t_atomtypes   atomtypes;      /* Atomtype properties                  */
+   t_block       cgs;            /* The charge groups                    */
+   t_blocka      excls;          /* The exclusions                       */
+@@ -110,14 +110,14 @@ typedef struct {
+ 
+ /* The old topology struct, completely written out, used in analysis tools */
+ typedef struct {
+-  char  	**name;		/* Name of the topology	       	        */
+-  t_idef	idef;		/* The interaction function definition	*/
+-  t_atoms	atoms;		/* The atoms		       	        */
++  char          **name;         /* Name of the topology                 */
++  t_idef        idef;           /* The interaction function definition	*/
++  t_atoms       atoms;          /* The atoms                            */
+   t_atomtypes   atomtypes;      /* Atomtype properties                  */
+   t_block       cgs;            /* The charge groups                    */
+   t_block       mols;           /* The molecules                        */
+   t_blocka      excls;          /* The exclusions                       */
+-  t_symtab	symtab;		/* The symbol table			*/
++  t_symtab      symtab;         /* The symbol table                     */
+ } t_topology;
+ 
+ #ifdef __cplusplus
+diff --git a/man/man1/Makefile.am b/man/man1/Makefile.am
+index 3ad3d4a..813dd9f 100644
+--- a/man/man1/Makefile.am
++++ b/man/man1/Makefile.am
+@@ -18,6 +18,7 @@ man_MANS =   \
+ 	g_current.1  \
+ 	g_density.1  \
+ 	g_densmap.1  \
++	g_densorder.1  \
+ 	g_dielectric.1  \
+ 	g_dih.1  \
+ 	g_dipoles.1  \
+@@ -32,6 +33,7 @@ man_MANS =   \
+ 	g_hbond.1  \
+ 	g_helix.1  \
+ 	g_helixorient.1  \
++	g_hydorder.1  \
+ 	g_lie.1  \
+ 	g_mdmat.1  \
+ 	g_membed.1  \
+@@ -41,7 +43,9 @@ man_MANS =   \
+ 	g_nmeig.1  \
+ 	g_nmens.1  \
+ 	g_nmtraj.1  \
++	g_options.1  \
+ 	g_order.1  \
++	g_pme_error.1  \
+ 	g_polystat.1  \
+ 	g_potential.1  \
+ 	g_principal.1  \
+diff --git a/man/man1/do_dssp.1 b/man/man1/do_dssp.1
+index 92b9b7a..8d7f0d3 100644
+--- a/man/man1/do_dssp.1
++++ b/man/man1/do_dssp.1
+@@ -1,8 +1,8 @@
+-.TH do_dssp 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH do_dssp 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ do_dssp - assigns secondary structure and calculates solvent accessible surface area
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3do_dssp\fP
+ .BI "\-f" " traj.xtc "
+@@ -26,12 +26,13 @@ do_dssp - assigns secondary structure and calculates solvent accessible surface
+ .BI "\-xvg" " enum "
+ .BI "\-sss" " string "
+ .SH DESCRIPTION
+-\&do_dssp 
++\&\fB do_dssp\fR 
+ \&reads a trajectory file and computes the secondary structure for
+ \&each time frame 
+ \&calling the dssp program. If you do not have the dssp program,
+-\&get it. do_dssp assumes that the dssp executable is
+-\&/usr/local/bin/dssp. If this is not the case, then you should
++\&get it from http://swift.cmbi.ru.nl/gv/dssp. \fB do_dssp\fR assumes 
++\&that the dssp executable is located in 
++\&\fB /usr/local/bin/dssp\fR. If this is not the case, then you should
+ \&set an environment variable \fB DSSP\fR pointing to the dssp
+ \&executable, e.g.: 
+ 
+@@ -42,7 +43,7 @@ do_dssp - assigns secondary structure and calculates solvent accessible surface
+ \&The structure assignment for each residue and time is written to an
+ \&\fB .xpm\fR matrix file. This file can be visualized with for instance
+ \&\fB xv\fR and can be converted to postscript with \fB xpm2ps\fR.
+-\&Individual chains are separated by light grey lines in the xpm and
++\&Individual chains are separated by light grey lines in the \fB .xpm\fR and
+ \&postscript files.
+ \&The number of residues with each secondary structure type and the
+ \&total secondary structure (\fB \-sss\fR) count as a function of
+@@ -125,7 +126,7 @@ do_dssp - assigns secondary structure and calculates solvent accessible surface
+  Time unit: \fB fs\fR, \fB ps\fR, \fB ns\fR, \fB us\fR, \fB ms\fR or \fB s\fR
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/editconf.1 b/man/man1/editconf.1
+index 402147a..8806884 100644
+--- a/man/man1/editconf.1
++++ b/man/man1/editconf.1
+@@ -1,8 +1,8 @@
+-.TH editconf 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH editconf 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ editconf - edits the box and writes subgroups 
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3editconf\fP
+ .BI "\-f" " conf.gro "
+@@ -29,6 +29,7 @@ editconf - edits the box and writes subgroups
+ .BI "\-scale" " vector "
+ .BI "\-density" " real "
+ .BI "\-[no]pbc" ""
++.BI "\-resnr" " int "
+ .BI "\-[no]grasp" ""
+ .BI "\-rvdw" " real "
+ .BI "\-sig56" " real "
+@@ -38,7 +39,7 @@ editconf - edits the box and writes subgroups
+ .BI "\-label" " string "
+ .BI "\-[no]conect" ""
+ .SH DESCRIPTION
+-\&editconf converts generic structure format to \fB .gro\fR, \fB .g96\fR
++\&\fB editconf\fR converts generic structure format to \fB .gro\fR, \fB .g96\fR
+ \&or \fB .pdb\fR.
+ \&
+ 
+@@ -56,18 +57,19 @@ editconf - edits the box and writes subgroups
+ \&The last two are special cases of a triclinic box.
+ \&The length of the three box vectors of the truncated octahedron is the
+ \&shortest distance between two opposite hexagons.
+-\&The volume of a dodecahedron is 0.71 and that of a truncated octahedron
+-\&is 0.77 of that of a cubic box with the same periodic image distance.
++\&Relative to a cubic box with some periodic image distance, the volume of a 
++\&dodecahedron with this same periodic distance is 0.71 times that of the cube, 
++\&and that of a truncated octahedron is 0.77 times.
+ \&
+ 
+ 
+ \&Option \fB \-box\fR requires only
+-\&one value for a cubic box, dodecahedron and a truncated octahedron.
++\&one value for a cubic, rhombic dodecahedral, or truncated octahedral box.
+ \&
+ 
+ 
+-\&With \fB \-d\fR and a \fB triclinic\fR box the size of the system in the x, y
+-\&and z directions is used. With \fB \-d\fR and \fB cubic\fR,
++\&With \fB \-d\fR and a \fB triclinic\fR box the size of the system in the \fI x\fR\-, \fI y\fR\-,
++\&and \fI z\fR\-directions is used. With \fB \-d\fR and \fB cubic\fR,
+ \&\fB dodecahedron\fR or \fB octahedron\fR boxes, the dimensions are set
+ \&to the diameter of the system (largest distance between atoms) plus twice
+ \&the specified distance.
+@@ -75,7 +77,7 @@ editconf - edits the box and writes subgroups
+ 
+ 
+ \&Option \fB \-angles\fR is only meaningful with option \fB \-box\fR and
+-\&a triclinic box and can not be used with option \fB \-d\fR.
++\&a triclinic box and cannot be used with option \fB \-d\fR.
+ \&
+ 
+ 
+@@ -90,17 +92,18 @@ editconf - edits the box and writes subgroups
+ 
+ 
+ \&\fB \-princ\fR aligns the principal axes of the system along the
+-\&coordinate axes, this may allow you to decrease the box volume,
++\&coordinate axes, with the longest axis aligned with the \fI x\fR\-axis. 
++\&This may allow you to decrease the box volume,
+ \&but beware that molecules can rotate significantly in a nanosecond.
+ \&
+ 
+ 
+ \&Scaling is applied before any of the other operations are
+ \&performed. Boxes and coordinates can be scaled to give a certain density (option
+-\&\fB \-density\fR). Note that this may be inaccurate in case a gro
+-\&file is given as input. A special feature of the scaling option, when the
++\&\fB \-density\fR). Note that this may be inaccurate in case a \fB .gro\fR
++\&file is given as input. A special feature of the scaling option is that when the
+ \&factor \-1 is given in one dimension, one obtains a mirror image,
+-\&mirrored in one of the plains, when one uses \-1 in three dimensions
++\&mirrored in one of the planes. When one uses \-1 in three dimensions, 
+ \&a point\-mirror image is obtained.
+ 
+ 
+@@ -108,7 +111,7 @@ editconf - edits the box and writes subgroups
+ 
+ 
+ \&Periodicity can be removed in a crude manner.
+-\&It is important that the box sizes at the bottom of your input file
++\&It is important that the box vectors at the bottom of your input file
+ \&are correct when the periodicity is to be removed.
+ \&
+ 
+@@ -126,7 +129,8 @@ editconf - edits the box and writes subgroups
+ \&
+ 
+ 
+-\&With the option \-mead a special pdb (pqr) file for the MEAD electrostatics
++\&With the option \fB \-mead\fR a special \fB .pdb\fR (\fB .pqr\fR)
++\&file for the MEAD electrostatics
+ \&program (Poisson\-Boltzmann solver) can be made. A further prerequisite
+ \&is that the input file is a run input file.
+ \&The B\-factor field is then filled with the Van der Waals radius
+@@ -134,7 +138,7 @@ editconf - edits the box and writes subgroups
+ \&
+ 
+ 
+-\&The option \-grasp is similar, but it puts the charges in the B\-factor
++\&The option \fB \-grasp\fR is similar, but it puts the charges in the B\-factor
+ \&and the radius in the occupancy.
+ \&
+ 
+@@ -145,13 +149,13 @@ editconf - edits the box and writes subgroups
+ \&
+ 
+ 
+-\&Finally with option \fB \-label\fR editconf can add a chain identifier
+-\&to a pdb file, which can be useful for analysis with e.g. rasmol.
++\&Finally, with option \fB \-label\fR, \fB editconf\fR can add a chain identifier
++\&to a \fB .pdb\fR file, which can be useful for analysis with e.g. Rasmol.
+ \&
+ 
+ 
+ \&To convert a truncated octrahedron file produced by a package which uses
+-\&a cubic box with the corners cut off (such as Gromos) use:
++\&a cubic box with the corners cut off (such as GROMOS), use:
+ 
+ \&\fB editconf \-f in \-rotate 0 45 35.264 \-bt o \-box veclen \-o out\fR
+ 
+@@ -188,7 +192,7 @@ editconf - edits the box and writes subgroups
+  Set the nicelevel
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-[no]ndef"  "no    "
+  Choose output from default index groups
+@@ -230,11 +234,14 @@ editconf - edits the box and writes subgroups
+  Scaling factor
+ 
+ .BI "\-density"  " real" " 1000  " 
+- Density (g/l) of the output box achieved by scaling
++ Density (g/L) of the output box achieved by scaling
+ 
+ .BI "\-[no]pbc"  "no    "
+  Remove the periodicity (make molecule whole again)
+ 
++.BI "\-resnr"  " int" " \-1" 
++  Renumber residues starting from resnr
++
+ .BI "\-[no]grasp"  "no    "
+  Store the charge of the atom in the B\-factor field and the radius of the atom in the occupancy field
+ 
+@@ -257,12 +264,10 @@ editconf - edits the box and writes subgroups
+  Add chain label for all residues
+ 
+ .BI "\-[no]conect"  "no    "
+- Add CONECT records to a pdb file when written. Can only be done when a topology is present
++ Add CONECT records to a \fB .pdb\fR file when written. Can only be done when a topology is present
+ 
+ .SH KNOWN PROBLEMS
+-\- For complex molecules, the periodicity removal routine may break down, 
+-
+-\- in that case you can use trjconv.
++\- For complex molecules, the periodicity removal routine may break down, in that case you can use \fB trjconv\fR.
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/eneconv.1 b/man/man1/eneconv.1
+index 6dc846c..703abce 100644
+--- a/man/man1/eneconv.1
++++ b/man/man1/eneconv.1
+@@ -1,8 +1,8 @@
+-.TH eneconv 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH eneconv 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ eneconv - converts energy files
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3eneconv\fP
+ .BI "\-f" " ener.edr "
+@@ -16,17 +16,18 @@ eneconv - converts energy files
+ .BI "\-offset" " real "
+ .BI "\-[no]settime" ""
+ .BI "\-[no]sort" ""
++.BI "\-[no]rmdh" ""
+ .BI "\-scalefac" " real "
+ .BI "\-[no]error" ""
+ .SH DESCRIPTION
+ \&With \fI multiple files\fR specified for the \fB \-f\fR option:
+ 
+ \&Concatenates several energy files in sorted order.
+-\&In case of double time frames the one
++\&In the case of double time frames, the one
+ \&in the later file is used. By specifying \fB \-settime\fR you will be
+ \&asked for the start time of each file. The input files are taken
+ \&from the command line,
+-\&such that the command \fB eneconv \-o fixed.edr *.edr\fR should do
++\&such that the command \fB eneconv \-f *.edr \-o fixed.edr\fR should do
+ \&the trick. 
+ 
+ 
+@@ -69,7 +70,7 @@ eneconv - converts energy files
+  Only write out frame when t MOD dt = offset
+ 
+ .BI "\-offset"  " real" " 0     " 
+- Time offset for \-dt option
++ Time offset for \fB \-dt\fR option
+ 
+ .BI "\-[no]settime"  "no    "
+  Change starting time interactively
+@@ -77,6 +78,9 @@ eneconv - converts energy files
+ .BI "\-[no]sort"  "yes   "
+  Sort energy files (not frames)
+ 
++.BI "\-[no]rmdh"  "no    "
++ Remove free energy block data
++
+ .BI "\-scalefac"  " real" " 1     " 
+  Multiply energy component by this factor
+ 
+diff --git a/man/man1/g_anadock.1 b/man/man1/g_anadock.1
+index d32edf5..fc8b6c2 100644
+--- a/man/man1/g_anadock.1
++++ b/man/man1/g_anadock.1
+@@ -1,8 +1,8 @@
+-.TH g_anadock 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_anadock 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_anadock - cluster structures from Autodock runs
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_anadock\fP
+ .BI "\-f" " eiwit.pdb "
+@@ -18,14 +18,14 @@ g_anadock - cluster structures from Autodock runs
+ .BI "\-[no]rms" ""
+ .BI "\-cutoff" " real "
+ .SH DESCRIPTION
+-\&anadock analyses the results of an Autodock run and clusters the
++\&\fB g_anadock\fR analyses the results of an Autodock run and clusters the
+ \&structures together, based on distance or RMSD. The docked energy
+ \&and free energy estimates are analysed, and for each cluster the
+ \&energy statistics are printed.
+ 
+ 
+ \&An alternative approach to this is to cluster the structures first
+-\&(using \fB g_cluster\fR and then sort the clusters on either lowest
++\&using \fB g_cluster\fR and then sort the clusters on either lowest
+ \&energy or average energy.
+ .SH FILES
+ .BI "\-f" " eiwit.pdb" 
+diff --git a/man/man1/g_anaeig.1 b/man/man1/g_anaeig.1
+index f34e4ed..b23c3d0 100644
+--- a/man/man1/g_anaeig.1
++++ b/man/man1/g_anaeig.1
+@@ -1,8 +1,8 @@
+-.TH g_anaeig 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_anaeig 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_anaeig - analyzes the eigenvectors
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_anaeig\fP
+ .BI "\-v" " eigenvec.trr "
+@@ -91,12 +91,12 @@ g_anaeig - analyzes the eigenvectors
+ \&\fB \-last\fR have been set explicitly, in which case all eigenvectors
+ \&will be written to separate files. Chain identifiers will be added
+ \&when writing a \fB .pdb\fR file with two or three structures (you
+-\&can use \fB rasmol \-nmrpdb\fR to view such a pdb file).
++\&can use \fB rasmol \-nmrpdb\fR to view such a \fB .pdb\fR file).
+ 
+ 
+ \&  Overlap calculations between covariance analysis:
+ 
+-\&  NOTE: the analysis should use the same fitting structure
++\&  \fB Note:\fR the analysis should use the same fitting structure
+ 
+ 
+ \&\fB \-over\fR: calculate the subspace overlap of the eigenvectors in
+@@ -218,7 +218,7 @@ g_anaeig - analyzes the eigenvectors
+  Time unit: \fB fs\fR, \fB ps\fR, \fB ns\fR, \fB us\fR, \fB ms\fR or \fB s\fR
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_analyze.1 b/man/man1/g_analyze.1
+index a9d90fe..7237823 100644
+--- a/man/man1/g_analyze.1
++++ b/man/man1/g_analyze.1
+@@ -1,8 +1,8 @@
+-.TH g_analyze 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_analyze 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_analyze - analyzes data sets
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_analyze\fP
+ .BI "\-f" " graph.xvg "
+@@ -47,23 +47,23 @@ g_analyze - analyzes data sets
+ .BI "\-beginfit" " real "
+ .BI "\-endfit" " real "
+ .SH DESCRIPTION
+-\&g_analyze reads an ascii file and analyzes data sets.
++\&\fB g_analyze\fR reads an ASCII file and analyzes data sets.
+ \&A line in the input file may start with a time
+-\&(see option \fB \-time\fR) and any number of y values may follow.
++\&(see option \fB \-time\fR) and any number of \fI y\fR\-values may follow.
+ \&Multiple sets can also be
+-\&read when they are separated by & (option \fB \-n\fR),
+-\&in this case only one y value is read from each line.
++\&read when they are separated by & (option \fB \-n\fR);
++\&in this case only one \fI y\fR\-value is read from each line.
+ \&All lines starting with  and @ are skipped.
+ \&All analyses can also be done for the derivative of a set
+ \&(option \fB \-d\fR).
+ 
+ 
+-\&All options, except for \fB \-av\fR and \fB \-power\fR assume that the
++\&All options, except for \fB \-av\fR and \fB \-power\fR, assume that the
+ \&points are equidistant in time.
+ 
+ 
+-\&g_analyze always shows the average and standard deviation of each
+-\&set. For each set it also shows the relative deviation of the third
++\&\fB g_analyze\fR always shows the average and standard deviation of each
++\&set, as well as the relative deviation of the third
+ \&and fourth cumulant from those of a Gaussian distribution with the same
+ \&standard deviation.
+ 
+@@ -104,13 +104,13 @@ g_analyze - analyzes data sets
+ \&that the autocorrelation is a sum of two exponentials.
+ \&The analytical curve for the block average is:
+ 
+-\&f(t) = sigma sqrt(2/T (  a   (tau1 ((exp(\-t/tau1) \- 1) tau1/t + 1)) +
++\&f(t) = sigma\fB *\fRsqrt(2/T (  alpha   (tau1 ((exp(\-t/tau1) \- 1) tau1/t + 1)) +
+ 
+-\&                       (1\-a) (tau2 ((exp(\-t/tau2) \- 1) tau2/t + 1)))),
++\&                       (1\-alpha) (tau2 ((exp(\-t/tau2) \- 1) tau2/t + 1)))),
+ where T is the total time.
+-\&a, tau1 and tau2 are obtained by fitting f2(t) to error2.
++\&alpha, tau1 and tau2 are obtained by fitting f2(t) to error2.
+ \&When the actual block average is very close to the analytical curve,
+-\&the error is sigma*sqrt(2/T (a tau1 + (1\-a) tau2)).
++\&the error is sigma\fB *\fRsqrt(2/T (a tau1 + (1\-a) tau2)).
+ \&The complete derivation is given in
+ \&B. Hess, J. Chem. Phys. 116:209\-217, 2002.
+ 
+@@ -145,7 +145,7 @@ where T is the total time.
+ 
+ \&Option \fB \-power\fR fits the data to b ta, which is accomplished
+ \&by fitting to a t + b on log\-log scale. All points after the first
+-\&zero or negative value are ignored.
++\&zero or with a negative value are ignored.
+ 
+ Option \fB \-luzar\fR performs a Luzar & Chandler kinetics analysis
+ \&on output from \fB g_hbond\fR. The input file can be taken directly
+@@ -198,7 +198,7 @@ Option \fB \-luzar\fR performs a Luzar & Chandler kinetics analysis
+  Set the nicelevel
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -222,7 +222,7 @@ Option \fB \-luzar\fR performs a Luzar & Chandler kinetics analysis
+  Binwidth for the distribution
+ 
+ .BI "\-errbar"  " enum" " none" 
+- Error bars for \-av: \fB none\fR, \fB stddev\fR, \fB error\fR or \fB 90\fR
++ Error bars for \fB \-av\fR: \fB none\fR, \fB stddev\fR, \fB error\fR or \fB 90\fR
+ 
+ .BI "\-[no]integrate"  "no    "
+  Integrate data function(s) numerically using trapezium rule
+@@ -234,10 +234,10 @@ Option \fB \-luzar\fR performs a Luzar & Chandler kinetics analysis
+  Interpret second data set as error in the y values for integrating
+ 
+ .BI "\-[no]regression"  "no    "
+- Perform a linear regression analysis on the data. If \-xydy is set a second set will be interpreted as the error bar in the Y value. Otherwise, if multiple data sets are present a multilinear regression will be performed yielding the constant A that minimize chi2 = (y \- A0 x0 \- A1 x1 \- ... \- AN xN)2 where now Y is the first data set in the input file and xi the others. Do read the information at the option \fB \-time\fR.
++ Perform a linear regression analysis on the data. If \fB \-xydy\fR is set a second set will be interpreted as the error bar in the Y value. Otherwise, if multiple data sets are present a multilinear regression will be performed yielding the constant A that minimize chi2 = (y \- A0 x0 \- A1 x1 \- ... \- AN xN)2 where now Y is the first data set in the input file and xi the others. Do read the information at the option \fB \-time\fR.
+ 
+ .BI "\-[no]luzar"  "no    "
+- Do a Luzar and Chandler analysis on a correlation function and related as produced by g_hbond. When in addition the \-xydy flag is given the second and fourth column will be interpreted as errors in c(t) and n(t).
++ Do a Luzar and Chandler analysis on a correlation function and related as produced by \fB g_hbond\fR. When in addition the \fB \-xydy\fR flag is given the second and fourth column will be interpreted as errors in c(t) and n(t).
+ 
+ .BI "\-temp"  " real" " 298.15" 
+  Temperature for the Luzar hydrogen bonding kinetics analysis
+@@ -246,7 +246,7 @@ Option \fB \-luzar\fR performs a Luzar & Chandler kinetics analysis
+  Time (ps) from which to start fitting the correlation functions in order to obtain the forward and backward rate constants for HB breaking and formation
+ 
+ .BI "\-fitend"  " real" " 60    " 
+- Time (ps) where to stop fitting the correlation functions in order to obtain the forward and backward rate constants for HB breaking and formation. Only with \-gem
++ Time (ps) where to stop fitting the correlation functions in order to obtain the forward and backward rate constants for HB breaking and formation. Only with \fB \-gem\fR
+ 
+ .BI "\-smooth"  " real" " \-1    " 
+  If = 0, the tail of the ACF will be smoothed by fitting it to an exponential function: y = A exp(\-x/tau)
+@@ -273,7 +273,7 @@ Option \fB \-luzar\fR performs a Luzar & Chandler kinetics analysis
+  Order of Legendre polynomial for ACF (0 indicates none): \fB 0\fR, \fB 1\fR, \fB 2\fR or \fB 3\fR
+ 
+ .BI "\-fitfn"  " enum" " none" 
+- Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR or \fB exp9\fR
++ Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR, \fB exp9\fR or \fB erffit\fR
+ 
+ .BI "\-ncskip"  " int" " 0" 
+  Skip N points in the output file of correlation functions
+diff --git a/man/man1/g_angle.1 b/man/man1/g_angle.1
+index f69617d..be7c954 100644
+--- a/man/man1/g_angle.1
++++ b/man/man1/g_angle.1
+@@ -1,8 +1,8 @@
+-.TH g_angle 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_angle 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_angle - calculates distributions and correlations for angles and dihedrals
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_angle\fP
+ .BI "\-f" " traj.xtc "
+@@ -36,22 +36,22 @@ g_angle - calculates distributions and correlations for angles and dihedrals
+ .BI "\-beginfit" " real "
+ .BI "\-endfit" " real "
+ .SH DESCRIPTION
+-\&g_angle computes the angle distribution for a number of angles
++\&\fB g_angle\fR computes the angle distribution for a number of angles
+ \&or dihedrals. This way you can check whether your simulation
+-\&is correct. With option \-ov you can plot the average angle of
+-\&a group of angles as a function of time. With the \-all option
++\&is correct. With option \fB \-ov\fR you can plot the average angle of
++\&a group of angles as a function of time. With the \fB \-all\fR option
+ \&the first graph is the average, the rest are the individual angles.
+ 
+ 
+-\&With the \-of option g_angle also calculates the fraction of trans
++\&With the \fB \-of\fR option, \fB g_angle\fR also calculates the fraction of trans
+ \&dihedrals (only for dihedrals) as function of time, but this is
+ \&probably only fun for a selected few.
+ 
+ 
+-\&With option \-oc a dihedral correlation function is calculated.
++\&With option \fB \-oc\fR a dihedral correlation function is calculated.
+ 
+ 
+-\&It should be noted that the indexfile should contain
++\&It should be noted that the index file should contain
+ \&atom\-triples for angles or atom\-quadruplets for dihedrals.
+ \&If this is not the case, the program will crash.
+ 
+@@ -116,7 +116,7 @@ g_angle - calculates distributions and correlations for angles and dihedrals
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -134,7 +134,7 @@ g_angle - calculates distributions and correlations for angles and dihedrals
+  Print dihedral angles modulo 360 degrees
+ 
+ .BI "\-[no]chandler"  "no    "
+- Use Chandler correlation function (N[trans] = 1, N[gauche] = 0) rather than cosine correlation function. Trans is defined as phi  \-60 || phi  60.
++ Use Chandler correlation function (N[trans] = 1, N[gauche] = 0) rather than cosine correlation function. Trans is defined as phi  \-60 or phi  60.
+ 
+ .BI "\-[no]avercorr"  "no    "
+  Average the correlation functions for the individual angles/dihedrals
+@@ -149,7 +149,7 @@ g_angle - calculates distributions and correlations for angles and dihedrals
+  Order of Legendre polynomial for ACF (0 indicates none): \fB 0\fR, \fB 1\fR, \fB 2\fR or \fB 3\fR
+ 
+ .BI "\-fitfn"  " enum" " none" 
+- Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR or \fB exp9\fR
++ Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR, \fB exp9\fR or \fB erffit\fR
+ 
+ .BI "\-ncskip"  " int" " 0" 
+  Skip N points in the output file of correlation functions
+diff --git a/man/man1/g_bar.1 b/man/man1/g_bar.1
+index dd4a4f4..3ecfe5b 100644
+--- a/man/man1/g_bar.1
++++ b/man/man1/g_bar.1
+@@ -1,15 +1,15 @@
+-.TH g_bar 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_bar 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_bar - calculates free energy difference estimates through Bennett's acceptance ratio
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_bar\fP
+ .BI "\-f" " dhdl.xvg "
++.BI "\-g" " ener.edr "
+ .BI "\-o" " bar.xvg "
+ .BI "\-oi" " barint.xvg "
+ .BI "\-oh" " histogram.xvg "
+-.BI "\-g" " energy.edr "
+ .BI "\-[no]h" ""
+ .BI "\-[no]version" ""
+ .BI "\-nice" " int "
+@@ -23,42 +23,73 @@ g_bar - calculates free energy difference estimates through Bennett's acceptance
+ .BI "\-nbmax" " int "
+ .BI "\-nbin" " int "
+ .SH DESCRIPTION
+-\&g_bar calculates free energy difference estimates through 
+-\&Bennett's acceptance ratio method. 
+-\&Input option \fB \-f\fR expects multiple dhdl files. 
++\&\fB g_bar\fR calculates free energy difference estimates through 
++\&Bennett's acceptance ratio method (BAR). It also automatically
++\&adds series of individual free energies obtained with BAR into
++\&a combined free energy estimate.
++
++
++\&Every individual BAR free energy difference relies on two 
++\&simulations at different states: say state A and state B, as
++\&controlled by a parameter, lambda (see the \fB .mdp\fR parameter
++\&\fB init_lambda\fR). The BAR method calculates a ratio of weighted
++\&average of the Hamiltonian difference of state B given state A and
++\&vice versa. If the Hamiltonian does not depend linearly on lambda
++\&(in which case we can extrapolate the derivative of the Hamiltonian
++\&with respect to lambda, as is the default when \fB free_energy\fR is on),
++\&the energy differences to the other state need to be calculated
++\&explicitly during the simulation. This can be controlled with
++\&the \fB .mdp\fR option \fB foreign_lambda\fR.
++
++
++\&Input option \fB \-f\fR expects multiple \fB dhdl.xvg\fR files. 
+ \&Two types of input files are supported:
+ 
+-\&* Files with only one y\-value, for such files it is assumed 
+-\&that the y\-value is dH/dlambda and that the Hamiltonian depends 
+-\&linearly on lambda. The lambda value of the simulation is inferred 
+-\&from the subtitle if present, otherwise from a number in the
+-\&subdirectory in the file name.
++\&\fB *\fR  Files with only one \fI y\fR\-value, for such files it is assumed 
++\&   that the \fI y\fR\-value is dH/dlambda and that the Hamiltonian depends 
++\&   linearly on lambda. The lambda value of the simulation is inferred 
++\&   from the subtitle (if present), otherwise from a number in the
++\&   subdirectory in the file name.
+ \&
+ 
+-\&* Files with more than one y\-value. The files should have columns 
+-\&with dH/dlambda and Delta lambda. The lambda values are inferred 
+-\&from the legends: 
+-\&lambda of the simulation from the legend of dH/dlambda 
+-\&and the foreign lambda's from the legends of Delta H.
++\&\fB *\fR  Files with more than one \fI y\fR\-value. The files should have columns 
++\&   with dH/dlambda and Deltalambda. The lambda values are inferred 
++\&   from the legends: lambda of the simulation from the legend of dH/dlambda 
++\&   and the foreign lambda values from the legends of Delta H.
+ 
+ 
+-\&The lambda of the simulation is parsed from dhdl.xvg file's legend 
+-\&containing the string 'dH', the foreign lambda's from the legend 
++\&The lambda of the simulation is parsed from \fB dhdl.xvg\fR file's legend 
++\&containing the string 'dH', the foreign lambda values from the legend 
+ \&containing the capitalized letters 'D' and 'H'. The temperature 
+ \&is parsed from the legend line containing 'T ='.
+ 
+ 
+-\&The free energy estimates are determined using BAR with bisection, 
+-\&the precision of the output is set with \fB \-prec\fR. 
++\&The input option \fB \-g\fR expects multiple \fB .edr\fR files. 
++\&These can contain either lists of energy differences (see the
++\&\fB .mdp\fR option \fB separate_dhdl_file\fR), or a series of histograms
++\&(see the \fB .mdp\fR options \fB dh_hist_size\fR and \fB dh_hist_spacing\fR).
++\&The temperature and lambda values are automatically deduced from
++\&the \fB ener.edr\fR file.
++
++The free energy estimates are determined using BAR with bisection, 
++\&with the precision of the output set with \fB \-prec\fR. 
+ \&An error estimate taking into account time correlations 
+ \&is made by splitting the data into blocks and determining 
+ \&the free energy differences over those blocks and assuming 
+ \&the blocks are independent. 
+ \&The final error estimate is determined from the average variance 
+-\&over 5 blocks. A range of blocks numbers for error estimation can 
++\&over 5 blocks. A range of block numbers for error estimation can 
+ \&be provided with the options \fB \-nbmin\fR and \fB \-nbmax\fR.
+ 
+ 
++\&\fB g_bar\fR tries to aggregate samples with the same 'native' and 'foreign'
++\&lambda values, but always assumes independent samples. \fB Note\fR that
++\&when aggregating energy differences/derivatives with different
++\&sampling intervals, this is almost certainly not correct. Usually
++\&subsequent energies are correlated and different time intervals mean
++\&different degrees of correlation between samples.
++
++
+ \&The results are split in two parts: the last part contains the final 
+ \&results in kJ/mol, together with the error estimate for each part 
+ \&and the total. The first part contains detailed free energy 
+@@ -66,17 +97,17 @@ g_bar - calculates free energy difference estimates through Bennett's acceptance
+ \&kT (together with their computed error estimate). The printed 
+ \&values are:
+ 
+-\&*  lam_A: the lambda values for point A.
++\&\fB *\fR  lam_A: the lambda values for point A.
+ 
+-\&*  lam_B: the lambda values for point B.
++\&\fB *\fR  lam_B: the lambda values for point B.
+ 
+-\&*     DG: the free energy estimate.
++\&\fB *\fR     DG: the free energy estimate.
+ 
+-\&*    s_A: an estimate of the relative entropy of B in A.
++\&\fB *\fR    s_A: an estimate of the relative entropy of B in A.
+ 
+-\&*    s_A: an estimate of the relative entropy of A in B.
++\&\fB *\fR    s_A: an estimate of the relative entropy of A in B.
+ 
+-\&*  stdev: an estimate expected per\-sample standard deviation.
++\&\fB *\fR  stdev: an estimate expected per\-sample standard deviation.
+ 
+ 
+ \&The relative entropy of both states in each other's ensemble can be 
+@@ -85,15 +116,19 @@ g_bar - calculates free energy difference estimates through Bennett's acceptance
+ \&ensemble of lambda_A (and vice versa for s_B), is a 
+ \&measure of the 'distance' between Boltzmann distributions of 
+ \&the two states, that goes to zero for identical distributions. See 
+-\&Wu & Kofke, J. Chem. Phys. 123 084109 (2009) for more information.
++\&Wu & Kofke, J. Chem. Phys. 123 084109 (2005) for more information.
+ \&
+ 
+ 
+ \&The estimate of the expected per\-sample standard deviation, as given 
+-\&in Bennett's original BAR paper: 
+-\&Bennett, J. Comp. Phys. 22, p 245 (1976), Eq. 10 gives an estimate 
+-\&of the quality of sampling (not directly of the actual statistical 
+-\&error, because it assumes independent samples).
++\&in Bennett's original BAR paper: Bennett, J. Comp. Phys. 22, p 245 (1976).
++\&Eq. 10 therein gives an estimate of the quality of sampling (not directly
++\&of the actual statistical error, because it assumes independent samples).
++
++
++\&To get a visual estimate of the phase space overlap, use the 
++\&\fB \-oh\fR option to write series of histograms, together with the 
++\&\fB \-nbin\fR option.
+ 
+ 
+ .SH FILES
+@@ -101,6 +136,10 @@ g_bar - calculates free energy difference estimates through Bennett's acceptance
+ .B Input, Opt., Mult.
+  xvgr/xmgr file 
+ 
++.BI "\-g" " ener.edr" 
++.B Input, Opt., Mult.
++ Energy file 
++
+ .BI "\-o" " bar.xvg" 
+ .B Output, Opt.
+  xvgr/xmgr file 
+@@ -113,10 +152,6 @@ g_bar - calculates free energy difference estimates through Bennett's acceptance
+ .B Output, Opt.
+  xvgr/xmgr file 
+ 
+-.BI "\-g" " energy.edr" 
+-.B Input, Opt., Mult.
+- Energy file 
+-
+ .SH OTHER OPTIONS
+ .BI "\-[no]h"  "no    "
+  Print help info and quit
+@@ -128,7 +163,7 @@ g_bar - calculates free energy difference estimates through Bennett's acceptance
+  Set the nicelevel
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_bond.1 b/man/man1/g_bond.1
+index ec92658..8944075 100644
+--- a/man/man1/g_bond.1
++++ b/man/man1/g_bond.1
+@@ -1,8 +1,8 @@
+-.TH g_bond 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_bond 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_bond - calculates distances between atoms
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_bond\fP
+ .BI "\-f" " traj.xtc "
+@@ -24,8 +24,8 @@ g_bond - calculates distances between atoms
+ .BI "\-[no]aver" ""
+ .BI "\-[no]averdist" ""
+ .SH DESCRIPTION
+-\&g_bond makes a distribution of bond lengths. If all is well a
+-\&gaussian distribution should be made when using a harmonic potential.
++\&\fB g_bond\fR makes a distribution of bond lengths. If all is well a
++\&Gaussian distribution should be made when using a harmonic potential.
+ \&Bonds are read from a single group in the index file in order i1\-j1
+ \&i2\-j2 through in\-jn.
+ 
+@@ -84,7 +84,7 @@ g_bond - calculates distances between atoms
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -99,7 +99,7 @@ g_bond - calculates distances between atoms
+  Average bond length distributions
+ 
+ .BI "\-[no]averdist"  "yes   "
+- Average distances (turns on \-d)
++ Average distances (turns on \fB \-d\fR)
+ 
+ .SH KNOWN PROBLEMS
+ \- It should be possible to get bond information from the topology.
+diff --git a/man/man1/g_bundle.1 b/man/man1/g_bundle.1
+index ad82758..a80d361 100644
+--- a/man/man1/g_bundle.1
++++ b/man/man1/g_bundle.1
+@@ -1,8 +1,8 @@
+-.TH g_bundle 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_bundle 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_bundle - analyzes bundles of axes, e.g. helices
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_bundle\fP
+ .BI "\-f" " traj.xtc "
+@@ -29,7 +29,7 @@ g_bundle - analyzes bundles of axes, e.g. helices
+ .BI "\-na" " int "
+ .BI "\-[no]z" ""
+ .SH DESCRIPTION
+-\&g_bundle analyzes bundles of axes. The axes can be for instance
++\&\fB g_bundle\fR analyzes bundles of axes. The axes can be for instance
+ \&helix axes. The program reads two index groups and divides both
+ \&of them in \fB \-na\fR parts. The centers of mass of these parts
+ \&define the tops and bottoms of the axes.
+@@ -50,8 +50,8 @@ g_bundle - analyzes bundles of axes, e.g. helices
+ 
+ \&With option \fB \-oa\fR the top, mid (or kink when \fB \-ok\fR is set)
+ \&and bottom points of each axis
+-\&are written to a pdb file each frame. The residue numbers correspond
+-\&to the axis numbers. When viewing this file with \fB rasmol\fR, use the
++\&are written to a \fB .pdb\fR file each frame. The residue numbers correspond
++\&to the axis numbers. When viewing this file with Rasmol, use the
+ \&command line option \fB \-nmrpdb\fR, and type \fB set axis true\fR to
+ \&display the reference axis.
+ .SH FILES
+@@ -136,7 +136,7 @@ g_bundle - analyzes bundles of axes, e.g. helices
+  Number of axes
+ 
+ .BI "\-[no]z"  "no    "
+- Use the Z\-axis as reference iso the average axis
++ Use the \fI z\fR\-axis as reference instead of the average axis
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/g_chi.1 b/man/man1/g_chi.1
+index d43c71c..5625ba2 100644
+--- a/man/man1/g_chi.1
++++ b/man/man1/g_chi.1
+@@ -1,8 +1,8 @@
+-.TH g_chi 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_chi 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_chi - calculates everything you want to know about chi and other dihedrals
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_chi\fP
+ .BI "\-s" " conf.gro "
+@@ -52,25 +52,25 @@ g_chi - calculates everything you want to know about chi and other dihedrals
+ .BI "\-beginfit" " real "
+ .BI "\-endfit" " real "
+ .SH DESCRIPTION
+-\&g_chi computes phi, psi, omega and chi dihedrals for all your 
++\&\fB g_chi\fR computes phi, psi, omega, and chi dihedrals for all your 
+ \&amino acid backbone and sidechains.
+ \&It can compute dihedral angle as a function of time, and as
+ \&histogram distributions.
+-\&The distributions (histo\-(dihedral)(RESIDUE).xvg) are cumulative over all residues of each type.
++\&The distributions \fB (histo\-(dihedral)(RESIDUE).xvg\fR) are cumulative over all residues of each type.
+ 
+ 
+ \&If option \fB \-corr\fR is given, the program will
+ \&calculate dihedral autocorrelation functions. The function used
+ \&is C(t) =  cos(chi(tau)) cos(chi(tau+t)) . The use of cosines
+ \&rather than angles themselves, resolves the problem of periodicity.
+-\&(Van der Spoel & Berendsen (1997), \fB Biophys. J. 72\fR, 2032\-2041).
++\&(Van der Spoel & Berendsen (1997), Biophys. J. 72, 2032\-2041).
+ \&Separate files for each dihedral of each residue
+-\&(corr(dihedral)(RESIDUE)(nresnr).xvg) are output, as well as a
++\&\fB (corr(dihedral)(RESIDUE)(nresnr).xvg\fR) are output, as well as a
+ \&file containing the information for all residues (argument of \fB \-corr\fR).
+ 
+ 
+ \&With option \fB \-all\fR, the angles themselves as a function of time for
+-\&each residue are printed to separate files (dihedral)(RESIDUE)(nresnr).xvg.
++\&each residue are printed to separate files \fB (dihedral)(RESIDUE)(nresnr).xvg\fR.
+ \&These can be in radians or degrees.
+ 
+ 
+@@ -85,32 +85,33 @@ g_chi - calculates everything you want to know about chi and other dihedrals
+ 
+ \&(d) a table for each residue of the rotamer occupancy.
+ 
+-\&All rotamers are taken as 3\-fold, except for omegas and chi\-dihedrals
+-\&to planar groups (i.e. chi2 of aromatics asp and asn, chi3 of glu
+-\&and gln, and chi4 of arg), which are 2\-fold. "rotamer 0" means 
++
++\&All rotamers are taken as 3\-fold, except for omega and chi dihedrals
++\&to planar groups (i.e. chi2 of aromatics, Asp and Asn; chi3 of Glu
++\&and Gln; and chi4 of Arg), which are 2\-fold. "rotamer 0" means 
+ \&that the dihedral was not in the core region of each rotamer. 
+ \&The width of the core region can be set with \fB \-core_rotamer\fR
+ 
+ 
+-\&The S2 order parameters are also output to an xvg file
+-\&(argument \fB \-o\fR ) and optionally as a pdb file with
++\&The S2 order parameters are also output to an \fB .xvg\fR file
++\&(argument \fB \-o\fR ) and optionally as a \fB .pdb\fR file with
+ \&the S2 values as B\-factor (argument \fB \-p\fR). 
+ \&The total number of rotamer transitions per timestep
+ \&(argument \fB \-ot\fR), the number of transitions per rotamer
+ \&(argument \fB \-rt\fR), and the 3J couplings (argument \fB \-jc\fR), 
+-\&can also be written to .xvg files.
++\&can also be written to \fB .xvg\fR files.
+ 
+ 
+-\&If \fB \-chi_prod\fR is set (and maxchi  0), cumulative rotamers, e.g.
++\&If \fB \-chi_prod\fR is set (and \fB \-maxchi\fR  0), cumulative rotamers, e.g.
+ \&1+9(chi1\-1)+3(chi2\-1)+(chi3\-1) (if the residue has three 3\-fold 
+-\&dihedrals and maxchi = 3)
++\&dihedrals and \fB \-maxchi\fR = 3)
+ \&are calculated. As before, if any dihedral is not in the core region,
+ \&the rotamer is taken to be 0. The occupancies of these cumulative 
+ \&rotamers (starting with rotamer 0) are written to the file
+ \&that is the argument of \fB \-cp\fR, and if the \fB \-all\fR flag
+ \&is given, the rotamers as functions of time
+-\&are written to chiproduct(RESIDUE)(nresnr).xvg 
+-\&and their occupancies to histo\-chiproduct(RESIDUE)(nresnr).xvg.
++\&are written to \fB chiproduct(RESIDUE)(nresnr).xvg\fR 
++\&and their occupancies to \fB histo\-chiproduct(RESIDUE)(nresnr).xvg\fR.
+ 
+ 
+ \&The option \fB \-r\fR generates a contour plot of the average omega angle
+@@ -185,7 +186,7 @@ g_chi - calculates everything you want to know about chi and other dihedrals
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -194,16 +195,16 @@ g_chi - calculates everything you want to know about chi and other dihedrals
+  starting residue
+ 
+ .BI "\-[no]phi"  "no    "
+- Output for Phi dihedral angles
++ Output for phi dihedral angles
+ 
+ .BI "\-[no]psi"  "no    "
+- Output for Psi dihedral angles
++ Output for psi dihedral angles
+ 
+ .BI "\-[no]omega"  "no    "
+- Output for Omega dihedrals (peptide bonds)
++ Output for omega dihedrals (peptide bonds)
+ 
+ .BI "\-[no]rama"  "no    "
+- Generate Phi/Psi and Chi1/Chi2 ramachandran plots
++ Generate phi/psi and chi1/chi2 Ramachandran plots
+ 
+ .BI "\-[no]viol"  "no    "
+  Write a file that gives 0 or 1 for violated Ramachandran angles
+@@ -218,25 +219,25 @@ g_chi - calculates everything you want to know about chi and other dihedrals
+  in angle vs time files, use radians rather than degrees.
+ 
+ .BI "\-[no]shift"  "no    "
+- Compute chemical shifts from Phi/Psi angles
++ Compute chemical shifts from phi/psi angles
+ 
+ .BI "\-binwidth"  " int" " 1" 
+  bin width for histograms (degrees)
+ 
+ .BI "\-core_rotamer"  " real" " 0.5   " 
+- only the central \-core_rotamer*(360/multiplicity) belongs to each rotamer (the rest is assigned to rotamer 0)
++ only the central \fB \-core_rotamer\fR*(360/multiplicity) belongs to each rotamer (the rest is assigned to rotamer 0)
+ 
+ .BI "\-maxchi"  " enum" " 0" 
+- calculate first ndih Chi dihedrals: \fB 0\fR, \fB 1\fR, \fB 2\fR, \fB 3\fR, \fB 4\fR, \fB 5\fR or \fB 6\fR
++ calculate first ndih chi dihedrals: \fB 0\fR, \fB 1\fR, \fB 2\fR, \fB 3\fR, \fB 4\fR, \fB 5\fR or \fB 6\fR
+ 
+ .BI "\-[no]normhisto"  "yes   "
+  Normalize histograms
+ 
+ .BI "\-[no]ramomega"  "no    "
+- compute average omega as a function of phi/psi and plot it in an xpm plot
++ compute average omega as a function of phi/psi and plot it in an \fB .xpm\fR plot
+ 
+ .BI "\-bfact"  " real" " \-1    " 
+- B\-factor value for pdb file for atoms with no calculated dihedral order parameter
++ B\-factor value for \fB .pdb\fR file for atoms with no calculated dihedral order parameter
+ 
+ .BI "\-[no]chi_prod"  "no    "
+  compute a single cumulative rotamer for each residue
+@@ -245,7 +246,7 @@ g_chi - calculates everything you want to know about chi and other dihedrals
+  Include dihedrals to sidechain hydrogens
+ 
+ .BI "\-bmax"  " real" " 0     " 
+- Maximum B\-factor on any of the atoms that make up a dihedral, for the dihedral angle to be considere in the statistics. Applies to database work where a number of X\-Ray structures is analyzed. \-bmax = 0 means no limit.
++ Maximum B\-factor on any of the atoms that make up a dihedral, for the dihedral angle to be considere in the statistics. Applies to database work where a number of X\-Ray structures is analyzed. \fB \-bmax\fR = 0 means no limit.
+ 
+ .BI "\-acflen"  " int" " \-1" 
+  Length of the ACF, default is half the number of frames
+@@ -257,7 +258,7 @@ g_chi - calculates everything you want to know about chi and other dihedrals
+  Order of Legendre polynomial for ACF (0 indicates none): \fB 0\fR, \fB 1\fR, \fB 2\fR or \fB 3\fR
+ 
+ .BI "\-fitfn"  " enum" " none" 
+- Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR or \fB exp9\fR
++ Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR, \fB exp9\fR or \fB erffit\fR
+ 
+ .BI "\-ncskip"  " int" " 0" 
+  Skip N points in the output file of correlation functions
+@@ -271,11 +272,11 @@ g_chi - calculates everything you want to know about chi and other dihedrals
+ .SH KNOWN PROBLEMS
+ \- Produces MANY output files (up to about 4 times the number of residues in the protein, twice that if autocorrelation functions are calculated). Typically several hundred files are output.
+ 
+-\- Phi and psi dihedrals are calculated in a non\-standard way, using H\-N\-CA\-C for phi instead of C(\-)\-N\-CA\-C, and N\-CA\-C\-O for psi instead of N\-CA\-C\-N(+). This causes (usually small) discrepancies with the output of other tools like g_rama.
++\- phi and psi dihedrals are calculated in a non\-standard way, using H\-N\-CA\-C for phi instead of C(\-)\-N\-CA\-C, and N\-CA\-C\-O for psi instead of N\-CA\-C\-N(+). This causes (usually small) discrepancies with the output of other tools like \fB g_rama\fR.
+ 
+-\- \-r0 option does not work properly
++\- \fB \-r0\fR option does not work properly
+ 
+-\- Rotamers with multiplicity 2 are printed in chi.log as if they had multiplicity 3, with the 3rd (g(+)) always having probability 0
++\- Rotamers with multiplicity 2 are printed in \fB chi.log\fR as if they had multiplicity 3, with the 3rd (g(+)) always having probability 0
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/g_cluster.1 b/man/man1/g_cluster.1
+index d18de12..774aa6d 100644
+--- a/man/man1/g_cluster.1
++++ b/man/man1/g_cluster.1
+@@ -1,8 +1,8 @@
+-.TH g_cluster 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_cluster 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_cluster - clusters structures
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_cluster\fP
+ .BI "\-f" " traj.xtc "
+@@ -45,10 +45,11 @@ g_cluster - clusters structures
+ .BI "\-seed" " int "
+ .BI "\-niter" " int "
+ .BI "\-kT" " real "
++.BI "\-[no]pbc" ""
+ .SH DESCRIPTION
+-\&g_cluster can cluster structures with several different methods.
++\&\fB g_cluster\fR can cluster structures using several different methods.
+ \&Distances between structures can be determined from a trajectory
+-\&or read from an XPM matrix file with the \fB \-dm\fR option.
++\&or read from an \fB .xpm\fR matrix file with the \fB \-dm\fR option.
+ \&RMS deviation after fitting or RMS deviation of atom\-pair distances
+ \&can be used to define the distance between structures.
+ 
+@@ -74,7 +75,7 @@ g_cluster - clusters structures
+ \&(\fI Angew. Chem. Int. Ed.\fR \fB 1999\fR, \fI 38\fR, pp 236\-240).
+ \&Count number of neighbors using cut\-off, take structure with
+ \&largest number of neighbors with all its neighbors as cluster
+-\&and eleminate it from the pool of clusters. Repeat for remaining
++\&and eliminate it from the pool of clusters. Repeat for remaining
+ \&structures in pool.
+ 
+ 
+@@ -198,7 +199,7 @@ g_cluster - clusters structures
+  Time unit: \fB fs\fR, \fB ps\fR, \fB ns\fR, \fB us\fR, \fB ms\fR or \fB s\fR
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -237,10 +238,10 @@ g_cluster - clusters structures
+  Method for cluster determination: \fB linkage\fR, \fB jarvis\-patrick\fR, \fB monte\-carlo\fR, \fB diagonalization\fR or \fB gromos\fR
+ 
+ .BI "\-minstruct"  " int" " 1" 
+- Minimum number of structures in cluster for coloring in the xpm file
++ Minimum number of structures in cluster for coloring in the \fB .xpm\fR file
+ 
+ .BI "\-[no]binary"  "no    "
+- Treat the RMSD matrix as consisting of 0 and 1, where the cut\-off is given by \-cutoff
++ Treat the RMSD matrix as consisting of 0 and 1, where the cut\-off is given by \fB \-cutoff\fR
+ 
+ .BI "\-M"  " int" " 10" 
+  Number of nearest neighbors considered for Jarvis\-Patrick algorithm, 0 is use cutoff
+@@ -257,6 +258,9 @@ g_cluster - clusters structures
+ .BI "\-kT"  " real" " 0.001 " 
+  Boltzmann weighting factor for Monte Carlo optimization (zero turns off uphill steps)
+ 
++.BI "\-[no]pbc"  "yes   "
++ PBC check
++
+ .SH SEE ALSO
+ .BR gromacs(7)
+ 
+diff --git a/man/man1/g_clustsize.1 b/man/man1/g_clustsize.1
+index 07e2885..ddbfcf4 100644
+--- a/man/man1/g_clustsize.1
++++ b/man/man1/g_clustsize.1
+@@ -1,8 +1,8 @@
+-.TH g_clustsize 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_clustsize 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_clustsize - calculate size distributions of atomic clusters
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_clustsize\fP
+ .BI "\-f" " traj.xtc "
+@@ -35,8 +35,8 @@ g_clustsize - calculate size distributions of atomic clusters
+ .BI "\-rgbhi" " vector "
+ .SH DESCRIPTION
+ \&This program computes the size distributions of molecular/atomic clusters in
+-\&the gas phase. The output is given in the form of a XPM file.
+-\&The total number of clusters is written to a XVG file.
++\&the gas phase. The output is given in the form of an \fB .xpm\fR file.
++\&The total number of clusters is written to an \fB .xvg\fR file.
+ 
+ 
+ \&When the \fB \-mol\fR option is given clusters will be made out of
+@@ -46,11 +46,11 @@ g_clustsize - calculate size distributions of atomic clusters
+ 
+ 
+ \&When velocities are present in your trajectory, the temperature of
+-\&the largest cluster will be printed in a separate xvg file assuming
++\&the largest cluster will be printed in a separate \fB .xvg\fR file assuming
+ \&that the particles are free to move. If you are using constraints,
+ \&please correct the temperature. For instance water simulated with SHAKE
+ \&or SETTLE will yield a temperature that is 1.5 times too low. You can
+-\&compensate for this with the \-ndf option. Remember to take the removal
++\&compensate for this with the \fB \-ndf\fR option. Remember to take the removal
+ \&of center of mass motion into account.
+ 
+ 
+@@ -124,7 +124,7 @@ g_clustsize - calculate size distributions of atomic clusters
+  Time unit: \fB fs\fR, \fB ps\fR, \fB ns\fR, \fB us\fR, \fB ms\fR or \fB s\fR
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -133,7 +133,7 @@ g_clustsize - calculate size distributions of atomic clusters
+  Largest distance (nm) to be considered in a cluster
+ 
+ .BI "\-[no]mol"  "no    "
+- Cluster molecules rather than atoms (needs tpr file)
++ Cluster molecules rather than atoms (needs \fB .tpr\fR file)
+ 
+ .BI "\-[no]pbc"  "yes   "
+  Use periodic boundary conditions
+@@ -142,7 +142,7 @@ g_clustsize - calculate size distributions of atomic clusters
+  Number of frames to skip between writing
+ 
+ .BI "\-nlevels"  " int" " 20" 
+- Number of levels of grey in xpm output
++ Number of levels of grey in \fB .xpm\fR output
+ 
+ .BI "\-ndf"  " int" " \-1" 
+  Number of degrees of freedom of the entire system for temperature calculation. If not set, the number of atoms times three is used.
+diff --git a/man/man1/g_confrms.1 b/man/man1/g_confrms.1
+index 4c31798..af439a0 100644
+--- a/man/man1/g_confrms.1
++++ b/man/man1/g_confrms.1
+@@ -1,8 +1,8 @@
+-.TH g_confrms 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_confrms 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_confrms - fits two structures and calculates the rmsd 
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_confrms\fP
+ .BI "\-f1" " conf1.gro "
+@@ -23,8 +23,8 @@ g_confrms - fits two structures and calculates the rmsd
+ .BI "\-[no]label" ""
+ .BI "\-[no]bfac" ""
+ .SH DESCRIPTION
+-\&g_confrms computes the root mean square deviation (RMSD) of two
+-\&structures after LSQ fitting the second structure on the first one.
++\&\fB g_confrms\fR computes the root mean square deviation (RMSD) of two
++\&structures after least\-squares fitting the second structure on the first one.
+ \&The two structures do NOT need to have the same number of atoms,
+ \&only the two index groups used for the fit need to be identical.
+ \&With \fB \-name\fR only matching atom names from the selected groups
+@@ -73,7 +73,7 @@ g_confrms - fits two structures and calculates the rmsd
+  Set the nicelevel
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-[no]one"  "no    "
+  Only write the fitted structure to file
+diff --git a/man/man1/g_covar.1 b/man/man1/g_covar.1
+index 39cedbc..4d90b2b 100644
+--- a/man/man1/g_covar.1
++++ b/man/man1/g_covar.1
+@@ -1,8 +1,8 @@
+-.TH g_covar 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_covar 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_covar - calculates and diagonalizes the covariance matrix
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_covar\fP
+ .BI "\-f" " traj.xtc "
+@@ -56,13 +56,22 @@ g_covar - calculates and diagonalizes the covariance matrix
+ \&
+ 
+ 
+-\&Option \fB \-xpm\fR writes the whole covariance matrix to an xpm file.
++\&Option \fB \-xpm\fR writes the whole covariance matrix to an \fB .xpm\fR file.
+ \&
+ 
+ 
+-\&Option \fB \-xpma\fR writes the atomic covariance matrix to an xpm file,
++\&Option \fB \-xpma\fR writes the atomic covariance matrix to an \fB .xpm\fR file,
+ \&i.e. for each atom pair the sum of the xx, yy and zz covariances is
+ \&written.
++\&
++
++
++\&Note that the diagonalization of a matrix requires memory and time
++\&that will increase at least as fast as than the square of the number
++\&of atoms involved. It is easy to run out of memory, in which
++\&case this tool will probably exit with a 'Segmentation fault'. You
++\&should consider carefully whether a reduced set of atoms will meet
++\&your needs for lower costs.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+ .B Input
+diff --git a/man/man1/g_current.1 b/man/man1/g_current.1
+index 8a02558..a69fc08 100644
+--- a/man/man1/g_current.1
++++ b/man/man1/g_current.1
+@@ -1,8 +1,8 @@
+-.TH g_current 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_current 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_current - calculate current autocorrelation function of system
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_current\fP
+ .BI "\-s" " topol.tpr "
+@@ -32,17 +32,17 @@ g_current - calculate current autocorrelation function of system
+ .BI "\-tr" " real "
+ .BI "\-temp" " real "
+ .SH DESCRIPTION
+-\&This is a tool for calculating the current autocorrelation function, the correlation
++\&\fB g_current\fR is a tool for calculating the current autocorrelation function, the correlation
+ \&of the rotational and translational dipole moment of the system, and the resulting static
+-\&dielectric constant. To obtain a reasonable result the index group has to be neutral.
+-\&Furthermore the routine is capable of extracting the static conductivity from the current 
+-\&autocorrelation function, if velocities are given. Additionally an Einstein\-Helfand fit also
+-\&allows to get the static conductivity.
++\&dielectric constant. To obtain a reasonable result, the index group has to be neutral.
++\&Furthermore, the routine is capable of extracting the static conductivity from the current 
++\&autocorrelation function, if velocities are given. Additionally, an Einstein\-Helfand fit 
++\&can be used to obtain the static conductivity.
+ 
+ 
+ \&The flag \fB \-caf\fR is for the output of the current autocorrelation function and \fB \-mc\fR writes the
+ \&correlation of the rotational and translational part of the dipole moment in the corresponding
+-\&file. However this option is only available for trajectories containing velocities.
++\&file. However, this option is only available for trajectories containing velocities.
+ \&Options \fB \-sh\fR and \fB \-tr\fR are responsible for the averaging and integration of the
+ \&autocorrelation functions. Since averaging proceeds by shifting the starting point
+ \&through the trajectory, the shift can be modified with \fB \-sh\fR to enable the choice of uncorrelated
+@@ -64,10 +64,10 @@ g_current - calculate current autocorrelation function of system
+ 
+ 
+ \&\fB \-[no]nojump\fR unfolds the coordinates to allow free diffusion. This is required to get a continuous
+-\&translational dipole moment, required for the Einstein\-Helfand fit. The resuls from the fit allow to
+-\&determine the dielectric constant for system of charged molecules. However it is also possible to extract
++\&translational dipole moment, required for the Einstein\-Helfand fit. The results from the fit allow
++\&the determination of the dielectric constant for system of charged molecules. However, it is also possible to extract
+ \&the dielectric constant from the fluctuations of the total dipole moment in folded coordinates. But this
+-\&options has to be used with care, since only very short time spans fulfill the approximation, that the density
++\&option has to be used with care, since only very short time spans fulfill the approximation that the density
+ \&of the molecules is approximately constant and the averages are already converged. To be on the safe side,
+ \&the dielectric constant should be calculated with the help of the Einstein\-Helfand method for
+ \&the translational part of the dielectric constant.
+@@ -128,7 +128,7 @@ g_current - calculate current autocorrelation function of system
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -140,7 +140,7 @@ g_current - calculate current autocorrelation function of system
+  Removes jumps of atoms across the box.
+ 
+ .BI "\-eps"  " real" " 0     " 
+- Dielectric constant of the surrounding medium. eps=0.0 corresponds to eps=infinity (thinfoil boundary conditions).
++ Dielectric constant of the surrounding medium. eps=0.0 corresponds to eps=infinity (tin\-foil boundary conditions).
+ 
+ .BI "\-bfit"  " real" " 100   " 
+  Begin of the fit of the straight line to the MSD of the translational fraction of the dipole moment.
+diff --git a/man/man1/g_density.1 b/man/man1/g_density.1
+index e4334a3..ec2ac27 100644
+--- a/man/man1/g_density.1
++++ b/man/man1/g_density.1
+@@ -1,8 +1,8 @@
+-.TH g_density 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_density 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_density - calculates the density of the system
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_density\fP
+ .BI "\-f" " traj.xtc "
+@@ -25,17 +25,23 @@ g_density - calculates the density of the system
+ .BI "\-[no]symm" ""
+ .BI "\-[no]center" ""
+ .SH DESCRIPTION
+-\&Compute partial densities across the box, using an index file. Densities
+-\&in kg/m3, number densities or electron densities can be
++\&Compute partial densities across the box, using an index file.
++
++
++\&For the total density of NPT simulations, use \fB g_energy\fR instead.
++\&
++
++
++\&Densities are in kg/m3, and number densities or electron densities can also be
+ \&calculated. For electron densities, a file describing the number of
+ \&electrons for each type of atom should be provided using \fB \-ei\fR.
+ \&It should look like:
+ 
+-\&   2
++\&   \fB 2\fR
+ 
+-\&   atomname = nrelectrons
++\&   \fB atomname = nrelectrons\fR
+ 
+-\&   atomname = nrelectrons
++\&   \fB atomname = nrelectrons\fR
+ 
+ \&The first line contains the number of lines to read from the file.
+ \&There should be one line for each unique atom name in your system.
+@@ -82,7 +88,7 @@ g_density - calculates the density of the system
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_densmap.1 b/man/man1/g_densmap.1
+index 7683711..d2ba3ea 100644
+--- a/man/man1/g_densmap.1
++++ b/man/man1/g_densmap.1
+@@ -1,8 +1,8 @@
+-.TH g_densmap 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_densmap 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_densmap - calculates 2D planar or axial-radial density maps
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_densmap\fP
+ .BI "\-f" " traj.xtc "
+@@ -31,11 +31,11 @@ g_densmap - calculates 2D planar or axial-radial density maps
+ .BI "\-dmin" " real "
+ .BI "\-dmax" " real "
+ .SH DESCRIPTION
+-\&g_densmap computes 2D number\-density maps.
++\&\fB g_densmap\fR computes 2D number\-density maps.
+ \&It can make planar and axial\-radial density maps.
+ \&The output \fB .xpm\fR file can be visualized with for instance xv
+-\&and can be converted to postscript with xpm2ps.
+-\&Optionally, output can be in text form to a .dat file.
++\&and can be converted to postscript with \fB xpm2ps\fR.
++\&Optionally, output can be in text form to a \fB .dat\fR file with \fB \-od\fR, instead of the usual \fB .xpm\fR file with \fB \-o\fR.
+ \&
+ 
+ 
+@@ -110,7 +110,7 @@ g_densmap - calculates 2D planar or axial-radial density maps
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-bin"  " real" " 0.02  " 
+  Grid size (nm)
+diff --git a/man/man1/g_densorder.1 b/man/man1/g_densorder.1
+new file mode 100644
+index 0000000..af70bc4
+--- /dev/null
++++ b/man/man1/g_densorder.1
+@@ -0,0 +1,123 @@
++.TH g_densorder 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
++.SH NAME
++g_densorder - calculate surface fluctuations
++
++.B VERSION 4.5.4-dev-20110404-bc5695c
++.SH SYNOPSIS
++\f3g_densorder\fP
++.BI "\-s" " topol.tpr "
++.BI "\-f" " traj.xtc "
++.BI "\-n" " index.ndx "
++.BI "\-o" " Density4D.dat "
++.BI "\-or" " hello.out "
++.BI "\-og" " interface.xpm "
++.BI "\-Spect" " intfspect.out "
++.BI "\-[no]h" ""
++.BI "\-[no]version" ""
++.BI "\-nice" " int "
++.BI "\-b" " time "
++.BI "\-e" " time "
++.BI "\-dt" " time "
++.BI "\-[no]w" ""
++.BI "\-[no]1d" ""
++.BI "\-bw" " real "
++.BI "\-bwn" " real "
++.BI "\-order" " int "
++.BI "\-axis" " string "
++.BI "\-method" " enum "
++.BI "\-d1" " real "
++.BI "\-d2" " real "
++.BI "\-tblock" " int "
++.BI "\-nlevel" " int "
++.SH DESCRIPTION
++\&A small program to reduce a two\-phase density distribution
++\&along an axis, computed over a MD trajectory
++\&to 2D surfaces fluctuating in time, by a fit to
++\&a functional profile for interfacial densities
++\&A time\-averaged spatial representation of the
++\&interfaces can be output with the option \-tavg
++.SH FILES
++.BI "\-s" " topol.tpr" 
++.B Input
++ Run input file: tpr tpb tpa 
++
++.BI "\-f" " traj.xtc" 
++.B Input
++ Trajectory: xtc trr trj gro g96 pdb cpt 
++
++.BI "\-n" " index.ndx" 
++.B Input
++ Index file 
++
++.BI "\-o" " Density4D.dat" 
++.B Output, Opt.
++ Generic data file 
++
++.BI "\-or" " hello.out" 
++.B Output, Opt., Mult.
++ Generic output file 
++
++.BI "\-og" " interface.xpm" 
++.B Output, Opt., Mult.
++ X PixMap compatible matrix file 
++
++.BI "\-Spect" " intfspect.out" 
++.B Output, Opt., Mult.
++ Generic output file 
++
++.SH OTHER OPTIONS
++.BI "\-[no]h"  "no    "
++ Print help info and quit
++
++.BI "\-[no]version"  "no    "
++ Print version info and quit
++
++.BI "\-nice"  " int" " 0" 
++ Set the nicelevel
++
++.BI "\-b"  " time" " 0     " 
++ First frame (ps) to read from trajectory
++
++.BI "\-e"  " time" " 0     " 
++ Last frame (ps) to read from trajectory
++
++.BI "\-dt"  " time" " 0     " 
++ Only use frame when t MOD dt = first time (ps)
++
++.BI "\-[no]w"  "no    "
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
++
++.BI "\-[no]1d"  "no    "
++ Pseudo\-1d interface geometry
++
++.BI "\-bw"  " real" " 0.2   " 
++ Binwidth of density distribution tangential to interface
++
++.BI "\-bwn"  " real" " 0.05  " 
++ Binwidth of density distribution normal to interface
++
++.BI "\-order"  " int" " 0" 
++ Order of Gaussian filter, order 0 equates to NO filtering
++
++.BI "\-axis"  " string" " Z" 
++ Axis Direction \- X, Y or Z
++
++.BI "\-method"  " enum" " bisect" 
++ Interface location method: \fB bisect\fR or \fB functional\fR
++
++.BI "\-d1"  " real" " 0     " 
++ Bulk density phase 1 (at small z)
++
++.BI "\-d2"  " real" " 1000  " 
++ Bulk density phase 2 (at large z)
++
++.BI "\-tblock"  " int" " 100" 
++ Number of frames in one time\-block average
++
++.BI "\-nlevel"  " int" " 100" 
++ Number of Height levels in 2D \- XPixMaps
++
++.SH SEE ALSO
++.BR gromacs(7)
++
++More information about \fBGROMACS\fR is available at <\fIhttp://www.gromacs.org/\fR>.
+diff --git a/man/man1/g_dielectric.1 b/man/man1/g_dielectric.1
+index a10fee1..b14a35c 100644
+--- a/man/man1/g_dielectric.1
++++ b/man/man1/g_dielectric.1
+@@ -1,8 +1,8 @@
+-.TH g_dielectric 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_dielectric 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_dielectric - calculates frequency dependent dielectric constants
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_dielectric\fP
+ .BI "\-f" " dipcorr.xvg "
+@@ -32,19 +32,22 @@ g_dielectric - calculates frequency dependent dielectric constants
+ .BI "\-ffn" " enum "
+ .BI "\-nsmooth" " int "
+ .SH DESCRIPTION
+-\&dielectric calculates frequency dependent dielectric constants
++\&\fB g_dielectric\fR calculates frequency dependent dielectric constants
+ \&from the autocorrelation function of the total dipole moment in
+-\&your simulation. This ACF can be generated by g_dipoles.
++\&your simulation. This ACF can be generated by \fB g_dipoles\fR.
+ \&For an estimate of the error you can run g_statistics on the
+ \&ACF, and use the output thus generated for this program.
+ \&The functional forms of the available functions are:
+ 
+ 
+-\&One parameter  : y = Exp[\-a1 x],
+-\&Two parameters : y = a2 Exp[\-a1 x],
++\&One parameter:    y = Exp[\-a1 x],
++
++\&Two parameters:   y = a2 Exp[\-a1 x],
++
+ \&Three parameters: y = a2 Exp[\-a1 x] + (1 \- a2) Exp[\-a3 x].
++
+ \&Start values for the fit procedure can be given on the command line.
+-\&It is also possible to fix parameters at their start value, use \-fix
++\&It is also possible to fix parameters at their start value, use \fB \-fix\fR
+ \&with the number of the parameter you want to fix.
+ \&
+ 
+@@ -95,7 +98,7 @@ g_dielectric - calculates frequency dependent dielectric constants
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -104,10 +107,10 @@ g_dielectric - calculates frequency dependent dielectric constants
+  use fast fourier transform for correlation function
+ 
+ .BI "\-[no]x1"  "yes   "
+- use first column as X axis rather than first data set
++ use first column as \fI x\fR\-axis rather than first data set
+ 
+ .BI "\-eint"  " real" " 5     " 
+- Time were to end the integration of the data and start to use the fit
++ Time to end the integration of the data and start to use the fit
+ 
+ .BI "\-bfit"  " real" " 5     " 
+  Begin time of fit
+@@ -128,16 +131,16 @@ g_dielectric - calculates frequency dependent dielectric constants
+  Start value for fit parameter tau2
+ 
+ .BI "\-eps0"  " real" " 80    " 
+- Epsilon 0 of your liquid
++ epsilon0 of your liquid
+ 
+ .BI "\-epsRF"  " real" " 78.5  " 
+- Epsilon of the reaction field used in your simulation. A value of 0 means infinity.
++ epsilon of the reaction field used in your simulation. A value of 0 means infinity.
+ 
+ .BI "\-fix"  " int" " 0" 
+  Fix parameters at their start values, A (2), tau1 (1), or tau2 (4)
+ 
+ .BI "\-ffn"  " enum" " none" 
+- Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR or \fB exp9\fR
++ Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR, \fB exp9\fR or \fB erffit\fR
+ 
+ .BI "\-nsmooth"  " int" " 3" 
+  Number of points for smoothing
+diff --git a/man/man1/g_dih.1 b/man/man1/g_dih.1
+index aa6624a..7ab738a 100644
+--- a/man/man1/g_dih.1
++++ b/man/man1/g_dih.1
+@@ -1,8 +1,8 @@
+-.TH g_dih 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_dih 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_dih - analyzes dihedral transitions
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_dih\fP
+ .BI "\-f" " traj.xtc "
+@@ -18,7 +18,7 @@ g_dih - analyzes dihedral transitions
+ .BI "\-[no]sa" ""
+ .BI "\-mult" " int "
+ .SH DESCRIPTION
+-\&g_dih can do two things. The default is to analyze dihedral transitions
++\&\fB g_dih\fR can do two things. The default is to analyze dihedral transitions
+ \&by merely computing all the dihedral angles defined in your topology
+ \&for the whole trajectory. When a dihedral flips over to another minimum
+ \&an angle/time plot is made.
+@@ -61,7 +61,7 @@ g_dih - analyzes dihedral transitions
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-[no]sa"  "no    "
+  Perform cluster analysis in dihedral space instead of analysing dihedral transitions.
+diff --git a/man/man1/g_dipoles.1 b/man/man1/g_dipoles.1
+index ea960c9..3e0721f 100644
+--- a/man/man1/g_dipoles.1
++++ b/man/man1/g_dipoles.1
+@@ -1,8 +1,8 @@
+-.TH g_dipoles 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_dipoles 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_dipoles - computes the total dipole plus fluctuations
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_dipoles\fP
+ .BI "\-en" " ener.edr "
+@@ -53,24 +53,24 @@ g_dipoles - computes the total dipole plus fluctuations
+ .BI "\-beginfit" " real "
+ .BI "\-endfit" " real "
+ .SH DESCRIPTION
+-\&g_dipoles computes the total dipole plus fluctuations of a simulation
++\&\fB g_dipoles\fR computes the total dipole plus fluctuations of a simulation
+ \&system. From this you can compute e.g. the dielectric constant for
+-\&low dielectric media.
++\&low\-dielectric media.
+ \&For molecules with a net charge, the net charge is subtracted at
+ \&center of mass of the molecule.
+ 
+ 
+-\&The file Mtot.xvg contains the total dipole moment of a frame, the
++\&The file \fB Mtot.xvg\fR contains the total dipole moment of a frame, the
+ \&components as well as the norm of the vector.
+-\&The file aver.xvg contains  |Mu|2  and | Mu |2 during the
++\&The file \fB aver.xvg\fR contains  |Mu|2  and | Mu |2 during the
+ \&simulation.
+-\&The file dipdist.xvg contains the distribution of dipole moments during
++\&The file \fB dipdist.xvg\fR contains the distribution of dipole moments during
+ \&the simulation
+-\&The mu_max is used as the highest value in the distribution graph.
++\&The value of \fB \-mumax\fR is used as the highest value in the distribution graph.
+ 
+ 
+-\&Furthermore the dipole autocorrelation function will be computed when
+-\&option \-corr is used. The output file name is given with the \fB \-c\fR
++\&Furthermore, the dipole autocorrelation function will be computed when
++\&option \fB \-corr\fR is used. The output file name is given with the \fB \-c\fR
+ \&option.
+ \&The correlation functions can be averaged over all molecules
+ \&(\fB mol\fR), plotted per molecule separately (\fB molsep\fR)
+@@ -81,7 +81,7 @@ g_dipoles - computes the total dipole plus fluctuations
+ \&Option \fB \-g\fR produces a plot of the distance dependent Kirkwood
+ \&G\-factor, as well as the average cosine of the angle between the dipoles
+ \&as a function of the distance. The plot also includes gOO and hOO
+-\&according to Nymand & Linse, JCP 112 (2000) pp 6386\-6395. In the same plot
++\&according to Nymand & Linse, J. Chem. Phys. 112 (2000) pp 6386\-6395. In the same plot, 
+ \&we also include the energy per scale computed by taking the inner product of
+ \&the dipoles divided by the distance to the third power.
+ 
+@@ -92,13 +92,13 @@ g_dipoles - computes the total dipole plus fluctuations
+ \&EXAMPLES
+ 
+ 
+-\&g_dipoles \-corr mol \-P1 \-o dip_sqr \-mu 2.273 \-mumax 5.0 \-nofft
++\&\fB g_dipoles \-corr mol \-P1 \-o dip_sqr \-mu 2.273 \-mumax 5.0 \-nofft\fR
+ 
+ 
+ \&This will calculate the autocorrelation function of the molecular
+ \&dipoles using a first order Legendre polynomial of the angle of the
+ \&dipole vector and itself a time t later. For this calculation 1001
+-\&frames will be used. Further the dielectric constant will be calculated
++\&frames will be used. Further, the dielectric constant will be calculated
+ \&using an epsilonRF of infinity (default), temperature of 300 K (default) and
+ \&an average dipole moment of the molecule of 2.273 (SPC). For the
+ \&distribution function a maximum of 5.0 will be used.
+@@ -187,7 +187,7 @@ g_dipoles - computes the total dipole plus fluctuations
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -214,7 +214,7 @@ g_dipoles - computes the total dipole plus fluctuations
+  Calculate |cos theta| between all pairs of molecules. May be slow
+ 
+ .BI "\-ncos"  " int" " 1" 
+- Must be 1 or 2. Determines whether the cos is computed between all mole cules in one group, or between molecules in two different groups. This turns on the \-gkr flag.
++ Must be 1 or 2. Determines whether the cos is computed between all molecules in one group, or between molecules in two different groups. This turns on the \fB \-gkr\fR flag.
+ 
+ .BI "\-axis"  " string" " Z" 
+  Take the normal on the computational box in direction X, Y or Z.
+@@ -229,16 +229,16 @@ g_dipoles - computes the total dipole plus fluctuations
+  Same as previous option in case ncos = 2, i.e. dipole interaction between two groups of molecules
+ 
+ .BI "\-rcmax"  " real" " 0     " 
+- Maximum distance to use in the dipole orientation distribution (with ncos == 2). If zero, a criterium based on the box length will be used.
++ Maximum distance to use in the dipole orientation distribution (with ncos == 2). If zero, a criterion based on the box length will be used.
+ 
+ .BI "\-[no]phi"  "no    "
+- Plot the 'torsion angle' defined as the rotation of the two dipole vectors around the distance vector between the two molecules in the xpm file from the \-cmap option. By default the cosine of the angle between the dipoles is plotted.
++ Plot the 'torsion angle' defined as the rotation of the two dipole vectors around the distance vector between the two molecules in the \fB .xpm\fR file from the \fB \-cmap\fR option. By default the cosine of the angle between the dipoles is plotted.
+ 
+ .BI "\-nlevels"  " int" " 20" 
+  Number of colors in the cmap output
+ 
+ .BI "\-ndegrees"  " int" " 90" 
+- Number of divisions on the y\-axis in the camp output (for 180 degrees)
++ Number of divisions on the \fI y\fR\-axis in the cmap output (for 180 degrees)
+ 
+ .BI "\-acflen"  " int" " \-1" 
+  Length of the ACF, default is half the number of frames
+@@ -250,7 +250,7 @@ g_dipoles - computes the total dipole plus fluctuations
+  Order of Legendre polynomial for ACF (0 indicates none): \fB 0\fR, \fB 1\fR, \fB 2\fR or \fB 3\fR
+ 
+ .BI "\-fitfn"  " enum" " none" 
+- Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR or \fB exp9\fR
++ Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR, \fB exp9\fR or \fB erffit\fR
+ 
+ .BI "\-ncskip"  " int" " 0" 
+  Skip N points in the output file of correlation functions
+diff --git a/man/man1/g_disre.1 b/man/man1/g_disre.1
+index 820456e..c384783 100644
+--- a/man/man1/g_disre.1
++++ b/man/man1/g_disre.1
+@@ -1,8 +1,8 @@
+-.TH g_disre 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_disre 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_disre - analyzes distance restraints
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_disre\fP
+ .BI "\-s" " topol.tpr "
+@@ -30,9 +30,9 @@ g_disre - analyzes distance restraints
+ .BI "\-nlevels" " int "
+ .BI "\-[no]third" ""
+ .SH DESCRIPTION
+-\&g_disre computes violations of distance restraints.
+-\&If necessary all protons can be added to a protein molecule 
+-\&using the protonate program.
++\&\fB g_disre\fR computes violations of distance restraints.
++\&If necessary, all protons can be added to a protein molecule 
++\&using the \fB g_protonate\fR program.
+ 
+ 
+ \&The program always
+@@ -46,7 +46,7 @@ g_disre - analyzes distance restraints
+ \&printing.
+ 
+ 
+-\&When the optional\fB \-q\fR flag is given a pdb file coloured by the
++\&When the optional \fB \-q\fR flag is given a \fB .pdb\fR file coloured by the
+ \&amount of average violations.
+ 
+ 
+@@ -124,7 +124,7 @@ g_disre - analyzes distance restraints
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_dist.1 b/man/man1/g_dist.1
+index f39ad40..eb14147 100644
+--- a/man/man1/g_dist.1
++++ b/man/man1/g_dist.1
+@@ -1,8 +1,8 @@
+-.TH g_dist 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_dist 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_dist - calculates the distances between the centers of mass of two groups
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_dist\fP
+ .BI "\-f" " traj.xtc "
+@@ -19,9 +19,9 @@ g_dist - calculates the distances between the centers of mass of two groups
+ .BI "\-xvg" " enum "
+ .BI "\-dist" " real "
+ .SH DESCRIPTION
+-\&g_dist can calculate the distance between the centers of mass of two
++\&\fB g_dist\fR can calculate the distance between the centers of mass of two
+ \&groups of atoms as a function of time. The total distance and its
+-\&x, y and z components are plotted.
++\&\fI x\fR\-, \fI y\fR\-, and \fI z\fR\-components are plotted.
+ 
+ 
+ \&Or when \fB \-dist\fR is set, print all the atoms in group 2 that are
+diff --git a/man/man1/g_dyndom.1 b/man/man1/g_dyndom.1
+index 1b0668c..e66b5b2 100644
+--- a/man/man1/g_dyndom.1
++++ b/man/man1/g_dyndom.1
+@@ -1,8 +1,8 @@
+-.TH g_dyndom 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_dyndom 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_dyndom - interpolate and extrapolate structure rotations
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_dyndom\fP
+ .BI "\-f" " dyndom.pdb "
+@@ -19,11 +19,11 @@ g_dyndom - interpolate and extrapolate structure rotations
+ .BI "\-head" " vector "
+ .BI "\-tail" " vector "
+ .SH DESCRIPTION
+-\&g_dyndom reads a pdb file output from DynDom
+-\&http://www.cmp.uea.ac.uk/dyndom/
+-\&It reads the coordinates, and the coordinates of the rotation axis
+-\&furthermore it reads an index file containing the domains.
+-\&Furthermore it takes the first and last atom of the arrow file
++\&\fB g_dyndom\fR reads a \fB .pdb\fR file output from DynDom
++\&(http://www.cmp.uea.ac.uk/dyndom/).
++\&It reads the coordinates, the coordinates of the rotation axis,
++\&and an index file containing the domains.
++\&Furthermore, it takes the first and last atom of the arrow file
+ \&as command line arguments (head and tail) and
+ \&finally it takes the translation vector (given in DynDom info file)
+ \&and the angle of rotation (also as command line arguments). If the angle
+@@ -75,7 +75,7 @@ g_dyndom - interpolate and extrapolate structure rotations
+  DymDom dtermined angle of rotation about rotation vector
+ 
+ .BI "\-trans"  " real" " 0     " 
+- Translation (Aangstroem) along rotation vector (see DynDom info file)
++ Translation (Angstrom) along rotation vector (see DynDom info file)
+ 
+ .BI "\-head"  " vector" " 0 0 0" 
+  First atom of the arrow vector
+diff --git a/man/man1/g_enemat.1 b/man/man1/g_enemat.1
+index 2d03501..0243604 100644
+--- a/man/man1/g_enemat.1
++++ b/man/man1/g_enemat.1
+@@ -1,8 +1,8 @@
+-.TH g_enemat 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_enemat 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_enemat - extracts an energy matrix from an energy file
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_enemat\fP
+ .BI "\-f" " ener.edr "
+@@ -35,12 +35,12 @@ g_enemat - extracts an energy matrix from an energy file
+ .BI "\-[no]free" ""
+ .BI "\-temp" " real "
+ .SH DESCRIPTION
+-\&g_enemat extracts an energy matrix from the energy file (\fB \-f\fR).
++\&\fB g_enemat\fR extracts an energy matrix from the energy file (\fB \-f\fR).
+ \&With \fB \-groups\fR a file must be supplied with on each
+ \&line a group of atoms to be used. For these groups matrix of
+ \&interaction energies will be extracted from the energy file
+ \&by looking for energy groups with names corresponding to pairs
+-\&of groups of atoms. E.g. if your \fB \-groups\fR file contains:
++\&of groups of atoms, e.g. if your \fB \-groups\fR file contains:
+ 
+ \&\fB 2\fR
+ 
+@@ -110,7 +110,7 @@ g_enemat - extracts an energy matrix from an energy file
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -122,7 +122,7 @@ g_enemat - extracts an energy matrix from an energy file
+  Skip number of frames between data points
+ 
+ .BI "\-[no]mean"  "yes   "
+- with \-groups extracts matrix of mean energies instead of matrix for each timestep
++ with \fB \-groups\fR extracts matrix of mean energies instead of matrix for each timestep
+ 
+ .BI "\-nlevels"  " int" " 20" 
+  number of levels for matrix colors
+diff --git a/man/man1/g_energy.1 b/man/man1/g_energy.1
+index dcec1de..3d05b1b 100644
+--- a/man/man1/g_energy.1
++++ b/man/man1/g_energy.1
+@@ -1,8 +1,8 @@
+-.TH g_energy 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_energy 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_energy - writes energies to xvg files and displays averages
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_energy\fP
+ .BI "\-f" " ener.edr "
+@@ -20,6 +20,7 @@ g_energy - writes energies to xvg files and displays averages
+ .BI "\-corr" " enecorr.xvg "
+ .BI "\-vis" " visco.xvg "
+ .BI "\-ravg" " runavgdf.xvg "
++.BI "\-odh" " dhdl.xvg "
+ .BI "\-[no]h" ""
+ .BI "\-[no]version" ""
+ .BI "\-nice" " int "
+@@ -38,7 +39,6 @@ g_energy - writes energies to xvg files and displays averages
+ .BI "\-skip" " int "
+ .BI "\-[no]aver" ""
+ .BI "\-nmol" " int "
+-.BI "\-nconstr" " int "
+ .BI "\-[no]fluc" ""
+ .BI "\-[no]orinst" ""
+ .BI "\-[no]ovec" ""
+@@ -50,56 +50,28 @@ g_energy - writes energies to xvg files and displays averages
+ .BI "\-beginfit" " real "
+ .BI "\-endfit" " real "
+ .SH DESCRIPTION
+-\&g_energy extracts energy components or distance restraint
++\&\fB g_energy\fR extracts energy components or distance restraint
+ \&data from an energy file. The user is prompted to interactively
+-\&select the energy terms she wants.
++\&select the desired energy terms.
+ 
+ 
+-\&Average, RMSD and drift are calculated with full precision from the
++\&Average, RMSD, and drift are calculated with full precision from the
+ \&simulation (see printed manual). Drift is calculated by performing
+-\&a LSQ fit of the data to a straight line. The reported total drift
++\&a least\-squares fit of the data to a straight line. The reported total drift
+ \&is the difference of the fit at the first and last point.
+ \&An error estimate of the average is given based on a block averages
+-\&over 5 blocks using the full precision averages. The error estimate
++\&over 5 blocks using the full\-precision averages. The error estimate
+ \&can be performed over multiple block lengths with the options
+ \&\fB \-nbmin\fR and \fB \-nbmax\fR.
+-\&Note that in most cases the energy files contains averages over all
++\&\fB Note\fR that in most cases the energy files contains averages over all
+ \&MD steps, or over many more points than the number of frames in
+-\&energy file. This makes the g_energy statistics output more accurate
+-\&than the xvg output. When exact averages are not present in the energy
+-\&file the statistics mentioned above is simply over the single, per\-frame
++\&energy file. This makes the \fB g_energy\fR statistics output more accurate
++\&than the \fB .xvg\fR output. When exact averages are not present in the energy
++\&file, the statistics mentioned above are simply over the single, per\-frame
+ \&energy values.
+ 
+ 
+-\&The term fluctuation gives the RMSD around the LSQ fit.
+-
+-
+-\&Some fluctuation\-dependent properties can be calculated provided
+-\&the correct energy terms are selected. The following properties
+-\&will be computed:
+-
+-\&Property                        Energy terms needed
+-
+-\&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
+-
+-\&Heat capacity Cp (NPT sims):    Enthalpy, Temp     
+-
+-\&Heat capacity Cv (NVT sims):    Etot, Temp         
+-
+-\&Thermal expansion coeff. (NPT): Enthalpy, Vol, Temp
+-
+-\&Isothermal compressibility:     Vol, Temp          
+-
+-\&Adiabatic bulk modulus:         Vol, Temp          
+-
+-\&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
+-
+-\&You always need to set the number of molecules \fB \-nmol\fR, and,
+-\&if you used constraints in your simulations you will need to give
+-\&the number of constraints per molecule \fB \-nconstr\fR in order to
+-\&correct for this: (nconstr/2) kB is subtracted from the heat
+-\&capacity in this case. For instance in the case of rigid water
+-\&you need to give the value 3 to this option.
++\&The term fluctuation gives the RMSD around the least\-squares fit.
+ 
+ 
+ \&When the \fB \-viol\fR option is set, the time averaged
+@@ -129,6 +101,11 @@ g_energy - writes energies to xvg files and displays averages
+ \&\fB \-ovec\fR also the eigenvectors are plotted.
+ 
+ 
++\&Option \fB \-odh\fR extracts and plots the free energy data
++\&(Hamiltoian differences and/or the Hamiltonian derivative dhdl)
++\&from the \fB ener.edr\fR file.
++
++
+ \&With \fB \-fee\fR an estimate is calculated for the free\-energy
+ \&difference with an ideal gas state: 
+ 
+@@ -152,8 +129,9 @@ g_energy - writes energies to xvg files and displays averages
+ \&When a second energy file is specified (\fB \-f2\fR), a free energy
+ \&difference is calculated dF = \-kT ln  e  \-(EB\-EA)/kT A ,
+ \&where EA and EB are the energies from the first and second energy
+-\&files, and the average is over the ensemble A. \fB NOTE\fR that
+-\&the energies must both be calculated from the same trajectory.
++\&files, and the average is over the ensemble A. The running average
++\&of the free energy difference is printed to a file specified by \fB \-ravg\fR.
++\&\fB Note\fR that the energies must both be calculated from the same trajectory.
+ .SH FILES
+ .BI "\-f" " ener.edr" 
+ .B Input
+@@ -215,6 +193,10 @@ g_energy - writes energies to xvg files and displays averages
+ .B Output, Opt.
+  xvgr/xmgr file 
+ 
++.BI "\-odh" " dhdl.xvg" 
++.B Output, Opt.
++ xvgr/xmgr file 
++
+ .SH OTHER OPTIONS
+ .BI "\-[no]h"  "no    "
+  Print help info and quit
+@@ -232,7 +214,7 @@ g_energy - writes energies to xvg files and displays averages
+  Last frame (ps) to read from trajectory
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -270,9 +252,6 @@ g_energy - writes energies to xvg files and displays averages
+ .BI "\-nmol"  " int" " 1" 
+  Number of molecules in your sample: the energies are divided by this number
+ 
+-.BI "\-nconstr"  " int" " 0" 
+- Number of constraints per molecule. Necessary for calculating the heat capacity
+-
+ .BI "\-[no]fluc"  "no    "
+  Calculate autocorrelation of energy fluctuations rather than energy itself
+ 
+@@ -280,7 +259,7 @@ g_energy - writes energies to xvg files and displays averages
+  Analyse instantaneous orientation data
+ 
+ .BI "\-[no]ovec"  "no    "
+- Also plot the eigenvectors with \-oten
++ Also plot the eigenvectors with \fB \-oten\fR
+ 
+ .BI "\-acflen"  " int" " \-1" 
+  Length of the ACF, default is half the number of frames
+@@ -292,7 +271,7 @@ g_energy - writes energies to xvg files and displays averages
+  Order of Legendre polynomial for ACF (0 indicates none): \fB 0\fR, \fB 1\fR, \fB 2\fR or \fB 3\fR
+ 
+ .BI "\-fitfn"  " enum" " none" 
+- Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR or \fB exp9\fR
++ Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR, \fB exp9\fR or \fB erffit\fR
+ 
+ .BI "\-ncskip"  " int" " 0" 
+  Skip N points in the output file of correlation functions
+diff --git a/man/man1/g_filter.1 b/man/man1/g_filter.1
+index 02ebe01..1945b9f 100644
+--- a/man/man1/g_filter.1
++++ b/man/man1/g_filter.1
+@@ -1,8 +1,8 @@
+-.TH g_filter 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_filter 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_filter - frequency filters trajectories, useful for making smooth movies
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_filter\fP
+ .BI "\-f" " traj.xtc "
+@@ -22,7 +22,7 @@ g_filter - frequency filters trajectories, useful for making smooth movies
+ .BI "\-[no]nojump" ""
+ .BI "\-[no]fit" ""
+ .SH DESCRIPTION
+-\&g_filter performs frequency filtering on a trajectory.
++\&\fB g_filter\fR performs frequency filtering on a trajectory.
+ \&The filter shape is cos(pi t/A) + 1 from \-A to +A, where A is given
+ \&by the option \fB \-nf\fR times the time step in the input trajectory.
+ \&This filter reduces fluctuations with period A by 85%, with period
+@@ -31,7 +31,7 @@ g_filter - frequency filters trajectories, useful for making smooth movies
+ 
+ 
+ \&Option \fB \-ol\fR writes a low\-pass filtered trajectory.
+-\&A frame is written every \fB nf\fR input frames.
++\&A frame is written every \fB \-nf\fR input frames.
+ \&This ratio of filter length and output interval ensures a good
+ \&suppression of aliasing of high\-frequency motion, which is useful for
+ \&making smooth movies. Also averages of properties which are linear
+@@ -43,7 +43,7 @@ g_filter - frequency filters trajectories, useful for making smooth movies
+ \&Option \fB \-oh\fR writes a high\-pass filtered trajectory.
+ \&The high\-pass filtered coordinates are added to the coordinates
+ \&from the structure file. When using high\-pass filtering use \fB \-fit\fR
+-\&or make sure you use a trajectory which has been fitted on
++\&or make sure you use a trajectory that has been fitted on
+ \&the coordinates in the structure file.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+@@ -86,7 +86,7 @@ g_filter - frequency filters trajectories, useful for making smooth movies
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-nf"  " int" " 10" 
+  Sets the filter length as well as the output interval for low\-pass filtering
+diff --git a/man/man1/g_gyrate.1 b/man/man1/g_gyrate.1
+index 20dbf17..bc10125 100644
+--- a/man/man1/g_gyrate.1
++++ b/man/man1/g_gyrate.1
+@@ -1,8 +1,8 @@
+-.TH g_gyrate 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_gyrate 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_gyrate - calculates the radius of gyration
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_gyrate\fP
+ .BI "\-f" " traj.xtc "
+@@ -31,8 +31,8 @@ g_gyrate - calculates the radius of gyration
+ .BI "\-beginfit" " real "
+ .BI "\-endfit" " real "
+ .SH DESCRIPTION
+-\&g_gyrate computes the radius of gyration of a group of atoms
+-\&and the radii of gyration about the x, y and z axes,
++\&\fB g_gyrate\fR computes the radius of gyration of a group of atoms
++\&and the radii of gyration about the \fI x\fR\-, \fI y\fR\- and \fI z\fR\-axes,
+ \&as a function of time. The atoms are explicitly mass weighted.
+ 
+ 
+@@ -41,8 +41,8 @@ g_gyrate - calculates the radius of gyration
+ \&sized parts.
+ 
+ 
+-\&With the option \fB \-nz\fR 2D radii of gyration in the x\-y plane
+-\&of slices along the z\-axis are calculated.
++\&With the option \fB \-nz\fR 2D radii of gyration in the \fI x\-y\fR plane
++\&of slices along the \fI z\fR\-axis are calculated.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+ .B Input
+@@ -84,7 +84,7 @@ g_gyrate - calculates the radius of gyration
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -114,7 +114,7 @@ g_gyrate - calculates the radius of gyration
+  Order of Legendre polynomial for ACF (0 indicates none): \fB 0\fR, \fB 1\fR, \fB 2\fR or \fB 3\fR
+ 
+ .BI "\-fitfn"  " enum" " none" 
+- Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR or \fB exp9\fR
++ Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR, \fB exp9\fR or \fB erffit\fR
+ 
+ .BI "\-ncskip"  " int" " 0" 
+  Skip N points in the output file of correlation functions
+diff --git a/man/man1/g_h2order.1 b/man/man1/g_h2order.1
+index 2349dae..e3f2820 100644
+--- a/man/man1/g_h2order.1
++++ b/man/man1/g_h2order.1
+@@ -1,8 +1,8 @@
+-.TH g_h2order 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_h2order 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_h2order - computes the orientation of water molecules
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_h2order\fP
+ .BI "\-f" " traj.xtc "
+@@ -21,12 +21,12 @@ g_h2order - computes the orientation of water molecules
+ .BI "\-d" " string "
+ .BI "\-sl" " int "
+ .SH DESCRIPTION
+-\&Compute the orientation of water molecules with respect to the normal
++\&\fB g_h2order\fR computes the orientation of water molecules with respect to the normal
+ \&of the box. The program determines the average cosine of the angle
+-\&between de dipole moment of water and an axis of the box. The box is
++\&between the dipole moment of water and an axis of the box. The box is
+ \&divided in slices and the average orientation per slice is printed.
+ \&Each water molecule is assigned to a slice, per time frame, based on the
+-\&position of the oxygen. When \-nm  is used the angle between the water
++\&position of the oxygen. When \fB \-nm\fR is used, the angle between the water
+ \&dipole and the axis from the center of mass to the oxygen is calculated
+ \&instead of the angle between the dipole and a box axis.
+ .SH FILES
+@@ -70,7 +70,7 @@ g_h2order - computes the orientation of water molecules
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -82,7 +82,7 @@ g_h2order - computes the orientation of water molecules
+  Calculate order parameter as function of boxlength, dividing the box in nr slices.
+ 
+ .SH KNOWN PROBLEMS
+-\- The program assigns whole water molecules to a slice, based on the firstatom of three in the index file group. It assumes an order O,H,H.Name is not important, but the order is. If this demand is not met,assigning molecules to slices is different.
++\- The program assigns whole water molecules to a slice, based on the first atom of three in the index file group. It assumes an order O,H,H. Name is not important, but the order is. If this demand is not met, assigning molecules to slices is different.
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/g_hbond.1 b/man/man1/g_hbond.1
+index 049b54d..9d2e3eb 100644
+--- a/man/man1/g_hbond.1
++++ b/man/man1/g_hbond.1
+@@ -1,8 +1,8 @@
+-.TH g_hbond 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_hbond 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_hbond - computes and analyzes hydrogen bonds
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_hbond\fP
+ .BI "\-f" " traj.xtc "
+@@ -26,6 +26,7 @@ g_hbond - computes and analyzes hydrogen bonds
+ .BI "\-b" " time "
+ .BI "\-e" " time "
+ .BI "\-dt" " time "
++.BI "\-tu" " enum "
+ .BI "\-xvg" " enum "
+ .BI "\-a" " real "
+ .BI "\-r" " real "
+@@ -53,7 +54,7 @@ g_hbond - computes and analyzes hydrogen bonds
+ .BI "\-beginfit" " real "
+ .BI "\-endfit" " real "
+ .SH DESCRIPTION
+-\&g_hbond computes and analyzes hydrogen bonds. Hydrogen bonds are
++\&\fB g_hbond\fR computes and analyzes hydrogen bonds. Hydrogen bonds are
+ \&determined based on cutoffs for the angle Acceptor \- Donor \- Hydrogen
+ \&(zero is extended) and the distance Hydrogen \- Acceptor.
+ \&OH and NH groups are regarded as donors, O is an acceptor always,
+@@ -67,7 +68,7 @@ g_hbond - computes and analyzes hydrogen bonds
+ \&groups are analyzed.
+ 
+ 
+-\&If you set \-shell, you will be asked for an additional index group
++\&If you set \fB \-shell\fR, you will be asked for an additional index group
+ \&which should contain exactly one atom. In this case, only hydrogen
+ \&bonds between atoms within the shell distance from the one atom are
+ \&considered.
+@@ -205,6 +206,9 @@ g_hbond - computes and analyzes hydrogen bonds
+ .BI "\-dt"  " time" " 0     " 
+  Only use frame when t MOD dt = first time (ps)
+ 
++.BI "\-tu"  " enum" " ps" 
++ Time unit: \fB fs\fR, \fB ps\fR, \fB ns\fR, \fB us\fR, \fB ms\fR or \fB s\fR
++
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+ 
+@@ -218,7 +222,7 @@ g_hbond - computes and analyzes hydrogen bonds
+  Use distance Donor\-Acceptor (if TRUE) or Hydrogen\-Acceptor (FALSE)
+ 
+ .BI "\-r2"  " real" " 0     " 
+- Second cutoff radius. Mainly useful with \-contact and \-ac
++ Second cutoff radius. Mainly useful with \fB \-contact\fR and \fB \-ac\fR
+ 
+ .BI "\-abin"  " real" " 1     " 
+  Binwidth angle distribution (degrees)
+@@ -236,10 +240,10 @@ g_hbond - computes and analyzes hydrogen bonds
+  when  0, only calculate hydrogen bonds within  nm shell around one particle
+ 
+ .BI "\-fitstart"  " real" " 1     " 
+- Time (ps) from which to start fitting the correlation functions in order to obtain the forward and backward rate constants for HB breaking and formation. With \-gemfit we suggest \-fitstart 0
++ Time (ps) from which to start fitting the correlation functions in order to obtain the forward and backward rate constants for HB breaking and formation. With \fB \-gemfit\fR we suggest \fB \-fitstart 0\fR
+ 
+ .BI "\-fitstart"  " real" " 1     " 
+- Time (ps) to which to stop fitting the correlation functions in order to obtain the forward and backward rate constants for HB breaking and formation (only with \-gemfit)
++ Time (ps) to which to stop fitting the correlation functions in order to obtain the forward and backward rate constants for HB breaking and formation (only with \fB \-gemfit\fR)
+ 
+ .BI "\-temp"  " real" " 298.15" 
+  Temperature (K) for computing the Gibbs energy corresponding to HB breaking and reforming
+@@ -248,7 +252,7 @@ g_hbond - computes and analyzes hydrogen bonds
+  If = 0, the tail of the ACF will be smoothed by fitting it to an exponential function: y = A exp(\-x/tau)
+ 
+ .BI "\-dump"  " int" " 0" 
+- Dump the first N hydrogen bond ACFs in a single xvg file for debugging
++ Dump the first N hydrogen bond ACFs in a single \fB .xvg\fR file for debugging
+ 
+ .BI "\-max_hb"  " real" " 0     " 
+  Theoretical maximum number of hydrogen bonds used for normalizing HB autocorrelation function. Can be useful in case the program estimates it wrongly
+@@ -260,7 +264,7 @@ g_hbond - computes and analyzes hydrogen bonds
+  Use reversible geminate recombination for the kinetics/thermodynamics calclations. See Markovitch et al., J. Chem. Phys 129, 084505 (2008) for details.: \fB none\fR, \fB dd\fR, \fB ad\fR, \fB aa\fR or \fB a4\fR
+ 
+ .BI "\-diff"  " real" " \-1    " 
+- Dffusion coefficient to use in the rev. gem. recomb. kinetic model. If non\-positive, then it will be fitted to the ACF along with ka and kd.
++ Dffusion coefficient to use in the reversible geminate recombination kinetic model. If negative, then it will be fitted to the ACF along with ka and kd.
+ 
+ .BI "\-acflen"  " int" " \-1" 
+  Length of the ACF, default is half the number of frames
+@@ -272,7 +276,7 @@ g_hbond - computes and analyzes hydrogen bonds
+  Order of Legendre polynomial for ACF (0 indicates none): \fB 0\fR, \fB 1\fR, \fB 2\fR or \fB 3\fR
+ 
+ .BI "\-fitfn"  " enum" " none" 
+- Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR or \fB exp9\fR
++ Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR, \fB exp9\fR or \fB erffit\fR
+ 
+ .BI "\-ncskip"  " int" " 0" 
+  Skip N points in the output file of correlation functions
+diff --git a/man/man1/g_helix.1 b/man/man1/g_helix.1
+index cfdd05e..0151fc0 100644
+--- a/man/man1/g_helix.1
++++ b/man/man1/g_helix.1
+@@ -1,8 +1,8 @@
+-.TH g_helix 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_helix 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_helix - calculates basic properties of alpha helices
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_helix\fP
+ .BI "\-s" " topol.tpr "
+@@ -27,46 +27,46 @@ g_helix - calculates basic properties of alpha helices
+ .BI "\-ahxstart" " int "
+ .BI "\-ahxend" " int "
+ .SH DESCRIPTION
+-\&g_helix computes all kind of helix properties. First, the peptide
+-\&is checked to find the longest helical part. This is determined by
+-\&Hydrogen bonds and Phi/Psi angles.
++\&\fB g_helix\fR computes all kinds of helix properties. First, the peptide
++\&is checked to find the longest helical part, as determined by
++\&hydrogen bonds and phi/psi angles.
+ \&That bit is fitted
+-\&to an ideal helix around the Z\-axis and centered around the origin.
++\&to an ideal helix around the \fI z\fR\-axis and centered around the origin.
+ \&Then the following properties are computed:
+ 
+ 
+-\&\fB 1.\fR Helix radius (file radius.xvg). This is merely the
++\&\fB 1.\fR Helix radius (file \fB radius.xvg\fR). This is merely the
+ \&RMS deviation in two dimensions for all Calpha atoms.
+ \&it is calced as sqrt((SUM i(x2(i)+y2(i)))/N), where N is the number
+ \&of backbone atoms. For an ideal helix the radius is 0.23 nm
+ 
+-\&\fB 2.\fR Twist (file twist.xvg). The average helical angle per
+-\&residue is calculated. For alpha helix it is 100 degrees,
+-\&for 3\-10 helices it will be smaller,
++\&\fB 2.\fR Twist (file \fB twist.xvg\fR). The average helical angle per
++\&residue is calculated. For an alpha\-helix it is 100 degrees,
++\&for 3\-10 helices it will be smaller, and 
+ \&for 5\-helices it will be larger.
+ 
+-\&\fB 3.\fR Rise per residue (file rise.xvg). The helical rise per
+-\&residue is plotted as the difference in Z\-coordinate between Ca
+-\&atoms. For an ideal helix this is 0.15 nm
++\&\fB 3.\fR Rise per residue (file \fB rise.xvg\fR). The helical rise per
++\&residue is plotted as the difference in \fI z\fR\-coordinate between Calpha
++\&atoms. For an ideal helix, this is 0.15 nm
+ 
+-\&\fB 4.\fR Total helix length (file len\-ahx.xvg). The total length
++\&\fB 4.\fR Total helix length (file \fB len\-ahx.xvg\fR). The total length
+ \&of the
+ \&helix in nm. This is simply the average rise (see above) times the
+ \&number of helical residues (see below).
+ 
+-\&\fB 5.\fR Number of helical residues (file n\-ahx.xvg). The title says
++\&\fB 5.\fR Number of helical residues (file \fB n\-ahx.xvg\fR). The title says
+ \&it all.
+ 
+-\&\fB 6.\fR Helix Dipole, backbone only (file dip\-ahx.xvg).
++\&\fB 6.\fR Helix dipole, backbone only (file \fB dip\-ahx.xvg\fR).
+ 
+ \&\fB 7.\fR RMS deviation from ideal helix, calculated for the Calpha
+-\&atoms only (file rms\-ahx.xvg).
++\&atoms only (file \fB rms\-ahx.xvg\fR).
+ 
+-\&\fB 8.\fR Average Calpha\-Calpha dihedral angle (file phi\-ahx.xvg).
++\&\fB 8.\fR Average Calpha \- Calpha dihedral angle (file \fB phi\-ahx.xvg\fR).
+ 
+-\&\fB 9.\fR Average Phi and Psi angles (file phipsi.xvg).
++\&\fB 9.\fR Average phi and psi angles (file \fB phipsi.xvg\fR).
+ 
+-\&\fB 10.\fR Ellipticity at 222 nm according to \fI Hirst and Brooks\fR
++\&\fB 10.\fR Ellipticity at 222 nm according to Hirst and Brooks.
+ \&
+ 
+ 
+@@ -115,7 +115,7 @@ g_helix - calculates basic properties of alpha helices
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-r0"  " int" " 1" 
+  The first residue number in the sequence
+diff --git a/man/man1/g_helixorient.1 b/man/man1/g_helixorient.1
+index c6a1429..11d6320 100644
+--- a/man/man1/g_helixorient.1
++++ b/man/man1/g_helixorient.1
+@@ -1,8 +1,8 @@
+-.TH g_helixorient 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_helixorient 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_helixorient - calculates local pitch/bending/rotation/orientation inside helices
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_helixorient\fP
+ .BI "\-s" " topol.tpr "
+@@ -26,18 +26,18 @@ g_helixorient - calculates local pitch/bending/rotation/orientation inside helic
+ .BI "\-[no]sidechain" ""
+ .BI "\-[no]incremental" ""
+ .SH DESCRIPTION
+-\&g_helixorient calculates the coordinates and direction of the average
++\&\fB g_helixorient\fR calculates the coordinates and direction of the average
+ \&axis inside an alpha helix, and the direction/vectors of both the
+-\&alpha carbon and (optionally) a sidechain atom relative to the axis.
++\&Calpha and (optionally) a sidechain atom relative to the axis.
+ 
+ 
+-\&As input, you need to specify an index group with alpha carbon atoms
+-\&corresponding to an alpha helix of continuous residues. Sidechain
++\&As input, you need to specify an index group with Calpha atoms
++\&corresponding to an alpha\-helix of continuous residues. Sidechain
+ \&directions require a second index group of the same size, containing
+ \&the heavy atom in each residue that should represent the sidechain.
+ 
+ 
+-\&Note that this program does not do any fitting of structures.
++\&\fB Note\fR that this program does not do any fitting of structures.
+ 
+ 
+ \&We need four Calpha coordinates to define the local direction of the helix
+@@ -45,11 +45,11 @@ g_helixorient - calculates local pitch/bending/rotation/orientation inside helic
+ 
+ 
+ \&The tilt/rotation is calculated from Euler rotations, where we define
+-\&the helix axis as the local X axis, the residues/CA\-vector as Y, and the
+-\&Z axis from their cross product. We use the Euler Y\-Z\-X rotation, meaning
++\&the helix axis as the local \fI x\fR\-axis, the residues/Calpha vector as \fI y\fR, and the
++\&\fI z\fR\-axis from their cross product. We use the Euler Y\-Z\-X rotation, meaning
+ \&we first tilt the helix axis (1) around and (2) orthogonal to the residues
+ \&vector, and finally apply the (3) rotation around it. For debugging or other
+-\&purposes, we also write out the actual Euler rotation angles as theta1\-3.xvg
++\&purposes, we also write out the actual Euler rotation angles as \fB theta[1\-3].xvg\fR
+ .SH FILES
+ .BI "\-s" " topol.tpr" 
+ .B Input
+diff --git a/man/man1/g_hydorder.1 b/man/man1/g_hydorder.1
+new file mode 100644
+index 0000000..2322d10
+--- /dev/null
++++ b/man/man1/g_hydorder.1
+@@ -0,0 +1,103 @@
++.TH g_hydorder 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
++.SH NAME
++g_hydorder
++.B VERSION 4.5.4-dev-20110404-bc5695c
++.SH SYNOPSIS
++\f3g_hydorder\fP
++.BI "\-f" " traj.xtc "
++.BI "\-n" " index.ndx "
++.BI "\-s" " topol.tpr "
++.BI "\-o" " intf.xpm "
++.BI "\-or" " raw.out "
++.BI "\-Spect" " intfspect.out "
++.BI "\-[no]h" ""
++.BI "\-[no]version" ""
++.BI "\-nice" " int "
++.BI "\-b" " time "
++.BI "\-e" " time "
++.BI "\-dt" " time "
++.BI "\-[no]w" ""
++.BI "\-d" " enum "
++.BI "\-bw" " real "
++.BI "\-sgang1" " real "
++.BI "\-sgang2" " real "
++.BI "\-tblock" " int "
++.BI "\-nlevel" " int "
++.SH DESCRIPTION
++\&The tetrahedrality order parameters can be determined
++\&around an atom. Both angle an distance order parameters are calculated. See
++\&P.\-L. Chau and A.J. Hardwick, Mol. Phys., 93, (1998), 511\-518.
++\&for more details.
++This application calculates the orderparameter in a 3d\-mesh in the box, and
++\&with 2 phases in the box gives the user the option to define a 2D interface in time
++\&separating the faces by specifying parameters \-sgang1 and \-sgang2 (It is important
++\&to select these judiciously)
++.SH FILES
++.BI "\-f" " traj.xtc" 
++.B Input
++ Trajectory: xtc trr trj gro g96 pdb cpt 
++
++.BI "\-n" " index.ndx" 
++.B Input
++ Index file 
++
++.BI "\-s" " topol.tpr" 
++.B Input
++ Run input file: tpr tpb tpa 
++
++.BI "\-o" " intf.xpm" 
++.B Output, Mult.
++ X PixMap compatible matrix file 
++
++.BI "\-or" " raw.out" 
++.B Output, Opt., Mult.
++ Generic output file 
++
++.BI "\-Spect" " intfspect.out" 
++.B Output, Opt., Mult.
++ Generic output file 
++
++.SH OTHER OPTIONS
++.BI "\-[no]h"  "no    "
++ Print help info and quit
++
++.BI "\-[no]version"  "no    "
++ Print version info and quit
++
++.BI "\-nice"  " int" " 19" 
++ Set the nicelevel
++
++.BI "\-b"  " time" " 0     " 
++ First frame (ps) to read from trajectory
++
++.BI "\-e"  " time" " 0     " 
++ Last frame (ps) to read from trajectory
++
++.BI "\-dt"  " time" " 0     " 
++ Only use frame when t MOD dt = first time (ps)
++
++.BI "\-[no]w"  "no    "
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
++
++.BI "\-d"  " enum" " z" 
++ Direction of the normal on the membrane: \fB z\fR, \fB x\fR or \fB y\fR
++
++.BI "\-bw"  " real" " 1     " 
++ Binwidth of box mesh
++
++.BI "\-sgang1"  " real" " 1     " 
++ tetrahedral angle parameter in Phase 1 (bulk)
++
++.BI "\-sgang2"  " real" " 1     " 
++ tetrahedral angle parameter in Phase 2 (bulk)
++
++.BI "\-tblock"  " int" " 1" 
++ Number of frames in one time\-block average
++
++.BI "\-nlevel"  " int" " 100" 
++ Number of Height levels in 2D \- XPixMaps
++
++.SH SEE ALSO
++.BR gromacs(7)
++
++More information about \fBGROMACS\fR is available at <\fIhttp://www.gromacs.org/\fR>.
+diff --git a/man/man1/g_lie.1 b/man/man1/g_lie.1
+index 8596ace..7dddb0e 100644
+--- a/man/man1/g_lie.1
++++ b/man/man1/g_lie.1
+@@ -1,8 +1,8 @@
+-.TH g_lie 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_lie 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_lie - free energy estimate from linear combinations
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_lie\fP
+ .BI "\-f" " ener.edr "
+@@ -21,7 +21,7 @@ g_lie - free energy estimate from linear combinations
+ .BI "\-Cqq" " real "
+ .BI "\-ligand" " string "
+ .SH DESCRIPTION
+-\&g_lie computes a free energy estimate based on an energy analysis
++\&\fB g_lie\fR computes a free energy estimate based on an energy analysis
+ \&from. One needs an energy file with the following components:
+ \&Coul (A\-B) LJ\-SR (A\-B) etc.
+ .SH FILES
+@@ -53,7 +53,7 @@ g_lie - free energy estimate from linear combinations
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_mdmat.1 b/man/man1/g_mdmat.1
+index 5ecc49f..c4b84e9 100644
+--- a/man/man1/g_mdmat.1
++++ b/man/man1/g_mdmat.1
+@@ -1,8 +1,8 @@
+-.TH g_mdmat 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_mdmat 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_mdmat - calculates residue contact maps
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_mdmat\fP
+ .BI "\-f" " traj.xtc "
+@@ -21,16 +21,15 @@ g_mdmat - calculates residue contact maps
+ .BI "\-t" " real "
+ .BI "\-nlevels" " int "
+ .SH DESCRIPTION
+-\&g_mdmat makes distance matrices consisting of the smallest distance
+-\&between residue pairs. With \-frames these distance matrices can be
+-\&stored as a function
+-\&of time, to be able to see differences in tertiary structure as a
+-\&funcion of time. If you choose your options unwise, this may generate
+-\&a large output file. Default only an averaged matrix over the whole
++\&\fB g_mdmat\fR makes distance matrices consisting of the smallest distance
++\&between residue pairs. With \fB \-frames\fR, these distance matrices can be
++\&stored in order to see differences in tertiary structure as a
++\&function of time. If you choose your options unwisely, this may generate
++\&a large output file. By default, only an averaged matrix over the whole
+ \&trajectory is output.
+ \&Also a count of the number of different atomic contacts between
+ \&residues over the whole trajectory can be made.
+-\&The output can be processed with xpm2ps to make a PostScript (tm) plot.
++\&The output can be processed with \fB xpm2ps\fR to make a PostScript (tm) plot.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+ .B Input
+diff --git a/man/man1/g_membed.1 b/man/man1/g_membed.1
+index 659033e..0070258 100644
+--- a/man/man1/g_membed.1
++++ b/man/man1/g_membed.1
+@@ -1,8 +1,8 @@
+-.TH g_membed 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_membed 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_membed - embeds a protein into a lipid bilayer
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_membed\fP
+ .BI "\-f" " into_mem.tpr "
+@@ -39,6 +39,7 @@ g_membed - embeds a protein into a lipid bilayer
+ .BI "\-pf" " pullf.xvg "
+ .BI "\-mtx" " nm.mtx "
+ .BI "\-dn" " dipole.ndx "
++.BI "\-multidir" " rundir "
+ .BI "\-[no]h" ""
+ .BI "\-[no]version" ""
+ .BI "\-nice" " int "
+@@ -58,28 +59,27 @@ g_membed - embeds a protein into a lipid bilayer
+ .BI "\-[no]compact" ""
+ .BI "\-[no]v" ""
+ .SH DESCRIPTION
+-\&g_membed embeds a membrane protein into an equilibrated lipid bilayer at the position
++\&\fB g_membed\fR embeds a membrane protein into an equilibrated lipid bilayer at the position
+ \&and orientation specified by the user.
+ 
+-\&
+ 
+ \&SHORT MANUAL
+ \-\-\-\-\-\-\-\-\-\-\-\-
+ 
+ \&The user should merge the structure files of the protein and membrane (+solvent), creating a
+ \&single structure file with the protein overlapping the membrane at the desired position and
+-\&orientation. Box size should be taken from the membrane structure file. The corresponding topology
+-\&files should also be merged. Consecutively, create a tpr file (input for g_membed) from these files,with the following options included in the mdp file.
++\&orientation. The box size is taken from the membrane structure file. The corresponding topology
++\&files should also be merged. Consecutively, create a \fB .tpr\fR file (input for \fB g_membed\fR) from these files,with the following options included in the \fB .mdp\fR file.
+ 
+-\& \- integrator      = md
++\& \- \fB integrator      = md\fR
+ 
+-\& \- energygrp       = Protein (or other group that you want to insert)
++\& \- \fB energygrp       = Protein\fR (or other group that you want to insert)
+ 
+-\& \- freezegrps      = Protein
++\& \- \fB freezegrps      = Protein\fR
+ 
+-\& \- freezedim       = Y Y Y
++\& \- \fB freezedim       = Y Y Y\fR
+ 
+-\& \- energygrp_excl  = Protein Protein
++\& \- \fB energygrp_excl  = Protein Protein\fR
+ 
+ \&The output is a structure file containing the protein embedded in the membrane. If a topology
+ \&file is provided, the number of lipid and 
+@@ -87,33 +87,31 @@ g_membed - embeds a protein into a lipid bilayer
+ 
+ \&For a more extensive manual see Wolf et al, J Comp Chem 31 (2010) 2169\-2174, Appendix.
+ 
+-\&
+ 
+ \&SHORT METHOD DESCRIPTION
+ 
+ \&\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
+ 
+-\&1. The protein is resized around its center of mass by a factor \-xy in the xy\-plane
+-\&(the membrane plane) and a factor \-z in the z\-direction (if the size of the
++\&1. The protein is resized around its center of mass by a factor \fB \-xy\fR in the xy\-plane
++\&(the membrane plane) and a factor \fB \-z\fR in the \fI z\fR\-direction (if the size of the
+ \&protein in the z\-direction is the same or smaller than the width of the membrane, a
+-\&\-z value larger than 1 can prevent that the protein will be enveloped by the lipids).
++\&\fB \-z\fR value larger than 1 can prevent that the protein will be enveloped by the lipids).
+ 
+ \&2. All lipid and solvent molecules overlapping with the resized protein are removed. All
+-\&intraprotein interactions are turned off to prevent numerical issues for small values of \-xy
+-\& or \-z
++\&intraprotein interactions are turned off to prevent numerical issues for small values of \fB \-xy\fR
++\& or \fB \-z\fR
+ 
+ \&3. One md step is performed.
+ 
+-\&4. The resize factor (\-xy or \-z) is incremented by a small amount ((1\-xy)/nxy or (1\-z)/nz) and the
++\&4. The resize factor (\fB \-xy\fR or \fB \-z\fR) is incremented by a small amount ((1\-xy)/nxy or (1\-z)/nz) and the
+ \&protein is resized again around its center of mass. The resize factor for the xy\-plane
+-\&is incremented first. The resize factor for the z\-direction is not changed until the \-xy factor
+-\&is 1 (thus after \-nxy iteration).
++\&is incremented first. The resize factor for the z\-direction is not changed until the \fB \-xy\fR factor
++\&is 1 (thus after \fB \-nxy\fR iterations).
+ 
+-\&5. Repeat step 3 and 4 until the protein reaches its original size (\-nxy + \-nz iterations).
++\&5. Repeat step 3 and 4 until the protein reaches its original size (\fB \-nxy\fR + \fB \-nz\fR iterations).
+ 
+-\&For a more extensive method descrition see Wolf et al, J Comp Chem, 31 (2010) 2169\-2174.
++\&For a more extensive method description see Wolf et al, J Comp Chem, 31 (2010) 2169\-2174.
+ 
+-\&
+ 
+ \&NOTE
+ \-\-\-\-
+@@ -121,10 +119,9 @@ g_membed - embeds a protein into a lipid bilayer
+ \& \- Protein can be any molecule you want to insert in the membrane.
+ 
+ \& \- It is recommended to perform a short equilibration run after the embedding
+-\&(see Wolf et al, J Comp Chem 31 (2010) 2169\-2174, to re\-equilibrate the membrane. Clearly
++\&(see Wolf et al, J Comp Chem 31 (2010) 2169\-2174), to re\-equilibrate the membrane. Clearly
+ \&protein equilibration might require longer.
+ 
+-\&
+ 
+ .SH FILES
+ .BI "\-f" " into_mem.tpr" 
+@@ -263,6 +260,10 @@ g_membed - embeds a protein into a lipid bilayer
+ .B Output, Opt.
+  Index file 
+ 
++.BI "\-multidir" " rundir" 
++.B Input, Opt., Mult.
++ Run directory 
++
+ .SH OTHER OPTIONS
+ .BI "\-[no]h"  "no    "
+  Print help info and quit
+diff --git a/man/man1/g_mindist.1 b/man/man1/g_mindist.1
+index 67428bd..a07a6f0 100644
+--- a/man/man1/g_mindist.1
++++ b/man/man1/g_mindist.1
+@@ -1,8 +1,8 @@
+-.TH g_mindist 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_mindist 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_mindist - calculates the minimum distance between two groups
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_mindist\fP
+ .BI "\-f" " traj.xtc "
+@@ -33,7 +33,7 @@ g_mindist - calculates the minimum distance between two groups
+ .BI "\-[no]respertime" ""
+ .BI "\-[no]printresname" ""
+ .SH DESCRIPTION
+-\&g_mindist computes the distance between one group and a number of
++\&\fB g_mindist\fR computes the distance between one group and a number of
+ \&other groups. Both the minimum distance
+ \&(between any pair of atoms from the respective groups)
+ \&and the number of contacts within a given
+@@ -111,7 +111,7 @@ g_mindist - calculates the minimum distance between two groups
+  Time unit: \fB fs\fR, \fB ps\fR, \fB ns\fR, \fB us\fR, \fB ms\fR or \fB s\fR
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_morph.1 b/man/man1/g_morph.1
+index e55da0d..31c44c2 100644
+--- a/man/man1/g_morph.1
++++ b/man/man1/g_morph.1
+@@ -1,8 +1,8 @@
+-.TH g_morph 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_morph 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_morph - linear interpolation of conformations 
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_morph\fP
+ .BI "\-f1" " conf1.gro "
+@@ -20,15 +20,15 @@ g_morph - linear interpolation of conformations
+ .BI "\-last" " real "
+ .BI "\-[no]fit" ""
+ .SH DESCRIPTION
+-\&g_morph does a linear interpolation of conformations in order to
++\&\fB g_morph\fR does a linear interpolation of conformations in order to
+ \&create intermediates. Of course these are completely unphysical, but
+ \&that you may try to justify yourself. Output is in the form of a 
+ \&generic trajectory. The number of intermediates can be controlled with
+-\&the \-ninterm flag. The first and last flag correspond to the way of
++\&the \fB \-ninterm\fR flag. The first and last flag correspond to the way of
+ \&interpolating: 0 corresponds to input structure 1 while
+ \&1 corresponds to input structure 2.
+-\&If you specify first  0 or last  1 extrapolation will be
+-\&on the path from input structure x1 to x2. In general the coordinates
++\&If you specify \fB \-first\fR  0 or \fB \-last\fR  1 extrapolation will be
++\&on the path from input structure x1 to x2. In general, the coordinates
+ \&of the intermediate x(i) out of N total intermidates correspond to:
+ 
+ 
+@@ -36,8 +36,8 @@ g_morph - linear interpolation of conformations
+ 
+ 
+ \&Finally the RMSD with respect to both input structures can be computed
+-\&if explicitly selected (\-or option). In that case an index file may be
+-\&read to select what group RMS is computed from.
++\&if explicitly selected (\fB \-or\fR option). In that case, an index file may be
++\&read to select the group from which the RMS is computed.
+ .SH FILES
+ .BI "\-f1" " conf1.gro" 
+ .B Input
+@@ -70,7 +70,7 @@ g_morph - linear interpolation of conformations
+  Set the nicelevel
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_msd.1 b/man/man1/g_msd.1
+index 838ba4c..95cdad0 100644
+--- a/man/man1/g_msd.1
++++ b/man/man1/g_msd.1
+@@ -1,8 +1,8 @@
+-.TH g_msd 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_msd 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_msd - calculates mean square displacements
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_msd\fP
+ .BI "\-f" " traj.xtc "
+@@ -30,7 +30,7 @@ g_msd - calculates mean square displacements
+ .BI "\-beginfit" " time "
+ .BI "\-endfit" " time "
+ .SH DESCRIPTION
+-\&g_msd computes the mean square displacement (MSD) of atoms from
++\&\fB g_msd\fR computes the mean square displacement (MSD) of atoms from
+ \&a set of initial positions. This provides an easy way to compute
+ \&the diffusion constant using the Einstein relation.
+ \&The time between the reference points for the MSD calculation
+@@ -49,7 +49,8 @@ g_msd - calculates mean square displacements
+ \&each group, the order in the output is: trace xx yy zz yx zx zy.
+ 
+ 
+-\&If \fB \-mol\fR is set, g_msd plots the MSD for individual molecules: 
++\&If \fB \-mol\fR is set, \fB g_msd\fR plots the MSD for individual molecules
++\&(including making molecules whole across periodic boundaries): 
+ \&for each individual molecule a diffusion constant is computed for 
+ \&its center of mass. The chosen index group will be split into 
+ \&molecules.
+@@ -62,7 +63,7 @@ g_msd - calculates mean square displacements
+ \&With the option \fB \-rmcomm\fR, the center of mass motion of a 
+ \&specific group can be removed. For trajectories produced with 
+ \&GROMACS this is usually not necessary, 
+-\&as mdrun usually already removes the center of mass motion.
++\&as \fB mdrun\fR usually already removes the center of mass motion.
+ \&When you use this option be sure that the whole system is stored
+ \&in the trajectory file.
+ 
+@@ -79,7 +80,7 @@ g_msd - calculates mean square displacements
+ \&\fB \-beginfit\fR and \fB \-endfit\fR.
+ 
+ 
+-\&Option \fB \-pdb\fR writes a pdb file with the coordinates of the frame
++\&Option \fB \-pdb\fR writes a \fB .pdb\fR file with the coordinates of the frame
+ \&at time \fB \-tpdb\fR with in the B\-factor field the square root of
+ \&the diffusion coefficient of the molecule.
+ \&This option implies option \fB \-mol\fR.
+@@ -128,7 +129,7 @@ g_msd - calculates mean square displacements
+  Time unit: \fB fs\fR, \fB ps\fR, \fB ns\fR, \fB us\fR, \fB ms\fR or \fB s\fR
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -152,7 +153,7 @@ g_msd - calculates mean square displacements
+  Remove center of mass motion
+ 
+ .BI "\-tpdb"  " time" " 0     " 
+- The frame to use for option \-pdb (ps)
++ The frame to use for option \fB \-pdb\fR (ps)
+ 
+ .BI "\-trestart"  " time" " 10    " 
+  Time between restarting points in trajectory (ps)
+diff --git a/man/man1/g_nmeig.1 b/man/man1/g_nmeig.1
+index 16a72bb..4bca624 100644
+--- a/man/man1/g_nmeig.1
++++ b/man/man1/g_nmeig.1
+@@ -1,14 +1,15 @@
+-.TH g_nmeig 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_nmeig 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_nmeig - diagonalizes the Hessian 
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_nmeig\fP
+ .BI "\-f" " hessian.mtx "
+ .BI "\-s" " topol.tpr "
+ .BI "\-of" " eigenfreq.xvg "
+ .BI "\-ol" " eigenval.xvg "
++.BI "\-qc" " quant_corr.xvg "
+ .BI "\-v" " eigenvec.trr "
+ .BI "\-[no]h" ""
+ .BI "\-[no]version" ""
+@@ -17,8 +18,10 @@ g_nmeig - diagonalizes the Hessian
+ .BI "\-[no]m" ""
+ .BI "\-first" " int "
+ .BI "\-last" " int "
++.BI "\-T" " real "
++.BI "\-[no]constr" ""
+ .SH DESCRIPTION
+-\&g_nmeig calculates the eigenvectors/values of a (Hessian) matrix,
++\&\fB g_nmeig\fR calculates the eigenvectors/values of a (Hessian) matrix,
+ \&which can be calculated with \fB mdrun\fR.
+ \&The eigenvectors are written to a trajectory file (\fB \-v\fR).
+ \&The structure is written first with t=0. The eigenvectors
+@@ -26,9 +29,32 @@ g_nmeig - diagonalizes the Hessian
+ \&The eigenvectors can be analyzed with \fB g_anaeig\fR.
+ \&An ensemble of structures can be generated from the eigenvectors with
+ \&\fB g_nmens\fR. When mass weighting is used, the generated eigenvectors
+-\&will be scaled back to plain cartesian coordinates before generating the
+-\&output \- in this case they will no longer be exactly orthogonal in the
+-\&standard cartesian norm (But in the mass weighted norm they would be).
++\&will be scaled back to plain Cartesian coordinates before generating the
++\&output. In this case, they will no longer be exactly orthogonal in the
++\&standard Cartesian norm, but in the mass\-weighted norm they would be.
++
++
++\&This program can be optionally used to compute quantum corrections to heat capacity
++\&and enthalpy by providing an extra file argument \fB \-qcorr\fR. See the GROMACS
++\&manual, Chapter 1, for details. The result includes subtracting a harmonic
++\&degree of freedom at the given temperature.
++\&The total correction is printed on the terminal screen.
++\&The recommended way of getting the corrections out is:
++
++
++\&\fB g_nmeig \-s topol.tpr \-f nm.mtx \-first 7 \-last 10000 \-T 300 \-qc [\-constr]\fR
++
++
++\&The \fB \-constr\fR option should be used when bond constraints were used during the
++\&simulation \fB for all the covalent bonds\fR. If this is not the case, 
++\&you need to analyze the \fB quant_corr.xvg\fR file yourself.
++
++
++\&To make things more flexible, the program can also take virtual sites into account
++\&when computing quantum corrections. When selecting \fB \-constr\fR and
++\&\fB \-qc\fR, the \fB \-begin\fR and \fB \-end\fR options will be set automatically as well.
++\&Again, if you think you know it better, please check the \fB eigenfreq.xvg\fR
++\&output.
+ .SH FILES
+ .BI "\-f" " hessian.mtx" 
+ .B Input
+@@ -36,7 +62,7 @@ g_nmeig - diagonalizes the Hessian
+ 
+ .BI "\-s" " topol.tpr" 
+ .B Input
+- Structure+mass(db): tpr tpb tpa gro g96 pdb 
++ Run input file: tpr tpb tpa 
+ 
+ .BI "\-of" " eigenfreq.xvg" 
+ .B Output
+@@ -46,6 +72,10 @@ g_nmeig - diagonalizes the Hessian
+ .B Output
+  xvgr/xmgr file 
+ 
++.BI "\-qc" " quant_corr.xvg" 
++.B Output, Opt.
++ xvgr/xmgr file 
++
+ .BI "\-v" " eigenvec.trr" 
+ .B Output
+  Full precision trajectory: trr trj cpt 
+@@ -72,6 +102,12 @@ g_nmeig - diagonalizes the Hessian
+ .BI "\-last"  " int" " 50" 
+  Last eigenvector to write away
+ 
++.BI "\-T"  " real" " 298.15" 
++ Temperature for computing quantum heat capacity and enthalpy when using normal mode calculations to correct classical simulations
++
++.BI "\-[no]constr"  "no    "
++ If constraints were used in the simulation but not in the normal mode analysis (this is the recommended way of doing it) you will need to set this for computing the quantum corrections.
++
+ .SH SEE ALSO
+ .BR gromacs(7)
+ 
+diff --git a/man/man1/g_nmens.1 b/man/man1/g_nmens.1
+index 85d3f98..88f72fd 100644
+--- a/man/man1/g_nmens.1
++++ b/man/man1/g_nmens.1
+@@ -1,8 +1,8 @@
+-.TH g_nmens 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_nmens 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_nmens - generates an ensemble of structures from the normal modes
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_nmens\fP
+ .BI "\-v" " eigenvec.trr "
+@@ -21,7 +21,7 @@ g_nmens - generates an ensemble of structures from the normal modes
+ .BI "\-last" " int "
+ .SH DESCRIPTION
+ \&\fB g_nmens\fR generates an ensemble around an average structure
+-\&in a subspace which is defined by a set of normal modes (eigenvectors).
++\&in a subspace that is defined by a set of normal modes (eigenvectors).
+ \&The eigenvectors are assumed to be mass\-weighted.
+ \&The position along each eigenvector is randomly taken from a Gaussian
+ \&distribution with variance kT/eigenvalue.
+diff --git a/man/man1/g_nmtraj.1 b/man/man1/g_nmtraj.1
+index 173fa32..b4fe86b 100644
+--- a/man/man1/g_nmtraj.1
++++ b/man/man1/g_nmtraj.1
+@@ -1,8 +1,8 @@
+-.TH g_nmtraj 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_nmtraj 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_nmtraj - generate a virtual trajectory from an eigenvector
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_nmtraj\fP
+ .BI "\-s" " topol.tpr "
+@@ -18,7 +18,7 @@ g_nmtraj - generate a virtual trajectory from an eigenvector
+ .BI "\-nframes" " int "
+ .SH DESCRIPTION
+ \&\fB g_nmtraj\fR generates an virtual trajectory from an eigenvector, 
+-\&corresponding to a harmonic cartesian oscillation around the average 
++\&corresponding to a harmonic Cartesian oscillation around the average 
+ \&structure. The eigenvectors should normally be mass\-weighted, but you can 
+ \&use non\-weighted eigenvectors to generate orthogonal motions. 
+ \&The output frames are written as a trajectory file covering an entire period, and 
+@@ -26,10 +26,10 @@ g_nmtraj - generate a virtual trajectory from an eigenvector
+ \&PDB format you can view it directly in PyMol and also render a photorealistic movie. 
+ \&Motion amplitudes are calculated from the eigenvalues and a preset temperature, 
+ \&assuming equipartition of the energy over all modes. To make the motion clearly visible 
+-\&in PyMol you might want to amplify it by setting an unrealistic high temperature. 
+-\&However, be aware that both the linear cartesian displacements and mass weighting will 
++\&in PyMol you might want to amplify it by setting an unrealistically high temperature. 
++\&However, be aware that both the linear Cartesian displacements and mass weighting will 
+ \&lead to serious structure deformation for high amplitudes \- this is is simply a limitation 
+-\&of the cartesian normal mode model. By default the selected eigenvector is set to 7, since 
++\&of the Cartesian normal mode model. By default the selected eigenvector is set to 7, since 
+ \& the first six normal modes are the translational and rotational degrees of freedom.
+ .SH FILES
+ .BI "\-s" " topol.tpr" 
+diff --git a/man/man1/g_options.1 b/man/man1/g_options.1
+new file mode 100644
+index 0000000..5c0a41c
+--- /dev/null
++++ b/man/man1/g_options.1
+@@ -0,0 +1,49 @@
++.TH g_options 1 "Sun 10 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110410-e5eb052-dirty"
++.SH NAME
++g_options
++.B VERSION 4.5.4-dev-20110410-e5eb052-dirty
++.SH SYNOPSIS
++\f3g_options\fP
++.BI "\-[no]h" ""
++.BI "\-[no]version" ""
++.BI "\-nice" " int "
++.SH DESCRIPTION
++\&GROMACS programs have some standard options,
++\&of which some are hidden by default:
++.SH OTHER OPTIONS
++.BI "\-[no]h"  "no    "
++ Print help info and quit
++
++.BI "\-[no]version"  "no    "
++ Print version info and quit
++
++.BI "\-nice"  " int" " 0" 
++ Set the nicelevel
++
++.SH KNOWN PROBLEMS
++\- If the configuration script found Motif or Lesstif on your system, you can use the graphical interface (if not, you will get an error):
++\fB \-X\fR gmx_bool \fB no\fR Use dialog box GUI to edit command line options
++
++\- When compiled on an SGI\-IRIX system, all GROMACS programs have an additional option:
++\fB \-npri\fR int \fB 0\fR Set non blocking priority (try 128)
++
++\- Optional files are not used unless the option is set, in contrast to non\-optional files, where the default file name is used when the option is not set.
++
++\- All GROMACS programs will accept file options without a file extension or filename being specified. In such cases the default filenames will be used. With multiple input file types, such as generic structure format, the directory will be searched for files of each type with the supplied or default name. When no such file is found, or with output files the first file type will be used.
++
++\- All GROMACS programs with the exception of \fB mdrun\fR and \fB eneconv\fR check if the command line options are valid.  If this is not the case, the program will be halted.
++
++\- Enumerated options (enum) should be used with one of the arguments listed in the option description, the argument may be abbreviated. The first match to the shortest argument in the list will be selected.
++
++\- Vector options can be used with 1 or 3 parameters. When only one parameter is supplied the two others are also set to this value.
++
++\- All GROMACS programs can read compressed or g\-zipped files. There might be a problem with reading compressed \fB .xtc\fR, \fB .trr\fR and \fB .trj\fR files, but these will not compress very well anyway.
++
++\- Most GROMACS programs can process a trajectory with fewer atoms than the run input or structure file, but only if the trajectory consists of the first n atoms of the run input or structure file.
++
++\- Many GROMACS programs will accept the \fB \-tu\fR option to set the time units to use in output files (e.g. for \fB xmgr\fR graphs or \fB xpm\fR matrices) and in all time options.
++
++.SH SEE ALSO
++.BR gromacs(7)
++
++More information about \fBGROMACS\fR is available at <\fIhttp://www.gromacs.org/\fR>.
+diff --git a/man/man1/g_order.1 b/man/man1/g_order.1
+index 8ff7a0d..e29acbd 100644
+--- a/man/man1/g_order.1
++++ b/man/man1/g_order.1
+@@ -1,8 +1,8 @@
+-.TH g_order 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_order 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_order - computes the order parameter per atom for carbon tails
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_order\fP
+ .BI "\-f" " traj.xtc "
+@@ -44,9 +44,9 @@ g_order - computes the order parameter per atom for carbon tails
+ 
+ \&The program can also give all
+ \&diagonal elements of the order tensor and even calculate the deuterium
+-\&order parameter Scd (default). If the option \-szonly is given, only one
+-\&order tensor component (specified by the \-d option) is given and the
+-\&order parameter per slice is calculated as well. If \-szonly is not
++\&order parameter Scd (default). If the option \fB \-szonly\fR is given, only one
++\&order tensor component (specified by the \fB \-d\fR option) is given and the
++\&order parameter per slice is calculated as well. If \fB \-szonly\fR is not
+ \&selected, all diagonal elements and the deuterium order parameter is
+ \&given.
+ 
+@@ -125,7 +125,7 @@ The tetrahedrality order parameters can be determined
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -134,10 +134,10 @@ The tetrahedrality order parameters can be determined
+  Direction of the normal on the membrane: \fB z\fR, \fB x\fR or \fB y\fR
+ 
+ .BI "\-sl"  " int" " 1" 
+- Calculate order parameter as function of boxlength, dividing the box in nr slices.
++ Calculate order parameter as function of box length, dividing the box in nr slices.
+ 
+ .BI "\-[no]szonly"  "no    "
+- Only give Sz element of order tensor. (axis can be specified with \-d)
++ Only give Sz element of order tensor. (axis can be specified with \fB \-d\fR)
+ 
+ .BI "\-[no]unsat"  "no    "
+  Calculate order parameters for unsaturated carbons. Note that this cannot be mixed with normal order parameters.
+diff --git a/man/man1/g_pme_error.1 b/man/man1/g_pme_error.1
+new file mode 100644
+index 0000000..a3c313e
+--- /dev/null
++++ b/man/man1/g_pme_error.1
+@@ -0,0 +1,70 @@
++.TH g_pme_error 1 "Sun 10 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110410-e5eb052-dirty"
++.SH NAME
++g_pme_error - estimates the error of using PME with a given input file
++
++.B VERSION 4.5.4-dev-20110410-e5eb052-dirty
++.SH SYNOPSIS
++\f3g_pme_error\fP
++.BI "\-s" " topol.tpr "
++.BI "\-o" " error.out "
++.BI "\-so" " tuned.tpr "
++.BI "\-[no]h" ""
++.BI "\-[no]version" ""
++.BI "\-nice" " int "
++.BI "\-beta" " real "
++.BI "\-[no]tune" ""
++.BI "\-self" " real "
++.BI "\-seed" " int "
++.BI "\-[no]v" ""
++.SH DESCRIPTION
++\&\fB g_pme_error\fR estimates the error of the electrostatic forces
++\&if using the sPME algorithm. The flag \fB \-tune\fR will determine
++\&the splitting parameter such that the error is equally
++\&distributed over the real and reciprocal space part.
++\&The part of the error that stems from self interaction of the particles is computationally demanding. However, a good a approximation is to
++\&just use a fraction of the particles for this term which can be
++\&indicated by the flag \fB \-self\fR.
++
++
++.SH FILES
++.BI "\-s" " topol.tpr" 
++.B Input
++ Run input file: tpr tpb tpa 
++
++.BI "\-o" " error.out" 
++.B Output
++ Generic output file 
++
++.BI "\-so" " tuned.tpr" 
++.B Output, Opt.
++ Run input file: tpr tpb tpa 
++
++.SH OTHER OPTIONS
++.BI "\-[no]h"  "no    "
++ Print help info and quit
++
++.BI "\-[no]version"  "no    "
++ Print version info and quit
++
++.BI "\-nice"  " int" " 0" 
++ Set the nicelevel
++
++.BI "\-beta"  " real" " \-1    " 
++ If positive, overwrite ewald_beta from \fB .tpr\fR file with this value
++
++.BI "\-[no]tune"  "no    "
++ Tune the splitting parameter such that the error is equally distributed between real and reciprocal space
++
++.BI "\-self"  " real" " 1     " 
++ If between 0.0 and 1.0, determine self interaction error from just this fraction of the charged particles
++
++.BI "\-seed"  " int" " 0" 
++ Random number seed used for Monte Carlo algorithm when \fB \-self\fR is set to a value between 0.0 and 1.0
++
++.BI "\-[no]v"  "no    "
++ Be loud and noisy
++
++.SH SEE ALSO
++.BR gromacs(7)
++
++More information about \fBGROMACS\fR is available at <\fIhttp://www.gromacs.org/\fR>.
+diff --git a/man/man1/g_polystat.1 b/man/man1/g_polystat.1
+index 08e6ffe..cebc497 100644
+--- a/man/man1/g_polystat.1
++++ b/man/man1/g_polystat.1
+@@ -1,8 +1,8 @@
+-.TH g_polystat 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_polystat 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_polystat - calculates static properties of polymers
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_polystat\fP
+ .BI "\-s" " topol.tpr "
+@@ -24,7 +24,7 @@ g_polystat - calculates static properties of polymers
+ .BI "\-[no]mw" ""
+ .BI "\-[no]pc" ""
+ .SH DESCRIPTION
+-\&g_polystat plots static properties of polymers as a function of time
++\&\fB g_polystat\fR plots static properties of polymers as a function of time
+ \&and prints the average.
+ 
+ 
+@@ -103,7 +103,7 @@ g_polystat - calculates static properties of polymers
+  Time unit: \fB fs\fR, \fB ps\fR, \fB ns\fR, \fB us\fR, \fB ms\fR or \fB s\fR
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_potential.1 b/man/man1/g_potential.1
+index 124063e..aee31ae 100644
+--- a/man/man1/g_potential.1
++++ b/man/man1/g_potential.1
+@@ -1,8 +1,8 @@
+-.TH g_potential 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_potential 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_potential - calculates the electrostatic potential across the box
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_potential\fP
+ .BI "\-f" " traj.xtc "
+@@ -28,14 +28,14 @@ g_potential - calculates the electrostatic potential across the box
+ .BI "\-ng" " int "
+ .BI "\-[no]correct" ""
+ .SH DESCRIPTION
+-\&Compute the electrostatical potential across the box. The potential is
++\&\fB g_potential\fR computes the electrostatical potential across the box. The potential is
+ \&calculated by first summing the charges per slice and then integrating
+ \&twice of this charge distribution. Periodic boundaries are not taken
+ \&into account. Reference of potential is taken to be the left side of
+-\&the box. It's also possible to calculate the potential in spherical
++\&the box. It is also possible to calculate the potential in spherical
+ \&coordinates as function of r by calculating a charge distribution in
+ \&spherical slices and twice integrating them. epsilon_r is taken as 1,
+-\&2 is more appropriate in many cases.
++\&but 2 is more appropriate in many cases.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+ .B Input
+@@ -81,7 +81,7 @@ g_potential - calculates the electrostatic potential across the box
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_principal.1 b/man/man1/g_principal.1
+index eb19599..5f353e1 100644
+--- a/man/man1/g_principal.1
++++ b/man/man1/g_principal.1
+@@ -1,8 +1,8 @@
+-.TH g_principal 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_principal 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_principal - calculates axes of inertia for a group of atoms
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_principal\fP
+ .BI "\-f" " traj.xtc "
+@@ -22,7 +22,7 @@ g_principal - calculates axes of inertia for a group of atoms
+ .BI "\-[no]w" ""
+ .BI "\-[no]foo" ""
+ .SH DESCRIPTION
+-\&g_principal calculates the three principal axes of inertia for a group
++\&\fB g_principal\fR calculates the three principal axes of inertia for a group
+ \&of atoms.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+@@ -76,7 +76,7 @@ g_principal - calculates axes of inertia for a group of atoms
+  Time unit: \fB fs\fR, \fB ps\fR, \fB ns\fR, \fB us\fR, \fB ms\fR or \fB s\fR
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-[no]foo"  "no    "
+  Dummy option to avoid empty array
+diff --git a/man/man1/g_protonate.1 b/man/man1/g_protonate.1
+index 5f8d79d..c18fa87 100644
+--- a/man/man1/g_protonate.1
++++ b/man/man1/g_protonate.1
+@@ -1,8 +1,8 @@
+-.TH g_protonate 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_protonate 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_protonate - protonates structures
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_protonate\fP
+ .BI "\-s" " topol.tpr "
+@@ -16,15 +16,15 @@ g_protonate - protonates structures
+ .BI "\-e" " time "
+ .BI "\-dt" " time "
+ .SH DESCRIPTION
+-\&\fB protonate\fR reads (a) conformation(s) and adds all missing
+-\&hydrogens as defined in \fB ffgmx2.hdb\fR. If only \fB \-s\fR is
++\&\fB g_protonate\fR reads (a) conformation(s) and adds all missing
++\&hydrogens as defined in \fB gmx2.ff/aminoacids.hdb\fR. If only \fB \-s\fR is
+ \&specified, this conformation will be protonated, if also \fB \-f\fR
+-\&is specified, the conformation(s) will be read from this file
++\&is specified, the conformation(s) will be read from this file, 
+ \&which can be either a single conformation or a trajectory.
+ \&
+ 
+ 
+-\&If a pdb file is supplied, residue names might not correspond to
++\&If a \fB .pdb\fR file is supplied, residue names might not correspond to
+ \&to the GROMACS naming conventions, in which case these residues will
+ \&probably not be properly protonated.
+ \&
+diff --git a/man/man1/g_rama.1 b/man/man1/g_rama.1
+index 4cc33ad..df19aaf 100644
+--- a/man/man1/g_rama.1
++++ b/man/man1/g_rama.1
+@@ -1,8 +1,8 @@
+-.TH g_rama 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_rama 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_rama - computes Ramachandran plots
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_rama\fP
+ .BI "\-f" " traj.xtc "
+@@ -17,7 +17,7 @@ g_rama - computes Ramachandran plots
+ .BI "\-[no]w" ""
+ .BI "\-xvg" " enum "
+ .SH DESCRIPTION
+-\&g_rama selects the Phi/Psi dihedral combinations from your topology file
++\&\fB g_rama\fR selects the phi/psi dihedral combinations from your topology file
+ \&and computes these as a function of time.
+ \&Using simple Unix tools such as \fI grep\fR you can select out
+ \&specific residues.
+@@ -54,7 +54,7 @@ g_rama - computes Ramachandran plots
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_rdf.1 b/man/man1/g_rdf.1
+index 9e15a5c..4f19f52 100644
+--- a/man/man1/g_rdf.1
++++ b/man/man1/g_rdf.1
+@@ -1,8 +1,8 @@
+-.TH g_rdf 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_rdf 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_rdf - calculates radial distribution functions
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_rdf\fP
+ .BI "\-f" " traj.xtc "
+@@ -42,22 +42,22 @@ g_rdf - calculates radial distribution functions
+ \&a scattering experiment.
+ 
+ 
+-\&g_rdf calculates radial distribution functions in different ways.
++\&\fB g_rdf\fR calculates radial distribution functions in different ways.
+ \&The normal method is around a (set of) particle(s), the other methods
+ \&are around the center of mass of a set of particles (\fB \-com\fR)
+ \&or to the closest particle in a set (\fB \-surf\fR).
+-\&With all methods rdf's can also be calculated around axes parallel
+-\&to the z\-axis with option \fB \-xy\fR.
++\&With all methods, the RDF can also be calculated around axes parallel
++\&to the \fI z\fR\-axis with option \fB \-xy\fR.
+ \&With option \fB \-surf\fR normalization can not be used.
+ 
+ 
+-\&The option \fB \-rdf\fR sets the type of rdf to be computed.
++\&The option \fB \-rdf\fR sets the type of RDF to be computed.
+ \&Default is for atoms or particles, but one can also select center
+-\&of mass or geometry of molecules or residues. In all cases only
++\&of mass or geometry of molecules or residues. In all cases, only
+ \&the atoms in the index groups are taken into account.
+-\&For molecules and/or the center of mass option a run input file
++\&For molecules and/or the center of mass option, a run input file
+ \&is required.
+-\&Other weighting than COM or COG can currently only be achieved
++\&Weighting other than COM or COG can currently only be achieved
+ \&by providing a run input file with different masses.
+ \&Options \fB \-com\fR and \fB \-surf\fR also work in conjunction
+ \&with \fB \-rdf\fR.
+@@ -65,17 +65,17 @@ g_rdf - calculates radial distribution functions
+ 
+ \&If a run input file is supplied (\fB \-s\fR) and \fB \-rdf\fR is set
+ \&to \fB atom\fR, exclusions defined
+-\&in that file are taken into account when calculating the rdf.
++\&in that file are taken into account when calculating the RDF.
+ \&The option \fB \-cut\fR is meant as an alternative way to avoid
+-\&intramolecular peaks in the rdf plot.
++\&intramolecular peaks in the RDF plot.
+ \&It is however better to supply a run input file with a higher number of
+-\&exclusions. For eg. benzene a topology with nrexcl set to 5
+-\&would eliminate all intramolecular contributions to the rdf.
++\&exclusions. For e.g. benzene a topology, setting nrexcl to 5
++\&would eliminate all intramolecular contributions to the RDF.
+ \&Note that all atoms in the selected groups are used, also the ones
+ \&that don't have Lennard\-Jones interactions.
+ 
+ 
+-\&Option \fB \-cn\fR produces the cumulative number rdf,
++\&Option \fB \-cn\fR produces the cumulative number RDF,
+ \&i.e. the average number of particles within a distance r.
+ 
+ 
+@@ -135,7 +135,7 @@ g_rdf - calculates radial distribution functions
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_rms.1 b/man/man1/g_rms.1
+index 1cb58ec..4ae7172 100644
+--- a/man/man1/g_rms.1
++++ b/man/man1/g_rms.1
+@@ -1,8 +1,8 @@
+-.TH g_rms 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_rms 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_rms - calculates rmsd's with a reference structure and rmsd matrices
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_rms\fP
+ .BI "\-s" " topol.tpr "
+@@ -40,10 +40,10 @@ g_rms - calculates rmsd's with a reference structure and rmsd matrices
+ .BI "\-nlevels" " int "
+ .BI "\-ng" " int "
+ .SH DESCRIPTION
+-\&g_rms compares two structures by computing the root mean square
+-\&deviation (RMSD), the size\-independent 'rho' similarity parameter
+-\&(rho) or the scaled rho (rhosc), 
+-\&see Maiorov & Crippen, PROTEINS \fB 22\fR, 273 (1995).
++\&\fB g_rms\fR compares two structures by computing the root mean square
++\&deviation (RMSD), the size\-independent rho similarity parameter
++\&(\fB rho\fR) or the scaled rho (\fB rhosc\fR), 
++\&see Maiorov & Crippen, Proteins \fB 22\fR, 273 (1995).
+ \&This is selected by \fB \-what\fR.
+ 
+ Each structure from a trajectory (\fB \-f\fR) is compared to a
+@@ -54,7 +54,7 @@ Each structure from a trajectory (\fB \-f\fR) is compared to a
+ \&With option \fB \-mir\fR also a comparison with the mirror image of
+ \&the reference structure is calculated.
+ \&This is useful as a reference for 'significant' values, see
+-\&Maiorov & Crippen, PROTEINS \fB 22\fR, 273 (1995).
++\&Maiorov & Crippen, Proteins \fB 22\fR, 273 (1995).
+ 
+ 
+ \&Option \fB \-prev\fR produces the comparison with a previous frame
+@@ -74,10 +74,10 @@ Each structure from a trajectory (\fB \-f\fR) is compared to a
+ 
+ \&Option \fB \-mw\fR controls whether mass weighting is done or not.
+ \&If you select the option (default) and 
+-\&supply a valid tpr file masses will be taken from there, 
+-\&otherwise the masses will be deduced from the atommass.dat file in
+-\&the GROMACS library directory. This is fine for proteins but not
+-\&necessarily for other molecules. A default mass of 12.011 amu (Carbon)
++\&supply a valid \fB .tpr\fR file masses will be taken from there, 
++\&otherwise the masses will be deduced from the \fB atommass.dat\fR file in
++\&\fB GMXLIB\fR. This is fine for proteins, but not
++\&necessarily for other molecules. A default mass of 12.011 amu (carbon)
+ \&is assigned to unknown atoms. You can check whether this happend by
+ \&turning on the \fB \-debug\fR flag and inspecting the log file.
+ 
+@@ -161,7 +161,7 @@ Each structure from a trajectory (\fB \-f\fR) is compared to a
+  Time unit: \fB fs\fR, \fB ps\fR, \fB ns\fR, \fB us\fR, \fB ms\fR or \fB s\fR
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_rmsdist.1 b/man/man1/g_rmsdist.1
+index 07721cc..a04194a 100644
+--- a/man/man1/g_rmsdist.1
++++ b/man/man1/g_rmsdist.1
+@@ -1,8 +1,8 @@
+-.TH g_rmsdist 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5-beta4-2010-08-26 09:43:57 +0200-33da7ba-dirty"
++.TH g_rmsdist 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_rmsdist - calculates atom pair distances averaged with power \-2, \-3 or \-6
+ 
+-.B VERSION 4.5-beta4-2010-08-26 09:43:57 +0200-33da7ba-dirty
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_rmsdist\fP
+ .BI "\-f" " traj.xtc "
+@@ -29,16 +29,16 @@ g_rmsdist - calculates atom pair distances averaged with power \-2, \-3 or \-6
+ .BI "\-[no]sumh" ""
+ .BI "\-[no]pbc" ""
+ .SH DESCRIPTION
+-\&g_rmsdist computes the root mean square deviation of atom distances,
++\&\fB g_rmsdist\fR computes the root mean square deviation of atom distances,
+ \&which has the advantage that no fit is needed like in standard RMS
+-\&deviation as computed by g_rms.
++\&deviation as computed by \fB g_rms\fR.
+ \&The reference structure is taken from the structure file.
+-\&The rmsd at time t is calculated as the rms
++\&The RMSD at time t is calculated as the RMS
+ \&of the differences in distance between atom\-pairs in the reference
+ \&structure and the structure at time t.
+ 
+ 
+-\&g_rmsdist can also produce matrices of the rms distances, rms distances
++\&\fB g_rmsdist\fR can also produce matrices of the rms distances, rms distances
+ \&scaled with the mean distance and the mean distances and matrices with
+ \&NMR averaged distances (1/r3 and 1/r6 averaging). Finally, lists
+ \&of atom pairs with 1/r3 and 1/r6 averaged distance below the
+@@ -120,7 +120,7 @@ g_rmsdist - calculates atom pair distances averaged with power \-2, \-3 or \-6
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_rmsf.1 b/man/man1/g_rmsf.1
+index d29a510..943f195 100644
+--- a/man/man1/g_rmsf.1
++++ b/man/man1/g_rmsf.1
+@@ -1,8 +1,8 @@
+-.TH g_rmsf 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_rmsf 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_rmsf - calculates atomic fluctuations
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_rmsf\fP
+ .BI "\-f" " traj.xtc "
+@@ -27,14 +27,14 @@ g_rmsf - calculates atomic fluctuations
+ .BI "\-[no]aniso" ""
+ .BI "\-[no]fit" ""
+ .SH DESCRIPTION
+-\&g_rmsf computes the root mean square fluctuation (RMSF, i.e. standard 
+-\&deviation) of atomic positions 
+-\&after (optionally) fitting to a reference frame.
++\&\fB g_rmsf\fR computes the root mean square fluctuation (RMSF, i.e. standard 
++\&deviation) of atomic positions in the trajectory (supplied with \fB \-f\fR)
++\&after (optionally) fitting to a reference frame (supplied with \fB \-s\fR).
+ 
+ 
+ \&With option \fB \-oq\fR the RMSF values are converted to B\-factor
+-\&values, which are written to a pdb file with the coordinates, of the
+-\&structure file, or of a pdb file when \fB \-q\fR is specified.
++\&values, which are written to a \fB .pdb\fR file with the coordinates, of the
++\&structure file, or of a \fB .pdb\fR file when \fB \-q\fR is specified.
+ \&Option \fB \-ox\fR writes the B\-factors to a file with the average
+ \&coordinates.
+ 
+@@ -43,18 +43,18 @@ g_rmsf - calculates atomic fluctuations
+ \&respect to the reference structure is calculated.
+ 
+ 
+-\&With the option \fB aniso\fR g_rmsf will compute anisotropic
++\&With the option \fB \-aniso\fR, \fB g_rmsf\fR will compute anisotropic
+ \&temperature factors and then it will also output average coordinates
+-\&and a pdb file with ANISOU records (corresonding to the \fB \-oq\fR
++\&and a \fB .pdb\fR file with ANISOU records (corresonding to the \fB \-oq\fR
+ \&or \fB \-ox\fR option). Please note that the U values
+-\&are orientation dependent, so before comparison with experimental data
++\&are orientation\-dependent, so before comparison with experimental data
+ \&you should verify that you fit to the experimental coordinates.
+ 
+ 
+-\&When a pdb input file is passed to the program and the \fB \-aniso\fR
++\&When a \fB .pdb\fR input file is passed to the program and the \fB \-aniso\fR
+ \&flag is set
+ \&a correlation plot of the Uij will be created, if any anisotropic
+-\&temperature factors are present in the pdb file.
++\&temperature factors are present in the \fB .pdb\fR file.
+ 
+ 
+ \&With option \fB \-dir\fR the average MSF (3x3) matrix is diagonalized.
+@@ -121,7 +121,7 @@ g_rmsf - calculates atomic fluctuations
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_rotacf.1 b/man/man1/g_rotacf.1
+index 3a42027..0285ff0 100644
+--- a/man/man1/g_rotacf.1
++++ b/man/man1/g_rotacf.1
+@@ -1,8 +1,8 @@
+-.TH g_rotacf 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_rotacf 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_rotacf - calculates the rotational correlation function for molecules
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_rotacf\fP
+ .BI "\-f" " traj.xtc "
+@@ -27,13 +27,13 @@ g_rotacf - calculates the rotational correlation function for molecules
+ .BI "\-beginfit" " real "
+ .BI "\-endfit" " real "
+ .SH DESCRIPTION
+-\&g_rotacf calculates the rotational correlation function
++\&\fB g_rotacf\fR calculates the rotational correlation function
+ \&for molecules. Three atoms (i,j,k) must be given in the index
+-\&file, defining two vectors ij and jk. The rotational acf
++\&file, defining two vectors ij and jk. The rotational ACF
+ \&is calculated as the autocorrelation function of the vector
+ \&n = ij x jk, i.e. the cross product of the two vectors.
+ \&Since three atoms span a plane, the order of the three atoms
+-\&does not matter. Optionally, controlled by the \-d switch, you can
++\&does not matter. Optionally, controlled by the \fB \-d\fR switch, you can
+ \&calculate the rotational correlation function for linear molecules
+ \&by specifying two atoms (i,j) in the index file.
+ \&
+@@ -42,15 +42,14 @@ g_rotacf - calculates the rotational correlation function for molecules
+ \&EXAMPLES
+ 
+ 
+-\&g_rotacf \-P 1 \-nparm 2 \-fft \-n index \-o rotacf\-x\-P1
+-\&\-fa expfit\-x\-P1 \-beginfit 2.5 \-endfit 20.0
++\&\fB g_rotacf \-P 1 \-nparm 2 \-fft \-n index \-o rotacf\-x\-P1
++\&\-fa expfit\-x\-P1 \-beginfit 2.5 \-endfit 20.0\fR
+ 
+ 
+ \&This will calculate the rotational correlation function using a first
+ \&order Legendre polynomial of the angle of a vector defined by the index
+-\&file. The correlation function will be fitted from 2.5 ps till 20.0 ps
+-\&to a two parameter exponential.
+-\&
++\&file. The correlation function will be fitted from 2.5 ps until 20.0 ps
++\&to a two\-parameter exponential.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+ .B Input
+@@ -88,7 +87,7 @@ g_rotacf - calculates the rotational correlation function for molecules
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -109,7 +108,7 @@ g_rotacf - calculates the rotational correlation function for molecules
+  Order of Legendre polynomial for ACF (0 indicates none): \fB 0\fR, \fB 1\fR, \fB 2\fR or \fB 3\fR
+ 
+ .BI "\-fitfn"  " enum" " none" 
+- Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR or \fB exp9\fR
++ Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR, \fB exp9\fR or \fB erffit\fR
+ 
+ .BI "\-ncskip"  " int" " 0" 
+  Skip N points in the output file of correlation functions
+diff --git a/man/man1/g_rotmat.1 b/man/man1/g_rotmat.1
+index cf26c4f..36b3282 100644
+--- a/man/man1/g_rotmat.1
++++ b/man/man1/g_rotmat.1
+@@ -1,8 +1,8 @@
+-.TH g_rotmat 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5-beta4-2010-08-26 09:43:57 +0200-33da7ba-dirty"
++.TH g_rotmat 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_rotmat - plots the rotation matrix for fitting to a reference structure
+ 
+-.B VERSION 4.5-beta4-2010-08-26 09:43:57 +0200-33da7ba-dirty
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_rotmat\fP
+ .BI "\-f" " traj.xtc "
+@@ -22,7 +22,7 @@ g_rotmat - plots the rotation matrix for fitting to a reference structure
+ .BI "\-[no]fitxy" ""
+ .BI "\-[no]mw" ""
+ .SH DESCRIPTION
+-\&g_rotmat plots the rotation matrix required for least squares fitting
++\&\fB g_rotmat\fR plots the rotation matrix required for least squares fitting
+ \&a conformation onto the reference conformation provided with
+ \&\fB \-s\fR. Translation is removed before fitting.
+ \&The output are the three vectors that give the new directions
+@@ -36,7 +36,7 @@ g_rotmat - plots the rotation matrix for fitting to a reference structure
+ \&determining the orientation of a molecule
+ \&at an interface, possibly on a trajectory produced with
+ \&\fB trjconv \-fit rotxy+transxy\fR to remove the rotation
+-\&in the xy\-plane.
++\&in the \fI x\-y\fR plane.
+ \&
+ 
+ 
+@@ -45,12 +45,12 @@ g_rotmat - plots the rotation matrix for fitting to a reference structure
+ \&the lowest sum of RMSD's to all other structures is used.
+ \&Since the computational cost of this procedure grows with
+ \&the square of the number of frames, the \fB \-skip\fR option
+-\&can be useful. A full fit or only a fit in the x/y plane can
++\&can be useful. A full fit or only a fit in the \fI x\-y\fR plane can
+ \&be performed.
+ \&
+ 
+ 
+-\&Option \fB \-fitxy\fR fits in the x/y plane before determining
++\&Option \fB \-fitxy\fR fits in the \fI x\-y\fR plane before determining
+ \&the rotation matrix.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+@@ -89,7 +89,7 @@ g_rotmat - plots the rotation matrix for fitting to a reference structure
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -98,7 +98,7 @@ g_rotmat - plots the rotation matrix for fitting to a reference structure
+  Determine the optimal reference structure: \fB none\fR, \fB xyz\fR or \fB xy\fR
+ 
+ .BI "\-skip"  " int" " 1" 
+- Use every nr\-th frame for \-ref
++ Use every nr\-th frame for \fB \-ref\fR
+ 
+ .BI "\-[no]fitxy"  "no    "
+  Fit the x/y rotation before determining the rotation
+diff --git a/man/man1/g_saltbr.1 b/man/man1/g_saltbr.1
+index 7b845e4..505774f 100644
+--- a/man/man1/g_saltbr.1
++++ b/man/man1/g_saltbr.1
+@@ -1,8 +1,8 @@
+-.TH g_saltbr 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_saltbr 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_saltbr - computes salt bridges
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_saltbr\fP
+ .BI "\-f" " traj.xtc "
+@@ -16,15 +16,16 @@ g_saltbr - computes salt bridges
+ .BI "\-t" " real "
+ .BI "\-[no]sep" ""
+ .SH DESCRIPTION
+-\&g_saltbr plots the distance between all combination of charged groups
++\&\fB g_saltbr\fR plots the distance between all combination of charged groups
+ \&as a function of time. The groups are combined in different ways.
+-\&A minimum distance can be given, (eg. the cut\-off), then groups
++\&A minimum distance can be given (i.e. a cut\-off), such that groups
+ \&that are never closer than that distance will not be plotted.
+ 
+-\&Output will be in a number of fixed filenames, min\-min.xvg, plus\-min.xvg
+-\&and plus\-plus.xvg, or files for every individual ion\-pair if the \fB \-sep\fR
+-\&option is selected. In this case files are named as \fB sb\-ResnameResnr\-Atomnr\fR.
+-\&There may be many such files.
++
++\&Output will be in a number of fixed filenames, \fB min\-min.xvg\fR, \fB plus\-min.xvg\fR
++\&and \fB plus\-plus.xvg\fR, or files for every individual ion pair if the \fB \-sep\fR
++\&option is selected. In this case, files are named as \fB sb\-(Resname)(Resnr)\-(Atomnr)\fR.
++\&There may be \fB many\fR such files.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+ .B Input
+diff --git a/man/man1/g_sas.1 b/man/man1/g_sas.1
+index abfca19..3f5e400 100644
+--- a/man/man1/g_sas.1
++++ b/man/man1/g_sas.1
+@@ -1,8 +1,8 @@
+-.TH g_sas 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_sas 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_sas - computes solvent accessible surface area
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_sas\fP
+ .BI "\-f" " traj.xtc "
+@@ -31,17 +31,17 @@ g_sas - computes solvent accessible surface area
+ .BI "\-[no]prot" ""
+ .BI "\-dgs" " real "
+ .SH DESCRIPTION
+-\&g_sas computes hydrophobic, hydrophilic and total solvent accessible surface area.
+-\&As a side effect the Connolly surface can be generated as well in
+-\&a pdb file where the nodes are represented as atoms and the vertices
++\&\fB g_sas\fR computes hydrophobic, hydrophilic and total solvent accessible surface area.
++\&As a side effect, the Connolly surface can be generated as well in
++\&a \fB .pdb\fR file where the nodes are represented as atoms and the vertices
+ \&connecting the nearest nodes as CONECT records.
+ \&The program will ask for a group for the surface calculation
+ \&and a group for the output. The calculation group should always
+ \&consists of all the non\-solvent atoms in the system.
+ \&The output group can be the whole or part of the calculation group.
+-\&The area can be plotted
++\&The average and standard deviation of the area over the trajectory can be plotted
+ \&per residue and atom as well (options \fB \-or\fR and \fB \-oa\fR).
+-\&In combination with the latter option an \fB itp\fR file can be
++\&In combination with the latter option an \fB .itp\fR file can be
+ \&generated (option \fB \-i\fR)
+ \&which can be used to restrain surface atoms.
+ 
+@@ -55,9 +55,9 @@ g_sas - computes solvent accessible surface area
+ \&Please consider whether the normal probe radius is appropriate
+ \&in this case or whether you would rather use e.g. 0. It is good
+ \&to keep in mind that the results for volume and density are very
+-\&approximate, in e.g. ice Ih one can easily fit water molecules in the
+-\&pores which would yield too low volume, too high surface area and too
+-\&high density.
++\&approximate. For example, in ice Ih, one can easily fit water molecules in the
++\&pores which would yield a volume that is too low, and surface area and density
++\&that are both too high.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+ .B Input
+@@ -115,7 +115,7 @@ g_sas - computes solvent accessible surface area
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -139,10 +139,10 @@ g_sas - computes solvent accessible surface area
+  Take periodicity into account
+ 
+ .BI "\-[no]prot"  "yes   "
+- Output the protein to the connelly pdb file too
++ Output the protein to the Connelly \fB .pdb\fR file too
+ 
+ .BI "\-dgs"  " real" " 0     " 
+- default value for solvation free energy per area (kJ/mol/nm2)
++ Default value for solvation free energy per area (kJ/mol/nm2)
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/g_select.1 b/man/man1/g_select.1
+index ed8ce52..5be4198 100644
+--- a/man/man1/g_select.1
++++ b/man/man1/g_select.1
+@@ -1,8 +1,8 @@
+-.TH g_select 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_select 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_select - selects groups of atoms based on flexible textual selections
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_select\fP
+ .BI "\-f" " traj.xtc "
+@@ -31,7 +31,7 @@ g_select - selects groups of atoms based on flexible textual selections
+ .BI "\-[no]cfnorm" ""
+ .BI "\-resnr" " enum "
+ .SH DESCRIPTION
+-\&g_select writes out basic data about dynamic selections.
++\&\fB g_select\fR writes out basic data about dynamic selections.
+ \&It can be used for some simple analyses, or the output can
+ \&be combined with output from other programs and/or external
+ \&analysis programs to calculate more complex things.
+@@ -66,7 +66,7 @@ g_select - selects groups of atoms based on flexible textual selections
+ 
+ 
+ \&With \fB \-on\fR, the selected atoms are written as a index file
+-\&compatible with make_ndx and the analyzing tools. Each selection
++\&compatible with \fB make_ndx\fR and the analyzing tools. Each selection
+ \&is written as a selection group and for dynamic selections a
+ \&group is written for each frame.
+ 
+diff --git a/man/man1/g_sgangle.1 b/man/man1/g_sgangle.1
+index c7d48d2..d4f551e 100644
+--- a/man/man1/g_sgangle.1
++++ b/man/man1/g_sgangle.1
+@@ -1,8 +1,8 @@
+-.TH g_sgangle 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_sgangle 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_sgangle - computes the angle and distance between two groups
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_sgangle\fP
+ .BI "\-f" " traj.xtc "
+@@ -26,10 +26,10 @@ g_sgangle - computes the angle and distance between two groups
+ \&Compute the angle and distance between two groups. 
+ \&The groups are defined by a number of atoms given in an index file and
+ \&may be two or three atoms in size.
+-\&If \-one is set, only one group should be specified in the index
++\&If \fB \-one\fR is set, only one group should be specified in the index
+ \&file and the angle between this group at time 0 and t will be computed.
+ \&The angles calculated depend on the order in which the atoms are 
+-\&given. Giving for instance 5 6 will rotate the vector 5\-6 with 
++\&given. Giving, for instance, 5 6 will rotate the vector 5\-6 with 
+ \&180 degrees compared to giving 6 5. 
+ 
+ If three atoms are given, 
+@@ -41,13 +41,13 @@ If three atoms are given,
+ 
+ \&Here is what some of the file options do:
+ 
+-\&\-oa: Angle between the two groups specified in the index file. If a group contains three atoms the normal to the plane defined by those three atoms will be used. If a group contains two atoms, the vector defined by those two atoms will be used.
++\&\fB \-oa\fR: Angle between the two groups specified in the index file. If a group contains three atoms the normal to the plane defined by those three atoms will be used. If a group contains two atoms, the vector defined by those two atoms will be used.
+ 
+-\&\-od: Distance between two groups. Distance is taken from the center of one group to the center of the other group.
++\&\fB \-od\fR: Distance between two groups. Distance is taken from the center of one group to the center of the other group.
+ 
+-\&\-od1: If one plane and one vector is given, the distances for each of the atoms from the center of the plane is given separately.
++\&\fB \-od1\fR: If one plane and one vector is given, the distances for each of the atoms from the center of the plane is given separately.
+ 
+-\&\-od2: For two planes this option has no meaning.
++\&\fB \-od2\fR: For two planes this option has no meaning.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+ .B Input
+@@ -97,7 +97,7 @@ If three atoms are given,
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -106,7 +106,7 @@ If three atoms are given,
+  Only one group compute angle between vector at time zero and time t
+ 
+ .BI "\-[no]z"  "no    "
+- Use the Z\-axis as reference
++ Use the \fI z\fR\-axis as reference
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/g_sham.1 b/man/man1/g_sham.1
+index 30d01a1..168cf7b 100644
+--- a/man/man1/g_sham.1
++++ b/man/man1/g_sham.1
+@@ -1,8 +1,8 @@
+-.TH g_sham 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_sham 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_sham - read/write xmgr and xvgr data sets
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_sham\fP
+ .BI "\-f" " graph.xvg "
+@@ -45,19 +45,19 @@ g_sham - read/write xmgr and xvgr data sets
+ .BI "\-nlevels" " int "
+ .BI "\-mname" " string "
+ .SH DESCRIPTION
+-\&g_sham makes multi\-dimensional free\-energy, enthalpy and entropy plots.
+-\&g_sham reads one or more xvg files and analyzes data sets.
+-\&g_sham basic purpose is plotting Gibbs free energy landscapes
++\&\fB g_sham\fR makes multi\-dimensional free\-energy, enthalpy and entropy plots.
++\&\fB g_sham\fR reads one or more \fB .xvg\fR files and analyzes data sets.
++\&The basic purpose of \fB g_sham\fR is to plot Gibbs free energy landscapes
+ \&(option \fB \-ls\fR)
+-\&by Bolzmann inverting multi\-dimensional histograms (option \fB \-lp\fR)
++\&by Bolzmann inverting multi\-dimensional histograms (option \fB \-lp\fR),
+ \&but it can also
+ \&make enthalpy (option \fB \-lsh\fR) and entropy (option \fB \-lss\fR)
+ \&plots. The histograms can be made for any quantities the user supplies.
+ \&A line in the input file may start with a time
+-\&(see option \fB \-time\fR) and any number of y values may follow.
++\&(see option \fB \-time\fR) and any number of \fI y\fR\-values may follow.
+ \&Multiple sets can also be
+ \&read when they are separated by & (option \fB \-n\fR),
+-\&in this case only one y value is read from each line.
++\&in this case only one \fI y\fR\-value is read from each line.
+ \&All lines starting with  and @ are skipped.
+ \&
+ 
+@@ -71,23 +71,23 @@ g_sham - read/write xmgr and xvgr data sets
+ 
+ \&Option \fB \-ene\fR can be used to supply a file with energies.
+ \&These energies are used as a weighting function in the single
+-\&histogram analysis method due to Kumar et. al. When also temperatures
+-\&are supplied (as a second column in the file) an experimental
++\&histogram analysis method by Kumar et al. When temperatures
++\&are supplied (as a second column in the file), an experimental
+ \&weighting scheme is applied. In addition the vales
+ \&are used for making enthalpy and entropy plots.
+ \&
+ 
+ 
+-\&With option \fB \-dim\fR dimensions can be gives for distances.
++\&With option \fB \-dim\fR, dimensions can be gives for distances.
+ \&When a distance is 2\- or 3\-dimensional, the circumference or surface
+ \&sampled by two particles increases with increasing distance.
+ \&Depending on what one would like to show, one can choose to correct
+ \&the histogram and free\-energy for this volume effect.
+-\&The probability is normalized by r and r2 for a dimension of 2 and 3
++\&The probability is normalized by r and r2 for dimensions of 2 and 3, 
+ \&respectively.
+ \&A value of \-1 is used to indicate an angle in degrees between two
+ \&vectors: a sin(angle) normalization will be applied.
+-\&Note that for angles between vectors the inner\-product or cosine
++\&\fB Note\fR that for angles between vectors the inner\-product or cosine
+ \&is the natural quantity to use, as it will produce bins of the same
+ \&volume.
+ .SH FILES
+@@ -158,7 +158,7 @@ g_sham - read/write xmgr and xvgr data sets
+  Set the nicelevel
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_sigeps.1 b/man/man1/g_sigeps.1
+index 24bf17d..7934223 100644
+--- a/man/man1/g_sigeps.1
++++ b/man/man1/g_sigeps.1
+@@ -1,8 +1,8 @@
+-.TH g_sigeps 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_sigeps 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_sigeps - convert c6/12 or c6/cn combinations to and from sigma/epsilon
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_sigeps\fP
+ .BI "\-o" " potje.xvg "
+@@ -23,10 +23,10 @@ g_sigeps - convert c6/12 or c6/cn combinations to and from sigma/epsilon
+ .BI "\-qj" " real "
+ .BI "\-sigfac" " real "
+ .SH DESCRIPTION
+-\&Sigeps is a simple utility that converts c6/c12 or c6/cn combinations
++\&\fB g_sigeps\fR is a simple utility that converts C6/C12 or C6/Cn combinations
+ \&to sigma and epsilon, or vice versa. It can also plot the potential
+-\&in  file. In addition it makes an approximation of a Buckingham potential
+-\&to a Lennard Jones potential.
++\&in  file. In addition, it makes an approximation of a Buckingham potential
++\&to a Lennard\-Jones potential.
+ .SH FILES
+ .BI "\-o" " potje.xvg" 
+ .B Output
+@@ -43,7 +43,7 @@ g_sigeps - convert c6/12 or c6/cn combinations to and from sigma/epsilon
+  Set the nicelevel
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_sorient.1 b/man/man1/g_sorient.1
+index 9289f26..8bd1cd8 100644
+--- a/man/man1/g_sorient.1
++++ b/man/man1/g_sorient.1
+@@ -1,8 +1,8 @@
+-.TH g_sorient 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_sorient 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_sorient - analyzes solvent orientation around solutes
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_sorient\fP
+ .BI "\-f" " traj.xtc "
+@@ -29,17 +29,19 @@ g_sorient - analyzes solvent orientation around solutes
+ .BI "\-rbin" " real "
+ .BI "\-[no]pbc" ""
+ .SH DESCRIPTION
+-\&g_sorient analyzes solvent orientation around solutes.
++\&\fB g_sorient\fR analyzes solvent orientation around solutes.
+ \&It calculates two angles between the vector from one or more
+ \&reference positions to the first atom of each solvent molecule:
+ 
++
+ \&theta1: the angle with the vector from the first atom of the solvent
+ \&molecule to the midpoint between atoms 2 and 3.
+ 
+ \&theta2: the angle with the normal of the solvent plane, defined by the
+-\&same three atoms, or when the option \fB \-v23\fR is set
++\&same three atoms, or, when the option \fB \-v23\fR is set, 
+ \&the angle with the vector between atoms 2 and 3.
+ 
++
+ \&The reference can be a set of atoms or
+ \&the center of mass of a set of atoms. The group of solvent atoms should
+ \&consist of 3 atoms per solvent molecule.
+@@ -115,7 +117,7 @@ g_sorient - analyzes solvent orientation around solutes
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_spatial.1 b/man/man1/g_spatial.1
+index cab6fbc..46439a6 100644
+--- a/man/man1/g_spatial.1
++++ b/man/man1/g_spatial.1
+@@ -1,8 +1,8 @@
+-.TH g_spatial 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_spatial 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+-g_spatial - calculates the spatial distribution function (more control than g_sdf)
++g_spatial - calculates the spatial distribution function
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_spatial\fP
+ .BI "\-s" " topol.tpr "
+@@ -21,57 +21,57 @@ g_spatial - calculates the spatial distribution function (more control than g_sd
+ .BI "\-bin" " real "
+ .BI "\-nab" " int "
+ .SH DESCRIPTION
+-\&g_spatial calculates the spatial distribution function and 
++\&\fB g_spatial\fR calculates the spatial distribution function and 
+ \&outputs it in a form that can be read by VMD as Gaussian98 cube format. 
+-\&This was developed from template.c (gromacs\-3.3). 
+-\&For a system of 32K atoms and a 50ns trajectory, the SDF can be generated 
++\&This was developed from template.c (GROMACS\-3.3). 
++\&For a system of 32,000 atoms and a 50 ns trajectory, the SDF can be generated 
+ \&in about 30 minutes, with most of the time dedicated to the two runs through 
+-\&trjconv that are required to center everything properly. 
+-\&This also takes a whole bunch of space (3 copies of the xtc file). 
++\&\fB trjconv\fR that are required to center everything properly. 
++\&This also takes a whole bunch of space (3 copies of the \fB .xtc\fR file). 
+ \&Still, the pictures are pretty and very informative when the fitted selection is properly made. 
+-\&3\-4 atoms in a widely mobile group like a free amino acid in solution works 
++\&3\-4 atoms in a widely mobile group (like a free amino acid in solution) works 
+ \&well, or select the protein backbone in a stable folded structure to get the SDF 
+ \&of solvent and look at the time\-averaged solvation shell. 
+-\&It is also possible using this program to generate the SDF based on some arbitrarty 
+-\&Cartesian coordinate. To do that, simply omit the preliminary trjconv steps. 
++\&It is also possible using this program to generate the SDF based on some arbitrary 
++\&Cartesian coordinate. To do that, simply omit the preliminary \fB trjconv\fR steps. 
+ 
+ \&USAGE: 
+ 
+-\&1. Use make_ndx to create a group containing the atoms around which you want the SDF 
++\&1. Use \fB make_ndx\fR to create a group containing the atoms around which you want the SDF 
+ 
+-\&2. trjconv \-s a.tpr \-f a.xtc \-o b.xtc \-center tric \-ur compact \-pbc none 
++\&2. \fB trjconv \-s a.tpr \-f a.xtc \-o b.xtc \-center tric \-ur compact \-pbc none\fR 
+ 
+-\&3. trjconv \-s a.tpr \-f b.xtc \-o c.xtc \-fit rot+trans 
++\&3. \fB trjconv \-s a.tpr \-f b.xtc \-o c.xtc \-fit rot+trans\fR 
+ 
+-\&4. run g_spatial on the xtc output of step 3. 
++\&4. run \fB g_spatial\fR on the \fB .xtc\fR output of step 3. 
+ 
+-\&5. Load grid.cube into VMD and view as an isosurface. 
++\&5. Load \fB grid.cube\fR into VMD and view as an isosurface. 
+ 
+-\&*** Systems such as micelles will require trjconv \-pbc cluster between steps 1 and 2
++\&\fB Note\fR that systems such as micelles will require \fB trjconv \-pbc cluster\fR between steps 1 and 2
+ 
+-\&WARNINGS: 
++\&WARNINGS:
+ 
+ \&The SDF will be generated for a cube that contains all bins that have some non\-zero occupancy. 
+-\&However, the preparatory \-fit rot+trans option to trjconv implies that your system will be rotating 
++\&However, the preparatory \fB \-fit rot+trans\fR option to \fB trjconv\fR implies that your system will be rotating 
+ \&and translating in space (in order that the selected group does not). Therefore the values that are 
+ \&returned will only be valid for some region around your central group/coordinate that has full overlap 
+ \&with system volume throughout the entire translated/rotated system over the course of the trajectory. 
+ \&It is up to the user to ensure that this is the case. 
+ 
+-\&BUGS: 
++\&BUGS:
+ 
+ \&When the allocated memory is not large enough, a segmentation fault may occur. This is usually detected 
+-\&and the program is halted prior to the fault while displaying a warning message suggesting the use of the \-nab 
++\&and the program is halted prior to the fault while displaying a warning message suggesting the use of the \fB \-nab\fR (Number of Additional Bins)
+ \&option. However, the program does not detect all such events. If you encounter a segmentation fault, run it again 
+-\&with an increased \-nab value. 
++\&with an increased \fB \-nab\fR value. 
+ 
+-\&RISKY OPTIONS: 
++\&RISKY OPTIONS:
+ 
+ \&To reduce the amount of space and time required, you can output only the coords 
+-\&that are going to be used in the first and subsequent run through trjconv. 
+-\&However, be sure to set the \-nab option to a sufficiently high value since 
+-\&memory is allocated for cube bins based on the initial coords and the \-nab 
+-\&(Number of Additional Bins) option value. 
++\&that are going to be used in the first and subsequent run through \fB trjconv\fR. 
++\&However, be sure to set the \fB \-nab\fR option to a sufficiently high value since 
++\&memory is allocated for cube bins based on the initial coordinates and the \fB \-nab\fR 
++\&option value. 
+ 
+ .SH FILES
+ .BI "\-s" " topol.tpr" 
+@@ -106,13 +106,13 @@ g_spatial - calculates the spatial distribution function (more control than g_sd
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-[no]pbc"  "no    "
+  Use periodic boundary conditions for computing distances
+ 
+ .BI "\-[no]div"  "yes   "
+- Calculate and apply the divisor for bin occupancies based on atoms/minimal cube size. Set as TRUE for visualization and as FALSE (\-nodiv) to get accurate counts per frame
++ Calculate and apply the divisor for bin occupancies based on atoms/minimal cube size. Set as TRUE for visualization and as FALSE (\fB \-nodiv\fR) to get accurate counts per frame
+ 
+ .BI "\-ign"  " int" " \-1" 
+  Do not display this number of outer cubes (positive values may reduce boundary speckles; \-1 ensures outer surface is visible)
+diff --git a/man/man1/g_spol.1 b/man/man1/g_spol.1
+index 9670024..4aca26b 100644
+--- a/man/man1/g_spol.1
++++ b/man/man1/g_spol.1
+@@ -1,8 +1,8 @@
+-.TH g_spol 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_spol 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_spol - analyzes solvent dipole orientation and polarization around solutes
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_spol\fP
+ .BI "\-f" " traj.xtc "
+@@ -24,7 +24,7 @@ g_spol - analyzes solvent dipole orientation and polarization around solutes
+ .BI "\-dip" " real "
+ .BI "\-bw" " real "
+ .SH DESCRIPTION
+-\&g_spol analyzes dipoles around a solute; it is especially useful
++\&\fB g_spol\fR analyzes dipoles around a solute; it is especially useful
+ \&for polarizable water. A group of reference atoms, or a center
+ \&of mass reference (option \fB \-com\fR) and a group of solvent
+ \&atoms is required. The program splits the group of solvent atoms
+@@ -35,7 +35,7 @@ g_spol - analyzes solvent dipole orientation and polarization around solutes
+ \&the inner product of the distance vector
+ \&and the dipole of the solvent molecule is determined.
+ \&For solvent molecules with net charge (ions), the net charge of the ion
+-\&is subtracted evenly at all atoms in the selection of each ion.
++\&is subtracted evenly from all atoms in the selection of each ion.
+ \&The average of these dipole components is printed.
+ \&The same is done for the polarization, where the average dipole is
+ \&subtracted from the instantaneous dipole. The magnitude of the average
+@@ -79,7 +79,7 @@ g_spol - analyzes solvent dipole orientation and polarization around solutes
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+diff --git a/man/man1/g_tcaf.1 b/man/man1/g_tcaf.1
+index 84bb83f..c208f14 100644
+--- a/man/man1/g_tcaf.1
++++ b/man/man1/g_tcaf.1
+@@ -1,8 +1,8 @@
+-.TH g_tcaf 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_tcaf 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_tcaf - calculates viscosities of liquids
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_tcaf\fP
+ .BI "\-f" " traj.trr "
+@@ -33,36 +33,36 @@ g_tcaf - calculates viscosities of liquids
+ .BI "\-beginfit" " real "
+ .BI "\-endfit" " real "
+ .SH DESCRIPTION
+-\&g_tcaf computes tranverse current autocorrelations.
+-\&These are used to estimate the shear viscosity eta.
+-\&For details see: Palmer, JCP 49 (1994) pp 359\-366.
++\&\fB g_tcaf\fR computes tranverse current autocorrelations.
++\&These are used to estimate the shear viscosity, eta.
++\&For details see: Palmer, Phys. Rev. E 49 (1994) pp 359\-366.
+ 
+ 
+ \&Transverse currents are calculated using the
+-\&k\-vectors (1,0,0) and (2,0,0) each also in the y\- and z\-direction,
++\&k\-vectors (1,0,0) and (2,0,0) each also in the \fI y\fR\- and \fI z\fR\-direction,
+ \&(1,1,0) and (1,\-1,0) each also in the 2 other planes (these vectors
+ \&are not independent) and (1,1,1) and the 3 other box diagonals (also
+ \&not independent). For each k\-vector the sine and cosine are used, in
+ \&combination with the velocity in 2 perpendicular directions. This gives
+ \&a total of 16*2*2=64 transverse currents. One autocorrelation is
+-\&calculated fitted for each k\-vector, which gives 16 tcaf's. Each of
+-\&these tcaf's is fitted to f(t) = exp(\-v)(cosh(Wv) + 1/W sinh(Wv)),
+-\&v = \-t/(2 tau), W = sqrt(1 \- 4 tau eta/rho k2), which gives 16 tau's
+-\&and eta's. The fit weights decay with time as exp(\-t/wt), the tcaf and
++\&calculated fitted for each k\-vector, which gives 16 TCAF's. Each of
++\&these TCAF's is fitted to f(t) = exp(\-v)(cosh(Wv) + 1/W sinh(Wv)),
++\&v = \-t/(2 tau), W = sqrt(1 \- 4 tau eta/rho k2), which gives 16 values of tau
++\&and eta. The fit weights decay with time as exp(\-t/wt), and the TCAF and
+ \&fit are calculated up to time 5*wt.
+-\&The eta's should be fitted to 1 \- a eta(k) k2, from which
++\&The eta values should be fitted to 1 \- a eta(k) k2, from which
+ \&one can estimate the shear viscosity at k=0.
+ 
+ 
+ \&When the box is cubic, one can use the option \fB \-oc\fR, which
+-\&averages the tcaf's over all k\-vectors with the same length.
++\&averages the TCAF's over all k\-vectors with the same length.
+ \&This results in more accurate tcaf's.
+-\&Both the cubic tcaf's and fits are written to \fB \-oc\fR
++\&Both the cubic TCAF's and fits are written to \fB \-oc\fR
+ \&The cubic eta estimates are also written to \fB \-ov\fR.
+ 
+ 
+-\&With option \fB \-mol\fR the transverse current is determined of
+-\&molecules instead of atoms. In this case the index group should
++\&With option \fB \-mol\fR, the transverse current is determined of
++\&molecules instead of atoms. In this case, the index group should
+ \&consist of molecule numbers instead of atom numbers.
+ 
+ 
+@@ -71,7 +71,7 @@ g_tcaf - calculates viscosities of liquids
+ \&infinite wavelength.
+ 
+ 
+-\&NOTE: make sure you write coordinates and velocities often enough.
++\&\fB Note:\fR make sure you write coordinates and velocities often enough.
+ \&The initial, non\-exponential, part of the autocorrelation function
+ \&is very important for obtaining a good fit.
+ .SH FILES
+@@ -131,7 +131,7 @@ g_tcaf - calculates viscosities of liquids
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -155,7 +155,7 @@ g_tcaf - calculates viscosities of liquids
+  Order of Legendre polynomial for ACF (0 indicates none): \fB 0\fR, \fB 1\fR, \fB 2\fR or \fB 3\fR
+ 
+ .BI "\-fitfn"  " enum" " none" 
+- Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR or \fB exp9\fR
++ Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR, \fB exp9\fR or \fB erffit\fR
+ 
+ .BI "\-ncskip"  " int" " 0" 
+  Skip N points in the output file of correlation functions
+diff --git a/man/man1/g_traj.1 b/man/man1/g_traj.1
+index b1d0f99..3b1d73b 100644
+--- a/man/man1/g_traj.1
++++ b/man/man1/g_traj.1
+@@ -1,8 +1,8 @@
+-.TH g_traj 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_traj 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_traj - plots x, v and f of selected atoms/groups (and more) from a trajectory
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_traj\fP
+ .BI "\-f" " traj.xtc "
+@@ -41,9 +41,10 @@ g_traj - plots x, v and f of selected atoms/groups (and more) from a trajectory
+ .BI "\-[no]len" ""
+ .BI "\-[no]fp" ""
+ .BI "\-bin" " real "
++.BI "\-ctime" " real "
+ .BI "\-scale" " real "
+ .SH DESCRIPTION
+-\&g_traj plots coordinates, velocities, forces and/or the box.
++\&\fB g_traj\fR plots coordinates, velocities, forces and/or the box.
+ \&With \fB \-com\fR the coordinates, velocities and forces are
+ \&calculated for the center of mass of each group.
+ \&When \fB \-mol\fR is set, the numbers in the index file are
+@@ -64,15 +65,16 @@ g_traj - plots x, v and f of selected atoms/groups (and more) from a trajectory
+ 
+ 
+ \&Options \fB \-cv\fR and \fB \-cf\fR write the average velocities
+-\&and average forces as temperature factors to a pdb file with
+-\&the average coordinates. The temperature factors are scaled such
+-\&that the maximum is 10. The scaling can be changed with the option
+-\&\fB \-scale\fR. To get the velocities or forces of one
++\&and average forces as temperature factors to a \fB .pdb\fR file with
++\&the average coordinates or the coordinates at \fB \-ctime\fR.
++\&The temperature factors are scaled such that the maximum is 10.
++\&The scaling can be changed with the option \fB \-scale\fR.
++\&To get the velocities or forces of one
+ \&frame set both \fB \-b\fR and \fB \-e\fR to the time of
+ \&desired frame. When averaging over frames you might need to use
+ \&the \fB \-nojump\fR option to obtain the correct average coordinates.
+ \&If you select either of these option the average force and velocity
+-\&for each atom are written to an xvg file as well
++\&for each atom are written to an \fB .xvg\fR file as well
+ \&(specified with \fB \-av\fR or \fB \-af\fR).
+ 
+ 
+@@ -167,7 +169,7 @@ g_traj - plots x, v and f of selected atoms/groups (and more) from a trajectory
+  Time unit: \fB fs\fR, \fB ps\fR, \fB ns\fR, \fB us\fR, \fB ms\fR or \fB s\fR
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -205,8 +207,11 @@ g_traj - plots x, v and f of selected atoms/groups (and more) from a trajectory
+ .BI "\-bin"  " real" " 1     " 
+  Binwidth for velocity histogram (nm/ps)
+ 
++.BI "\-ctime"  " real" " \-1    " 
++ Use frame at this time for x in \fB \-cv\fR and \fB \-cf\fR instead of the average x
++
+ .BI "\-scale"  " real" " 0     " 
+- Scale factor for pdb output, 0 is autoscale
++ Scale factor for \fB .pdb\fR output, 0 is autoscale
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/g_tune_pme.1 b/man/man1/g_tune_pme.1
+index 6601032..fe62f5a 100644
+--- a/man/man1/g_tune_pme.1
++++ b/man/man1/g_tune_pme.1
+@@ -1,8 +1,8 @@
+-.TH g_tune_pme 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_tune_pme 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_tune_pme - time mdrun as a function of PME nodes to optimize settings
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_tune_pme\fP
+ .BI "\-p" " perf.out "
+@@ -65,6 +65,7 @@ g_tune_pme - time mdrun as a function of PME nodes to optimize settings
+ .BI "\-max" " real "
+ .BI "\-min" " real "
+ .BI "\-npme" " enum "
++.BI "\-fix" " int "
+ .BI "\-upfac" " real "
+ .BI "\-downfac" " real "
+ .BI "\-ntpr" " int "
+@@ -96,12 +97,12 @@ g_tune_pme - time mdrun as a function of PME nodes to optimize settings
+ .BI "\-[no]ionize" ""
+ .SH DESCRIPTION
+ \&For a given number \fB \-np\fR or \fB \-nt\fR of processors/threads, this program systematically
+-\&times mdrun with various numbers of PME\-only nodes and determines
++\&times \fB mdrun\fR with various numbers of PME\-only nodes and determines
+ \&which setting is fastest. It will also test whether performance can
+ \&be enhanced by shifting load from the reciprocal to the real space
+ \&part of the Ewald sum. 
+-\&Simply pass your \fB .tpr\fR file to g_tune_pme together with other options
+-\&for mdrun as needed.
++\&Simply pass your \fB .tpr\fR file to \fB g_tune_pme\fR together with other options
++\&for \fB mdrun\fR as needed.
+ 
+ 
+ \&Which executables are used can be set in the environment variables
+@@ -109,23 +110,25 @@ g_tune_pme - time mdrun as a function of PME nodes to optimize settings
+ \&will be used as defaults. Note that for certain MPI frameworks you
+ \&need to provide a machine\- or hostfile. This can also be passed
+ \&via the MPIRUN variable, e.g.
+-\&'export MPIRUN="/usr/local/mpirun \-machinefile hosts"'
+ 
+ 
+-\&Please call g_tune_pme with the normal options you would pass to
+-\&mdrun and add \fB \-np\fR for the number of processors to perform the
++\&\fB export MPIRUN="/usr/local/mpirun \-machinefile hosts"\fR
++
++
++\&Please call \fB g_tune_pme\fR with the normal options you would pass to
++\&\fB mdrun\fR and add \fB \-np\fR for the number of processors to perform the
+ \&tests on, or \fB \-nt\fR for the number of threads. You can also add \fB \-r\fR
+ \&to repeat each test several times to get better statistics. 
+ 
+ 
+-\&g_tune_pme can test various real space / reciprocal space workloads
++\&\fB g_tune_pme\fR can test various real space / reciprocal space workloads
+ \&for you. With \fB \-ntpr\fR you control how many extra \fB .tpr\fR files will be
+ \&written with enlarged cutoffs and smaller fourier grids respectively.
+-\&Typically, the first test (no. 0) will be with the settings from the input
+-\&\fB .tpr\fR file; the last test (no. \fB ntpr\fR) will have cutoffs multiplied
++\&Typically, the first test (number 0) will be with the settings from the input
++\&\fB .tpr\fR file; the last test (number \fB ntpr\fR) will have cutoffs multiplied
+ \&by (and at the same time fourier grid dimensions divided by) the scaling
+-\&factor \fB \-fac\fR (default 1.2). The remaining \fB .tpr\fR files will have equally
+-\&spaced values inbetween these extremes. Note that you can set \fB \-ntpr\fR to 1
++\&factor \fB \-fac\fR (default 1.2). The remaining \fB .tpr\fR files will have about 
++\&equally\-spaced values in between these extremes. \fB Note\fR that you can set \fB \-ntpr\fR to 1
+ \&if you just want to find the optimal number of PME\-only nodes; in that case
+ \&your input \fB .tpr\fR file will remain unchanged.
+ 
+@@ -136,15 +139,15 @@ g_tune_pme - time mdrun as a function of PME nodes to optimize settings
+ \&are by default reset after 100 steps. For large systems
+ \&(1M atoms) you may have to set \fB \-resetstep\fR to a higher value.
+ \&From the 'DD' load imbalance entries in the md.log output file you
+-\&can tell after how many steps the load is sufficiently balanced.
++\&can tell after how many steps the load is sufficiently balanced. Example call:
+ 
+-Example call: \fB g_tune_pme \-np 64 \-s protein.tpr \-launch\fR
++\fB g_tune_pme \-np 64 \-s protein.tpr \-launch\fR
+ 
+ 
+-\&After calling mdrun several times, detailed performance information
+-\&is available in the output file perf.out. 
+-\&Note that during the benchmarks a couple of temporary files are written
+-\&(options \-b*), these will be automatically deleted after each test.
++\&After calling \fB mdrun\fR several times, detailed performance information
++\&is available in the output file \fB perf.out.\fR 
++\&\fB Note\fR that during the benchmarks, a couple of temporary files are written
++\&(options \fB \-b\fR*), these will be automatically deleted after each test.
+ 
+ 
+ \&If you want the simulation to be started automatically with the
+@@ -365,7 +368,7 @@ Example call: \fB g_tune_pme \-np 64 \-s protein.tpr \-launch\fR
+  Number of nodes to run the tests on (must be  2 for separate PME nodes)
+ 
+ .BI "\-npstring"  " enum" " \-np" 
+- Specify the number of processors to $MPIRUN using this string: \fB \-np\fR, \fB \-n\fR or \fB none\fR
++ Specify the number of processors to \fB $MPIRUN\fR using this string: \fB \-np\fR, \fB \-n\fR or \fB none\fR
+ 
+ .BI "\-nt"  " int" " 1" 
+  Number of threads to run the tests on (turns MPI & mpirun off)
+@@ -380,7 +383,10 @@ Example call: \fB g_tune_pme \-np 64 \-s protein.tpr \-launch\fR
+  Min fraction of PME nodes to test with
+ 
+ .BI "\-npme"  " enum" " auto" 
+- Benchmark all possible values for \-npme or just the subset that is expected to perform well: \fB auto\fR, \fB all\fR or \fB subset\fR
++ Benchmark all possible values for \fB \-npme\fR or just the subset that is expected to perform well: \fB auto\fR, \fB all\fR or \fB subset\fR
++
++.BI "\-fix"  " int" " \-2" 
++ If = \-1, do not vary the number of PME\-only nodes, instead use this fixed value and only vary rcoulomb and the PME grid spacing.
+ 
+ .BI "\-upfac"  " real" " 1.2   " 
+  Upper limit for rcoulomb scaling factor (Note that rcoulomb upscaling results in fourier grid downscaling)
+@@ -389,19 +395,19 @@ Example call: \fB g_tune_pme \-np 64 \-s protein.tpr \-launch\fR
+  Lower limit for rcoulomb scaling factor
+ 
+ .BI "\-ntpr"  " int" " 0" 
+- Number of tpr files to benchmark. Create these many files with scaling factors ranging from 1.0 to fac. If  1, automatically choose the number of tpr files to test
++ Number of \fB .tpr\fR files to benchmark. Create this many files with scaling factors ranging from 1.0 to fac. If  1, automatically choose the number of \fB .tpr\fR files to test
+ 
+ .BI "\-four"  " real" " 0     " 
+- Use this fourierspacing value instead of the grid found in the tpr input file. (Spacing applies to a scaling factor of 1.0 if multiple tpr files are written)
++ Use this fourierspacing value instead of the grid found in the \fB .tpr\fR input file. (Spacing applies to a scaling factor of 1.0 if multiple \fB .tpr\fR files are written)
+ 
+ .BI "\-steps"  " step" " 1000" 
+- Take timings for these many steps in the benchmark runs
++ Take timings for this many steps in the benchmark runs
+ 
+ .BI "\-resetstep"  " int" " 100" 
+- Let dlb equilibrate these many steps before timings are taken (reset cycle counters after these many steps)
++ Let dlb equilibrate this many steps before timings are taken (reset cycle counters after this many steps)
+ 
+ .BI "\-simsteps"  " step" " \-1" 
+- If non\-negative, perform these many steps in the real run (overwrite nsteps from tpr, add cpt steps)
++ If non\-negative, perform this many steps in the real run (overwrites nsteps from \fB .tpr\fR, add \fB .cpt\fR steps)
+ 
+ .BI "\-[no]launch"  "no    "
+  Lauch the real simulation after optimization
+@@ -467,7 +473,7 @@ Example call: \fB g_tune_pme \-np 64 \-s protein.tpr \-launch\fR
+  Seed for replica exchange, \-1 is generate a seed
+ 
+ .BI "\-[no]ionize"  "no    "
+- Do a simulation including the effect of an X\-Ray bombardment on your system
++ Do a simulation including the effect of an X\-ray bombardment on your system
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/g_vanhove.1 b/man/man1/g_vanhove.1
+index 66df424..4008a1a 100644
+--- a/man/man1/g_vanhove.1
++++ b/man/man1/g_vanhove.1
+@@ -1,8 +1,8 @@
+-.TH g_vanhove 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_vanhove 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_vanhove - calculates Van Hove displacement functions
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_vanhove\fP
+ .BI "\-f" " traj.xtc "
+@@ -30,10 +30,10 @@ g_vanhove - calculates Van Hove displacement functions
+ .BI "\-rt" " real "
+ .BI "\-ft" " int "
+ .SH DESCRIPTION
+-\&g_vanhove computes the Van Hove correlation function.
++\&\fB g_vanhove\fR computes the Van Hove correlation function.
+ \&The Van Hove G(r,t) is the probability that a particle that is at r0
+ \&at time zero can be found at position r0+r at time t.
+-\&g_vanhove determines G not for a vector r, but for the length of r.
++\&\fB g_vanhove\fR determines G not for a vector r, but for the length of r.
+ \&Thus it gives the probability that a particle moves a distance of r
+ \&in time t.
+ \&Jumps across the periodic boundaries are removed.
+@@ -112,7 +112,7 @@ g_vanhove - calculates Van Hove displacement functions
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -127,7 +127,7 @@ g_vanhove - calculates Van Hove displacement functions
+  Maximum r in the matrix (nm)
+ 
+ .BI "\-rbin"  " real" " 0.01  " 
+- Binwidth in the matrix and for \-or (nm)
++ Binwidth in the matrix and for \fB \-or\fR (nm)
+ 
+ .BI "\-mmax"  " real" " 0     " 
+  Maximum density in the matrix, 0 is calculate (1/nm)
+@@ -136,16 +136,16 @@ g_vanhove - calculates Van Hove displacement functions
+  Number of levels in the matrix
+ 
+ .BI "\-nr"  " int" " 1" 
+- Number of curves for the \-or output
++ Number of curves for the \fB \-or\fR output
+ 
+ .BI "\-fr"  " int" " 0" 
+- Frame spacing for the \-or output
++ Frame spacing for the \fB \-or\fR output
+ 
+ .BI "\-rt"  " real" " 0     " 
+- Integration limit for the \-ot output (nm)
++ Integration limit for the \fB \-ot\fR output (nm)
+ 
+ .BI "\-ft"  " int" " 0" 
+- Number of frames in the \-ot output, 0 is plot all
++ Number of frames in the \fB \-ot\fR output, 0 is plot all
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/g_velacc.1 b/man/man1/g_velacc.1
+index 86c4ab8..6a25e52 100644
+--- a/man/man1/g_velacc.1
++++ b/man/man1/g_velacc.1
+@@ -1,8 +1,8 @@
+-.TH g_velacc 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_velacc 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_velacc - calculates velocity autocorrelation functions
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_velacc\fP
+ .BI "\-f" " traj.trr "
+@@ -27,7 +27,7 @@ g_velacc - calculates velocity autocorrelation functions
+ .BI "\-beginfit" " real "
+ .BI "\-endfit" " real "
+ .SH DESCRIPTION
+-\&g_velacc computes the velocity autocorrelation function.
++\&\fB g_velacc\fR computes the velocity autocorrelation function.
+ \&When the \fB \-m\fR option is used, the momentum autocorrelation
+ \&function is calculated.
+ 
+@@ -72,7 +72,7 @@ g_velacc - calculates velocity autocorrelation functions
+  Only use frame when t MOD dt = first time (ps)
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -93,7 +93,7 @@ g_velacc - calculates velocity autocorrelation functions
+  Order of Legendre polynomial for ACF (0 indicates none): \fB 0\fR, \fB 1\fR, \fB 2\fR or \fB 3\fR
+ 
+ .BI "\-fitfn"  " enum" " none" 
+- Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR or \fB exp9\fR
++ Fit function: \fB none\fR, \fB exp\fR, \fB aexp\fR, \fB exp_exp\fR, \fB vac\fR, \fB exp5\fR, \fB exp7\fR, \fB exp9\fR or \fB erffit\fR
+ 
+ .BI "\-ncskip"  " int" " 0" 
+  Skip N points in the output file of correlation functions
+diff --git a/man/man1/g_wham.1 b/man/man1/g_wham.1
+index 98c591e..ffb9ae4 100644
+--- a/man/man1/g_wham.1
++++ b/man/man1/g_wham.1
+@@ -1,8 +1,8 @@
+-.TH g_wham 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_wham 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_wham - weighted histogram analysis after umbrella sampling
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_wham\fP
+ .BI "\-ix" " pullx\-files.dat "
+@@ -11,10 +11,11 @@ g_wham - weighted histogram analysis after umbrella sampling
+ .BI "\-ip" " pdo\-files.dat "
+ .BI "\-o" " profile.xvg "
+ .BI "\-hist" " histo.xvg "
++.BI "\-oiact" " iact.xvg "
++.BI "\-iiact" " iact\-in.dat "
+ .BI "\-bsres" " bsResult.xvg "
+ .BI "\-bsprof" " bsProfs.xvg "
+ .BI "\-tab" " umb\-pot.dat "
+-.BI "\-wcorr" " cycl\-corr.xvg "
+ .BI "\-[no]h" ""
+ .BI "\-[no]version" ""
+ .BI "\-nice" " int "
+@@ -34,14 +35,15 @@ g_wham - weighted histogram analysis after umbrella sampling
+ .BI "\-[no]log" ""
+ .BI "\-unit" " enum "
+ .BI "\-zprof0" " real "
+-.BI "\-cycl" " enum "
+-.BI "\-alpha" " real "
+-.BI "\-[no]flip" ""
+-.BI "\-[no]hist\-eq" ""
++.BI "\-[no]cycl" ""
++.BI "\-[no]sym" ""
++.BI "\-[no]ac" ""
++.BI "\-acsig" " real "
++.BI "\-ac\-trestart" " real "
+ .BI "\-nBootstrap" " int "
+-.BI "\-bs\-dt" " real "
++.BI "\-bs\-method" " enum "
++.BI "\-bs\-tau" " real "
+ .BI "\-bs\-seed" " int "
+-.BI "\-[no]histbs" ""
+ .BI "\-histbs\-block" " int "
+ .BI "\-[no]vbs" ""
+ .SH DESCRIPTION
+@@ -51,24 +53,24 @@ g_wham - weighted histogram analysis after umbrella sampling
+ \&compute a potential of mean force (PMF). 
+ 
+ 
+-\&At present, three input modes are supported:
++\&At present, three input modes are supported.
+ 
+ \&\fB *\fR With option \fB \-it\fR, the user provides a file which contains the
+-\&  filenames of the umbrella simulation run\-input files (tpr files),
+-\&  AND, with option \-ix, a file which contains filenames of
+-\&  the pullx mdrun output files. The tpr and pullx files must
+-\&  be in corresponding order, i.e. the first tpr created the
+-\&  first pullx, etc.
++\& file names of the umbrella simulation run\-input files (\fB .tpr\fR files),
++\& AND, with option \fB \-ix\fR, a file which contains file names of
++\& the pullx \fB mdrun\fR output files. The \fB .tpr\fR and pullx files must
++\& be in corresponding order, i.e. the first \fB .tpr\fR created the
++\& first pullx, etc.
+ 
+ \&\fB *\fR Same as the previous input mode, except that the the user
+-\&  provides the pull force ouput file names (pullf.xvg) with option \-if.
+-\&  From the pull force the position in the ubrella potential is
+-\&  computed. This does not work with tabulated umbrella potentials.
+-\&\fB *\fR With option \fB \-ip\fR, the user provides filenames of (gzipped) pdo files, i.e.
+-\&  the gromacs 3.3 umbrella output files. If you have some unusual
+-\&  reaction coordinate you may also generate your own pdo files and
+-\&  feed them with the \-ip option into to g_wham. The pdo file header
+-\&  must be similar to the folowing:
++\& provides the pull force output file names (\fB pullf.xvg\fR) with option \fB \-if\fR.
++\& From the pull force the position in the umbrella potential is
++\& computed. This does not work with tabulated umbrella potentials.
++\fB *\fR With option \fB \-ip\fR, the user provides file names of (gzipped) \fB .pdo\fR files, i.e.
++\& the GROMACS 3.3 umbrella output files. If you have some unusual reaction coordinate you may also generate your own \fB .pdo\fR files and
++\& feed them with the \fB \-ip\fR option into to \fB g_wham\fR. The \fB .pdo\fR file header
++\& must be similar to the following:
++
+ 
+ \&\fB  UMBRELLA      3.0
+ 
+@@ -86,95 +88,134 @@ g_wham - weighted histogram analysis after umbrella sampling
+ 
+ \&\fR
+ 
+-\&  Nr of pull groups, umbrella positions, force constants, and names
+-\&  may (of course) differ. Following the header, a time column and
+-\&  a data columns for each pull group follow (i.e. the displacement
+-\&  with respect to the umbrella center). Up to four pull groups are possible
+-\&  at present.
++
++\&The number of pull groups, umbrella positions, force constants, and names 
++\&may (of course) differ. Following the header, a time column and 
++\&a data column for each pull group follows (i.e. the displacement
++\&with respect to the umbrella center). Up to four pull groups are possible 
++\&per \fB .pdo\fR file at present.
+ 
+ 
+ \&By default, the output files are
+ 
+ \&  \fB \-o\fR      PMF output file
+ 
+-\&  \fB \-hist\fR   histograms output file
++\&  \fB \-hist\fR   Histograms output file
++
++\&Always check whether the histograms sufficiently overlap.
+ 
+ 
+ \&The umbrella potential is assumed to be harmonic and the force constants are 
+-\&read from the tpr or pdo files. If a non\-harmonic umbrella force was applied 
+-\&a tabulated potential can be provied with \-tab.
++\&read from the \fB .tpr\fR or \fB .pdo\fR files. If a non\-harmonic umbrella force was applied 
++\&a tabulated potential can be provided with \fB \-tab\fR.
+ 
+ 
+ \&WHAM OPTIONS
++\-\-\-\-\-\-\-\-\-\-\-\-
+ 
+-
+-\&  \fB \-bins\fR   Nr of bins used in analysis
++\&  \fB \-bins\fR   Number of bins used in analysis
+ 
+ \&  \fB \-temp\fR   Temperature in the simulations
+ 
+ \&  \fB \-tol\fR    Stop iteration if profile (probability) changed less than tolerance
+ 
+-\&  \fB \-auto\fR   Automatic determination of boudndaries
++\&  \fB \-auto\fR   Automatic determination of boundaries
+ 
+ \&  \fB \-min,\-max\fR   Boundaries of the profile 
+ 
+-\&The data points which are used 
+-\&to compute the profile can be restricted with options \-b, \-e, and \-dt. 
+-\&Play particularly with \-b to ensure sufficient equilibration in each 
+-\&umbrella window!
+-
+-
+-\&With \-log (default) the profile is written in energy units, otherwise (\-nolog) as 
+-\&probability. The unit can be specified with \-unit. With energy output, 
+-\&the energy in the first bin is defined to be zero. If you want the free energy at a different 
+-\&position to be zero, choose with \-zprof0 (useful with bootstrapping, see below).
++\&The data points that are used to compute the profile
++\&can be restricted with options \fB \-b\fR, \fB \-e\fR, and \fB \-dt\fR. 
++\&Adjust \fB \-b\fR to ensure sufficient equilibration in each 
++\&umbrella window.
+ 
+ 
+-\&For cyclic (or periodic) reaction coordinates (dihedral angle, channel PMF
+-\&without osmotic gradient), \-cycl is useful.
++\&With \fB \-log\fR (default) the profile is written in energy units, otherwise 
++\&(with \fB \-nolog\fR) as probability. The unit can be specified with \fB \-unit\fR. 
++\&With energy output, the energy in the first bin is defined to be zero. 
++\&If you want the free energy at a different 
++\&position to be zero, set \fB \-zprof0\fR (useful with bootstrapping, see below).
+ 
+-\&\fB \-cycl yes\fR        min and max are assumed to
+-\&be neighboring points and histogram points outside min and max are mapped into 
+-\&the interval [min,max] (compare histogram output). 
+ 
+-\&\fB \-cycl weighted\fR   First, a non\-cyclic profile is computed. Subsequently, 
+-\&periodicity is enforced by adding corrections dG(i) between neighboring bins
+-\&i and i+1. The correction is chosen proportional to 1/[n(i)*n(i+1)]alpha, where
+-\&n(i) denotes the total nr of data points in bin i as collected from all histograms.
+-\&alpha is defined with \-alpha. The corrections are written to the file defined by \-wcorr.
+-\& (Compare Hub and de Groot, PNAS 105:1198 (2008))
++\&For cyclic or periodic reaction coordinates (dihedral angle, channel PMF
++\&without osmotic gradient), the option \fB \-cycl\fR is useful. \fB g_wham\fR will make use of the 
++\&periodicity of the system and generate a periodic PMF. The first and the last bin of the
++\&reaction coordinate will assumed be be neighbors.
+ 
+ 
+-\&ERROR ANALYSIS
+-
+-\&Statistical errors may be estimated with bootstrap analysis. Use it with care, 
+-\&otherwise the statistical error may be substantially undererstimated !!
++\&Option \fB \-sym\fR symmetrizes the profile around z=0 before output, 
++\&which may be useful for, e.g. membranes.
+ 
+-\&\fB \-nBootstrap\fR defines the nr of bootstraps. Two bootstrapping modes are supported.
+ 
+-\&\fB \-histbs\fR    Complete histograms are considered as independent data points (default). For each
+-\&bootstrap, N histograms are randomly chosen from the N given histograms (allowing duplication).
+-\&To avoid gaps without data along the reaction coordinate blocks of histograms (\-histbs\-block)
+-\&may be defined. In that case, the given histograms are divided into blocks and 
+-\&only histograms within each block are mixed. Note that the histograms
+-\&within each block must be representative for all possible histograms, otherwise the
+-\&statistical error is undererstimated!
++\&AUTOCORRELATIONS
++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
+ 
+-\&\fB \-nohistbs\fR  The given histograms are used to generate new random histograms,
+-\&such that the generated data points are distributed according the given histograms. The number
+-\&of points generated for each bootstrap histogram can be controlled with \-bs\-dt.
+-\&Note that one data point should be generated for each *independent* point in the given
+-\&histograms. With the long autocorrelations in MD simulations, this procedure may 
+-\&easily understimate the error!
++\&With \fB \-ac\fR, \fB g_wham\fR estimates the integrated autocorrelation 
++\&time (IACT) tau for each umbrella window and weights the respective 
++\&window with 1/[1+2*tau/dt]. The IACTs are written 
++\&to the file defined with \fB \-oiact\fR. In verbose mode, all 
++\&autocorrelation functions (ACFs) are written to \fB hist_autocorr.xvg\fR. 
++\&Because the IACTs can be severely underestimated in case of limited 
++\&sampling, option \fB \-acsig\fR allows to smooth the IACTs along the 
++\&reaction coordinate with a Gaussian (sigma provided with \fB \-acsig\fR, 
++\&see output in \fB iact.xvg\fR). Note that the IACTs are estimated by simple 
++\&integration of the ACFs while the ACFs are larger 0.05.
++\&If you prefer to compute the IACTs by a more sophisticated (but possibly 
++\&less robust) method such as fitting to a double exponential, you can 
++\&compute the IACTs with \fB g_analyze\fR and provide them to \fB g_wham\fR with the file 
++\&\fB iact\-in.dat\fR (option \fB \-iiact\fR), which should contain one line per 
++\&input file (\fB .pdo\fR or pullx/f file) and one column per pull group in the respective file.
+ 
+-\&Bootstrapping output:
+ 
+-\&\fB \-bsres\fR   Average profile and standard deviations
+-
+-\&\fB \-bsprof\fR  All bootstrapping profiles
++\&ERROR ANALYSIS
++\-\-\-\-\-\-\-\-\-\-\-\-\-\-
+ 
+-\&With \fB \-vbs\fR (verbose bootstrapping), the histograms of each bootstrap are written, and, 
+-\&with \fB \-nohistBS\fR, the cummulants of the histogram.
++\&Statistical errors may be estimated with bootstrap analysis. Use it with care, 
++\&otherwise the statistical error may be substantially underestimated. 
++\&More background and examples for the bootstrap technique can be found in 
++\&Hub, de Groot and Van der Spoel, JCTC (2010) 6: 3713\-3720.
++
++\&\fB \-nBootstrap\fR defines the number of bootstraps (use, e.g., 100). 
++\&Four bootstrapping methods are supported and 
++\&selected with \fB \-bs\-method\fR.
++
++\&  (1) \fB b\-hist\fR   Default: complete histograms are considered as independent 
++\&data points, and the bootstrap is carried out by assigning random weights to the 
++\&histograms ("Bayesian bootstrap"). Note that each point along the reaction coordinate
++\&must be covered by multiple independent histograms (e.g. 10 histograms), otherwise the 
++\&statistical error is underestimated.
++
++\&  (2) \fB hist\fR    Complete histograms are considered as independent data points. 
++\&For each bootstrap, N histograms are randomly chosen from the N given histograms 
++\&(allowing duplication, i.e. sampling with replacement).
++\&To avoid gaps without data along the reaction coordinate blocks of histograms 
++\&(\fB \-histbs\-block\fR) may be defined. In that case, the given histograms are 
++\&divided into blocks and only histograms within each block are mixed. Note that 
++\&the histograms within each block must be representative for all possible histograms, 
++\&otherwise the statistical error is underestimated.
++
++\&  (3) \fB traj\fR  The given histograms are used to generate new random trajectories,
++\&such that the generated data points are distributed according the given histograms 
++\&and properly autocorrelated. The autocorrelation time (ACT) for each window must be 
++\&known, so use \fB \-ac\fR or provide the ACT with \fB \-iiact\fR. If the ACT of all 
++\&windows are identical (and known), you can also provide them with \fB \-bs\-tau\fR. 
++\&Note that this method may severely underestimate the error in case of limited sampling, 
++\&that is if individual histograms do not represent the complete phase space at 
++\&the respective positions.
++
++\&  (4) \fB traj\-gauss\fR  The same as method \fB traj\fR, but the trajectories are 
++\&not bootstrapped from the umbrella histograms but from Gaussians with the average 
++\&and width of the umbrella histograms. That method yields similar error estimates 
++\&like method \fB traj\fR.
++
++Bootstrapping output:
++
++\&  \fB \-bsres\fR   Average profile and standard deviations
++
++\&  \fB \-bsprof\fR  All bootstrapping profiles
++
++\&With \fB \-vbs\fR (verbose bootstrapping), the histograms of each bootstrap are written, 
++\&and, with bootstrap method \fB traj\fR, the cumulative distribution functions of 
++\&the histograms.
+ .SH FILES
+ .BI "\-ix" " pullx\-files.dat" 
+ .B Input, Opt.
+@@ -200,6 +241,14 @@ g_wham - weighted histogram analysis after umbrella sampling
+ .B Output
+  xvgr/xmgr file 
+ 
++.BI "\-oiact" " iact.xvg" 
++.B Output, Opt.
++ xvgr/xmgr file 
++
++.BI "\-iiact" " iact\-in.dat" 
++.B Input, Opt.
++ Generic data file 
++
+ .BI "\-bsres" " bsResult.xvg" 
+ .B Output, Opt.
+  xvgr/xmgr file 
+@@ -212,10 +261,6 @@ g_wham - weighted histogram analysis after umbrella sampling
+ .B Input, Opt.
+  Generic data file 
+ 
+-.BI "\-wcorr" " cycl\-corr.xvg" 
+-.B Input, Opt.
+- xvgr/xmgr file 
+-
+ .SH OTHER OPTIONS
+ .BI "\-[no]h"  "no    "
+  Print help info and quit
+@@ -236,7 +281,7 @@ g_wham - weighted histogram analysis after umbrella sampling
+  Maximum coordinate in profile
+ 
+ .BI "\-[no]auto"  "yes   "
+- determine min and max automatically
++ Determine min and max automatically
+ 
+ .BI "\-bins"  " int" " 200" 
+  Number of bins in profile
+@@ -248,13 +293,13 @@ g_wham - weighted histogram analysis after umbrella sampling
+  Tolerance
+ 
+ .BI "\-[no]v"  "no    "
+- verbose mode
++ Verbose mode
+ 
+ .BI "\-b"  " real" " 50    " 
+- first time to analyse (ps)
++ First time to analyse (ps)
+ 
+ .BI "\-e"  " real" " 1e+20 " 
+- last time to analyse (ps)
++ Last time to analyse (ps)
+ 
+ .BI "\-dt"  " real" " 0     " 
+  Analyse only every dt ps
+@@ -263,46 +308,49 @@ g_wham - weighted histogram analysis after umbrella sampling
+  Write histograms and exit
+ 
+ .BI "\-[no]boundsonly"  "no    "
+- Determine min and max and exit (with \-auto)
++ Determine min and max and exit (with \fB \-auto\fR)
+ 
+ .BI "\-[no]log"  "yes   "
+  Calculate the log of the profile before printing
+ 
+ .BI "\-unit"  " enum" " kJ" 
+- energy unit in case of log output: \fB kJ\fR, \fB kCal\fR or \fB kT\fR
++ Energy unit in case of log output: \fB kJ\fR, \fB kCal\fR or \fB kT\fR
+ 
+ .BI "\-zprof0"  " real" " 0     " 
+- Define profile to 0.0 at this position (with \-log)
++ Define profile to 0.0 at this position (with \fB \-log\fR)
+ 
+-.BI "\-cycl"  " enum" " no" 
+- Create cyclic/periodic profile. Assumes min and max are the same point.: \fB no\fR, \fB yes\fR or \fB weighted\fR
++.BI "\-[no]cycl"  "no    "
++ Create cyclic/periodic profile. Assumes min and max are the same point.
+ 
+-.BI "\-alpha"  " real" " 2     " 
+- for '\-cycl weighted', set parameter alpha
++.BI "\-[no]sym"  "no    "
++ Symmetrize profile around z=0
+ 
+-.BI "\-[no]flip"  "no    "
+- Combine halves of profile (not supported)
++.BI "\-[no]ac"  "no    "
++ Calculate integrated autocorrelation times and use in wham
+ 
+-.BI "\-[no]hist\-eq"  "no    "
+- Enforce equal weight for all histograms. (Non\-Weighed\-HAM)
++.BI "\-acsig"  " real" " 0     " 
++ Smooth autocorrelation times along reaction coordinate with Gaussian of this sigma
++
++.BI "\-ac\-trestart"  " real" " 1     " 
++ When computing autocorrelation functions, restart computing every .. (ps)
+ 
+ .BI "\-nBootstrap"  " int" " 0" 
+- nr of bootstraps to estimate statistical uncertainty
++ nr of bootstraps to estimate statistical uncertainty (e.g., 200)
+ 
+-.BI "\-bs\-dt"  " real" " 0     " 
+- timestep for synthetic bootstrap histograms (ps). Ensure independent data points!
++.BI "\-bs\-method"  " enum" " b\-hist" 
++ Bootstrap method: \fB b\-hist\fR, \fB hist\fR, \fB traj\fR or \fB traj\-gauss\fR
+ 
+-.BI "\-bs\-seed"  " int" " \-1" 
+- seed for bootstrapping. (\-1 = use time)
++.BI "\-bs\-tau"  " real" " 0     " 
++ Autocorrelation time (ACT) assumed for all histograms. Use option \fB \-ac\fR if ACT is unknown.
+ 
+-.BI "\-[no]histbs"  "yes   "
+- In bootstrapping, consider complete histograms as one data point. Accounts better for long autocorrelations.
++.BI "\-bs\-seed"  " int" " \-1" 
++ Seed for bootstrapping. (\-1 = use time)
+ 
+ .BI "\-histbs\-block"  " int" " 8" 
+- when mixin histograms only mix within blocks of \-histBS_block.
++ When mixing histograms only mix within blocks of \fB \-histbs\-block\fR.
+ 
+ .BI "\-[no]vbs"  "no    "
+- verbose bootstrapping. Print the cummulants and a histogram file for each bootstrap.
++ Verbose bootstrapping. Print the CDFs and a histogram file for each bootstrap.
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/g_wheel.1 b/man/man1/g_wheel.1
+index 7d90b5c..4f9a6ec 100644
+--- a/man/man1/g_wheel.1
++++ b/man/man1/g_wheel.1
+@@ -1,8 +1,8 @@
+-.TH g_wheel 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_wheel 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_wheel - plots helical wheels
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_wheel\fP
+ .BI "\-f" " nnnice.dat "
+@@ -15,9 +15,9 @@ g_wheel - plots helical wheels
+ .BI "\-T" " string "
+ .BI "\-[no]nn" ""
+ .SH DESCRIPTION
+-\&wheel plots a helical wheel representation of your sequence.
+-\&The input sequence is in the .dat file where the first line contains
+-\&the number of residues and each consecutive line contains a residuename.
++\&\fB g_wheel\fR plots a helical wheel representation of your sequence.
++\&The input sequence is in the \fB .dat\fR file where the first line contains
++\&the number of residues and each consecutive line contains a residue name.
+ .SH FILES
+ .BI "\-f" " nnnice.dat" 
+ .B Input
+diff --git a/man/man1/g_x2top.1 b/man/man1/g_x2top.1
+index 321bb87..b99fc16 100644
+--- a/man/man1/g_x2top.1
++++ b/man/man1/g_x2top.1
+@@ -1,8 +1,8 @@
+-.TH g_x2top 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_x2top 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_x2top - generates a primitive topology from coordinates 
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_x2top\fP
+ .BI "\-f" " conf.gro "
+@@ -27,11 +27,11 @@ g_x2top - generates a primitive topology from coordinates
+ .BI "\-kt" " real "
+ .BI "\-kp" " real "
+ .SH DESCRIPTION
+-\&x2top generates a primitive topology from a coordinate file.
++\&\fB g_x2top\fR generates a primitive topology from a coordinate file.
+ \&The program assumes all hydrogens are present when defining
+ \&the hybridization from the atom name and the number of bonds.
+-\&The program can also make an rtp entry, which you can then add
+-\&to the rtp database.
++\&The program can also make an \fB .rtp\fR entry, which you can then add
++\&to the \fB .rtp\fR database.
+ 
+ 
+ \&When \fB \-param\fR is set, equilibrium distances and angles
+@@ -49,11 +49,11 @@ g_x2top - generates a primitive topology from coordinates
+ 
+ 
+ \&The corresponding data files can be found in the library directory
+-\&with name atomname2type.n2t. Check chapter 5 of the manual for more
+-\&information about file formats. By default the forcefield selection
++\&with name \fB atomname2type.n2t\fR. Check Chapter 5 of the manual for more
++\&information about file formats. By default, the force field selection
+ \&is interactive, but you can use the \fB \-ff\fR option to specify
+ \&one of the short names above on the command line instead. In that
+-\&case pdb2gmx just looks for the corresponding file.
++\&case \fB g_x2top\fR just looks for the corresponding file.
+ 
+ 
+ .SH FILES
+@@ -107,7 +107,7 @@ g_x2top - generates a primitive topology from coordinates
+  Use periodic boundary conditions.
+ 
+ .BI "\-[no]pdbq"  "no    "
+- Use the B\-factor supplied in a pdb file for the atomic charges
++ Use the B\-factor supplied in a \fB .pdb\fR file for the atomic charges
+ 
+ .BI "\-[no]param"  "yes   "
+  Print parameters in the output
+@@ -131,7 +131,7 @@ g_x2top - generates a primitive topology from coordinates
+ 
+ \- No improper dihedrals are generated
+ 
+-\- The atoms to atomtype translation table is incomplete (atomname2type.n2t files in the data directory). Please extend it and send the results back to the GROMACS crew.
++\- The atoms to atomtype translation table is incomplete (\fB atomname2type.n2t\fR file in the data directory). Please extend it and send the results back to the GROMACS crew.
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/g_xrama.1 b/man/man1/g_xrama.1
+index c0c0efc..6f741e9 100644
+--- a/man/man1/g_xrama.1
++++ b/man/man1/g_xrama.1
+@@ -1,8 +1,8 @@
+-.TH g_xrama 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH g_xrama 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ g_xrama - shows animated Ramachandran plots
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3g_xrama\fP
+ .BI "\-f" " traj.xtc "
+@@ -14,15 +14,15 @@ g_xrama - shows animated Ramachandran plots
+ .BI "\-e" " time "
+ .BI "\-dt" " time "
+ .SH DESCRIPTION
+-\&xrama shows a Ramachandran movie, that is, it shows
++\&\fB g_xrama\fR shows a Ramachandran movie, that is, it shows
+ \&the Phi/Psi angles as a function of time in an X\-Window.
+ 
+-Static Phi/Psi plots for printing can be made with g_rama.
++Static Phi/Psi plots for printing can be made with \fB g_rama\fR.
+ 
+ 
+ \&Some of the more common X command line options can be used:
+ 
+-\&\-bg, \-fg change colors, \-font fontname, changes the font.
++\&\fB \-bg\fR, \fB \-fg\fR change colors, \fB \-font fontname\fR, changes the font.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+ .B Input
+diff --git a/man/man1/genbox.1 b/man/man1/genbox.1
+index d374404..c573dbf 100644
+--- a/man/man1/genbox.1
++++ b/man/man1/genbox.1
+@@ -1,8 +1,8 @@
+-.TH genbox 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH genbox 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ genbox - solvates a system
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3genbox\fP
+ .BI "\-cp" " protein.gro "
+@@ -22,14 +22,14 @@ genbox - solvates a system
+ .BI "\-maxsol" " int "
+ .BI "\-[no]vel" ""
+ .SH DESCRIPTION
+-\&Genbox can do one of 3 things:
++\&\fB genbox\fR can do one of 3 things:
+ 
+ 
+-\&1) Generate a box of solvent. Specify \-cs and \-box. Or specify \-cs and
+-\&\-cp with a structure file with a box, but without atoms.
++\&1) Generate a box of solvent. Specify \fB \-cs\fR and \fB \-box\fR. Or specify \fB \-cs\fR and
++\&\fB \-cp\fR with a structure file with a box, but without atoms.
+ 
+ 
+-\&2) Solvate a solute configuration, eg. a protein, in a bath of solvent 
++\&2) Solvate a solute configuration, e.g. a protein, in a bath of solvent 
+ \&molecules. Specify \fB \-cp\fR (solute) and \fB \-cs\fR (solvent). 
+ \&The box specified in the solute coordinate file (\fB \-cp\fR) is used,
+ \&unless \fB \-box\fR is set.
+@@ -38,9 +38,9 @@ genbox - solvates a system
+ \&to change the box dimensions and center the solute.
+ \&Solvent molecules are removed from the box where the 
+ \&distance between any atom of the solute molecule(s) and any atom of 
+-\&the solvent molecule is less than the sum of the VanderWaals radii of 
+-\&both atoms. A database (\fB vdwradii.dat\fR) of VanderWaals radii is 
+-\&read by the program, atoms not in the database are 
++\&the solvent molecule is less than the sum of the van der Waals radii of 
++\&both atoms. A database (\fB vdwradii.dat\fR) of van der Waals radii is 
++\&read by the program, and atoms not in the database are 
+ \&assigned a default distance \fB \-vdwd\fR.
+ \&Note that this option will also influence the distances between
+ \&solvent molecules if they contain atoms that are not in the database.
+@@ -51,11 +51,16 @@ genbox - solvates a system
+ \&at random positions.
+ \&The program iterates until \fB nmol\fR molecules
+ \&have been inserted in the box. To test whether an insertion is 
+-\&successful the same VanderWaals criterium is used as for removal of 
+-\&solvent molecules. When no appropriately 
+-\&sized holes (holes that can hold an extra molecule) are available the 
++\&successful the same van der Waals criterium is used as for removal of 
++\&solvent molecules. When no appropriately\-sized 
++\&holes (holes that can hold an extra molecule) are available, the 
+ \&program tries for \fB \-nmol\fR * \fB \-try\fR times before giving up. 
+-\&Increase \-try if you have several small holes to fill.
++\&Increase \fB \-try\fR if you have several small holes to fill.
++
++
++\&If you need to do more than one of the above operations, it can be
++\&best to call \fB genbox\fR separately for each operation, so that
++\&you are sure of the order in which the operations occur.
+ 
+ 
+ \&The default solvent is Simple Point Charge water (SPC), with coordinates 
+@@ -81,18 +86,18 @@ genbox - solvates a system
+ \&longest molecule axis along a box edge. This way the amount of solvent
+ \&molecules necessary is reduced.
+ \&It should be kept in mind that this only works for
+-\&short simulations, as eg. an alpha\-helical peptide in solution can 
++\&short simulations, as e.g. an alpha\-helical peptide in solution can 
+ \&rotate over 90 degrees, within 500 ps. In general it is therefore 
+ \&better to make a more or less cubic box.
+ 
+ 
+-\&Setting \-shell larger than zero will place a layer of water of
++\&Setting \fB \-shell\fR larger than zero will place a layer of water of
+ \&the specified thickness (nm) around the solute. Hint: it is a good
+-\&idea to put the protein in the center of a box first (using editconf).
++\&idea to put the protein in the center of a box first (using \fB editconf\fR).
+ \&
+ 
+ 
+-\&Finally, genbox will optionally remove lines from your topology file in 
++\&Finally, \fB genbox\fR will optionally remove lines from your topology file in 
+ \&which a number of solvent molecules is already added, and adds a 
+ \&line with the total number of solvent molecules in your coordinate file.
+ .SH FILES
+@@ -133,7 +138,7 @@ genbox - solvates a system
+  no of extra molecules to insert
+ 
+ .BI "\-try"  " int" " 10" 
+- try inserting \-nmol*\-try times
++ try inserting \fB \-nmol\fR times \fB \-try\fR times
+ 
+ .BI "\-seed"  " int" " 1997" 
+  random generator seed
+diff --git a/man/man1/genconf.1 b/man/man1/genconf.1
+index 9757dbc..280008f 100644
+--- a/man/man1/genconf.1
++++ b/man/man1/genconf.1
+@@ -1,8 +1,8 @@
+-.TH genconf 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH genconf 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ genconf - multiplies a conformation in 'random' orientations
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3genconf\fP
+ .BI "\-f" " conf.gro "
+@@ -22,9 +22,9 @@ genconf - multiplies a conformation in 'random' orientations
+ .BI "\-maxrot" " vector "
+ .BI "\-[no]renumber" ""
+ .SH DESCRIPTION
+-\&genconf multiplies a given coordinate file by simply stacking them
++\&\fB genconf\fR multiplies a given coordinate file by simply stacking them
+ \&on top of each other, like a small child playing with wooden blocks.
+-\&The program makes a grid of \fI user defined\fR
++\&The program makes a grid of \fI user\-defined\fR
+ \&proportions (\fB \-nbox\fR), 
+ \&and interspaces the grid point with an extra space \fB \-dist\fR.
+ 
+@@ -32,7 +32,7 @@ genconf - multiplies a conformation in 'random' orientations
+ \&When option \fB \-rot\fR is used the program does not check for overlap
+ \&between molecules on grid points. It is recommended to make the box in
+ \&the input file at least as big as the coordinates + 
+-\&Van der Waals radius.
++\&van der Waals radius.
+ 
+ 
+ \&If the optional trajectory file is given, conformations are not
+diff --git a/man/man1/genion.1 b/man/man1/genion.1
+index bc535a2..748b7d1 100644
+--- a/man/man1/genion.1
++++ b/man/man1/genion.1
+@@ -1,8 +1,8 @@
+-.TH genion 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH genion 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ genion - generates mono atomic ions on energetically favorable positions
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3genion\fP
+ .BI "\-s" " topol.tpr "
+@@ -29,10 +29,10 @@ genion - generates mono atomic ions on energetically favorable positions
+ .BI "\-conc" " real "
+ .BI "\-[no]neutral" ""
+ .SH DESCRIPTION
+-\&genion replaces solvent molecules by monoatomic ions at
++\&\fB genion\fR replaces solvent molecules by monoatomic ions at
+ \&the position of the first atoms with the most favorable electrostatic
+ \&potential or at random. The potential is calculated on all atoms, using
+-\&normal GROMACS particle based methods (in contrast to other methods
++\&normal GROMACS particle\-based methods (in contrast to other methods
+ \&based on solving the Poisson\-Boltzmann equation).
+ \&The potential is recalculated after every ion insertion.
+ \&If specified in the run input file, a reaction field, shift function
+@@ -45,18 +45,23 @@ genion - generates mono atomic ions on energetically favorable positions
+ 
+ 
+ \&The ion molecule type, residue and atom names in all force fields
+-\&are the capitalized element names without sign. Ions which can have
+-\&multiple charge states get the multiplicilty added, without sign,
+-\&for the uncommon states only.
++\&are the capitalized element names without sign. This molecule name
++\&should be given with \fB \-pname\fR or \fB \-nname\fR, and the
++\&\fB [molecules]\fR section of your topology updated accordingly,
++\&either by hand or with \fB \-p\fR. Do not use an atom name instead!
++\&
++
++Ions which can have multiple charge states get the multiplicity
++\&added, without sign, for the uncommon states only.
+ 
+ 
+ \&With the option \fB \-pot\fR the potential can be written as B\-factors
+-\&in a pdb file (for visualisation using e.g. rasmol).
++\&in a \fB .pdb\fR file (for visualisation using e.g. Rasmol).
+ \&The unit of the potential is 1000 kJ/(mol e), the scaling be changed
+ \&with the \fB \-scale\fR option.
+ 
+ 
+-\&For larger ions, e.g. sulfate we recommended to use genbox.
++\&For larger ions, e.g. sulfate we recommended using \fB genbox\fR.
+ .SH FILES
+ .BI "\-s" " topol.tpr" 
+ .B Input
+@@ -127,10 +132,10 @@ genion - generates mono atomic ions on energetically favorable positions
+  Seed for random number generator
+ 
+ .BI "\-scale"  " real" " 0.001 " 
+- Scaling factor for the potential for \-pot
++ Scaling factor for the potential for \fB \-pot\fR
+ 
+ .BI "\-conc"  " real" " 0     " 
+- Specify salt concentration (mol/liter). This will add sufficient ions to reach up to the specified concentration as computed from the volume of the cell in the input tpr file. Overrides the \-np and  nn options.
++ Specify salt concentration (mol/liter). This will add sufficient ions to reach up to the specified concentration as computed from the volume of the cell in the input \fB .tpr\fR file. Overrides the \fB \-np\fR and \fB \-nn\fR options.
+ 
+ .BI "\-[no]neutral"  "no    "
+  This option will add enough ions to neutralize the system. In combination with the concentration option a neutral system at a given salt concentration will be generated.
+diff --git a/man/man1/genrestr.1 b/man/man1/genrestr.1
+index 68cc920..fde0d40 100644
+--- a/man/man1/genrestr.1
++++ b/man/man1/genrestr.1
+@@ -1,8 +1,8 @@
+-.TH genrestr 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH genrestr 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ genrestr - generates position restraints or distance restraints for index groups
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3genrestr\fP
+ .BI "\-f" " conf.gro "
+@@ -21,9 +21,9 @@ genrestr - generates position restraints or distance restraints for index groups
+ .BI "\-cutoff" " real "
+ .BI "\-[no]constr" ""
+ .SH DESCRIPTION
+-\&genrestr produces an include file for a topology containing
++\&\fB genrestr\fR produces an include file for a topology containing
+ \&a list of atom numbers and three force constants for the
+-\&X, Y and Z direction. A single isotropic force constant may
++\&\fI x\fR\-, \fI y\fR\-, and \fI z\fR\-direction. A single isotropic force constant may
+ \&be given on the command line instead of three components.
+ 
+ 
+@@ -32,17 +32,17 @@ genrestr - generates position restraints or distance restraints for index groups
+ \&they should be included within the correct \fB [ moleculetype ]\fR
+ \&block in the topology. Since the atom numbers in every moleculetype
+ \&in the topology start at 1 and the numbers in the input file for
+-\&genpr number consecutively from 1, genpr will only produce a useful
+-\&file for the first molecule.
++\&\fB genrestr\fR number consecutively from 1, \fB genrestr\fR will only
++\&produce a useful file for the first molecule.
+ 
+ 
+-\&The \-of option produces an index file that can be used for
+-\&freezing atoms. In this case the input file must be a pdb file.
++\&The \fB \-of\fR option produces an index file that can be used for
++\&freezing atoms. In this case, the input file must be a \fB .pdb\fR file.
+ 
+ 
+-\&With the \fB \-disre\fR option half a matrix of distance restraints
++\&With the \fB \-disre\fR option, half a matrix of distance restraints
+ \&is generated instead of position restraints. With this matrix, that
+-\&one typically would apply to C\-alpha atoms in a protein, one can
++\&one typically would apply to Calpha atoms in a protein, one can
+ \&maintain the overall conformation of a protein without tieing it to
+ \&a specific position (as with position restraints).
+ .SH FILES
+@@ -73,10 +73,10 @@ genrestr - generates position restraints or distance restraints for index groups
+  Set the nicelevel
+ 
+ .BI "\-fc"  " vector" " 1000 1000 1000" 
+- force constants (kJ mol\-1 nm\-2)
++ force constants (kJ/mol nm2)
+ 
+ .BI "\-freeze"  " real" " 0     " 
+- if the \-of option or this one is given an index file will be written containing atom numbers of all atoms that have a B\-factor less than the level given here
++ if the \fB \-of\fR option or this one is given an index file will be written containing atom numbers of all atoms that have a B\-factor less than the level given here
+ 
+ .BI "\-[no]disre"  "no    "
+  Generate a distance restraint matrix for all the atoms in index
+diff --git a/man/man1/gmxcheck.1 b/man/man1/gmxcheck.1
+index 157080f..08bc3a0 100644
+--- a/man/man1/gmxcheck.1
++++ b/man/man1/gmxcheck.1
+@@ -1,8 +1,8 @@
+-.TH gmxcheck 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH gmxcheck 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ gmxcheck - checks and compares files
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3gmxcheck\fP
+ .BI "\-f" " traj.xtc "
+@@ -26,7 +26,7 @@ gmxcheck - checks and compares files
+ .BI "\-[no]ab" ""
+ .BI "\-lastener" " string "
+ .SH DESCRIPTION
+-\&gmxcheck reads a trajectory (\fB .trj\fR, \fB .trr\fR or 
++\&\fB gmxcheck\fR reads a trajectory (\fB .trj\fR, \fB .trr\fR or 
+ \&\fB .xtc\fR), an energy file (\fB .ene\fR or \fB .edr\fR)
+ \&or an index file (\fB .ndx\fR)
+ \&and prints out useful information about them.
+@@ -44,11 +44,11 @@ gmxcheck - checks and compares files
+ \&If an index file, is given its contents will be summarized.
+ 
+ 
+-\&If both a trajectory and a tpr file are given (with \fB \-s1\fR)
++\&If both a trajectory and a \fB .tpr\fR file are given (with \fB \-s1\fR)
+ \&the program will check whether the bond lengths defined in the tpr
+ \&file are indeed correct in the trajectory. If not you may have
+ \&non\-matching files due to e.g. deshuffling or due to problems with
+-\&virtual sites. With these flags, gmxcheck provides a quick check for such problems.
++\&virtual sites. With these flags, \fB gmxcheck\fR provides a quick check for such problems.
+ 
+ 
+ \&The program can compare two run input (\fB .tpr\fR, \fB .tpb\fR or
+diff --git a/man/man1/gmxdump.1 b/man/man1/gmxdump.1
+index a1d4442..70daa77 100644
+--- a/man/man1/gmxdump.1
++++ b/man/man1/gmxdump.1
+@@ -1,8 +1,8 @@
+-.TH gmxdump 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH gmxdump 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ gmxdump - makes binary files human readable
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3gmxdump\fP
+ .BI "\-s" " topol.tpr "
+@@ -18,7 +18,7 @@ gmxdump - makes binary files human readable
+ .BI "\-[no]nr" ""
+ .BI "\-[no]sys" ""
+ .SH DESCRIPTION
+-\&gmxdump reads a run input file (\fB .tpa\fR/\fB .tpr\fR/\fB .tpb\fR),
++\&\fB gmxdump\fR reads a run input file (\fB .tpa\fR/\fB .tpr\fR/\fB .tpb\fR),
+ \&a trajectory (\fB .trj\fR/\fB .trr\fR/\fB .xtc\fR), an energy
+ \&file (\fB .ene\fR/\fB .edr\fR), or a checkpoint file (\fB .cpt\fR)
+ \&and prints that to standard output in a readable format.
+@@ -27,7 +27,7 @@ gmxdump - makes binary files human readable
+ 
+ 
+ \&The program can also preprocess a topology to help finding problems.
+-\&Note that currently setting GMXLIB is the only way to customize
++\&Note that currently setting \fB GMXLIB\fR is the only way to customize
+ \&directories used for searching include files.
+ .SH FILES
+ .BI "\-s" " topol.tpr" 
+diff --git a/man/man1/grompp.1 b/man/man1/grompp.1
+index 016ce3e..ff1b121 100644
+--- a/man/man1/grompp.1
++++ b/man/man1/grompp.1
+@@ -1,8 +1,8 @@
+-.TH grompp 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH grompp 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ grompp - makes a run input file
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3grompp\fP
+ .BI "\-f" " grompp.mdp "
+@@ -37,7 +37,7 @@ grompp - makes a run input file
+ \&for hydrogens and heavy atoms.
+ \&Then a coordinate file is read and velocities can be generated
+ \&from a Maxwellian distribution if requested.
+-\&grompp also reads parameters for the mdrun 
++\&\fB grompp\fR also reads parameters for the \fB mdrun\fR 
+ \&(eg. number of MD steps, time step, cut\-off), and others such as
+ \&NEMD parameters, which are corrected so that the net acceleration
+ \&is zero.
+@@ -45,15 +45,16 @@ grompp - makes a run input file
+ \&file for the MD program.
+ 
+ 
+-\&grompp uses the atom names from the topology file. The atom names
++\&\fB grompp\fR uses the atom names from the topology file. The atom names
+ \&in the coordinate file (option \fB \-c\fR) are only read to generate
+ \&warnings when they do not match the atom names in the topology.
+ \&Note that the atom names are irrelevant for the simulation as
+ \&only the atom types are used for generating interaction parameters.
+ 
+ 
+-\&grompp uses a built\-in preprocessor to resolve includes, macros 
+-\&etcetera. The preprocessor supports the following keywords:
++\&\fB grompp\fR uses a built\-in preprocessor to resolve includes, macros, 
++\&etc. The preprocessor supports the following keywords:
++
+ 
+ \&ifdef VARIABLE
+ 
+@@ -70,24 +71,20 @@ include "filename"
+ 
+ \&include filename
+ 
++
+ \&The functioning of these statements in your topology may be modulated by
+-\&using the following two flags in your \fB mdp\fR file:
++\&using the following two flags in your \fB .mdp\fR file:
+ 
+-\&define = \-DVARIABLE1 \-DVARIABLE2
+ 
+-\&include = /home/john/doe
++\&\fB define = \-DVARIABLE1 \-DVARIABLE2
++
++\&include = \-I/home/john/doe\fR
+ 
+ \&For further information a C\-programming textbook may help you out.
+ \&Specifying the \fB \-pp\fR flag will get the pre\-processed
+ \&topology file written out so that you can verify its contents.
+ 
+ 
+-\&If your system does not have a c\-preprocessor, you can still
+-\&use grompp, but you do not have access to the features 
+-\&from the cpp. Command line options to the c\-preprocessor can be given
+-\&in the \fB .mdp\fR file. See your local manual (man cpp).
+-
+-
+ \&When using position restraints a file with restraint coordinates
+ \&can be supplied with \fB \-r\fR, otherwise restraining will be done
+ \&with respect to the conformation from the \fB \-c\fR option.
+@@ -98,26 +95,26 @@ include "filename"
+ 
+ \&Starting coordinates can be read from trajectory with \fB \-t\fR.
+ \&The last frame with coordinates and velocities will be read,
+-\&unless the \fB \-time\fR option is used.
++\&unless the \fB \-time\fR option is used. Only if this information
++\&is absent will the coordinates in the \fB \-c\fR file be used.
+ \&Note that these velocities will not be used when \fB gen_vel = yes\fR
+ \&in your \fB .mdp\fR file. An energy file can be supplied with
+ \&\fB \-e\fR to read Nose\-Hoover and/or Parrinello\-Rahman coupling
+-\&variables. Note that for continuation it is better and easier to supply
+-\&a checkpoint file directly to mdrun, since that always contains
+-\&the complete state of the system and you don't need to generate
+-\&a new run input file. Note that if you only want to change the number
+-\&of run steps tpbconv is more convenient than grompp.
++\&variables.
+ 
+ 
+-\&Using the \fB \-morse\fR option grompp can convert the harmonic bonds
+-\&in your topology to morse potentials. This makes it possible to break
+-\&bonds. For this option to work you need an extra file in your $GMXLIB
+-\&with dissociation energy. Use the \-debug option to get more information
+-\&on the workings of this option (look for MORSE in the grompp.log file
+-\&using less or something like that).
++\&\fB grompp\fR can be used to restart simulations (preserving
++\&continuity) by supplying just a checkpoint file with \fB \-t\fR.
++\&However, for simply changing the number of run steps to extend
++\&a run, using \fB tpbconv\fR is more convenient than \fB grompp\fR.
++\&You then supply the old checkpoint file directly to \fB mdrun\fR
++\&with \fB \-cpi\fR. If you wish to change the ensemble or things
++\&like output frequency, then supplying the checkpoint file to
++\&\fB grompp\fR with \fB \-t\fR along with a new \fB .mdp\fR file
++\&with \fB \-f\fR is the recommended procedure.
+ 
+ 
+-\&By default all bonded interactions which have constant energy due to
++\&By default, all bonded interactions which have constant energy due to
+ \&virtual site constructions will be removed. If this constant energy is
+ \&not zero, this will result in a shift in the total energy. All bonded
+ \&interactions can be kept by turning off \fB \-rmvsbds\fR. Additionally,
+@@ -125,17 +122,24 @@ include "filename"
+ \&of virtual site constructions will be removed. If any constraints remain
+ \&which involve virtual sites, a fatal error will result.
+ 
+-To verify your run input file, please make notice of all warnings
++To verify your run input file, please take note of all warnings
+ \&on the screen, and correct where necessary. Do also look at the contents
+-\&of the \fB mdout.mdp\fR file, this contains comment lines, as well as
+-\&the input that \fB grompp\fR has read. If in doubt you can start grompp
++\&of the \fB mdout.mdp\fR file; this contains comment lines, as well as
++\&the input that \fB grompp\fR has read. If in doubt, you can start \fB grompp\fR
+ \&with the \fB \-debug\fR option which will give you more information
+-\&in a file called grompp.log (along with real debug info). Finally, you
++\&in a file called \fB grompp.log\fR (along with real debug info). You
+ \&can see the contents of the run input file with the \fB gmxdump\fR
+-\&program.
++\&program. \fB gmxcheck\fR can be used to compare the contents of two
++\&run input files.
++
++The \fB \-maxwarn\fR option can be used to override warnings printed
++\&by \fB grompp\fR that otherwise halt output. In some cases, warnings are
++\&harmless, but usually they are not. The user is advised to carefully
++\&interpret the output messages before attempting to bypass them with
++\&this option.
+ .SH FILES
+ .BI "\-f" " grompp.mdp" 
+-.B Input, Opt.
++.B Input
+  grompp input file with MD parameters 
+ 
+ .BI "\-po" " mdout.mdp" 
+@@ -198,7 +202,7 @@ To verify your run input file, please make notice of all warnings
+  Remove constant bonded interactions with virtual sites
+ 
+ .BI "\-maxwarn"  " int" " 0" 
+- Number of allowed warnings during input processing
++ Number of allowed warnings during input processing. Not for normal use and may generate unstable systems
+ 
+ .BI "\-[no]zero"  "no    "
+  Set parameters for bonded interactions without defaults to zero instead of generating an error
+diff --git a/man/man1/make_edi.1 b/man/man1/make_edi.1
+index 3000608..28c40cf 100644
+--- a/man/man1/make_edi.1
++++ b/man/man1/make_edi.1
+@@ -1,8 +1,8 @@
+-.TH make_edi 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH make_edi 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ make_edi - generate input files for essential dynamics sampling
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3make_edi\fP
+ .BI "\-f" " eigenvec.trr "
+@@ -19,28 +19,29 @@ make_edi - generate input files for essential dynamics sampling
+ .BI "\-mon" " string "
+ .BI "\-linfix" " string "
+ .BI "\-linacc" " string "
+-.BI "\-flood" " string "
+ .BI "\-radfix" " string "
+ .BI "\-radacc" " string "
+ .BI "\-radcon" " string "
++.BI "\-flood" " string "
+ .BI "\-outfrq" " int "
+ .BI "\-slope" " real "
++.BI "\-linstep" " string "
++.BI "\-accdir" " string "
++.BI "\-radstep" " real "
+ .BI "\-maxedsteps" " int "
++.BI "\-eqsteps" " int "
+ .BI "\-deltaF0" " real "
+ .BI "\-deltaF" " real "
+ .BI "\-tau" " real "
+-.BI "\-eqsteps" " int "
+ .BI "\-Eflnull" " real "
+ .BI "\-T" " real "
+ .BI "\-alpha" " real "
+-.BI "\-linstep" " string "
+-.BI "\-accdir" " string "
+-.BI "\-radstep" " real "
+ .BI "\-[no]restrain" ""
+ .BI "\-[no]hessian" ""
+ .BI "\-[no]harmonic" ""
++.BI "\-constF" " string "
+ .SH DESCRIPTION
+-\&\fB make_edi\fR generates an essential dynamics (ED) sampling input file to be used with mdrun
++\&\fB make_edi\fR generates an essential dynamics (ED) sampling input file to be used with \fB mdrun\fR
+ \&based on eigenvectors of a covariance matrix (\fB g_covar\fR) or from a
+ \&normal modes anaysis (\fB g_nmeig\fR).
+ \&ED sampling can be used to manipulate the position along collective coordinates
+@@ -67,7 +68,7 @@ make_edi - generate input files for essential dynamics sampling
+ 
+ \&B.L. de Groot, A.Amadei, R.M. Scheek, N.A.J. van Nuland and H.J.C. Berendsen; 
+ \&An extended sampling of the configurational space of HPr from E. coli
+-\&PROTEINS: Struct. Funct. Gen. 26: 314\-322 (1996)
++\&Proteins: Struct. Funct. Gen. 26: 314\-322 (1996)
+ \&
+ 
+ You will be prompted for one or more index groups that correspond to the eigenvectors,
+@@ -89,7 +90,7 @@ You will be prompted for one or more index groups that correspond to the eigenve
+ 
+ \&\fB \-radacc\fR: perform acceptance radius expansion along selected eigenvectors.
+ \&(steps in the desired direction will be accepted, others will be rejected).
+-\&Note: by default the starting MD structure will be taken as origin of the first
++\&\fB Note:\fR by default the starting MD structure will be taken as origin of the first
+ \&expansion cycle for radius expansion. If \fB \-ori\fR is specified, you will be able
+ \&to read in a structure file that defines an external origin.
+ 
+@@ -101,7 +102,7 @@ You will be prompted for one or more index groups that correspond to the eigenve
+ \&NOTE: each eigenvector can be selected only once. 
+ 
+ 
+-\&\fB \-outfrq\fR: frequency (in steps) of writing out projections etc. to .edo file
++\&\fB \-outfrq\fR: frequency (in steps) of writing out projections etc. to \fB .edo\fR file
+ 
+ 
+ \&\fB \-slope\fR: minimal slope in acceptance radius expansion. A new expansion
+@@ -116,21 +117,21 @@ You will be prompted for one or more index groups that correspond to the eigenve
+ \&Note on the parallel implementation: since ED sampling is a 'global' thing
+ \&(collective coordinates etc.), at least on the 'protein' side, ED sampling
+ \&is not very parallel\-friendly from an implentation point of view. Because
+-\&parallel ED requires much extra communication, expect the performance to be
++\&parallel ED requires some extra communication, expect the performance to be
+ \&lower as in a free MD simulation, especially on a large number of nodes. 
+ 
+ 
+-\&All output of mdrun (specify with \-eo) is written to a .edo file. In the output
++\&All output of \fB mdrun\fR (specify with \fB \-eo\fR) is written to a .edo file. In the output
+ \&file, per OUTFRQ step the following information is present: 
+ 
+ 
+-\&* the step number
++\&\fB *\fR the step number
+ 
+-\&* the number of the ED dataset. (Note that you can impose multiple ED constraints in
+-\&a single simulation \- on different molecules e.g. \- if several .edi files were concatenated
+-\&first. The constraints are applied in the order they appear in the .edi file.) 
++\&\fB *\fR the number of the ED dataset. (\fB Note\fR that you can impose multiple ED constraints in
++\&a single simulation (on different molecules) if several \fB .edi\fR files were concatenated
++\&first. The constraints are applied in the order they appear in the \fB .edi\fR file.) 
+ 
+-\&* RMSD (for atoms involved in fitting prior to calculating the ED constraints)
++\&\fB *\fR RMSD (for atoms involved in fitting prior to calculating the ED constraints)
+ 
+ \&* projections of the positions onto selected eigenvectors
+ 
+@@ -142,34 +143,34 @@ You will be prompted for one or more index groups that correspond to the eigenve
+ \&FLOODING:
+ 
+ 
+-\&with \-flood you can specify which eigenvectors are used to compute a flooding potential,
++\&with \fB \-flood\fR, you can specify which eigenvectors are used to compute a flooding potential,
+ \&which will lead to extra forces expelling the structure out of the region described
+ \&by the covariance matrix. If you switch \-restrain the potential is inverted and the structure
+ \&is kept in that region.
+ \&
+ 
+ 
+-\&The origin is normally the average structure stored in the eigvec.trr file.
+-\&It can be changed with \-ori to an arbitrary position in configurational space.
+-\&With \-tau, \-deltaF0 and \-Eflnull you control the flooding behaviour.
++\&The origin is normally the average structure stored in the \fB eigvec.trr\fR file.
++\&It can be changed with \fB \-ori\fR to an arbitrary position in configurational space.
++\&With \fB \-tau\fR, \fB \-deltaF0\fR, and \fB \-Eflnull\fR you control the flooding behaviour.
+ \&Efl is the flooding strength, it is updated according to the rule of adaptive flooding.
+ \&Tau is the time constant of adaptive flooding, high tau means slow adaption (i.e. growth). 
+ \&DeltaF0 is the flooding strength you want to reach after tau ps of simulation.
+-\&To use constant Efl set \-tau to zero.
++\&To use constant Efl set \fB \-tau\fR to zero.
+ \&
+ 
+ 
+-\&\-alpha is a fudge parameter to control the width of the flooding potential. A value of 2 has been found
++\&\fB \-alpha\fR is a fudge parameter to control the width of the flooding potential. A value of 2 has been found
+ \&to give good results for most standard cases in flooding of proteins.
+-\&Alpha basically accounts for incomplete sampling, if you sampled further the width of the ensemble would
+-\&increase, this is mimicked by alpha1.
+-\&For restraining alpha1 can give you smaller width in the restraining potential.
++\&alpha basically accounts for incomplete sampling, if you sampled further the width of the ensemble would
++\&increase, this is mimicked by alpha  1.
++\&For restraining, alpha  1 can give you smaller width in the restraining potential.
+ \&
+ 
+ 
+ \&RESTART and FLOODING:
+ \&If you want to restart a crashed flooding simulation please find the values deltaF and Efl in
+-\&the output file and manually put them into the .edi file under DELTA_F0 and EFL_NULL.
++\&the output file and manually put them into the \fB .edi\fR file under DELTA_F0 and EFL_NULL.
+ .SH FILES
+ .BI "\-f" " eigenvec.trr" 
+ .B Input
+@@ -221,9 +222,6 @@ You will be prompted for one or more index groups that correspond to the eigenve
+ .BI "\-linacc"  " string" " " 
+  Indices of eigenvectors for acceptance linear sampling
+ 
+-.BI "\-flood"  " string" " " 
+- Indices of eigenvectors for flooding
+-
+ .BI "\-radfix"  " string" " " 
+  Indices of eigenvectors for fixed increment radius expansion
+ 
+@@ -233,29 +231,41 @@ You will be prompted for one or more index groups that correspond to the eigenve
+ .BI "\-radcon"  " string" " " 
+  Indices of eigenvectors for acceptance radius contraction
+ 
++.BI "\-flood"  " string" " " 
++ Indices of eigenvectors for flooding
++
+ .BI "\-outfrq"  " int" " 100" 
+- Freqency (in steps) of writing output in .edo file
++ Freqency (in steps) of writing output in \fB .edo\fR file
+ 
+ .BI "\-slope"  " real" " 0     " 
+  Minimal slope in acceptance radius expansion
+ 
++.BI "\-linstep"  " string" " " 
++ Stepsizes (nm/step) for fixed increment linear sampling (put in quotes! "1.0 2.3 5.1 \-3.1")
++
++.BI "\-accdir"  " string" " " 
++ Directions for acceptance linear sampling \- only sign counts! (put in quotes! "\-1 +1 \-1.1")
++
++.BI "\-radstep"  " real" " 0     " 
++ Stepsize (nm/step) for fixed increment radius expansion
++
+ .BI "\-maxedsteps"  " int" " 0" 
+- Max nr of steps per cycle
++ Maximum number of steps per cycle
++
++.BI "\-eqsteps"  " int" " 0" 
++ Number of steps to run without any perturbations 
+ 
+ .BI "\-deltaF0"  " real" " 150   " 
+- Target destabilization energy  \- used for flooding
++ Target destabilization energy for flooding
+ 
+ .BI "\-deltaF"  " real" " 0     " 
+- Start deltaF with this parameter \- default 0, i.e. nonzero values only needed for restart
++ Start deltaF with this parameter \- default 0, nonzero values only needed for restart
+ 
+ .BI "\-tau"  " real" " 0.1   " 
+  Coupling constant for adaption of flooding strength according to deltaF0, 0 = infinity i.e. constant flooding strength
+ 
+-.BI "\-eqsteps"  " int" " 0" 
+- Number of steps to run without any perturbations 
+-
+ .BI "\-Eflnull"  " real" " 0     " 
+- This is the starting value of the flooding strength. The flooding strength is updated according to the adaptive flooding scheme. To use a constant flooding strength use \-tau 0. 
++ The starting value of the flooding strength. The flooding strength is updated according to the adaptive flooding scheme. For a constant flooding strength use \fB \-tau\fR 0. 
+ 
+ .BI "\-T"  " real" " 300   " 
+  T is temperature, the value is needed if you want to do flooding 
+@@ -263,15 +273,6 @@ You will be prompted for one or more index groups that correspond to the eigenve
+ .BI "\-alpha"  " real" " 1     " 
+  Scale width of gaussian flooding potential with alpha2 
+ 
+-.BI "\-linstep"  " string" " " 
+- Stepsizes (nm/step) for fixed increment linear sampling (put in quotes! "1.0 2.3 5.1 \-3.1")
+-
+-.BI "\-accdir"  " string" " " 
+- Directions for acceptance linear sampling \- only sign counts! (put in quotes! "\-1 +1 \-1.1")
+-
+-.BI "\-radstep"  " real" " 0     " 
+- Stepsize (nm/step) for fixed increment radius expansion
+-
+ .BI "\-[no]restrain"  "no    "
+  Use the flooding potential with inverted sign \- effects as quasiharmonic restraining potential
+ 
+@@ -281,6 +282,9 @@ You will be prompted for one or more index groups that correspond to the eigenve
+ .BI "\-[no]harmonic"  "no    "
+  The eigenvalues are interpreted as spring constant
+ 
++.BI "\-constF"  " string" " " 
++ Constant force flooding: manually set the forces for the eigenvectors selected with \-flood (put in quotes! "1.0 2.3 5.1 \-3.1"). No other flooding parameters are needed when specifying the forces directly.
++
+ .SH SEE ALSO
+ .BR gromacs(7)
+ 
+diff --git a/man/man1/make_ndx.1 b/man/man1/make_ndx.1
+index eb856a3..fca4200 100644
+--- a/man/man1/make_ndx.1
++++ b/man/man1/make_ndx.1
+@@ -1,8 +1,8 @@
+-.TH make_ndx 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH make_ndx 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ make_ndx - makes index files
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3make_ndx\fP
+ .BI "\-f" " conf.gro "
+@@ -15,13 +15,13 @@ make_ndx - makes index files
+ .SH DESCRIPTION
+ \&Index groups are necessary for almost every gromacs program.
+ \&All these programs can generate default index groups. You ONLY
+-\&have to use make_ndx when you need SPECIAL index groups.
++\&have to use \fB make_ndx\fR when you need SPECIAL index groups.
+ \&There is a default index group for the whole system, 9 default
+-\&index groups are generated for proteins, a default index group
++\&index groups for proteins, and a default index group
+ \&is generated for every other residue name.
+ 
+ 
+-\&When no index file is supplied, also make_ndx will generate the
++\&When no index file is supplied, also \fB make_ndx\fR will generate the
+ \&default groups.
+ \&With the index editor you can select on atom, residue and chain names
+ \&and numbers.
+diff --git a/man/man1/mdrun.1 b/man/man1/mdrun.1
+index 191bffd..8aaf75d 100644
+--- a/man/man1/mdrun.1
++++ b/man/man1/mdrun.1
+@@ -1,8 +1,8 @@
+-.TH mdrun 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH mdrun 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ mdrun - performs a simulation, do a normal mode analysis or an energy minimization
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3mdrun\fP
+ .BI "\-s" " topol.tpr "
+@@ -32,6 +32,7 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ .BI "\-pf" " pullf.xvg "
+ .BI "\-mtx" " nm.mtx "
+ .BI "\-dn" " dipole.ndx "
++.BI "\-multidir" " rundir "
+ .BI "\-[no]h" ""
+ .BI "\-[no]version" ""
+ .BI "\-nice" " int "
+@@ -39,7 +40,6 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ .BI "\-xvg" " enum "
+ .BI "\-[no]pd" ""
+ .BI "\-dd" " vector "
+-.BI "\-nt" " int "
+ .BI "\-npme" " int "
+ .BI "\-ddorder" " enum "
+ .BI "\-[no]ddcheck" ""
+@@ -62,20 +62,20 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ .BI "\-reseed" " int "
+ .BI "\-[no]ionize" ""
+ .SH DESCRIPTION
+-\&The mdrun program is the main computational chemistry engine
++\&The \fB mdrun\fR program is the main computational chemistry engine
+ \&within GROMACS. Obviously, it performs Molecular Dynamics simulations,
+ \&but it can also perform Stochastic Dynamics, Energy Minimization,
+ \&test particle insertion or (re)calculation of energies.
+-\&Normal mode analysis is another option. In this case mdrun
++\&Normal mode analysis is another option. In this case \fB mdrun\fR
+ \&builds a Hessian matrix from single conformation.
+ \&For usual Normal Modes\-like calculations, make sure that
+ \&the structure provided is properly energy\-minimized.
+-\&The generated matrix can be diagonalized by g_nmeig.
++\&The generated matrix can be diagonalized by \fB g_nmeig\fR.
+ 
+ 
+-\&The mdrun program reads the run input file (\fB \-s\fR)
++\&The \fB mdrun\fR program reads the run input file (\fB \-s\fR)
+ \&and distributes the topology over nodes if needed.
+-\&mdrun produces at least four output files.
++\&\fB mdrun\fR produces at least four output files.
+ \&A single log file (\fB \-g\fR) is written, unless the option
+ \&\fB \-seppot\fR is used, in which case each node writes a log file.
+ \&The trajectory file (\fB \-o\fR), contains coordinates, velocities and
+@@ -92,13 +92,13 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ \&turned on.
+ 
+ 
+-\&When mdrun is started using MPI with more than 1 node, parallelization
++\&When \fB mdrun\fR is started using MPI with more than 1 node, parallelization
+ \&is used. By default domain decomposition is used, unless the \fB \-pd\fR
+ \&option is set, which selects particle decomposition.
+ 
+ 
+ \&With domain decomposition, the spatial decomposition can be set
+-\&with option \fB \-dd\fR. By default mdrun selects a good decomposition.
++\&with option \fB \-dd\fR. By default \fB mdrun\fR selects a good decomposition.
+ \&The user only needs to change this when the system is very inhomogeneous.
+ \&Dynamic load balancing is set with the option \fB \-dlb\fR,
+ \&which can give a significant performance improvement,
+@@ -119,7 +119,7 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ \&this is computationally more efficient starting at about 12 nodes.
+ \&The number of PME nodes is set with option \fB \-npme\fR,
+ \&this can not be more than half of the nodes.
+-\&By default mdrun makes a guess for the number of PME
++\&By default \fB mdrun\fR makes a guess for the number of PME
+ \&nodes when the number of nodes is larger than 11 or performance wise
+ \&not compatible with the PME grid x dimension.
+ \&But the user should optimize npme. Performance statistics on this issue
+@@ -133,6 +133,7 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ \&This section lists all options that affect the domain decomposition.
+ \&
+ 
++
+ \&Option \fB \-rdd\fR can be used to set the required maximum distance
+ \&for inter charge\-group bonded interactions.
+ \&Communication for two\-body bonded interactions below the non\-bonded
+@@ -142,31 +143,34 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ \&and nearly indepedent of the value of \fB \-rdd\fR.
+ \&With dynamic load balancing option \fB \-rdd\fR also sets
+ \&the lower limit for the domain decomposition cell sizes.
+-\&By default \fB \-rdd\fR is determined by mdrun based on
++\&By default \fB \-rdd\fR is determined by \fB mdrun\fR based on
+ \&the initial coordinates. The chosen value will be a balance
+ \&between interaction range and communication cost.
+ \&
+ 
++
+ \&When inter charge\-group bonded interactions are beyond
+-\&the bonded cut\-off distance, mdrun terminates with an error message.
++\&the bonded cut\-off distance, \fB mdrun\fR terminates with an error message.
+ \&For pair interactions and tabulated bonds
+ \&that do not generate exclusions, this check can be turned off
+ \&with the option \fB \-noddcheck\fR.
+ \&
+ 
++
+ \&When constraints are present, option \fB \-rcon\fR influences
+ \&the cell size limit as well.
+ \&Atoms connected by NC constraints, where NC is the LINCS order plus 1,
+ \&should not be beyond the smallest cell size. A error message is
+ \&generated when this happens and the user should change the decomposition
+ \&or decrease the LINCS order and increase the number of LINCS iterations.
+-\&By default mdrun estimates the minimum cell size required for P\-LINCS
++\&By default \fB mdrun\fR estimates the minimum cell size required for P\-LINCS
+ \&in a conservative fashion. For high parallelization it can be useful
+ \&to set the distance required for P\-LINCS with the option \fB \-rcon\fR.
+ \&
+ 
++
+ \&The \fB \-dds\fR option sets the minimum allowed x, y and/or z scaling
+-\&of the cells with dynamic load balancing. mdrun will ensure that
++\&of the cells with dynamic load balancing. \fB mdrun\fR will ensure that
+ \&the cells can scale down by at least this factor. This option is used
+ \&for the automated spatial decomposition (when not using \fB \-dd\fR)
+ \&as well as for determining the number of grid pulses, which in turn
+@@ -181,7 +185,7 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ \&This can improve performance for highly parallel simulations
+ \&where this global communication step becomes the bottleneck.
+ \&For a global thermostat and/or barostat the temperature
+-\&and/or pressure will also only be updated every \-gcom steps.
++\&and/or pressure will also only be updated every \fB \-gcom\fR steps.
+ \&By default it is set to the minimum of nstcalcenergy and nstlist.
+ 
+ 
+@@ -194,19 +198,19 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ \&ED (essential dynamics) sampling is switched on by using the \fB \-ei\fR
+ \&flag followed by an \fB .edi\fR file.
+ \&The \fB .edi\fR file can be produced using options in the essdyn
+-\&menu of the WHAT IF program. mdrun produces a \fB .edo\fR file that
++\&menu of the WHAT IF program. \fB mdrun\fR produces a \fB .edo\fR file that
+ \&contains projections of positions, velocities and forces onto selected
+ \&eigenvectors.
+ 
+ 
+ \&When user\-defined potential functions have been selected in the
+-\&\fB .mdp\fR file the \fB \-table\fR option is used to pass mdrun
++\&\fB .mdp\fR file the \fB \-table\fR option is used to pass \fB mdrun\fR
+ \&a formatted table with potential functions. The file is read from
+-\&either the current directory or from the GMXLIB directory.
+-\&A number of pre\-formatted tables are presented in the GMXLIB dir,
+-\&for 6\-8, 6\-9, 6\-10, 6\-11, 6\-12 Lennard Jones potentials with
++\&either the current directory or from the \fB GMXLIB\fR directory.
++\&A number of pre\-formatted tables are presented in the \fB GMXLIB\fR dir,
++\&for 6\-8, 6\-9, 6\-10, 6\-11, 6\-12 Lennard\-Jones potentials with
+ \&normal Coulomb.
+-\&When pair interactions are present a separate table for pair interaction
++\&When pair interactions are present, a separate table for pair interaction
+ \&functions is read using the \fB \-tablep\fR option.
+ 
+ 
+@@ -214,7 +218,7 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ \&interaction functions are read using the \fB \-tableb\fR option.
+ \&For each different tabulated interaction type the table file name is
+ \&modified in a different way: before the file extension an underscore is
+-\&appended, then a b for bonds, an a for angles or a d for dihedrals
++\&appended, then a 'b' for bonds, an 'a' for angles or a 'd' for dihedrals
+ \&and finally the table number of the interaction type.
+ 
+ 
+@@ -223,10 +227,16 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ \&in the \fB .mdp\fR file.
+ 
+ 
+-\&With \fB \-multi\fR multiple systems are simulated in parallel.
+-\&As many input files are required as the number of systems.
+-\&The system number is appended to the run input and each output filename,
+-\&for instance topol.tpr becomes topol0.tpr, topol1.tpr etc.
++\&With \fB \-multi\fR or \fB \-multidir\fR, multiple systems can be 
++\&simulated in parallel.
++\&As many input files/directories are required as the number of systems. 
++\&The \fB \-multidir\fR option takes a list of directories (one for each 
++\&system) and runs in each of them, using the input/output file names, 
++\&such as specified by e.g. the \fB \-s\fR option, relative to these 
++\&directories.
++\&With \fB \-multi\fR, the system number is appended to the run input 
++\&and each output filename, for instance \fB topol.tpr\fR becomes
++\&\fB topol0.tpr\fR, \fB topol1.tpr\fR etc.
+ \&The number of nodes per system is the total number of nodes
+ \&divided by the number of systems.
+ \&One use of this option is for NMR refinement: when distance
+@@ -235,8 +245,8 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ 
+ 
+ \&With \fB \-replex\fR replica exchange is attempted every given number
+-\&of steps. The number of replicas is set with the \fB \-multi\fR option,
+-\&see above.
++\&of steps. The number of replicas is set with the \fB \-multi\fR or 
++\&\fB \-multidir\fR option, described above.
+ \&All run input files should use a different coupling temperature,
+ \&the order of the files is not important. The random seed is set with
+ \&\fB \-reseed\fR. The velocities are scaled and neighbor searching
+@@ -245,7 +255,7 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ 
+ \&Finally some experimental algorithms can be tested when the
+ \&appropriate options have been given. Currently under
+-\&investigation are: polarizability, and X\-Ray bombardments.
++\&investigation are: polarizability and X\-ray bombardments.
+ \&
+ 
+ 
+@@ -267,18 +277,22 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ \&A simulation can be continued by reading the full state from file
+ \&with option \fB \-cpi\fR. This option is intelligent in the way that
+ \&if no checkpoint file is found, Gromacs just assumes a normal run and
+-\&starts from the first step of the tpr file. By default the output
++\&starts from the first step of the \fB .tpr\fR file. By default the output
+ \&will be appending to the existing output files. The checkpoint file
+ \&contains checksums of all output files, such that you will never
+ \&loose data when some output files are modified, corrupt or removed.
+ \&There are three scenarios with \fB \-cpi\fR:
+ 
+-\&* no files with matching names are present: new output files are written
+ 
+-\&* all files are present with names and checksums matching those stored
++\&\fB *\fR no files with matching names are present: new output files are written
++
++
++\&\fB *\fR all files are present with names and checksums matching those stored
+ \&in the checkpoint file: files are appended
+ 
+-\&* otherwise no files are modified and a fatal error is generated
++
++\&\fB *\fR otherwise no files are modified and a fatal error is generated
++
+ 
+ \&With \fB \-noappend\fR new output files are opened and the simulation
+ \&part number is added to all output file names.
+@@ -309,18 +323,18 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ \&
+ 
+ 
+-\&When mdrun receives a TERM signal, it will set nsteps to the current
+-\&step plus one. When mdrun receives an INT signal (e.g. when ctrl+C is
++\&When \fB mdrun\fR receives a TERM signal, it will set nsteps to the current
++\&step plus one. When \fB mdrun\fR receives an INT signal (e.g. when ctrl+C is
+ \&pressed), it will stop after the next neighbor search step 
+ \&(with nstlist=0 at the next step).
+ \&In both cases all the usual output will be written to file.
+-\&When running with MPI, a signal to one of the mdrun processes
++\&When running with MPI, a signal to one of the \fB mdrun\fR processes
+ \&is sufficient, this signal should not be sent to mpirun or
+-\&the mdrun process that is the parent of the others.
++\&the \fB mdrun\fR process that is the parent of the others.
+ \&
+ 
+ 
+-\&When mdrun is started with MPI, it does not run niced by default.
++\&When \fB mdrun\fR is started with MPI, it does not run niced by default.
+ .SH FILES
+ .BI "\-s" " topol.tpr" 
+ .B Input
+@@ -430,6 +444,10 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ .B Output, Opt.
+  Index file 
+ 
++.BI "\-multidir" " rundir" 
++.B Input, Opt., Mult.
++ Run directory 
++
+ .SH OTHER OPTIONS
+ .BI "\-[no]h"  "no    "
+  Print help info and quit
+@@ -452,9 +470,6 @@ mdrun - performs a simulation, do a normal mode analysis or an energy minimizati
+ .BI "\-dd"  " vector" " 0 0 0" 
+  Domain decomposition grid, 0 is optimize
+ 
+-.BI "\-nt"  " int" " 0" 
+- Number of threads to start (0 is guess)
+-
+ .BI "\-npme"  " int" " \-1" 
+  Number of separate nodes to be used for PME, \-1 is guess
+ 
+diff --git a/man/man1/mk_angndx.1 b/man/man1/mk_angndx.1
+index aad17d3..e9bce82 100644
+--- a/man/man1/mk_angndx.1
++++ b/man/man1/mk_angndx.1
+@@ -1,8 +1,8 @@
+-.TH mk_angndx 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH mk_angndx 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ mk_angndx - generates index files for g_angle
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3mk_angndx\fP
+ .BI "\-s" " topol.tpr "
+@@ -14,7 +14,7 @@ mk_angndx - generates index files for g_angle
+ .BI "\-[no]hyd" ""
+ .BI "\-hq" " real "
+ .SH DESCRIPTION
+-\&mk_angndx makes an index file for calculation of
++\&\fB mk_angndx\fR makes an index file for calculation of
+ \&angle distributions etc. It uses a run input file (\fB .tpx\fR) for the
+ \&definitions of the angles, dihedrals etc.
+ .SH FILES
+diff --git a/man/man1/ngmx.1 b/man/man1/ngmx.1
+index dfa2e9d..0a4affc 100644
+--- a/man/man1/ngmx.1
++++ b/man/man1/ngmx.1
+@@ -1,8 +1,8 @@
+-.TH ngmx 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH ngmx 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ ngmx - displays a trajectory
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3ngmx\fP
+ .BI "\-f" " traj.xtc "
+@@ -15,7 +15,7 @@ ngmx - displays a trajectory
+ .BI "\-e" " time "
+ .BI "\-dt" " time "
+ .SH DESCRIPTION
+-\&ngmx is the Gromacs trajectory viewer. This program reads a
++\&\fB ngmx\fR is the GROMACS trajectory viewer. This program reads a
+ \&trajectory file, a run input file and an index file and plots a
+ \&3D structure of your molecule on your standard X Window
+ \&screen. No need for a high end graphics workstation, it even
+@@ -31,9 +31,8 @@ ngmx - displays a trajectory
+ \&show computational box.
+ 
+ 
+-\&Some of the more common X command line options can be used:
+-
+-\&\-bg, \-fg change colors, \-font fontname, changes the font.
++\&Some of the more common X command line options can be used: 
++\&\fB \-bg\fR, \fB \-fg\fR change colors, \fB \-font fontname\fR changes the font.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+ .B Input
+diff --git a/man/man1/pdb2gmx.1 b/man/man1/pdb2gmx.1
+index 6e0e76d..dfa5d22 100644
+--- a/man/man1/pdb2gmx.1
++++ b/man/man1/pdb2gmx.1
+@@ -1,8 +1,8 @@
+-.TH pdb2gmx 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH pdb2gmx 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ pdb2gmx - converts pdb files to topology and coordinate files
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3pdb2gmx\fP
+ .BI "\-f" " eiwit.pdb "
+@@ -41,22 +41,22 @@ pdb2gmx - converts pdb files to topology and coordinate files
+ .BI "\-[no]renum" ""
+ .BI "\-[no]rtpres" ""
+ .SH DESCRIPTION
+-\&This program reads a pdb (or gro) file, reads
++\&This program reads a \fB .pdb\fR (or \fB .gro\fR) file, reads
+ \&some database files, adds hydrogens to the molecules and generates
+-\&coordinates in Gromacs (Gromos), or optionally pdb, format
+-\&and a topology in Gromacs format.
++\&coordinates in GROMACS (GROMOS), or optionally \fB .pdb\fR, format
++\&and a topology in GROMACS format.
+ \&These files can subsequently be processed to generate a run input file.
+ \&
+ 
+ 
+-\&pdb2gmx will search for force fields by looking for
++\&\fB pdb2gmx\fR will search for force fields by looking for
+ \&a \fB forcefield.itp\fR file in subdirectories \fB forcefield.ff\fR
+-\&of the current working directory and of the Gomracs library directory
++\&of the current working directory and of the Gromacs library directory
+ \&as inferred from the path of the binary or the \fB GMXLIB\fR environment
+ \&variable.
+ \&By default the forcefield selection is interactive,
+ \&but you can use the \fB \-ff\fR option to specify one of the short names
+-\&in the list on the command line instead. In that case pdb2gmx just looks
++\&in the list on the command line instead. In that case \fB pdb2gmx\fR just looks
+ \&for the corresponding \fB forcefield.ff\fR directory.
+ \&
+ 
+@@ -66,14 +66,14 @@ pdb2gmx - converts pdb files to topology and coordinate files
+ \&If you want to modify or add a residue types, you can copy the force
+ \&field directory from the Gromacs library directory to your current
+ \&working directory. If you want to add new protein residue types,
+-\&you will need to modify residuetypes.dat in the libary directory
++\&you will need to modify \fB residuetypes.dat\fR in the library directory
+ \&or copy the whole library directory to a local directory and set
+ \&the environment variable \fB GMXLIB\fR to the name of that directory.
+-\&Check chapter 5 of the manual for more information about file formats.
++\&Check Chapter 5 of the manual for more information about file formats.
+ \&
+ 
+ 
+-\&Note that a pdb file is nothing more than a file format, and it
++\&Note that a \fB .pdb\fR file is nothing more than a file format, and it
+ \&need not necessarily contain a protein structure. Every kind of
+ \&molecule for which there is support in the database can be converted.
+ \&If there is no support in the database, you can add it yourself.
+@@ -89,7 +89,7 @@ pdb2gmx - converts pdb files to topology and coordinate files
+ \&on NE2 or on both. By default these selections are done automatically.
+ \&For His, this is based on an optimal hydrogen bonding
+ \&conformation. Hydrogen bonds are defined based on a simple geometric
+-\&criterium, specified by the maximum hydrogen\-donor\-acceptor angle
++\&criterion, specified by the maximum hydrogen\-donor\-acceptor angle
+ \&and donor\-acceptor distance, which are set by \fB \-angle\fR and
+ \&\fB \-dist\fR respectively.
+ 
+@@ -100,33 +100,33 @@ pdb2gmx - converts pdb files to topology and coordinate files
+ \&if you want a disulfide bridge or distance restraints between
+ \&two protein chains or if you have a HEME group bound to a protein.
+ \&In such cases multiple chains should be contained in a single
+-\&\fB molecule_type\fR definition.
+-\&To handle this, pdb2gmx has an option \fB \-chainsep\fR so you can
++\&\fB moleculetype\fR definition.
++\&To handle this, \fB pdb2gmx\fR has an option \fB \-chainsep\fR so you can
+ \&choose whether a new chain should start when we find a TER record,
+ \&when the chain id changes, combinations of either or both of these
+ \&or fully interactively.
+ 
+ 
+-\&pdb2gmx will also check the occupancy field of the pdb file.
++\&\fB pdb2gmx\fR will also check the occupancy field of the \fB .pdb\fR file.
+ \&If any of the occupancies are not one, indicating that the atom is
+ \&not resolved well in the structure, a warning message is issued.
+-\&When a pdb file does not originate from an X\-Ray structure determination
++\&When a \fB .pdb\fR file does not originate from an X\-ray structure determination
+ \&all occupancy fields may be zero. Either way, it is up to the user
+ \&to verify the correctness of the input data (read the article!).
+ 
+ 
+-\&During processing the atoms will be reordered according to Gromacs
++\&During processing the atoms will be reordered according to GROMACS
+ \&conventions. With \fB \-n\fR an index file can be generated that
+ \&contains one group reordered in the same way. This allows you to
+-\&convert a Gromos trajectory and coordinate file to Gromos. There is
++\&convert a GROMOS trajectory and coordinate file to GROMOS. There is
+ \&one limitation: reordering is done after the hydrogens are stripped
+ \&from the input and before new hydrogens are added. This means that
+ \&you should not use \fB \-ignh\fR.
+ 
+ 
+ \&The \fB .gro\fR and \fB .g96\fR file formats do not support chain
+-\&identifiers. Therefore it is useful to enter a pdb file name at
+-\&the \fB \-o\fR option when you want to convert a multichain pdb file.
++\&identifiers. Therefore it is useful to enter a \fB .pdb\fR file name at
++\&the \fB \-o\fR option when you want to convert a multi\-chain \fB .pdb\fR file.
+ \&
+ 
+ 
+@@ -135,8 +135,8 @@ pdb2gmx - converts pdb files to topology and coordinate files
+ \&hydrogens into virtual sites and fixing angles, which fixes their
+ \&position relative to neighboring atoms. Additionally, all atoms in the
+ \&aromatic rings of the standard amino acids (i.e. PHE, TRP, TYR and HIS)
+-\&can be converted into virtual sites, elminating the fast improper dihedral
+-\&fluctuations in these rings. Note that in this case all other hydrogen
++\&can be converted into virtual sites, eliminating the fast improper dihedral
++\&fluctuations in these rings. \fB Note\fR that in this case all other hydrogen
+ \&atoms are also converted to virtual sites. The mass of all atoms that are
+ \&converted into virtual sites, is added to the heavy atoms.
+ 
+@@ -185,7 +185,7 @@ pdb2gmx - converts pdb files to topology and coordinate files
+  Condition in PDB files when a new chain and molecule_type should be started: \fB id_or_ter\fR, \fB id_and_ter\fR, \fB ter\fR, \fB id\fR or \fB interactive\fR
+ 
+ .BI "\-ff"  " string" " select" 
+- Force field, interactive by default. Use \-h for information.
++ Force field, interactive by default. Use \fB \-h\fR for information.
+ 
+ .BI "\-water"  " enum" " select" 
+  Water model to use: \fB select\fR, \fB none\fR, \fB spc\fR, \fB spce\fR, \fB tip3p\fR, \fB tip4p\fR or \fB tip5p\fR
+@@ -200,22 +200,22 @@ pdb2gmx - converts pdb files to topology and coordinate files
+  Interactive termini selection, iso charged
+ 
+ .BI "\-[no]lys"  "no    "
+- Interactive Lysine selection, iso charged
++ Interactive lysine selection, iso charged
+ 
+ .BI "\-[no]arg"  "no    "
+- Interactive Arganine selection, iso charged
++ Interactive arginine selection, iso charged
+ 
+ .BI "\-[no]asp"  "no    "
+- Interactive Aspartic Acid selection, iso charged
++ Interactive aspartic Acid selection, iso charged
+ 
+ .BI "\-[no]glu"  "no    "
+- Interactive Glutamic Acid selection, iso charged
++ Interactive glutamic Acid selection, iso charged
+ 
+ .BI "\-[no]gln"  "no    "
+- Interactive Glutamine selection, iso neutral
++ Interactive glutamine selection, iso neutral
+ 
+ .BI "\-[no]his"  "no    "
+- Interactive Histidine selection, iso checking H\-bonds
++ Interactive histidine selection, iso checking H\-bonds
+ 
+ .BI "\-angle"  " real" " 135   " 
+  Minimum hydrogen\-donor\-acceptor angle for a H\-bond (degrees)
+@@ -224,10 +224,10 @@ pdb2gmx - converts pdb files to topology and coordinate files
+  Maximum donor\-acceptor distance for a H\-bond (nm)
+ 
+ .BI "\-[no]una"  "no    "
+- Select aromatic rings with united CH atoms on Phenylalanine, Tryptophane and Tyrosine
++ Select aromatic rings with united CH atoms on phenylalanine, tryptophane and tyrosine
+ 
+ .BI "\-[no]ignh"  "no    "
+- Ignore hydrogen atoms that are in the pdb file
++ Ignore hydrogen atoms that are in the coordinate file
+ 
+ .BI "\-[no]missing"  "no    "
+  Continue when atoms are missing, dangerous
+@@ -248,16 +248,16 @@ pdb2gmx - converts pdb files to topology and coordinate files
+  Change the mass of hydrogens to 2 amu
+ 
+ .BI "\-[no]chargegrp"  "yes   "
+- Use charge groups in the rtp file
++ Use charge groups in the \fB .rtp\fR file
+ 
+ .BI "\-[no]cmap"  "yes   "
+- Use cmap torsions (if enabled in the rtp file)
++ Use cmap torsions (if enabled in the \fB .rtp\fR file)
+ 
+ .BI "\-[no]renum"  "no    "
+  Renumber the residues consecutively in the output
+ 
+ .BI "\-[no]rtpres"  "no    "
+- Use rtp entry names as residue names
++ Use \fB .rtp\fR entry names as residue names
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/tpbconv.1 b/man/man1/tpbconv.1
+index 2f0db8a..4515836 100644
+--- a/man/man1/tpbconv.1
++++ b/man/man1/tpbconv.1
+@@ -1,8 +1,8 @@
+-.TH tpbconv 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH tpbconv 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ tpbconv - makes a run input file for restarting a crashed run
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3tpbconv\fP
+ .BI "\-s" " topol.tpr "
+@@ -24,27 +24,31 @@ tpbconv - makes a run input file for restarting a crashed run
+ \&tpbconv can edit run input files in four ways.
+ 
+ 
+-\&\fB 1st.\fR by modifying the number of steps in a run input file
++\&\fB 1.\fR by modifying the number of steps in a run input file
+ \&with options \fB \-extend\fR, \fB \-until\fR or \fB \-nsteps\fR
+ \&(nsteps=\-1 means unlimited number of steps)
+ 
+ 
+-\&\fB 2nd.\fR (OBSOLETE) by creating a run input file
++\&\fB 2.\fR (OBSOLETE) by creating a run input file
+ \&for a continuation run when your simulation has crashed due to e.g.
+ \&a full disk, or by making a continuation run input file.
+ \&This option is obsolete, since mdrun now writes and reads
+ \&checkpoint files.
+-\&Note that a frame with coordinates and velocities is needed.
++\&\fB Note\fR that a frame with coordinates and velocities is needed.
+ \&When pressure and/or Nose\-Hoover temperature coupling is used
+ \&an energy file can be supplied to get an exact continuation
+ \&of the original run.
+ 
+ 
+-\&\fB 3rd.\fR by creating a tpx file for a subset of your original
++\&\fB 3.\fR by creating a \fB .tpx\fR file for a subset of your original
+ \&tpx file, which is useful when you want to remove the solvent from
+-\&your tpx file, or when you want to make e.g. a pure Ca tpx file.
+-\&\fB WARNING: this tpx file is not fully functional\fR.
+-\&\fB 4th.\fR by setting the charges of a specified group
++\&your \fB .tpx\fR file, or when you want to make e.g. a pure Calpha \fB .tpx\fR file.
++\&Note that you may need to use \fB \-nsteps \-1\fR (or similar) to get
++\&this to work.
++\&\fB WARNING: this \fB .tpx\fR file is not fully functional\fR.
++
++
++\&\fB 4.\fR by setting the charges of a specified group
+ \&to zero. This is useful when doing free energy estimates
+ \&using the LIE (Linear Interaction Energy) method.
+ .SH FILES
+diff --git a/man/man1/trjcat.1 b/man/man1/trjcat.1
+index 56ab69a..105282d 100644
+--- a/man/man1/trjcat.1
++++ b/man/man1/trjcat.1
+@@ -1,8 +1,8 @@
+-.TH trjcat 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH trjcat 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ trjcat - concatenates trajectory files
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3trjcat\fP
+ .BI "\-f" " traj.xtc "
+@@ -25,12 +25,12 @@ trjcat - concatenates trajectory files
+ .BI "\-[no]overwrite" ""
+ .BI "\-[no]cat" ""
+ .SH DESCRIPTION
+-\&trjcat concatenates several input trajectory files in sorted order. 
++\&\fB trjcat\fR concatenates several input trajectory files in sorted order. 
+ \&In case of double time frames the one in the later file is used. 
+ \&By specifying \fB \-settime\fR you will be asked for the start time 
+ \&of each file. The input files are taken from the command line, 
+-\&such that a command like \fB trjcat \-o fixed.trr *.trr\fR should do 
+-\&the trick. Using \fB \-cat\fR you can simply paste several files 
++\&such that a command like \fB trjcat \-f *.trr \-o fixed.trr\fR should do 
++\&the trick. Using \fB \-cat\fR, you can simply paste several files 
+ \&together without removal of frames with identical time stamps.
+ 
+ 
+@@ -42,19 +42,19 @@ trjcat - concatenates trajectory files
+ 
+ 
+ \&If the \fB \-demux\fR option is given, the N trajectories that are
+-\&read, are written in another order as specified in the xvg file.
+-\&The xvg file should contain something like:
++\&read, are written in another order as specified in the \fB .xvg\fR file.
++\&The \fB .xvg\fR file should contain something like:
+ 
+ 
+-\&0  0  1  2  3  4  5
++\&\fB 0  0  1  2  3  4  5
+ 
+-\&2  1  0  2  3  5  4
++\&2  1  0  2  3  5  4\fR
+ 
+ \&Where the first number is the time, and subsequent numbers point to
+ \&trajectory indices.
+ \&The frames corresponding to the numbers present at the first line
+ \&are collected into the output trajectory. If the number of frames in
+-\&the trajectory does not match that in the xvg file then the program
++\&the trajectory does not match that in the \fB .xvg\fR file then the program
+ \&tries to be smart. Beware.
+ .SH FILES
+ .BI "\-f" " traj.xtc" 
+@@ -99,7 +99,7 @@ trjcat - concatenates trajectory files
+  Only write frame when t MOD dt = first time (ps)
+ 
+ .BI "\-prec"  " int" " 3" 
+- Precision for .xtc and .gro writing in number of decimal places
++ Precision for \fB .xtc\fR and \fB .gro\fR writing in number of decimal places
+ 
+ .BI "\-[no]vel"  "yes   "
+  Read and write velocities if possible
+@@ -111,13 +111,13 @@ trjcat - concatenates trajectory files
+  Sort trajectory files (not frames)
+ 
+ .BI "\-[no]keeplast"  "no    "
+- keep overlapping frames at end of trajectory
++ Keep overlapping frames at end of trajectory
+ 
+ .BI "\-[no]overwrite"  "no    "
+- overwrite overlapping frames during appending
++ Overwrite overlapping frames during appending
+ 
+ .BI "\-[no]cat"  "no    "
+- do not discard double time frames
++ Do not discard double time frames
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/trjconv.1 b/man/man1/trjconv.1
+index fbb082e..637edc2 100644
+--- a/man/man1/trjconv.1
++++ b/man/man1/trjconv.1
+@@ -1,8 +1,8 @@
+-.TH trjconv 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH trjconv 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ trjconv - converts and manipulates trajectory files
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3trjconv\fP
+ .BI "\-f" " traj.xtc "
+@@ -31,6 +31,7 @@ trjconv - converts and manipulates trajectory files
+ .BI "\-[no]center" ""
+ .BI "\-boxcenter" " enum "
+ .BI "\-box" " vector "
++.BI "\-clustercenter" " vector "
+ .BI "\-trans" " vector "
+ .BI "\-shift" " vector "
+ .BI "\-fit" " enum "
+@@ -47,7 +48,7 @@ trjconv - converts and manipulates trajectory files
+ .BI "\-dropover" " real "
+ .BI "\-[no]conect" ""
+ .SH DESCRIPTION
+-\&trjconv can convert trajectory files in many ways:
++\&\fB trjconv\fR can convert trajectory files in many ways:
+ 
+ \&\fB 1.\fR from one format to another
+ 
+@@ -68,7 +69,7 @@ trjconv - converts and manipulates trajectory files
+ 
+ \&\fB 9.\fR cut the trajectory in small subtrajectories according
+ \&to information in an index file. This allows subsequent analysis of
+-\&the subtrajectories that could, for example be the result of a
++\&the subtrajectories that could, for example, be the result of a
+ \&cluster analysis. Use option \fB \-sub\fR.
+ \&This assumes that the entries in the index file are frame numbers and
+ \&dumps each group in the index file to a separate trajectory file.
+@@ -77,7 +78,7 @@ trjconv - converts and manipulates trajectory files
+ \&in an \fB .xvg\fR file.
+ 
+ 
+-\&The program \fB trjcat\fR can concatenate multiple trajectory files.
++\&The program \fB trjcat\fR is better suited for concatenating multiple trajectory files.
+ \&
+ 
+ 
+@@ -91,7 +92,7 @@ trjconv - converts and manipulates trajectory files
+ \&is always taken from \fB \-ndec\fR, when this option is set.
+ \&All other formats have fixed precision. \fB .trr\fR and \fB .trj\fR
+ \&output can be single or double precision, depending on the precision
+-\&of the trjconv binary.
++\&of the \fB trjconv\fR binary.
+ \&Note that velocities are only supported in
+ \&\fB .trr\fR, \fB .trj\fR, \fB .gro\fR and \fB .g96\fR files.
+ 
+@@ -103,7 +104,7 @@ trjconv - converts and manipulates trajectory files
+ 
+ 
+ \&Option \fB \-sep\fR can be used to write every frame to a separate
+-\&.gro, .g96 or .pdb file, default all frames all written to one file.
++\&\fB .gro, .g96\fR or \fB .pdb\fR file. By default, all frames all written to one file.
+ \&\fB .pdb\fR files with all frames concatenated can be viewed with
+ \&\fB rasmol \-nmrpdb\fR.
+ 
+@@ -117,9 +118,9 @@ trjconv - converts and manipulates trajectory files
+ 
+ 
+ \&There are two options for fitting the trajectory to a reference
+-\&either for essential dynamics analysis or for whatever.
++\&either for essential dynamics analysis, etc.
+ \&The first option is just plain fitting to a reference structure
+-\&in the structure file, the second option is a progressive fit
++\&in the structure file. The second option is a progressive fit
+ \&in which the first timeframe is fitted to the reference structure 
+ \&in the structure file to obtain and each subsequent timeframe is 
+ \&fitted to the previously fitted structure. This way a continuous
+@@ -131,28 +132,32 @@ trjconv - converts and manipulates trajectory files
+ \&Option \fB \-pbc\fR sets the type of periodic boundary condition
+ \&treatment:
+ 
+-\&* \fB mol\fR puts the center of mass of molecules in the box.
++\&\fB * mol\fR puts the center of mass of molecules in the box.
+ 
+-\&* \fB res\fR puts the center of mass of residues in the box.
++\&\fB * res\fR puts the center of mass of residues in the box.
+ 
+-\&* \fB atom\fR puts all the atoms in the box.
++\&\fB * atom\fR puts all the atoms in the box.
+ 
+-\&* \fB nojump\fR checks if atoms jump across the box and then puts
++\&\fB * nojump\fR checks if atoms jump across the box and then puts
+ \&them back. This has the effect that all molecules
+ \&will remain whole (provided they were whole in the initial
+-\&conformation), note that this ensures a continuous trajectory but
++\&conformation). \fB Note\fR that this ensures a continuous trajectory but
+ \&molecules may diffuse out of the box. The starting configuration
+ \&for this procedure is taken from the structure file, if one is
+ \&supplied, otherwise it is the first frame.
+ 
+-\&* \fB cluster\fR clusters all the atoms in the selected index
+-\&such that they are all closest to the center of mass of the cluster
+-\&which is iteratively updated. Note that this will only give meaningful
++\&\fB * cluster\fR clusters all the atoms in the selected index
++\&such that they are all closest to the center of mass of the cluster,
++\&which is iteratively updated. \fB Note\fR that this will only give meaningful
+ \&results if you in fact have a cluster. Luckily that can be checked
+ \&afterwards using a trajectory viewer. Note also that if your molecules
+ \&are broken this will not work either.
+ 
+-\&* \fB whole\fR only makes broken molecules whole.
++\&The separate option \fB \-clustercenter\fR can be used to specify an
++\&approximate center for the cluster. This is useful e.g. if you have
++\&two big vesicles, and you want to maintain their relative positions.
++
++\&\fB * whole\fR only makes broken molecules whole.
+ 
+ 
+ \&Option \fB \-ur\fR sets the unit cell representation for options
+@@ -163,7 +168,7 @@ trjconv - converts and manipulates trajectory files
+ \&\fB tric\fR is the triclinic unit cell.
+ \&\fB compact\fR puts all atoms at the closest distance from the center
+ \&of the box. This can be useful for visualizing e.g. truncated
+-\&octahedrons. The center for options \fB tric\fR and \fB compact\fR
++\&octahedra. The center for options \fB tric\fR and \fB compact\fR
+ \&is \fB tric\fR (see below), unless the option \fB \-boxcenter\fR
+ \&is set differently.
+ 
+@@ -179,22 +184,19 @@ trjconv - converts and manipulates trajectory files
+ \&want all molecules in the box after the centering.
+ 
+ 
+-\&With \fB \-dt\fR it is possible to reduce the number of 
++\&With \fB \-dt\fR, it is possible to reduce the number of 
+ \&frames in the output. This option relies on the accuracy of the times
+ \&in your input trajectory, so if these are inaccurate use the
+ \&\fB \-timestep\fR option to modify the time (this can be done
+-\&simultaneously). For making smooth movies the program \fB g_filter\fR
++\&simultaneously). For making smooth movies, the program \fB g_filter\fR
+ \&can reduce the number of frames while using low\-pass frequency
+ \&filtering, this reduces aliasing of high frequency motions.
+ 
+ 
+-\&Using \fB \-trunc\fR trjconv can truncate \fB .trj\fR in place, i.e.
++\&Using \fB \-trunc\fR \fB trjconv\fR can truncate \fB .trj\fR in place, i.e.
+ \&without copying the file. This is useful when a run has crashed
+-\&during disk I/O (one more disk full), or when two contiguous
+-\&trajectories must be concatenated without have double frames.
+-
+-
+-\&\fB trjcat\fR is more suitable for concatenating trajectory files.
++\&during disk I/O (i.e. full disk), or when two contiguous
++\&trajectories must be concatenated without having double frames.
+ 
+ 
+ \&Option \fB \-dump\fR can be used to extract a frame at or near
+@@ -254,7 +256,7 @@ trjconv - converts and manipulates trajectory files
+  Time unit: \fB fs\fR, \fB ps\fR, \fB ns\fR, \fB us\fR, \fB ms\fR or \fB s\fR
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-xvg"  " enum" " xmgrace" 
+  xvg plot formatting: \fB xmgrace\fR, \fB xmgr\fR or \fB none\fR
+@@ -292,6 +294,9 @@ trjconv - converts and manipulates trajectory files
+ .BI "\-box"  " vector" " 0 0 0" 
+  Size for new cubic box (default: read from input)
+ 
++.BI "\-clustercenter"  " vector" " 0 0 0" 
++ Optional starting point for pbc cluster option
++
+ .BI "\-trans"  " vector" " 0 0 0" 
+  All coordinates will be translated by trans. This can advantageously be combined with \-pbc mol \-ur compact.
+ 
+@@ -311,7 +316,7 @@ trjconv - converts and manipulates trajectory files
+  Read and write forces if possible
+ 
+ .BI "\-trunc"  " time" " \-1    " 
+- Truncate input trj file after this time (ps)
++ Truncate input trajectory file after this time (ps)
+ 
+ .BI "\-exec"  " string" " " 
+  Execute command for every output frame with the frame number as argument
+@@ -326,7 +331,7 @@ trjconv - converts and manipulates trajectory files
+  Write each frame to a separate .gro, .g96 or .pdb file
+ 
+ .BI "\-nzero"  " int" " 0" 
+- Prepend file number in case you use the \-sep flag with this number of zeroes
++ If the \-sep flag is set, use these many digits for the file numbers and prepend zeros as needed
+ 
+ .BI "\-dropunder"  " real" " 0     " 
+  Drop all frames below this value
+@@ -335,7 +340,7 @@ trjconv - converts and manipulates trajectory files
+  Drop all frames above this value
+ 
+ .BI "\-[no]conect"  "no    "
+- Add conect records when writing pdb files. Useful for visualization of non\-standard molecules, e.g. coarse grained ones
++ Add conect records when writing \fB .pdb\fR files. Useful for visualization of non\-standard molecules, e.g. coarse grained ones
+ 
+ .SH SEE ALSO
+ .BR gromacs(7)
+diff --git a/man/man1/trjorder.1 b/man/man1/trjorder.1
+index c882706..40a18cd 100644
+--- a/man/man1/trjorder.1
++++ b/man/man1/trjorder.1
+@@ -1,8 +1,8 @@
+-.TH trjorder 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH trjorder 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ trjorder - orders molecules according to their distance to a group
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3trjorder\fP
+ .BI "\-f" " traj.xtc "
+@@ -23,7 +23,7 @@ trjorder - orders molecules according to their distance to a group
+ .BI "\-r" " real "
+ .BI "\-[no]z" ""
+ .SH DESCRIPTION
+-\&trjorder orders molecules according to the smallest distance
++\&\fB trjorder\fR orders molecules according to the smallest distance
+ \&to atoms in a reference group
+ \&or on z\-coordinate (with option \fB \-z\fR).
+ \&With distance ordering, it will ask for a group of reference
+@@ -36,7 +36,7 @@ trjorder - orders molecules according to their distance to a group
+ \&to the output trajectory.
+ 
+ 
+-\&trjorder can be useful for e.g. analyzing the n waters closest to a
++\&\fB trjorder\fR can be useful for e.g. analyzing the n waters closest to a
+ \&protein.
+ \&In that case the reference group would be the protein and the group
+ \&of molecules would consist of all the water atoms. When an index group
+@@ -45,8 +45,8 @@ trjorder - orders molecules according to their distance to a group
+ \&
+ 
+ 
+-\&If the output file is a pdb file, the distance to the reference target
+-\&will be stored in the B\-factor field in order to color with e.g. rasmol.
++\&If the output file is a \fB .pdb\fR file, the distance to the reference target
++\&will be stored in the B\-factor field in order to color with e.g. Rasmol.
+ \&
+ 
+ 
+diff --git a/man/man1/xpm2ps.1 b/man/man1/xpm2ps.1
+index 4b46844..216d97f 100644
+--- a/man/man1/xpm2ps.1
++++ b/man/man1/xpm2ps.1
+@@ -1,8 +1,8 @@
+-.TH xpm2ps 1 "Thu 26 Aug 2010" "" "GROMACS suite, VERSION 4.5"
++.TH xpm2ps 1 "Mon 4 Apr 2011" "" "GROMACS suite, VERSION 4.5.4-dev-20110404-bc5695c"
+ .SH NAME
+ xpm2ps - converts XPM matrices to encapsulated postscript (or XPM)
+ 
+-.B VERSION 4.5
++.B VERSION 4.5.4-dev-20110404-bc5695c
+ .SH SYNOPSIS
+ \f3xpm2ps\fP
+ .BI "\-f" " root.xpm "
+@@ -32,30 +32,30 @@ xpm2ps - converts XPM matrices to encapsulated postscript (or XPM)
+ .BI "\-cmin" " real "
+ .BI "\-cmax" " real "
+ .SH DESCRIPTION
+-\&xpm2ps makes a beautiful color plot of an XPixelMap file.
++\&\fB xpm2ps\fR makes a beautiful color plot of an XPixelMap file.
+ \&Labels and axis can be displayed, when they are supplied
+ \&in the correct matrix format.
+-\&Matrix data may be generated by programs such as do_dssp, g_rms or
+-\&g_mdmat.
++\&Matrix data may be generated by programs such as \fB do_dssp\fR, \fB g_rms\fR or
++\&\fB g_mdmat\fR.
+ 
+ 
+-\&Parameters are set in the \fB m2p\fR file optionally supplied with
+-\&\fB \-di\fR. Reasonable defaults are provided. Settings for the y\-axis
+-\&default to those for the x\-axis. Font names have a defaulting hierarchy:
++\&Parameters are set in the \fB .m2p\fR file optionally supplied with
++\&\fB \-di\fR. Reasonable defaults are provided. Settings for the \fI y\fR\-axis
++\&default to those for the \fI x\fR\-axis. Font names have a defaulting hierarchy:
+ \&titlefont \- legendfont; titlefont \- (xfont \- yfont \- ytickfont)
+ \&\- xtickfont, e.g. setting titlefont sets all fonts, setting xfont
+ \&sets yfont, ytickfont and xtickfont.
+ 
+ 
+-\&When no \fB m2p\fR file is supplied, many setting are set by
+-\&command line options. The most important option is \fB \-size\fR
++\&When no \fB .m2p\fR file is supplied, many settings are taken from
++\&command line options. The most important option is \fB \-size\fR,
+ \&which sets the size of the whole matrix in postscript units.
+ \&This option can be overridden with the \fB \-bx\fR and \fB \-by\fR
+-\&options (and the corresponding parameters in the \fB m2p\fR file),
++\&options (and the corresponding parameters in the \fB .m2p\fR file),
+ \&which set the size of a single matrix element.
+ 
+ 
+-\&With \fB \-f2\fR a 2nd matrix file can be supplied, both matrix
++\&With \fB \-f2\fR a second matrix file can be supplied. Both matrix
+ \&files will be read simultaneously and the upper left half of the
+ \&first one (\fB \-f\fR) is plotted together with the lower right
+ \&half of the second one (\fB \-f2\fR). The diagonal will contain
+@@ -67,7 +67,7 @@ xpm2ps - converts XPM matrices to encapsulated postscript (or XPM)
+ \&If the color coding and legend labels of both matrices are identical,
+ \&only one legend will be displayed, else two separate legends are
+ \&displayed.
+-\&With \fB \-combine\fR an alternative operation can be selected
++\&With \fB \-combine\fR, an alternative operation can be selected
+ \&to combine the matrices. The output range is automatically set
+ \&to the actual range of the combined matrix. This can be overridden
+ \&with \fB \-cmin\fR and \fB \-cmax\fR.
+@@ -75,10 +75,10 @@ xpm2ps - converts XPM matrices to encapsulated postscript (or XPM)
+ 
+ \&\fB \-title\fR can be set to \fB none\fR to suppress the title, or to
+ \&\fB ylabel\fR to show the title in the Y\-label position (alongside
+-\&the Y\-axis).
++\&the \fI y\fR\-axis).
+ 
+ 
+-\&With the \fB \-rainbow\fR option dull grey\-scale matrices can be turned
++\&With the \fB \-rainbow\fR option, dull grayscale matrices can be turned
+ \&into attractive color pictures.
+ 
+ 
+@@ -120,7 +120,7 @@ xpm2ps - converts XPM matrices to encapsulated postscript (or XPM)
+  Set the nicelevel
+ 
+ .BI "\-[no]w"  "no    "
+- View output xvg, xpm, eps and pdb files
++ View output \fB .xvg\fR, \fB .xpm\fR, \fB .eps\fR and \fB .pdb\fR files
+ 
+ .BI "\-[no]frame"  "yes   "
+  Display frame, ticks, labels, title and legend
+@@ -141,7 +141,7 @@ xpm2ps - converts XPM matrices to encapsulated postscript (or XPM)
+  Horizontal size of the matrix in ps units
+ 
+ .BI "\-bx"  " real" " 0     " 
+- Element x\-size, overrides \-size (also y\-size when \-by is not set)
++ Element x\-size, overrides \fB \-size\fR (also y\-size when \fB \-by\fR is not set)
+ 
+ .BI "\-by"  " real" " 0     " 
+  Element y\-size
+@@ -156,10 +156,10 @@ xpm2ps - converts XPM matrices to encapsulated postscript (or XPM)
+  only write out every nr\-th row and column
+ 
+ .BI "\-[no]zeroline"  "no    "
+- insert line in xpm matrix where axis label is zero
++ insert line in \fB .xpm\fR matrix where axis label is zero
+ 
+ .BI "\-legoffset"  " int" " 0" 
+- Skip first N colors from xpm file for the legend
++ Skip first N colors from \fB .xpm\fR file for the legend
+ 
+ .BI "\-combine"  " enum" " halves" 
+  Combine two matrices: \fB halves\fR, \fB add\fR, \fB sub\fR, \fB mult\fR or \fB div\fR
+diff --git a/share/html/online/Makefile.am b/share/html/online/Makefile.am
+index 8e0bcff..37d5fc5 100644
+--- a/share/html/online/Makefile.am
++++ b/share/html/online/Makefile.am
+@@ -35,7 +35,7 @@ online_DATA = \
+   g_dielectric.html  g_saltbr.html     mdrun.html            xrama.html      \
+   g_dih.html         g_sas.html        mk_angndx.html        xtc.html        \
+   g_dipoles.html     g_sgangle.html    mtx.html              xvg.html        \
+-  g_densmap.html     g_sham.html       make_edi.html			     \
++  g_densmap.html     g_sham.html       make_edi.html	     g_densorder.html \
+   style.css		\
+   water.html	gmxdemo.html	speptide.html	yourown.html \
+   methanol.html	mixed.html	protunf.html
+diff --git a/share/html/online/g_densorder.html b/share/html/online/g_densorder.html
+new file mode 100644
+index 0000000..6df73d5
+--- /dev/null
++++ b/share/html/online/g_densorder.html
+@@ -0,0 +1,63 @@
++<HTML>
++<HEAD>
++<TITLE>g_densorder</TITLE>
++<LINK rel=stylesheet href="style.css" type="text/css">
++<BODY text="#000000" bgcolor="#FFFFFF" link="#0000FF" vlink="#990000" alink="#FF0000">
++<TABLE WIDTH="98%" NOBORDER >
++<TR><TD WIDTH=400>
++<TABLE WIDTH=400 NOBORDER>
++<TD WIDTH=116>
++<a href="http://www.gromacs.org/"><img SRC="../images/gmxlogo_small.png"BORDER=0 </a></td>
++<td ALIGN=LEFT VALIGN=TOP WIDTH=280><br><h2>g_densorder</h2><font size=-1><A HREF="../online.html">Main Table of Contents</A></font><br><br></td>
++</TABLE></TD><TD WIDTH="*" ALIGN=RIGHT VALIGN=BOTTOM><p><B>VERSION 4.5.4-dev-20110404-3c0e5ec<br>
++Mon 4 Apr 2011</B></td></tr></TABLE>
++<HR>
++<H3>Description</H3>
++<p>
++A small program to reduce a two-phase density distribution
++along an axis, computed over a MD trajectory
++to 2D surfaces fluctuating in time, by a fit to
++a functional profile for interfacial densities
++A time-averaged spatial representation of the
++interfaces can be output with the option -tavg
++<P>
++<H3>Files</H3>
++<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2>
++<TR><TH>option</TH><TH>filename</TH><TH>type</TH><TH>description</TH></TR>
++<TR><TD ALIGN=RIGHT> <b><tt>-s</tt></b> </TD><TD ALIGN=RIGHT> <tt><a href="files.html">   topol.tpr</a></tt> </TD><TD> Input </TD><TD> Run input file: <a href="tpr.html">tpr</a> <a href="tpb.html">tpb</a> <a href="tpa.html">tpa</a> </TD></TR>
++<TR><TD ALIGN=RIGHT> <b><tt>-f</tt></b> </TD><TD ALIGN=RIGHT> <tt><a href="files.html">    traj.xtc</a></tt> </TD><TD> Input </TD><TD> Trajectory: <a href="xtc.html">xtc</a> <a href="trr.html">trr</a> <a href="trj.html">trj</a> <a href="gro.html">gro</a> <a href="g96.html">g96</a> <a href="pdb.html">pdb</a> cpt </TD></TR>
++<TR><TD ALIGN=RIGHT> <b><tt>-n</tt></b> </TD><TD ALIGN=RIGHT> <tt><a href="ndx.html">   index.ndx</a></tt> </TD><TD> Input </TD><TD> Index file </TD></TR>
++<TR><TD ALIGN=RIGHT> <b><tt>-o</tt></b> </TD><TD ALIGN=RIGHT> <tt><a href="dat.html">Density4D.dat</a></tt> </TD><TD> Output, Opt. </TD><TD> Generic data file </TD></TR>
++<TR><TD ALIGN=RIGHT> <b><tt>-or</tt></b> </TD><TD ALIGN=RIGHT> <tt><a href="out.html">   hello.out</a></tt> </TD><TD> Output, Opt., Mult. </TD><TD> Generic output file </TD></TR>
++<TR><TD ALIGN=RIGHT> <b><tt>-og</tt></b> </TD><TD ALIGN=RIGHT> <tt><a href="xpm.html">interface.xpm</a></tt> </TD><TD> Output, Opt., Mult. </TD><TD> X PixMap compatible matrix file </TD></TR>
++<TR><TD ALIGN=RIGHT> <b><tt>-Spect</tt></b> </TD><TD ALIGN=RIGHT> <tt><a href="out.html">intfspect.out</a></tt> </TD><TD> Output, Opt., Mult. </TD><TD> Generic output file </TD></TR>
++</TABLE>
++<P>
++<H3>Other options</H3>
++<TABLE BORDER=1 CELLSPACING=0 CELLPADDING=2>
++<TR><TH>option</TH><TH>type</TH><TH>default</TH><TH>description</TH></TR>
++<TR><TD ALIGN=RIGHT> <b><tt>-[no]h</tt></b> </TD><TD ALIGN=RIGHT> bool </TD><TD ALIGN=RIGHT> <tt>no    </tt> </TD><TD> Print help info and quit </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-[no]version</tt></b> </TD><TD ALIGN=RIGHT> bool </TD><TD ALIGN=RIGHT> <tt>no    </tt> </TD><TD> Print version info and quit </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-nice</tt></b> </TD><TD ALIGN=RIGHT> int </TD><TD ALIGN=RIGHT> <tt>0</tt> </TD><TD> Set the nicelevel </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-b</tt></b> </TD><TD ALIGN=RIGHT> time </TD><TD ALIGN=RIGHT> <tt>0     </tt> </TD><TD> First frame (ps) to read from trajectory </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-e</tt></b> </TD><TD ALIGN=RIGHT> time </TD><TD ALIGN=RIGHT> <tt>0     </tt> </TD><TD> Last frame (ps) to read from trajectory </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-dt</tt></b> </TD><TD ALIGN=RIGHT> time </TD><TD ALIGN=RIGHT> <tt>0     </tt> </TD><TD> Only use frame when t MOD dt = first time (ps) </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-[no]w</tt></b> </TD><TD ALIGN=RIGHT> bool </TD><TD ALIGN=RIGHT> <tt>no    </tt> </TD><TD> View output <tt>.<a href="xvg.html">xvg</a></tt>, <tt>.<a href="xpm.html">xpm</a></tt>, <tt>.<a href="eps.html">eps</a></tt> and <tt>.<a href="pdb.html">pdb</a></tt> files </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-[no]1d</tt></b> </TD><TD ALIGN=RIGHT> bool </TD><TD ALIGN=RIGHT> <tt>no    </tt> </TD><TD> Pseudo-1d interface geometry </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-bw</tt></b> </TD><TD ALIGN=RIGHT> real </TD><TD ALIGN=RIGHT> <tt>0.2   </tt> </TD><TD> Binwidth of density distribution tangential to interface </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-bwn</tt></b> </TD><TD ALIGN=RIGHT> real </TD><TD ALIGN=RIGHT> <tt>0.05  </tt> </TD><TD> Binwidth of density distribution normal to interface </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-order</tt></b> </TD><TD ALIGN=RIGHT> int </TD><TD ALIGN=RIGHT> <tt>0</tt> </TD><TD> Order of Gaussian filter, order 0 equates to NO filtering </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-axis</tt></b> </TD><TD ALIGN=RIGHT> string </TD><TD ALIGN=RIGHT> <tt>Z</tt> </TD><TD> Axis Direction - X, Y or Z </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-method</tt></b> </TD><TD ALIGN=RIGHT> enum </TD><TD ALIGN=RIGHT> <tt>bisect</tt> </TD><TD> Interface location method: <tt>bisect</tt> or <tt>functional</tt> </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-d1</tt></b> </TD><TD ALIGN=RIGHT> real </TD><TD ALIGN=RIGHT> <tt>0     </tt> </TD><TD> Bulk density phase 1 (at small z) </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-d2</tt></b> </TD><TD ALIGN=RIGHT> real </TD><TD ALIGN=RIGHT> <tt>1000  </tt> </TD><TD> Bulk density phase 2 (at large z) </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-tblock</tt></b> </TD><TD ALIGN=RIGHT> int </TD><TD ALIGN=RIGHT> <tt>100</tt> </TD><TD> Number of frames in one time-block average </TD></TD>
++<TR><TD ALIGN=RIGHT> <b><tt>-nlevel</tt></b> </TD><TD ALIGN=RIGHT> int </TD><TD ALIGN=RIGHT> <tt>100</tt> </TD><TD> Number of Height levels in 2D - XPixMaps </TD></TD>
++</TABLE>
++<P>
++<hr>
++<div ALIGN=RIGHT>
++<font size="-1"><a href="http://www.gromacs.org">http://www.gromacs.org</a></font><br>
++<font size="-1"><a href="mailto:gromacs at gromacs.org">gromacs at gromacs.org</a></font><br>
++</div>
++</BODY>
+diff --git a/share/top/amber03.ff/ions.itp b/share/top/amber03.ff/ions.itp
+index 0ab05f9..fe13ab6 100644
+--- a/share/top/amber03.ff/ions.itp
++++ b/share/top/amber03.ff/ions.itp
+@@ -4,7 +4,7 @@ IB+             1       ; big positive ion
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    IB                  1       IB+            IB      1    1.00000
++1       IB              1       IB+             IB       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -13,7 +13,7 @@ CA              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    C0                  1       CA             CA      1    2.00000
++1       C0              1       CA              CA       1      2.00000
+ 
+ 
+ [ moleculetype ]
+@@ -22,7 +22,7 @@ CL              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Cl                  1       CL             CL      1   -1.00000
++1       Cl              1       CL              CL       1      -1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -31,7 +31,7 @@ NA              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Na                  1       NA             NA      1    1.00000
++1       Na              1       NA              NA       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -40,7 +40,7 @@ MG              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    MG                  1       MG             MG      1    2.00000
++1       MG              1       MG              MG       1      2.00000
+ 
+ 
+ [ moleculetype ]
+@@ -49,7 +49,7 @@ K               1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    K                   1       K              K       1    1.00000
++1       K               1       K               K        1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -58,7 +58,7 @@ RB              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Rb                  1       RB             RB      1    1.00000
++1       Rb              1       RB              RB       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -67,7 +67,7 @@ CS              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Cs                  1       CS             CS      1    1.00000
++1       Cs              1       CS              CS       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -76,7 +76,7 @@ LI              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Li                  1       LI             LI      1    1.00000
++1       Li              1       LI              LI       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -85,4 +85,4 @@ ZN              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Zn                  1       ZN             ZN      1    2.00000
++1       Zn              1       ZN              ZN       1      2.00000
+diff --git a/share/top/amber94.ff/ions.itp b/share/top/amber94.ff/ions.itp
+index 0ab05f9..fe13ab6 100644
+--- a/share/top/amber94.ff/ions.itp
++++ b/share/top/amber94.ff/ions.itp
+@@ -4,7 +4,7 @@ IB+             1       ; big positive ion
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    IB                  1       IB+            IB      1    1.00000
++1       IB              1       IB+             IB       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -13,7 +13,7 @@ CA              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    C0                  1       CA             CA      1    2.00000
++1       C0              1       CA              CA       1      2.00000
+ 
+ 
+ [ moleculetype ]
+@@ -22,7 +22,7 @@ CL              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Cl                  1       CL             CL      1   -1.00000
++1       Cl              1       CL              CL       1      -1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -31,7 +31,7 @@ NA              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Na                  1       NA             NA      1    1.00000
++1       Na              1       NA              NA       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -40,7 +40,7 @@ MG              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    MG                  1       MG             MG      1    2.00000
++1       MG              1       MG              MG       1      2.00000
+ 
+ 
+ [ moleculetype ]
+@@ -49,7 +49,7 @@ K               1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    K                   1       K              K       1    1.00000
++1       K               1       K               K        1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -58,7 +58,7 @@ RB              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Rb                  1       RB             RB      1    1.00000
++1       Rb              1       RB              RB       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -67,7 +67,7 @@ CS              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Cs                  1       CS             CS      1    1.00000
++1       Cs              1       CS              CS       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -76,7 +76,7 @@ LI              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Li                  1       LI             LI      1    1.00000
++1       Li              1       LI              LI       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -85,4 +85,4 @@ ZN              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Zn                  1       ZN             ZN      1    2.00000
++1       Zn              1       ZN              ZN       1      2.00000
+diff --git a/share/top/amber99.ff/ions.itp b/share/top/amber99.ff/ions.itp
+index 0ab05f9..fe13ab6 100644
+--- a/share/top/amber99.ff/ions.itp
++++ b/share/top/amber99.ff/ions.itp
+@@ -4,7 +4,7 @@ IB+             1       ; big positive ion
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    IB                  1       IB+            IB      1    1.00000
++1       IB              1       IB+             IB       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -13,7 +13,7 @@ CA              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    C0                  1       CA             CA      1    2.00000
++1       C0              1       CA              CA       1      2.00000
+ 
+ 
+ [ moleculetype ]
+@@ -22,7 +22,7 @@ CL              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Cl                  1       CL             CL      1   -1.00000
++1       Cl              1       CL              CL       1      -1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -31,7 +31,7 @@ NA              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Na                  1       NA             NA      1    1.00000
++1       Na              1       NA              NA       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -40,7 +40,7 @@ MG              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    MG                  1       MG             MG      1    2.00000
++1       MG              1       MG              MG       1      2.00000
+ 
+ 
+ [ moleculetype ]
+@@ -49,7 +49,7 @@ K               1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    K                   1       K              K       1    1.00000
++1       K               1       K               K        1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -58,7 +58,7 @@ RB              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Rb                  1       RB             RB      1    1.00000
++1       Rb              1       RB              RB       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -67,7 +67,7 @@ CS              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Cs                  1       CS             CS      1    1.00000
++1       Cs              1       CS              CS       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -76,7 +76,7 @@ LI              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Li                  1       LI             LI      1    1.00000
++1       Li              1       LI              LI       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -85,4 +85,4 @@ ZN              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Zn                  1       ZN             ZN      1    2.00000
++1       Zn              1       ZN              ZN       1      2.00000
+diff --git a/share/top/amber99sb-ildn.ff/ions.itp b/share/top/amber99sb-ildn.ff/ions.itp
+index 0ab05f9..fe13ab6 100644
+--- a/share/top/amber99sb-ildn.ff/ions.itp
++++ b/share/top/amber99sb-ildn.ff/ions.itp
+@@ -4,7 +4,7 @@ IB+             1       ; big positive ion
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    IB                  1       IB+            IB      1    1.00000
++1       IB              1       IB+             IB       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -13,7 +13,7 @@ CA              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    C0                  1       CA             CA      1    2.00000
++1       C0              1       CA              CA       1      2.00000
+ 
+ 
+ [ moleculetype ]
+@@ -22,7 +22,7 @@ CL              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Cl                  1       CL             CL      1   -1.00000
++1       Cl              1       CL              CL       1      -1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -31,7 +31,7 @@ NA              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Na                  1       NA             NA      1    1.00000
++1       Na              1       NA              NA       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -40,7 +40,7 @@ MG              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    MG                  1       MG             MG      1    2.00000
++1       MG              1       MG              MG       1      2.00000
+ 
+ 
+ [ moleculetype ]
+@@ -49,7 +49,7 @@ K               1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    K                   1       K              K       1    1.00000
++1       K               1       K               K        1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -58,7 +58,7 @@ RB              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Rb                  1       RB             RB      1    1.00000
++1       Rb              1       RB              RB       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -67,7 +67,7 @@ CS              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Cs                  1       CS             CS      1    1.00000
++1       Cs              1       CS              CS       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -76,7 +76,7 @@ LI              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Li                  1       LI             LI      1    1.00000
++1       Li              1       LI              LI       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -85,4 +85,4 @@ ZN              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Zn                  1       ZN             ZN      1    2.00000
++1       Zn              1       ZN              ZN       1      2.00000
+diff --git a/share/top/amber99sb.ff/ions.itp b/share/top/amber99sb.ff/ions.itp
+index 0ab05f9..fe13ab6 100644
+--- a/share/top/amber99sb.ff/ions.itp
++++ b/share/top/amber99sb.ff/ions.itp
+@@ -4,7 +4,7 @@ IB+             1       ; big positive ion
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    IB                  1       IB+            IB      1    1.00000
++1       IB              1       IB+             IB       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -13,7 +13,7 @@ CA              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    C0                  1       CA             CA      1    2.00000
++1       C0              1       CA              CA       1      2.00000
+ 
+ 
+ [ moleculetype ]
+@@ -22,7 +22,7 @@ CL              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Cl                  1       CL             CL      1   -1.00000
++1       Cl              1       CL              CL       1      -1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -31,7 +31,7 @@ NA              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Na                  1       NA             NA      1    1.00000
++1       Na              1       NA              NA       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -40,7 +40,7 @@ MG              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    MG                  1       MG             MG      1    2.00000
++1       MG              1       MG              MG       1      2.00000
+ 
+ 
+ [ moleculetype ]
+@@ -49,7 +49,7 @@ K               1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    K                   1       K              K       1    1.00000
++1       K               1       K               K        1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -58,7 +58,7 @@ RB              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Rb                  1       RB             RB      1    1.00000
++1       Rb              1       RB              RB       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -67,7 +67,7 @@ CS              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Cs                  1       CS             CS      1    1.00000
++1       Cs              1       CS              CS       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -76,7 +76,7 @@ LI              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Li                  1       LI             LI      1    1.00000
++1       Li              1       LI              LI       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -85,4 +85,4 @@ ZN              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Zn                  1       ZN             ZN      1    2.00000
++1       Zn              1       ZN              ZN       1      2.00000
+diff --git a/share/top/amberGS.ff/ions.itp b/share/top/amberGS.ff/ions.itp
+index 0ab05f9..fe13ab6 100644
+--- a/share/top/amberGS.ff/ions.itp
++++ b/share/top/amberGS.ff/ions.itp
+@@ -4,7 +4,7 @@ IB+             1       ; big positive ion
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    IB                  1       IB+            IB      1    1.00000
++1       IB              1       IB+             IB       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -13,7 +13,7 @@ CA              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    C0                  1       CA             CA      1    2.00000
++1       C0              1       CA              CA       1      2.00000
+ 
+ 
+ [ moleculetype ]
+@@ -22,7 +22,7 @@ CL              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Cl                  1       CL             CL      1   -1.00000
++1       Cl              1       CL              CL       1      -1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -31,7 +31,7 @@ NA              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Na                  1       NA             NA      1    1.00000
++1       Na              1       NA              NA       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -40,7 +40,7 @@ MG              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    MG                  1       MG             MG      1    2.00000
++1       MG              1       MG              MG       1      2.00000
+ 
+ 
+ [ moleculetype ]
+@@ -49,7 +49,7 @@ K               1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    K                   1       K              K       1    1.00000
++1       K               1       K               K        1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -58,7 +58,7 @@ RB              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Rb                  1       RB             RB      1    1.00000
++1       Rb              1       RB              RB       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -67,7 +67,7 @@ CS              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Cs                  1       CS             CS      1    1.00000
++1       Cs              1       CS              CS       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -76,7 +76,7 @@ LI              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Li                  1       LI             LI      1    1.00000
++1       Li              1       LI              LI       1      1.00000
+ 
+ 
+ [ moleculetype ]
+@@ -85,4 +85,4 @@ ZN              1
+ 
+ [ atoms ]
+ ; id    at type         res nr  residu name     at name  cg nr  charge
+-   1    Zn                  1       ZN             ZN      1    2.00000
++1       Zn              1       ZN              ZN       1      2.00000
+diff --git a/share/top/charmm27.ff/ions.itp b/share/top/charmm27.ff/ions.itp
+index d900cb0..38e71c3 100644
+--- a/share/top/charmm27.ff/ions.itp
++++ b/share/top/charmm27.ff/ions.itp
+@@ -1,68 +1,68 @@
+ [ moleculetype ] ; added by Bjelkmar Jan 2010, from c32b1/toppar/stream/toppar_water_ions.str
+-; molname	nrexcl
+-OH		1
++; molname   nrexcl
++OH          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1       OC      	1       OH               O1	 1	-1.32
+-2       H       	1       OH               H1	 1	0.32
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       OC          1       OH          O1       1      -1.32
++2       H           1       OH          H1       1      0.32
+ 
+ [ bonds ]
+-;i	j	funct	length	force.c.
+-1	2	1	0.09700	456056   ; hydroxyl bond
++;i  j   funct   length  force.c.
++1   2   1       0.09700 456056   ; hydroxyl bond
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-NA		1
++; molname   nrexcl
++NA          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   
+-1	SOD		1	NA		NA	 1	1		 
++; id    at type     res nr  residu name at name  cg nr  charge   
++1       SOD         1       NA          NA       1      1        
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-MG		1
++; molname   nrexcl
++MG          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge
+-1	MG		1	MG		MG	 1	2		 
++; id    at type     res nr  residu name at name  cg nr  charge
++1       MG          1       MG          MG       1      2        
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-K		1
++; molname   nrexcl
++K           1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   
+-1	POT		1	K		K	 1	1		 
++; id    at type     res nr  residu name at name  cg nr  charge   
++1       POT         1       K           K        1      1        
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-Ces		1
++; molname   nrexcl
++CS          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   
+-1	CES		1	Ces		Ces	 1	1		 
++; id    at type     res nr  residu name at name  cg nr  charge   
++1       CES         1       CS          CS       1      1        
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-Cal		1
++; molname   nrexcl
++CA          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   
+-1	CAL		1	Cal		Cal	 1	2	 
++; id    at type     res nr  residu name at name  cg nr  charge   
++1       CAL         1       CA          CA       1      2    
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CL		1
++; molname   nrexcl
++CL          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   
+-1	CLA		1	CL		CL	 1	-1	 
++; id    at type     res nr  residu name at name  cg nr  charge   
++1       CLA         1       CL          CL       1      -1   
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-ZN		1
++; molname   nrexcl
++ZN          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   
+-1	ZN		1	ZN		ZN	 1	-2	 
++; id    at type     res nr  residu name at name  cg nr  charge   
++1       ZN          1       ZN          ZN       1      -2   
+diff --git a/share/top/gmx.ff/ions.itp b/share/top/gmx.ff/ions.itp
+index 8099fe7..530d309 100644
+--- a/share/top/gmx.ff/ions.itp
++++ b/share/top/gmx.ff/ions.itp
+@@ -7,41 +7,41 @@ K               1
+ 1       K       1       K               K        1       1
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-NA		1
++; molname   nrexcl
++NA          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name	 cg nr	charge
+-1	NA	1	NA		NA	 1	1
++; id    at type res nr  residu name at name  cg nr  charge
++1       NA      1       NA          NA       1      1
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CA		1
++; molname   nrexcl
++CA          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge
+-1	CA	1	CA		CA	 1	2
++; id    at type res nr  residu name at name  cg nr  charge
++1       CA      1       CA          CA       1      2
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-MG		1
++; molname   nrexcl
++MG          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name	 cg nr	charge
+-1	MG	1	MG		MG	 1	2
++; id    at type res nr  residu name at name  cg nr  charge
++1       MG      1       MG          MG       1      2
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CL		1
++; molname   nrexcl
++CL          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge
+-1	CL	1	CL		CL	 1	-1
++; id    at type res nr  residu name at name  cg nr  charge
++1       CL      1       CL          CL       1      -1
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-ZN		1
++; molname   nrexcl
++ZN          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name	 cg nr	charge
+-1	ZN	1	ZN		ZN	 1	2
++; id    at type res nr  residu name at name  cg nr  charge
++1       ZN      1       ZN          ZN       1      2
+diff --git a/share/top/gmx2.ff/ions.itp b/share/top/gmx2.ff/ions.itp
+index 8099fe7..530d309 100644
+--- a/share/top/gmx2.ff/ions.itp
++++ b/share/top/gmx2.ff/ions.itp
+@@ -7,41 +7,41 @@ K               1
+ 1       K       1       K               K        1       1
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-NA		1
++; molname   nrexcl
++NA          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name	 cg nr	charge
+-1	NA	1	NA		NA	 1	1
++; id    at type res nr  residu name at name  cg nr  charge
++1       NA      1       NA          NA       1      1
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CA		1
++; molname   nrexcl
++CA          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge
+-1	CA	1	CA		CA	 1	2
++; id    at type res nr  residu name at name  cg nr  charge
++1       CA      1       CA          CA       1      2
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-MG		1
++; molname   nrexcl
++MG          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name	 cg nr	charge
+-1	MG	1	MG		MG	 1	2
++; id    at type res nr  residu name at name  cg nr  charge
++1       MG      1       MG          MG       1      2
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CL		1
++; molname   nrexcl
++CL          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge
+-1	CL	1	CL		CL	 1	-1
++; id    at type res nr  residu name at name  cg nr  charge
++1       CL      1       CL          CL       1      -1
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-ZN		1
++; molname   nrexcl
++ZN          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name	 cg nr	charge
+-1	ZN	1	ZN		ZN	 1	2
++; id    at type res nr  residu name at name  cg nr  charge
++1       ZN      1       ZN          ZN       1      2
+diff --git a/share/top/gromos43a1.ff/ions.itp b/share/top/gromos43a1.ff/ions.itp
+index 07c3d06..ed76e0d 100644
+--- a/share/top/gromos43a1.ff/ions.itp
++++ b/share/top/gromos43a1.ff/ions.itp
+@@ -1,55 +1,55 @@
+ [ moleculetype ]
+-; molname	nrexcl
+-CU1		1
++; molname   nrexcl
++CU1         1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CU1+	1	CU1		CU	 1	1	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CU1+    1       CU1         CU       1      1        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CU		1
++; molname   nrexcl
++CU          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CU2+	1	CU		CU	 1	2	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CU2+    1       CU          CU       1      2        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-ZN		1
++; molname   nrexcl
++ZN          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	ZN2+	1	ZN		ZN	 1	2	 65.37000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       ZN2+    1       ZN          ZN       1      2        65.37000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-MG		1
++; molname   nrexcl
++MG          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	MG2+	1	MG		MG	 1	2	 24.30500
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       MG2+    1       MG          MG       1      2        24.30500
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CA		1
++; molname   nrexcl
++CA          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CA2+	1	CA		CA	 1	2	 40.08000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CA2+    1       CA          CA       1      2        40.08000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-NA		1
++; molname   nrexcl
++NA      1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	NA+	1	NA		NA	 1	1	 22.9898
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       NA+     1       NA          NA       1      1        22.9898
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CL		1
++; molname   nrexcl
++CL      1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CL-	1	CL		CL	 1	-1	 35.45300
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CL-     1       CL          CL       1      -1       35.45300
+diff --git a/share/top/gromos43a2.ff/ions.itp b/share/top/gromos43a2.ff/ions.itp
+index 07c3d06..ed76e0d 100644
+--- a/share/top/gromos43a2.ff/ions.itp
++++ b/share/top/gromos43a2.ff/ions.itp
+@@ -1,55 +1,55 @@
+ [ moleculetype ]
+-; molname	nrexcl
+-CU1		1
++; molname   nrexcl
++CU1         1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CU1+	1	CU1		CU	 1	1	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CU1+    1       CU1         CU       1      1        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CU		1
++; molname   nrexcl
++CU          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CU2+	1	CU		CU	 1	2	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CU2+    1       CU          CU       1      2        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-ZN		1
++; molname   nrexcl
++ZN          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	ZN2+	1	ZN		ZN	 1	2	 65.37000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       ZN2+    1       ZN          ZN       1      2        65.37000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-MG		1
++; molname   nrexcl
++MG          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	MG2+	1	MG		MG	 1	2	 24.30500
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       MG2+    1       MG          MG       1      2        24.30500
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CA		1
++; molname   nrexcl
++CA          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CA2+	1	CA		CA	 1	2	 40.08000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CA2+    1       CA          CA       1      2        40.08000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-NA		1
++; molname   nrexcl
++NA      1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	NA+	1	NA		NA	 1	1	 22.9898
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       NA+     1       NA          NA       1      1        22.9898
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CL		1
++; molname   nrexcl
++CL      1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CL-	1	CL		CL	 1	-1	 35.45300
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CL-     1       CL          CL       1      -1       35.45300
+diff --git a/share/top/gromos45a3.ff/ions.itp b/share/top/gromos45a3.ff/ions.itp
+index 07c3d06..c0d70db 100644
+--- a/share/top/gromos45a3.ff/ions.itp
++++ b/share/top/gromos45a3.ff/ions.itp
+@@ -1,55 +1,55 @@
+ [ moleculetype ]
+-; molname	nrexcl
+-CU1		1
++; molname   nrexcl
++CU1         1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CU1+	1	CU1		CU	 1	1	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CU1+    1       CU1         CU       1      1        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CU		1
++; molname   nrexcl
++CU          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CU2+	1	CU		CU	 1	2	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CU2+    1       CU          CU       1      2        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-ZN		1
++; molname   nrexcl
++ZN          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	ZN2+	1	ZN		ZN	 1	2	 65.37000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       ZN2+    1       ZN          ZN       1      2        65.37000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-MG		1
++; molname   nrexcl
++MG          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	MG2+	1	MG		MG	 1	2	 24.30500
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       MG2+    1       MG          MG       1      2        24.30500
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CA		1
++; molname   nrexcl
++CA          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CA2+	1	CA		CA	 1	2	 40.08000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CA2+    1       CA          CA       1      2        40.08000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-NA		1
++; molname   nrexcl
++NA          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	NA+	1	NA		NA	 1	1	 22.9898
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       NA+     1       NA          NA       1      1        22.9898
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CL		1
++; molname   nrexcl
++CL          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CL-	1	CL		CL	 1	-1	 35.45300
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CL-     1       CL          CL       1      -1       35.45300
+diff --git a/share/top/gromos53a5.ff/ions.itp b/share/top/gromos53a5.ff/ions.itp
+index 07c3d06..c0d70db 100644
+--- a/share/top/gromos53a5.ff/ions.itp
++++ b/share/top/gromos53a5.ff/ions.itp
+@@ -1,55 +1,55 @@
+ [ moleculetype ]
+-; molname	nrexcl
+-CU1		1
++; molname   nrexcl
++CU1         1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CU1+	1	CU1		CU	 1	1	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CU1+    1       CU1         CU       1      1        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CU		1
++; molname   nrexcl
++CU          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CU2+	1	CU		CU	 1	2	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CU2+    1       CU          CU       1      2        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-ZN		1
++; molname   nrexcl
++ZN          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	ZN2+	1	ZN		ZN	 1	2	 65.37000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       ZN2+    1       ZN          ZN       1      2        65.37000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-MG		1
++; molname   nrexcl
++MG          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	MG2+	1	MG		MG	 1	2	 24.30500
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       MG2+    1       MG          MG       1      2        24.30500
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CA		1
++; molname   nrexcl
++CA          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CA2+	1	CA		CA	 1	2	 40.08000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CA2+    1       CA          CA       1      2        40.08000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-NA		1
++; molname   nrexcl
++NA          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	NA+	1	NA		NA	 1	1	 22.9898
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       NA+     1       NA          NA       1      1        22.9898
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CL		1
++; molname   nrexcl
++CL          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CL-	1	CL		CL	 1	-1	 35.45300
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CL-     1       CL          CL       1      -1       35.45300
+diff --git a/share/top/gromos53a6.ff/ions.itp b/share/top/gromos53a6.ff/ions.itp
+index 07c3d06..c0d70db 100644
+--- a/share/top/gromos53a6.ff/ions.itp
++++ b/share/top/gromos53a6.ff/ions.itp
+@@ -1,55 +1,55 @@
+ [ moleculetype ]
+-; molname	nrexcl
+-CU1		1
++; molname   nrexcl
++CU1         1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CU1+	1	CU1		CU	 1	1	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CU1+    1       CU1         CU       1      1        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CU		1
++; molname   nrexcl
++CU          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CU2+	1	CU		CU	 1	2	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CU2+    1       CU          CU       1      2        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-ZN		1
++; molname   nrexcl
++ZN          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	ZN2+	1	ZN		ZN	 1	2	 65.37000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       ZN2+    1       ZN          ZN       1      2        65.37000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-MG		1
++; molname   nrexcl
++MG          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	MG2+	1	MG		MG	 1	2	 24.30500
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       MG2+    1       MG          MG       1      2        24.30500
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CA		1
++; molname   nrexcl
++CA          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CA2+	1	CA		CA	 1	2	 40.08000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CA2+    1       CA          CA       1      2        40.08000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-NA		1
++; molname   nrexcl
++NA          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	NA+	1	NA		NA	 1	1	 22.9898
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       NA+     1       NA          NA       1      1        22.9898
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CL		1
++; molname   nrexcl
++CL          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CL-	1	CL		CL	 1	-1	 35.45300
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CL-     1       CL          CL       1      -1       35.45300
+diff --git a/share/top/ions.itp b/share/top/ions.itp
+index 48c3d7a..7bf7bad 100644
+--- a/share/top/ions.itp
++++ b/share/top/ions.itp
+@@ -13,60 +13,60 @@
+ ; do not have the signs of the ions in the molecule name.
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CU1+		1
++; molname   nrexcl
++CU1+        1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CU1+	1	CU1+		CU1+	 1	1	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CU1+    1       CU1+        CU1+     1      1        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CU2+		1
++; molname   nrexcl
++CU2+        1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CU2+	1	CU2+		CU	 1	2	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CU2+    1       CU2+        CU       1      2        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-ZN2+		1
++; molname   nrexcl
++ZN2+        1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	ZN2+	1	ZN2+		ZN	 1	2	 65.37000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       ZN2+    1       ZN2+        ZN       1      2        65.37000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-MG2+		1
++; molname   nrexcl
++MG2+        1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	MG2+	1	MG2+		MG	 1	2	 24.30500
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       MG2+    1       MG2+        MG       1      2        24.30500
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CA2+		1
++; molname   nrexcl
++CA2+        1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CA2+	1	CA2+		CA	 1	2	 40.08000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CA2+    1       CA2+        CA       1      2        40.08000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-NA+		1
++; molname   nrexcl
++NA+         1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	NA+	1	NA+		NA	 1	1	 22.9898
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       NA+     1       NA+         NA       1      1        22.9898
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CL-		1
++; molname   nrexcl
++CL-         1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	CL-	1	CL-		CL	 1	-1	 35.45300
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       CL-     1       CL-         CL       1      -1       35.45300
+ 
+ 
+ #include "gromos43a1.ff/ions.itp"
+@@ -79,107 +79,107 @@ CL-		1
+ ; do not have the signs of the ions in the molecule name.
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CU2+		1
++; molname   nrexcl
++CU2+        1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	Cu2+	1	CU2+		CU	 1	2	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       Cu2+    1       CU2+        CU       1      2        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-ZN2+		1
++; molname   nrexcl
++ZN2+        1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	Zn2+	1	ZN2+		ZN	 1	2	 65.37000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       Zn2+    1       ZN2+        ZN       1      2        65.37000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-MG2+		1
++; molname   nrexcl
++MG2+        1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_411	1	MG2+		MG	 1	2	 24.30500
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_411    1       MG2+        MG       1      2        24.30500
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CA2+		1
++; molname   nrexcl
++CA2+        1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_412	1	CA2+		CA	 1	2	 40.08000
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_412    1       CA2+        CA       1      2        40.08000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-LI+		1
++; molname   nrexcl
++LI+         1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_406	1	LI+		NA	 1	1	6.941
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_406    1       LI+         LI       1      1        6.941
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-NA+		1
++; molname   nrexcl
++NA+         1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_407	1	NA+		NA	 1	1	22.98977	 
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_407    1       NA+         NA       1      1        22.98977     
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-K+		1
++; molname   nrexcl
++K+          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_408	1	K+		K	 1	1	 39.0983
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_408    1       K+          K        1      1        39.0983
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-Rb+		1
++; molname   nrexcl
++Rb+         1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_409	1	Rb+		Rb	 1	1	85.4678
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_409    1       Rb+         Rb       1      1        85.4678
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-Cs+		1
++; molname   nrexcl
++Cs+         1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_410	1	Cs+		Cs	 1	1	132.9054
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_410    1       Cs+         Cs       1      1        132.9054
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-F-		1
++; molname   nrexcl
++F-          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_400	1	F-		F	 1	-1	 18.9984
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_400    1       F-          F        1      -1       18.9984
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CL-		1
++; molname   nrexcl
++CL-         1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_401	1	CL-		CL	 1	-1	 35.45300
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_401    1       CL-         CL       1      -1       35.45300
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-BR-		1
++; molname   nrexcl
++BR-         1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_402	1	BR-		BR	 1	-1	 79.904
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_402    1       BR-         BR       1      -1       79.904
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-I-		1
++; molname   nrexcl
++I-          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_403	1	I-		I	 1	-1	 126.9045
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_403    1       I-          I        1      -1       126.9045
+ 
+ #endif
+diff --git a/share/top/oplsaa.ff/ions.itp b/share/top/oplsaa.ff/ions.itp
+index e831a92..9e82720 100644
+--- a/share/top/oplsaa.ff/ions.itp
++++ b/share/top/oplsaa.ff/ions.itp
+@@ -3,105 +3,105 @@
+ ;
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CU  		1
++; molname   nrexcl
++CU          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	Cu2+	1	CU  		CU	 1	2	 63.54600
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       Cu2+    1       CU          CU       1      2        63.54600
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-ZN  		1
++; molname   nrexcl
++ZN          1
+ 
+ [ atoms ]
+-; id	at type	res nr 	residu name	at name  cg nr	charge   mass
+-1	Zn2+	1	ZN  		ZN	 1	2	 65.37000
++; id    at type res nr  residu name at name  cg nr  charge   mass
++1       Zn2+    1       ZN          ZN       1      2        65.37000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-MG  		1
++; molname   nrexcl
++MG          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_411	1	MG  		MG	 1	2	 24.30500
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_411    1       MG          MG       1      2        24.30500
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CA  		1
++; molname   nrexcl
++CA          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_412	1	CA  		CA	 1	2	 40.08000
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_412    1       CA          CA       1      2        40.08000
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-LI 		1
++; molname   nrexcl
++LI          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_406	1	LI 		NA	 1	1	6.941
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_406    1       LI          LI       1      1        6.941
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-NA		1
++; molname   nrexcl
++NA          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_407	1	NA		NA	 1	1	22.98977	 
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_407    1       NA          NA       1      1        22.98977     
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-K 		1
++; molname   nrexcl
++K           1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_408	1	K 		K	 1	1	 39.0983
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_408    1       K           K        1      1        39.0983
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-RB 		1
++; molname   nrexcl
++RB          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_409	1	RB 		RB	 1	1	85.4678
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_409    1       RB          RB       1      1        85.4678
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CS 		1
++; molname   nrexcl
++CS          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_410	1	CS 		CS	 1	1	132.9054
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_410    1       CS          CS       1      1        132.9054
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-F 		1
++; molname   nrexcl
++F           1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_400	1	F 		F	 1	-1	 18.9984
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_400    1       F           F        1      -1       18.9984
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-CL		1
++; molname   nrexcl
++CL      1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_401	1	CL-		CL	 1	-1	 35.45300
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_401    1       CL          CL       1      -1       35.45300
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-BR 		1
++; molname   nrexcl
++BR          1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_402	1	BR 		BR	 1	-1	 79.904
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_402    1       BR          BR       1      -1       79.904
+ 
+ [ moleculetype ]
+-; molname	nrexcl
+-I 		1
++; molname   nrexcl
++I           1
+ 
+ [ atoms ]
+-; id	at type		res nr 	residu name	at name  cg nr	charge   mass
+-1	opls_403	1	I 		I	 1	-1	 126.9045
++; id    at type     res nr  residu name at name  cg nr  charge   mass
++1       opls_403    1       I           I        1      -1       126.9045
+diff --git a/src/config.h.cmakein b/src/config.h.cmakein
+index 1e3c542..89c9c8a 100644
+--- a/src/config.h.cmakein
++++ b/src/config.h.cmakein
+@@ -61,6 +61,9 @@
+  */
+ #cmakedefine GMX_FLOAT_FORMAT_IEEE754
+ 
++/* Detect Cygwin */
++#cmakedefine GMX_CYGWIN
++
+ /* Use assembly intrinsics kernels for BlueGene */
+ #cmakedefine GMX_BLUEGENE
+ 
+@@ -167,6 +170,12 @@
+ /* Define for profiling option */
+ #cmakedefine TMPI_PROFILE
+ 
++/* Define for Linux pthread_setaffinity */
++#cmakedefine HAVE_PTHREAD_SETAFFINITY
++
++/* Define for Windows NUMA-aware allocator functions*/
++#cmakedefine TMPI_WINDOWS_NUMA_API
++
+ /* Define for sysconf() */
+ #cmakedefine HAVE_SYSCONF
+ 
+diff --git a/src/gmxlib/gmx_system_xdr.c b/src/gmxlib/gmx_system_xdr.c
+index 184faac..e66a599 100644
+--- a/src/gmxlib/gmx_system_xdr.c
++++ b/src/gmxlib/gmx_system_xdr.c
+@@ -95,7 +95,7 @@
+ /*
+  * for unit alignment
+  */
+-const static char xdr_zero[BYTES_PER_XDR_UNIT] = {0, 0, 0, 0};
++static char xdr_zero[BYTES_PER_XDR_UNIT] = {0, 0, 0, 0};
+ 
+ static xdr_uint32_t xdr_swapbytes(xdr_uint32_t x)
+ {
+diff --git a/src/gmxlib/index.c b/src/gmxlib/index.c
+index 0cb96f6..725b98f 100644
+--- a/src/gmxlib/index.c
++++ b/src/gmxlib/index.c
+@@ -148,7 +148,7 @@ static gmx_bool grp_cmp(t_blocka *b, int nra, atom_id a[], int index)
+ }
+ 
+ static void 
+-p_status(const char **restype, int nres, const char **typenames, int ntypes, gmx_bool bVerb)
++p_status(const char **restype, int nres, const char **typenames, int ntypes)
+ {
+     int i,j;
+     int found;
+@@ -172,16 +172,15 @@ p_status(const char **restype, int nres, const char **typenames, int ntypes, gmx
+         }
+     }
+     
+-    if (bVerb)
++    for(i=0; (i<ntypes); i++) 
+     {
+-        for(i=0; (i<ntypes); i++) 
++        if (counter[i] > 0)
+         {
+-            if(counter[i]>0)
+-            {
+-                printf("There are: %5d %10s residues\n",counter[i],typenames[i]);
+-            }
++            printf("There are: %5d %10s residues\n",counter[i],typenames[i]);
+         }
+     }
++
++    sfree(counter);
+ }
+ 
+ 
+@@ -741,30 +740,25 @@ void analyse(t_atoms *atoms,t_blocka *gb,char ***gn,gmx_bool bASK,gmx_bool bVerb
+         resnm = *atoms->resinfo[i].name;
+         gmx_residuetype_get_type(rt,resnm,&(restype[i]));
+ 
+-        if(i==0)
++        /* Note that this does not lead to a N*N loop, but N*K, where
++         * K is the number of residue _types_, which is small and independent of N.
++         */
++        found = 0;
++        for(k=0;k<ntypes && !found;k++)
+         {
+-            snew(p_typename,1);
+-            p_typename[ntypes++] = strdup(restype[i]);
++            found = !strcmp(restype[i],p_typename[k]);
+         }
+-        else
++        if(!found)
+         {
+-            /* Note that this does not lead to a N*N loop, but N*K, where
+-             * K is the number of residue _types_, which is small and independent of N.
+-             */
+-            found = 0;
+-            for(k=0;k<i && !found;k++)
+-            {
+-                found = !strcmp(restype[i],restype[k]);
+-            }
+-            if(!found)
+-            {
+-                srenew(p_typename,ntypes+1);
+-                p_typename[ntypes++] = strdup(restype[i]);
+-            }
++            srenew(p_typename,ntypes+1);
++            p_typename[ntypes++] = strdup(restype[i]);
+         }
+     }    
+     
+-    p_status(restype,atoms->nres,p_typename,ntypes,bVerb);
++    if (bVerb)
++    {
++        p_status(restype,atoms->nres,p_typename,ntypes);
++    }
+ 
+     for(k=0;k<ntypes;k++)
+     {              
+diff --git a/src/gmxlib/matio.c b/src/gmxlib/matio.c
+index e77df3b..f059b81 100644
+--- a/src/gmxlib/matio.c
++++ b/src/gmxlib/matio.c
+@@ -445,8 +445,7 @@ void read_xpm_entry(FILE *in,t_matrix *mm)
+   if (m>=0)
+     gmx_incons("Not enough rows in the matrix");
+ 
+-  /* This code makes me cry. DvdS 2010-07-08 */
+-  /*sfree(line);*/
++  sfree(line_buf);
+ }
+ 
+ int read_xpm_matrix(const char *fnm,t_matrix **matrix)
+diff --git a/src/gmxlib/rmpbc.c b/src/gmxlib/rmpbc.c
+index 0f7d005..86b7139 100644
+--- a/src/gmxlib/rmpbc.c
++++ b/src/gmxlib/rmpbc.c
+@@ -64,7 +64,10 @@ static t_graph *gmx_rmpbc_get_graph(gmx_rmpbc_t gpbc,int ePBC,int natoms)
+     int           i;
+     rmpbc_graph_t *gr;
+ 
+-    if (ePBC == epbcNONE || gpbc->idef->ntypes <= 0)
++    if (ePBC == epbcNONE
++        || NULL == gpbc
++        || NULL == gpbc->idef
++        || gpbc->idef->ntypes <= 0)
+     {
+         return NULL;
+     }
+@@ -128,19 +131,22 @@ void gmx_rmpbc_done(gmx_rmpbc_t gpbc)
+ {
+     int i;
+ 
+-    for(i=0; i<gpbc->ngraph; i++)
+-    {
+-        done_graph(gpbc->graph[i].gr);
+-    }
+-    if (gpbc->graph != NULL)
++    if (NULL != gpbc)
+     {
+-        sfree(gpbc->graph);
++        for(i=0; i<gpbc->ngraph; i++)
++        {
++            done_graph(gpbc->graph[i].gr);
++        }
++        if (gpbc->graph != NULL)
++        {
++            sfree(gpbc->graph);
++        }
+     }
+ }
+ 
+ static int gmx_rmpbc_ePBC(gmx_rmpbc_t gpbc,matrix box)
+ {
+-    if (gpbc->ePBC >= 0)
++    if (NULL != gpbc && gpbc->ePBC >= 0)
+     {
+         return gpbc->ePBC;
+     }
+diff --git a/src/gmxlib/thread_mpi/CMakeLists.txt b/src/gmxlib/thread_mpi/CMakeLists.txt
+index b753b69..5aba9ed 100644
+--- a/src/gmxlib/thread_mpi/CMakeLists.txt
++++ b/src/gmxlib/thread_mpi/CMakeLists.txt
+@@ -2,7 +2,7 @@
+ # Note that not all .c files are compiled directly: some of them 
+ # are #included (some multiple times) from other source files.
+ set(THREAD_MPI_LIB_SOURCE 
+-    alltoall.c      hwinfo.c        reduce.c
++    alltoall.c      reduce.c
+     barrier.c       list.c          reduce_fast.c
+     bcast.c         lock.c          scatter.c
+     collective.c    once.c          tmpi_init.c
+@@ -10,7 +10,7 @@ set(THREAD_MPI_LIB_SOURCE
+     errhandler.c    p2p_send_recv.c type.c
+     event.c         p2p_wait.c      
+     gather.c        profile.c
+-    group.c         )
++    group.c         numa_malloc.c)
+ 
+ 
+ if (THREAD_PTHREADS)
+diff --git a/src/gmxlib/thread_mpi/Makefile.am b/src/gmxlib/thread_mpi/Makefile.am
+index 51a7cac..e70c43c 100644
+--- a/src/gmxlib/thread_mpi/Makefile.am
++++ b/src/gmxlib/thread_mpi/Makefile.am
+@@ -20,7 +20,7 @@ libthread_mpi_la_SOURCES = alltoall.c      impl.h          pthreads.h \
+ 			   event.c         p2p_wait.c      topology.c \
+ 			   gather.c        profile.c       type.c \
+ 			   group.c         profile.h       winthreads.c \
+-			   hwinfo.c        pthreads.c      winthreads.h
++			   pthreads.c      winthreads.h	   numa_malloc.c
+ 
+ 
+ CLEANFILES     = *.la *~ \\\#*
+diff --git a/src/gmxlib/thread_mpi/hwinfo.c b/src/gmxlib/thread_mpi/hwinfo.c
+deleted file mode 100644
+index 1a2a050..0000000
+--- a/src/gmxlib/thread_mpi/hwinfo.c
++++ /dev/null
+@@ -1,103 +0,0 @@
+-/*
+-This source code file is part of thread_mpi.  
+-Written by Sander Pronk, Erik Lindahl, and possibly others. 
+-
+-Copyright (c) 2009, Sander Pronk, Erik Lindahl.
+-All rights reserved.
+-
+-Redistribution and use in source and binary forms, with or without
+-modification, are permitted provided that the following conditions are met:
+-1) Redistributions of source code must retain the above copyright
+-   notice, this list of conditions and the following disclaimer.
+-2) Redistributions in binary form must reproduce the above copyright
+-   notice, this list of conditions and the following disclaimer in the
+-   documentation and/or other materials provided with the distribution.
+-3) Neither the name of the copyright holders nor the
+-   names of its contributors may be used to endorse or promote products
+-   derived from this software without specific prior written permission.
+-
+-THIS SOFTWARE IS PROVIDED BY US ''AS IS'' AND ANY
+-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+-DISCLAIMED. IN NO EVENT SHALL WE BE LIABLE FOR ANY
+-DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+-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 should not
+-be called official thread_mpi. Details are found in the README & COPYING
+-files.
+-*/
+-
+-
+-#ifdef HAVE_TMPI_CONFIG_H
+-#include "tmpi_config.h"
+-#else
+-#ifdef HAVE_CONFIG_H
+-#include "config.h"
+-#endif
+-#endif
+-
+-#ifdef HAVE_UNISTD_H
+-#include <unistd.h>
+-#endif
+-#ifdef THREAD_WINDOWS
+-#include <windows.h>
+-#endif
+-
+-#include <errno.h>
+-#include <stdlib.h>
+-#include <stdio.h>
+-#include <string.h>
+-
+-#include "impl.h"
+-#include "thread_mpi/hwinfo.h"
+-
+-#ifdef TMPI_TRACE
+-#include <stdarg.h>
+-#endif
+-
+-
+-int tMPI_Get_hw_nthreads(void)
+-{
+-    int ret=-1;
+-#ifdef HAVE_SYSCONF
+-#if defined(_SC_NPROCESSORS_ONLN)
+-    ret=sysconf(_SC_NPROCESSORS_ONLN);
+-#elif defined(_SC_NPROC_ONLN)
+-    ret=sysconf(_SC_NPROC_ONLN);
+-#elif defined(_SC_NPROCESSORS_CONF)
+-    ret=sysconf(_SC_NPROCESSORS_CONF);
+-#elif defined(_SC_NPROC_CONF)
+-    ret=sysconf(_SC_NPROC_CONF);
+-#endif
+-#endif
+-
+-#ifdef THREAD_WINDOWS
+-    SYSTEM_INFO sysinfo;
+-    GetSystemInfo( &sysinfo );
+-
+-    ret=sysinfo.dwNumberOfProcessors;
+-#endif
+-    return ret;
+-}
+-
+-
+-int tMPI_Get_recommended_nthreads(void)
+-{
+-    int N=1; /* the default is 1 */
+-
+-#ifndef TMPI_NO_ATOMICS
+-    N=tMPI_Get_hw_nthreads();
+-    if (N<1)
+-        N=1;
+-#endif
+-    return N;
+-}
+-
+diff --git a/src/gmxlib/thread_mpi/impl.h b/src/gmxlib/thread_mpi/impl.h
+index 609b15b..cb39f26 100644
+--- a/src/gmxlib/thread_mpi/impl.h
++++ b/src/gmxlib/thread_mpi/impl.h
+@@ -62,7 +62,6 @@ files.
+ #include "thread_mpi/tmpi.h"
+ #include "thread_mpi/collective.h"
+ #include "thread_mpi/barrier.h"
+-#include "thread_mpi/hwinfo.h"
+ #include "thread_mpi/lock.h"
+ #ifdef TMPI_PROFILE
+ #include "profile.h"
+@@ -687,17 +686,11 @@ extern struct tmpi_global *tmpi_global;
+ void tMPI_Trace_print(const char *fmt, ...);
+ #endif
+ 
+-/* error-checking malloc/realloc/free: */
++/* error-checking malloc/realloc: */
+ void *tMPI_Malloc(size_t size);
+ void *tMPI_Realloc(void *p, size_t size);
+ void tMPI_Free(void *p);
+ 
+-/*
+-//use the following instead of the above function definition for debugging mis- matched allocate/free calls.
+-#include <smalloc.h>
+-#define tMPI_Free(a) sfree(a)
+-*/
+-
+ 
+ /* get the current thread structure pointer */
+ #define tMPI_Get_current() ((struct tmpi_thread*) \
+diff --git a/src/gmxlib/thread_mpi/numa_malloc.c b/src/gmxlib/thread_mpi/numa_malloc.c
+new file mode 100644
+index 0000000..bcfd879
+--- /dev/null
++++ b/src/gmxlib/thread_mpi/numa_malloc.c
+@@ -0,0 +1,530 @@
++
++
++#ifdef HAVE_TMPI_CONFIG_H
++#include "tmpi_config.h"
++#endif
++
++
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++
++
++#ifdef HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <string.h>
++#ifdef WITH_DMALLOC
++#include "dmalloc.h"
++#endif
++
++
++#if ! (defined(WIN32) || defined( _WIN32 ) || defined(WIN64) || defined( _WIN64 ) || defined (__CYGWIN__))
++
++
++/* We don't have specific NUMA aware allocators: */
++
++void *tMPI_Malloc_local(size_t size)
++{
++    return malloc(size);
++}
++
++void *tMPI_Calloc_local(size_t nmemb, size_t size)
++{
++    return calloc(nmemb, size);
++}
++
++void *tMPI_Realloc_local(void *ptr, size_t size)
++{
++    return realloc(ptr, size);
++}
++
++int tMPI_Free_numa(void *ptr)
++{
++    free(ptr);
++    return 0; /* we don't detect errors here */
++}
++
++#else
++
++#define TMPI_NUMA_MALLOC
++
++/*
++    Windows NUMA memory allocation support.
++
++    NUMA support is implemented to maximize the chance that memory access 
++    patterns remain Local to the NUMA node.  This avoids penalties accessing 
++    "remote" memory.
++    An important assumption here is that code paths which allocate and 
++    reallocate heap blocks are likely to be accessing that allocated memory 
++    on the same NUMA node.
++    Testing has shown the above criteria to be met, yielding gains of > 15% 
++    when on Windows with NUMA hardware.
++
++    The high level approach is:
++    1. Use a separate heap per NUMA node.  This reduces heap contention, steers 
++       allocations to the local NUMA node, and avoids re-use of freed heap 
++       blocks across (remote) NUMA nodes.
++    2. Allocate each heap locally to each NUMA node, such that heap control 
++       structures are on the NUMA node accessing the heap.
++    3. During realloc operations, transfer the new block to the local NUMA 
++       node, if appropriate.  This is a rare case when thread affinity and 
++       access patterns are correct. 
++    4. Use GetProcAddress() to obtain function pointers to functions that are 
++       operating system version dependent, to allow maximum binary 
++       compatibility. 
++
++    Scott Field (sfield at microsoft.com)      Jan-2011    
++    */
++
++//#define _WIN32_WINNT 0x0601
++#include <windows.h>
++
++
++
++/*
++    __declspec(align()) may not be supported by all compilers, so define the 
++    size of the structure manually to force alignment
++    note that HeapAlloc() already returns aligned blocks.
++    typedef __declspec(align(32)) struct ... 
++*/
++typedef struct {
++    DWORD dwMagic;
++    HANDLE hHeap;               /* 8 */
++    size_t cbAllocationSize;    /* 8 */
++    ULONG ProcessorNumber;      /* processor number at time of allocation 
++                                   (development/testing) */
++    USHORT NodeNumber;          /* NUMA node number at time of allocation 
++                                   (development/testing) */
++} HEAPHEADER, *PHEAPHEADER;
++
++#define HEAP_NUMA_MAGIC     0x05AF0777
++#define HEAPHEADER_SIZE     (32)
++
++#ifdef C_ASSERT
++/* fail compile if size of HEAPHEADER exceeds pre-defined value */
++C_ASSERT(sizeof(HEAPHEADER) <= HEAPHEADER_SIZE);
++#endif
++
++/* function prototypes and variables to support obtaining function 
++   addresses dynamically -- supports down-level operating systems */
++
++typedef BOOL (WINAPI *func_GetNumaHighestNodeNumber_t)( PULONG HighestNodeNumber );
++typedef BOOL (WINAPI *func_GetNumaProcessorNodeEx_t)( PPROCESSOR_NUMBER Processor, PUSHORT NodeNumber );
++typedef VOID (WINAPI *func_GetCurrentProcessorNumberEx_t)( PPROCESSOR_NUMBER ProcNumber );
++
++func_GetNumaHighestNodeNumber_t             smalloc_GetNumaHighestNodeNumber;         /* WinXP SP2, WinXP64, WinSrv 2003 */
++func_GetNumaProcessorNodeEx_t               smalloc_GetNumaProcessorNodeEx;           /* Windows 7, WinSrv 2008R2 */
++func_GetCurrentProcessorNumberEx_t          smalloc_GetCurrentProcessorNumberEx;      /* Windows 7, WinSrv 2008R2 */
++
++#define NUMA_STATUS_UNKNOWN     (0)
++#define NUMA_STATUS_NOT_NUMA    (1)
++#define NUMA_STATUS_NUMA        (2)
++
++DWORD g_dwTlsHeap;      /* TLS slot used for preferred heap handle */
++HANDLE *g_hHeap;        /* array of heap handles */             
++ULONG g_ulNumaStatus;   /* 0 = unknown, 1 = not NUMA, 2 = NUMA */
++
++VOID
++InitNumaHeapSupport(
++    VOID
++    )
++{
++    HMODULE hModKernel32;   /* module handle to kernel32.dll -- we already 
++                               reference it, so it's already loaded */
++    ULONG ulNumaHighestNodeNumber;
++
++    /* grab the addresses for the NUMA functions.  
++       It's fine if there is a race condition reaching this routine */
++    hModKernel32 = GetModuleHandleA("kernel32.dll");
++    if(hModKernel32 == NULL)
++    {
++        g_ulNumaStatus = NUMA_STATUS_NOT_NUMA;
++        return;
++    }
++
++    smalloc_GetNumaHighestNodeNumber = (func_GetNumaHighestNodeNumber_t)GetProcAddress( hModKernel32, "GetNumaHighestNodeNumber" );
++    smalloc_GetCurrentProcessorNumberEx = (func_GetCurrentProcessorNumberEx_t)GetProcAddress( hModKernel32, "GetCurrentProcessorNumberEx" );
++    smalloc_GetNumaProcessorNodeEx = (func_GetNumaProcessorNodeEx_t)GetProcAddress( hModKernel32, "GetNumaProcessorNodeEx" );
++
++    if( (smalloc_GetNumaHighestNodeNumber == NULL) ||
++        (smalloc_GetCurrentProcessorNumberEx == NULL) ||
++        (smalloc_GetNumaProcessorNodeEx == NULL) )
++    {
++        g_ulNumaStatus = NUMA_STATUS_NOT_NUMA;
++        return;
++    }
++
++    /* determine how many NUMA nodes are present */
++
++    if(!smalloc_GetNumaHighestNodeNumber(&ulNumaHighestNodeNumber) ||
++        (ulNumaHighestNodeNumber == 0) )
++    {
++        g_ulNumaStatus = NUMA_STATUS_NOT_NUMA;
++        return;
++    }
++
++    /* handle deferred creation of TLS slot.
++       note: this could be moved to one-time init path.
++       failures here result in assuming the system is not NUMA.
++    */
++
++    if( g_dwTlsHeap == 0 )
++    {
++        DWORD dwTlsHeap = TlsAlloc();
++        DWORD dwPriorValue;
++
++        if( dwTlsHeap == TLS_OUT_OF_INDEXES )
++        {
++            g_ulNumaStatus = NUMA_STATUS_NOT_NUMA;
++            return;
++        }
++
++        dwPriorValue = (DWORD)InterlockedCompareExchange(
++                (LONG volatile *)&g_dwTlsHeap,
++                (LONG) dwTlsHeap,
++                0
++                );
++                
++        if( dwPriorValue != 0 )
++        {
++            TlsFree( dwTlsHeap );
++        }
++    }
++
++    /* handle deferred creation of heap handle array.
++       note: this could be moved to one-time init path.
++    */
++
++    if( g_hHeap == NULL )
++    {
++        HANDLE *hHeapNew;
++        HANDLE *hPriorValue;
++
++        /* allocate an array to contain a heap handle for each NUMA node */
++        hHeapNew = (HANDLE*)HeapAlloc(
++                    GetProcessHeap(),
++                    HEAP_ZERO_MEMORY,
++                    sizeof(HANDLE) * (ulNumaHighestNodeNumber+1)
++                    );
++
++        if( hHeapNew == NULL )
++        {
++            g_ulNumaStatus = NUMA_STATUS_NOT_NUMA;
++            return;
++        }
++
++        hPriorValue = (HANDLE *)InterlockedCompareExchange(
++                (LONG volatile *)&g_hHeap,
++                (LONG) hHeapNew,
++                0
++                );
++
++        if( hPriorValue != NULL )
++        {
++            HeapFree(GetProcessHeap(), 0, hHeapNew);
++        }
++    }
++
++    /* indicate system is NUMA */
++    g_ulNumaStatus = NUMA_STATUS_NUMA;
++
++    return;
++}
++
++HANDLE
++ReturnHeapHandle(
++    VOID
++    )
++{
++    HANDLE hHeap;                               /* preferred heap handle to 
++                                                   return to caller */
++    PROCESSOR_NUMBER CurrentProcessorNumber;    /* processor number associated 
++                                                   with calling thread */
++    USHORT CurrentNumaNodeNumber;               /* NUMA node number assocaited 
++                                                   with calling thread */
++
++    /* determine NUMA status of system. */
++
++    if( g_ulNumaStatus == NUMA_STATUS_UNKNOWN )
++    {
++        InitNumaHeapSupport();
++        if( g_ulNumaStatus == NUMA_STATUS_NOT_NUMA )
++        {
++            return GetProcessHeap();
++        }
++    } else if( g_ulNumaStatus == NUMA_STATUS_NOT_NUMA )
++    {
++        /* not NUMA, return the process heap handle */
++        return GetProcessHeap();
++    }
++
++
++    /* return the preferred heap handle from the TLS slot, if set.  
++       This is the commonly taken path. */
++
++    hHeap = (HANDLE)TlsGetValue( g_dwTlsHeap );
++
++    if( hHeap != NULL )
++    {
++        return hHeap;
++    }
++
++
++    /* preferred heap handle not yet set.
++       determine the numa node we're executing on, and create a heap which 
++       is assigned to this node.
++       one (soft) assumption that is made here is that thread affinity has 
++       been set such that threads do not move between NUMA nodes.
++    */
++
++    smalloc_GetCurrentProcessorNumberEx(&CurrentProcessorNumber);
++        
++    if(!smalloc_GetNumaProcessorNodeEx(&CurrentProcessorNumber, &CurrentNumaNodeNumber))
++    {
++        /* GetNumaProcessorNodeEx() can fail on WOW64/32bit if invoked 
++           against processor numbers > 32.
++           this should never be reached for 64bit builds.
++        */
++        CurrentNumaNodeNumber = 0;
++    }
++
++
++    /* check if the NUMA node array slot already contains a heap */
++    /* CurrentNumaNodeNumber cannot execeed count of heaps, as NUMA nodes 
++       cannot be added. */
++
++    hHeap = g_hHeap[ CurrentNumaNodeNumber ];
++
++    if( hHeap == NULL )
++    {
++        HANDLE hHeapPrior = NULL;
++        ULONG ulOption = 2; /* HEAP_LFH */
++
++        /* create a heap for this numa node
++           defer creating the heap - while running on each node - to ensure 
++           the heap control structures get created on the local NUMA node.
++        */
++
++        hHeap = HeapCreate(0, 0, 0);
++    
++        if( hHeap == NULL )
++        {
++            /* just return the process heap.  We'll try to create a heap 
++               again next time */
++            return GetProcessHeap();
++        }
++
++        /* make the new heap a low-fragmentation heap */
++
++        HeapSetInformation(
++                hHeap,
++                0,          /* HeapCompatibilityInformation */
++                &ulOption,
++                sizeof(ulOption)
++                );
++
++        /* set the array slot entry for this NUMA node to contain the newly 
++           allocated heap */
++
++        hHeapPrior = (HANDLE)InterlockedCompareExchangePointer(&(g_hHeap[CurrentNumaNodeNumber]), hHeap, NULL);
++        if( hHeapPrior != NULL )
++        {
++            HeapDestroy( hHeap );
++            hHeap = hHeapPrior;
++        }
++    }
++
++    /* we reached here since there was no heap assigned to the TLS slot.  
++       Assign it. */
++    TlsSetValue(g_dwTlsHeap, hHeap);
++
++    return hHeap;
++}
++
++
++
++
++void *tMPI_Malloc_local(size_t size)
++{
++    HANDLE hHeap;
++    unsigned char *ptr;
++    size_t new_size;    
++    HEAPHEADER *phdr;
++
++    hHeap = ReturnHeapHandle();
++
++    new_size = size + HEAPHEADER_SIZE;
++
++    ptr = (unsigned char *)HeapAlloc( hHeap, 0, new_size );
++
++    if( ptr == NULL )
++    {
++        return NULL;
++    }
++
++    phdr = (HEAPHEADER*)ptr;
++
++    phdr->dwMagic = HEAP_NUMA_MAGIC;
++    phdr->hHeap = hHeap;                /* track the heap handle for realloc 
++                                           and free */
++    phdr->cbAllocationSize = new_size;  /* track the allocation size for 
++                                           realloc and debugging */
++
++    return ( ptr + HEAPHEADER_SIZE );
++}
++
++
++void *tMPI_Calloc_local(size_t nelem, size_t elsize)
++{
++    void *ptr;
++    size_t size = nelem * elsize;
++
++    ptr = tMPI_Malloc_local(size);
++
++    if(ptr != NULL)
++    {
++        memset(ptr, 0, size);
++    }
++
++    return ptr;
++}
++
++
++void *tMPI_Realloc_local(void *ptr, size_t size)
++{
++    HANDLE hHeap;
++    HEAPHEADER *phdr;
++    unsigned char *new_ptr;
++    size_t new_size;
++
++    /* calculate the allocation address and check for presence of the hint 
++       which indicates this was allocated by our allocator.
++    */
++
++    phdr = (HEAPHEADER*)((unsigned char*)ptr - HEAPHEADER_SIZE);
++
++    if( phdr->dwMagic != HEAP_NUMA_MAGIC )
++    {
++		/* TODO: call tMPI_Error() */ 
++        /*gmx_fatal(errno,__FILE__,__LINE__,
++          "Invalid Heap header during realloc. %p", ptr);*/
++
++        return NULL;
++    }
++
++    /* calculate size of new/realloc'd block.
++    */
++
++    new_size = size + HEAPHEADER_SIZE;
++
++    /* if the NUMA Node changed between the initial allocation and the 
++       reallocation, copy the memory to an allocation on the new local node:
++       we assume the new realloc'd block is more likely to be manipulated by 
++       the current thread which is calling realloc.
++       the simple way to detect this condition is to compare the preferred heap 
++       handle with the heap handle stored in the current memory block.
++    */
++
++    hHeap = ReturnHeapHandle();
++
++    if( hHeap != phdr->hHeap )
++    {
++        new_ptr = HeapAlloc( hHeap, 0, new_size );
++
++        /* if the new allocation succeeded, copy the buffer and free the 
++           original buffer.
++        */
++
++        if( new_ptr != NULL )
++        {
++            size_t copy_size;
++
++            /* the realloc can be larger or smaller than the original 
++               allocation size.
++            */
++
++            if( new_size > phdr->cbAllocationSize )
++            {
++                copy_size = phdr->cbAllocationSize;
++            } else {
++                copy_size = new_size;
++            }
++
++            /* copy the current memory block contents into the newly allocated 
++               buffer, and then free the original buffer.
++            */
++
++            memcpy( new_ptr, phdr, copy_size );
++
++            HeapFree( phdr->hHeap, 0, phdr );
++        }
++    
++    } else {
++
++        /* NodeNumber of existing allocation matches current node number.
++           realloc from the heap associated with the existing allocation.
++        */
++
++        hHeap = phdr->hHeap;
++
++        new_ptr = HeapReAlloc(
++                    hHeap,
++                    0,
++                    phdr,
++                    new_size
++                    );
++    }
++
++    if( new_ptr == NULL )
++    {
++        return NULL;
++    }
++
++    phdr = (HEAPHEADER*)new_ptr;
++    phdr->cbAllocationSize = new_size;  /* update allocation size to match 
++                                           realloc */
++    phdr->hHeap = hHeap;
++
++    return ( new_ptr + HEAPHEADER_SIZE );
++}
++
++
++int tMPI_Free_numa(void *ptr)
++{
++    HEAPHEADER *phdr;
++
++    /* caller doesn't call us on ptr == NULL case, so we don't need to 
++       check that here. */
++
++    phdr = (HEAPHEADER*)((unsigned char*)ptr - HEAPHEADER_SIZE);
++
++    /* this check should happen in __try / __except block until the 
++       mis-matched free/sfree calls are fixed, but this is here primarilly
++       for debugging and catching mis-matched memory alloc and free references.
++    */
++
++    if(phdr->dwMagic != HEAP_NUMA_MAGIC)
++    {
++        /* ptr is leaked here, rather than faulting in the allocator.
++           this is done in order to track mis-matched alloc/free calls.
++        */
++        return 1;
++    }
++
++    phdr->dwMagic = 0;
++
++    HeapFree( phdr->hHeap, 0, phdr );
++
++    return 0;
++}
++
++#endif /* NUMA allocation functions for (_WIN32 || _WIN64) */
++
++
++
++
+diff --git a/src/gmxlib/thread_mpi/p2p_buffer.c b/src/gmxlib/thread_mpi/p2p_buffer.c
+new file mode 100644
+index 0000000..f6ad352
+--- /dev/null
++++ b/src/gmxlib/thread_mpi/p2p_buffer.c
+@@ -0,0 +1,71 @@
++/*
++This source code file is part of thread_mpi.  
++Written by Sander Pronk, Erik Lindahl, and possibly others. 
++
++Copyright (c) 2009, Sander Pronk, Erik Lindahl.
++All rights reserved.
++
++Redistribution and use in source and binary forms, with or without
++modification, are permitted provided that the following conditions are met:
++1) Redistributions of source code must retain the above copyright
++   notice, this list of conditions and the following disclaimer.
++2) Redistributions in binary form must reproduce the above copyright
++   notice, this list of conditions and the following disclaimer in the
++   documentation and/or other materials provided with the distribution.
++3) Neither the name of the copyright holders nor the
++   names of its contributors may be used to endorse or promote products
++   derived from this software without specific prior written permission.
++
++THIS SOFTWARE IS PROVIDED BY US ''AS IS'' AND ANY
++EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
++WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
++DISCLAIMED. IN NO EVENT SHALL WE BE LIABLE FOR ANY
++DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
++(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
++LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
++ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
++(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
++SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
++
++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 should not
++be called official thread_mpi. Details are found in the README & COPYING
++files.
++*/
++
++#ifdef HAVE_TMPI_CONFIG_H
++#include "tmpi_config.h"
++#endif
++
++#ifdef HAVE_CONFIG_H
++#include "config.h"
++#endif
++
++
++#ifdef HAVE_UNISTD_H
++#include <unistd.h>
++#endif
++
++#include <errno.h>
++#include <stdlib.h>
++#include <stdio.h>
++#include <stdarg.h>
++#include <string.h>
++
++
++#include "impl.h"
++#include "p2p.h"
++
++/* point-to-point buffered mode transfer functions */
++
++int MPI_Buffer_attach(void* buffer, int size)
++{
++}
++
++
++int MPI_Buffer_detach(void* buffer_addr, int* size)
++{
++}
++
+diff --git a/src/gmxlib/thread_mpi/pthreads.c b/src/gmxlib/thread_mpi/pthreads.c
+index 22a3dd3..378a796 100644
+--- a/src/gmxlib/thread_mpi/pthreads.c
++++ b/src/gmxlib/thread_mpi/pthreads.c
+@@ -52,6 +52,10 @@ files.
+ 
+ #ifdef THREAD_PTHREADS 
+ 
++#ifdef HAVE_PTHREAD_SETAFFINITY
++#define _GNU_SOURCE
++#endif
++
+ /* pthread.h must be the first header, apart from the defines in config.h */
+ #include <pthread.h>
+ 
+@@ -65,6 +69,7 @@ files.
+ #include <stdio.h>
+ #include <stdarg.h>
+ 
++
+ #include "thread_mpi/atomic.h"
+ #include "thread_mpi/threads.h"
+ #include "impl.h"
+@@ -83,9 +88,16 @@ static pthread_mutex_t cond_init=PTHREAD_MUTEX_INITIALIZER;
+ static pthread_mutex_t barrier_init=PTHREAD_MUTEX_INITIALIZER; 
+ 
+ 
++/* lock & variable for setting main thread affinity */
++static tMPI_Spinlock_t main_thread_aff_lock=TMPI_SPINLOCK_INITIALIZER;
++static tMPI_Atomic_t main_thread_aff_set={ 0 };
++static tMPI_Atomic_t aff_thread_number;
++
+ 
+ 
+ 
++/* TODO: this needs to go away!  (there's another one in winthreads.c)
++   fatal errors are thankfully really rare*/
+ void tMPI_Fatal_error(const char *file, int line, const char *message, ...)
+ {
+     va_list ap;
+@@ -104,6 +116,25 @@ enum tMPI_Thread_support tMPI_Thread_support(void)
+     return TMPI_THREAD_SUPPORT_YES;
+ }
+ 
++
++int tMPI_Thread_get_hw_number(void)
++{
++    int ret=0;
++#ifdef HAVE_SYSCONF
++#if defined(_SC_NPROCESSORS_ONLN)
++    ret=sysconf(_SC_NPROCESSORS_ONLN);
++#elif defined(_SC_NPROC_ONLN)
++    ret=sysconf(_SC_NPROC_ONLN);
++#elif defined(_SC_NPROCESSORS_CONF)
++    ret=sysconf(_SC_NPROCESSORS_CONF);
++#elif defined(_SC_NPROC_CONF)
++    ret=sysconf(_SC_NPROC_CONF);
++#endif
++#endif
++
++    return ret;
++}
++
+ int tMPI_Thread_create(tMPI_Thread_t *thread, void *(*start_routine)(void *),
+                        void *arg)
+ {
+@@ -130,6 +161,80 @@ int tMPI_Thread_create(tMPI_Thread_t *thread, void *(*start_routine)(void *),
+ }
+ 
+ 
++/* set thread's own affinity to a processor number n */
++static int tMPI_Set_affinity(int n)
++{
++#ifdef HAVE_PTHREAD_SETAFFINITY
++    cpu_set_t set;
++
++    CPU_ZERO(&set);
++    CPU_SET(n, &set);
++    return pthread_setaffinity_np(pthread_self(), sizeof(set), &set);
++#endif
++    return 0;
++}
++
++int tMPI_Thread_create_aff(tMPI_Thread_t *thread, 
++                           void *(*start_routine)(void *),
++                           void *arg)
++{
++    int ret;
++
++    /* set the calling thread's affinity mask */
++    if (tMPI_Atomic_get(&main_thread_aff_set) == 0)
++    {
++#ifdef HAVE_PTHREAD_SETAFFINITY
++        cpu_set_t set;
++#endif
++        /* this can be a spinlock because the chances of collision are low. */
++        tMPI_Spinlock_lock( &main_thread_aff_lock );
++        tMPI_Atomic_set( &aff_thread_number, 0);
++#ifdef HAVE_PTHREAD_SETAFFINITY
++        CPU_ZERO(&set);
++        CPU_SET(0, &set);
++        pthread_setaffinity_np(pthread_self(), sizeof(set), &set);
++        /*fprintf(stderr, "Setting affinity.\n");*/
++#endif
++        tMPI_Atomic_set( &main_thread_aff_set, 1);
++        tMPI_Spinlock_unlock( &main_thread_aff_lock );
++    }
++
++
++    if(thread==NULL)
++    {
++        tMPI_Fatal_error(TMPI_FARGS,"Invalid thread pointer.");
++        return EINVAL;
++    }
++
++    *thread=(struct tMPI_Thread*)malloc(sizeof(struct tMPI_Thread)*1);
++    ret=pthread_create(&((*thread)->th),NULL,start_routine,arg);
++
++    if(ret!=0)
++    {
++        /* Cannot use tMPI_error() since messages use threads for locking */
++        tMPI_Fatal_error(TMPI_FARGS,"Failed to create POSIX thread, rc=%d",ret);
++        /* Use system memory allocation routines */
++        return -1;
++    }
++    else
++    {
++#ifdef HAVE_PTHREAD_SETAFFINITY
++        int n;
++        cpu_set_t set;
++
++        n=tMPI_Atomic_add_return(&aff_thread_number, 1);
++        CPU_ZERO(&set);
++        CPU_SET(n, &set);
++        return pthread_setaffinity_np((*thread)->th, sizeof(set), &set);
++#else
++        return 0;
++#endif
++    }
++}
++
++
++
++
+ 
+ int tMPI_Thread_join(tMPI_Thread_t thread, void **value_ptr)
+ {
+diff --git a/src/gmxlib/thread_mpi/settings.h b/src/gmxlib/thread_mpi/settings.h
+index f36cdaa..a8a8724 100644
+--- a/src/gmxlib/thread_mpi/settings.h
++++ b/src/gmxlib/thread_mpi/settings.h
+@@ -122,3 +122,8 @@ files.
+ /*#define TMPI_PROFILE*/
+ 
+ 
++/* whether to turn on thread affinity (required for NUMA optimizations) 
++   if the number of threads to spawn is equal to the number of processors. */
++#define TMPI_THREAD_AFFINITY
++
++
+diff --git a/src/gmxlib/thread_mpi/tmpi_init.c b/src/gmxlib/thread_mpi/tmpi_init.c
+index 01dd676..a0dea19 100644
+--- a/src/gmxlib/thread_mpi/tmpi_init.c
++++ b/src/gmxlib/thread_mpi/tmpi_init.c
+@@ -249,7 +249,10 @@ int tMPI_Get_N(int *argc, char ***argv, const char *optname, int *nthreads)
+     }
+     if (*nthreads<1)
+     {
+-        *nthreads=tMPI_Get_recommended_nthreads();
++        int nth=tMPI_Thread_get_hw_number();
++
++        if (nth<1) nth=1; /* make sure it's at least 1 */
++        *nthreads=nth;
+     }
+ 
+     return ret;
+@@ -392,6 +395,7 @@ void tMPI_Start_threads(tmpi_bool main_returns, int N, int *argc, char ***argv,
+     if (N>0) 
+     {
+         int i;
++        int set_affinity=FALSE;
+ 
+         tmpi_finalized=FALSE;
+         Nthreads=N;
+@@ -439,11 +443,36 @@ void tMPI_Start_threads(tmpi_bool main_returns, int N, int *argc, char ***argv,
+             threads[i].start_fn_main=start_fn_main;
+             threads[i].start_arg=start_arg;
+         }
++
++        /* now check whether to set affinity */
++#ifdef TMPI_THREAD_AFFINITY
++        {
++            int nhw=tMPI_Thread_get_hw_number();
++            if ((nhw > 1) && (nhw == N))
++            {
++                set_affinity=TRUE;
++            }
++        }
++#endif
++
+         for(i=1;i<N;i++) /* zero is the main thread */
+         {
+-            if (tMPI_Thread_create(&(threads[i].thread_id), 
+-                                  tMPI_Thread_starter,
+-                                  (void*)&(threads[i]) ) )
++            int ret;
++
++            if (set_affinity)
++            {
++                ret=tMPI_Thread_create_aff(&(threads[i].thread_id), 
++                                           tMPI_Thread_starter,
++                                           (void*)&(threads[i]) ) ;
++            }
++            else
++            {
++                ret=tMPI_Thread_create(&(threads[i].thread_id), 
++                                       tMPI_Thread_starter,
++                                       (void*)&(threads[i]) ) ;
++            }
++
++            if(ret)
+             {
+                 tMPI_Error(TMPI_COMM_WORLD, TMPI_ERR_INIT);
+             }
+@@ -489,7 +518,8 @@ int tMPI_Init_fn(int main_thread_returns, int N,
+ 
+     if (N<1)
+     {
+-        N=tMPI_Get_recommended_nthreads();
++        N=tMPI_Thread_get_hw_number();
++        if (N<1) N=1; /*because that's what the fn returns if it doesn't know*/
+     }
+ 
+     if (TMPI_COMM_WORLD==0 && N>=1) /* we're the main process */
+diff --git a/src/gmxlib/thread_mpi/winthreads.c b/src/gmxlib/thread_mpi/winthreads.c
+index 64993ae..98b89a9 100644
+--- a/src/gmxlib/thread_mpi/winthreads.c
++++ b/src/gmxlib/thread_mpi/winthreads.c
+@@ -86,9 +86,444 @@ static CRITICAL_SECTION barrier_init; /* mutex for initializing barriers */
+ static tMPI_Spinlock_t init_init=TMPI_SPINLOCK_INITIALIZER;
+ 
+ /* whether tMPI_Thread_create has initialized these mutexes */
+-tMPI_Atomic_t init_inited={ 0 };
++static tMPI_Atomic_t init_inited={ 0 };
+ 
++/* whether the main thread affinity has been set */
++static tMPI_Spinlock_t main_thread_aff_lock=TMPI_SPINLOCK_INITIALIZER;
++static tMPI_Atomic_t main_thread_aff_set={ 0 };
+ 
++/*
++    NUMA and Processor Group awareness support.
++
++    NUMA support is implemented to maximize the chance that memory access 
++    patterns remain Local to the NUMA node.
++    NUMA node processor affinity is utilized to prevent scheduler associated 
++    drift across NUMA nodes.
++    Process Group support is implemented to enable > 64 processors to be 
++    utilized.  This is only supported when building 64bit.
++
++    The high level approach is:
++    1. Build a description of CPU topology, including processor numbers, NUMA 
++        node numbers, and affinity masks.
++    2. For processor intensive worker threads, create threads such that 
++        the processor affinity and thread stack is kept local within a NUMA node.
++    3. Employ simple round-robin affinity and node assignment approach when 
++        creating threads.
++    4. Use GetProcAddress() to obtain function pointers to functions that 
++        are operating system version dependent, to allow maximum binary 
++        compatibility. 
++
++    Scott Field (sfield at microsoft.com)      Jan-2011    
++*/
++
++
++typedef struct {
++    PROCESSOR_NUMBER    ProcessorNumber;
++    GROUP_AFFINITY      GroupAffinity;
++    USHORT              NumaNodeNumber;
++} MPI_NUMA_PROCESSOR_INFO;
++
++
++/* thread/processor index, to allow setting round-robin affinity. */
++volatile ULONG g_ulThreadIndex;                 
++/* a value of zero implies the system is not NUMA */
++ULONG g_ulHighestNumaNodeNumber=0;
++/* total number of processors in g_MPI_ProcessInfo array */
++ULONG g_ulTotalProcessors;
++/* array describing available processors, affinity masks, and NUMA node */
++MPI_NUMA_PROCESSOR_INFO *g_MPI_ProcessorInfo;   
++
++/* function prototypes and variables to support obtaining function addresses 
++   dynamically -- supports down-level operating systems */
++
++typedef BOOL (WINAPI *func_GetNumaHighestNodeNumber_t)( PULONG 
++                                                        HighestNodeNumber );
++typedef BOOL (WINAPI *func_SetThreadGroupAffinity_t)( HANDLE hThread, 
++                            const GROUP_AFFINITY *GroupAffinity, 
++                            PGROUP_AFFINITY PreviousGroupAffinity );
++typedef BOOL (WINAPI *func_SetThreadIdealProcessorEx_t)( HANDLE hThread, 
++                            PPROCESSOR_NUMBER lpIdealProcessor, 
++                            PPROCESSOR_NUMBER lpPreviousIdealProcessor );
++typedef BOOL (WINAPI *func_GetNumaNodeProcessorMaskEx_t)( USHORT Node, 
++                            PGROUP_AFFINITY ProcessorMask );
++typedef BOOL (WINAPI *func_GetNumaProcessorNodeEx_t)( 
++                            PPROCESSOR_NUMBER Processor, 
++                            PUSHORT NodeNumber );
++typedef VOID (WINAPI *func_GetCurrentProcessorNumberEx_t)( 
++                            PPROCESSOR_NUMBER ProcNumber );
++
++typedef HANDLE (WINAPI *func_CreateRemoteThreadEx_t)(
++                            HANDLE hProcess,
++                            LPSECURITY_ATTRIBUTES lpThreadAttributes,
++                            SIZE_T dwStackSize,
++                            LPTHREAD_START_ROUTINE lpStartAddress,
++                            LPVOID lpParameter,
++                            DWORD dwCreationFlags,
++                            LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList,
++                            LPDWORD lpThreadId);
++
++typedef BOOL (WINAPI *func_InitializeProcThreadAttributeList_t)(
++                            LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList, 
++                            DWORD dwAttributeCount, 
++                            DWORD dwFlags, 
++                            PSIZE_T lpSize);
++typedef BOOL (WINAPI *func_UpdateProcThreadAttribute_t)(
++                            LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList,
++                            DWORD dwFlags,
++                            DWORD_PTR Attribute,
++                            PVOID lpValue,
++                            SIZE_T cbSize,
++                            PVOID lpPreviousValue,
++                            PSIZE_T lpReturnSize);
++typedef VOID (WINAPI *func_DeleteProcThreadAttributeList_t)(
++                            LPPROC_THREAD_ATTRIBUTE_LIST lpAttributeList);
++typedef DWORD (WINAPI *func_GetActiveProcessorCount_t)(WORD GroupNumber);
++typedef WORD (WINAPI *func_GetActiveProcessorGroupCount_t)(void);
++
++
++/* WinXP SP2, WinXP64, WinSrv 2003 */
++func_GetNumaHighestNodeNumber_t             func_GetNumaHighestNodeNumber;              
++/* Windows 7, WinSrv 2008R2 */
++func_SetThreadGroupAffinity_t               func_SetThreadGroupAffinity;                
++func_SetThreadIdealProcessorEx_t            func_SetThreadIdealProcessorEx; 
++func_GetNumaNodeProcessorMaskEx_t           func_GetNumaNodeProcessorMaskEx;
++func_GetNumaProcessorNodeEx_t               func_GetNumaProcessorNodeEx;    
++func_GetCurrentProcessorNumberEx_t          func_GetCurrentProcessorNumberEx;
++func_GetActiveProcessorCount_t              func_GetActiveProcessorCount;    
++func_GetActiveProcessorGroupCount_t         func_GetActiveProcessorGroupCount;
++func_CreateRemoteThreadEx_t                 func_CreateRemoteThreadEx;        
++/* Windows Vista, WinSrv 2008 */ 
++func_InitializeProcThreadAttributeList_t    func_InitializeProcThreadAttributeList;     
++func_UpdateProcThreadAttribute_t            func_UpdateProcThreadAttribute;             
++func_DeleteProcThreadAttributeList_t        func_DeleteProcThreadAttributeList;         
++
++
++/* Set the main thread's affinity */
++static int tMPI_Set_main_thread_affinity(void)
++{
++    /* calling thread PROCESSOR_NUMBER */
++    PROCESSOR_NUMBER CurrentProcessorNumber;      
++    /* calling thread GROUP_AFFINITY */
++    GROUP_AFFINITY CurrentThreadGroupAffinity; 
++    /* calling thread NUMA node */
++    USHORT CurrentNumaNodeNumber;
++
++
++    /* we can pre-check because it's atomic */
++    if (tMPI_Atomic_get(&main_thread_aff_set) == 0)
++    {
++        /* this can be a spinlock because the chances of collision are low. */
++        tMPI_Spinlock_lock( &main_thread_aff_lock );
++        if( g_ulHighestNumaNodeNumber != 0 )
++        {
++            func_GetCurrentProcessorNumberEx(&CurrentProcessorNumber);
++
++
++            /* set the NUMA node affinity for the current thread
++               failures to set the current thread affinity are ignored, 
++               as a fringe case can arise on >32 processor systems with a 32bit 
++               build/code.
++               */
++            func_SetThreadIdealProcessorEx(GetCurrentThread(), 
++                                           &CurrentProcessorNumber, 
++                                           NULL);
++
++            if(func_GetNumaProcessorNodeEx(&CurrentProcessorNumber, 
++                                           &CurrentNumaNodeNumber))
++            {
++                /* for the NUMA node number associated with the current processor 
++                   number, get the group affinity mask */
++                if(func_GetNumaNodeProcessorMaskEx(CurrentNumaNodeNumber, 
++                                                   &CurrentThreadGroupAffinity))
++                {
++                    /* set the current thread affinity to prevent it from running on 
++                       other NUMA nodes */
++                    func_SetThreadGroupAffinity(GetCurrentThread(), 
++                                                &CurrentThreadGroupAffinity, 
++                                                NULL);
++                }
++            }
++        }
++        else
++        {
++            /* No NUMA. For now, we just do a similar thing. */
++            if ( (func_GetCurrentProcessorNumberEx != NULL)  &&
++                 (func_SetThreadIdealProcessorEx))
++            {
++                func_GetCurrentProcessorNumberEx(&CurrentProcessorNumber);
++                func_SetThreadIdealProcessorEx(GetCurrentThread(), 
++                                               &CurrentProcessorNumber, 
++                                               NULL);
++            }
++        }
++        tMPI_Atomic_set( &main_thread_aff_set, 1);
++        tMPI_Spinlock_unlock( &main_thread_aff_lock );
++    }
++    return 0;
++}
++
++/*  returns 0 on success.
++    Success is returned if the system is non-NUMA, OR the system doesn't 
++    support appropriate NUMA APIs, OR the system is NUMA and we successfully 
++    initialized support.
++    
++    returns -1 on error.
++    This can happen if an API returned an error, a memory allocation failed, or 
++    we failed to initialize affinity mapping information.
++*/
++int tMPI_Init_NUMA(void)
++{
++    /* module handle to kernel32.dll -- we already reference it, so it's already loaded */
++    HMODULE hModKernel32 = NULL;                    
++    /* 0-based NUMA node count -- does not imply all nodes have available (eg: hot-plug) processors */
++    ULONG ulHighestNumaNodeNumber;                  
++    /* total number of processors available per affinity masks */
++    DWORD dwTotalProcessors = 0;                    
++    ULONG i = 0;
++
++    /* calling thread PROCESSOR_NUMBER */
++    PROCESSOR_NUMBER CurrentProcessorNumber;      
++    /* calling thread GROUP_AFFINITY */
++    GROUP_AFFINITY CurrentThreadGroupAffinity; 
++    /* calling thread NUMA node */
++    USHORT CurrentNumaNodeNumber;
++
++    WORD wActiveGroupCount;
++    WORD GroupIndex;
++
++    /* array of processor information structures */
++    MPI_NUMA_PROCESSOR_INFO *pMPI_ProcessorInfo = NULL; 
++
++    /* assume an error condition */
++    int iRet = -1;
++
++    hModKernel32 = GetModuleHandleA("kernel32.dll");
++
++    if( hModKernel32 == NULL )
++    {
++        return 0;
++    }
++
++    /* obtain addresses of relevant NUMA functions, most of which are 
++       Windows 7 / Windows Server 2008R2 only functions
++       this is done using GetProcAddress to enable the binary to run on older 
++       Windows versions.
++    */
++
++    func_GetNumaHighestNodeNumber = (func_GetNumaHighestNodeNumber_t) GetProcAddress( hModKernel32, "GetNumaHighestNodeNumber" );
++
++    if( func_GetNumaHighestNodeNumber == NULL )
++    {
++        return 0;
++    }
++
++    /* determine if we're on a NUMA system and if so, determine the number of 
++       (potential) nodes */
++
++    if(!func_GetNumaHighestNodeNumber( &ulHighestNumaNodeNumber ))
++    {
++        return -1;
++    }
++
++    if( ulHighestNumaNodeNumber == 0 )
++    {
++        /* system is not NUMA */
++        return 0;
++    }
++
++    func_SetThreadGroupAffinity = (func_SetThreadGroupAffinity_t)GetProcAddress( hModKernel32, "SetThreadGroupAffinity" );
++    func_SetThreadIdealProcessorEx = (func_SetThreadIdealProcessorEx_t)GetProcAddress( hModKernel32, "SetThreadIdealProcessorEx" );
++    func_CreateRemoteThreadEx = (func_CreateRemoteThreadEx_t)GetProcAddress( hModKernel32, "CreateRemoteThreadEx" );
++    func_GetNumaNodeProcessorMaskEx = (func_GetNumaNodeProcessorMaskEx_t)GetProcAddress( hModKernel32, "GetNumaNodeProcessorMaskEx" );
++    func_GetNumaProcessorNodeEx = (func_GetNumaProcessorNodeEx_t)GetProcAddress( hModKernel32, "GetNumaProcessorNodeEx" );
++    func_GetCurrentProcessorNumberEx = (func_GetCurrentProcessorNumberEx_t)GetProcAddress( hModKernel32, "GetCurrentProcessorNumberEx" );
++    func_GetActiveProcessorCount = (func_GetActiveProcessorCount_t)GetProcAddress( hModKernel32, "GetActiveProcessorCount" );
++    func_GetActiveProcessorGroupCount = (func_GetActiveProcessorGroupCount_t)GetProcAddress( hModKernel32, "GetActiveProcessorGroupCount" );
++    func_InitializeProcThreadAttributeList = (func_InitializeProcThreadAttributeList_t)GetProcAddress( hModKernel32, "InitializeProcThreadAttributeList" );
++    func_UpdateProcThreadAttribute = (func_UpdateProcThreadAttribute_t)GetProcAddress( hModKernel32, "UpdateProcThreadAttribute" );
++    func_DeleteProcThreadAttributeList = (func_DeleteProcThreadAttributeList_t)GetProcAddress( hModKernel32, "DeleteProcThreadAttributeList" );
++
++    if( (func_SetThreadGroupAffinity == NULL) ||
++        (func_SetThreadIdealProcessorEx == NULL) ||
++        (func_CreateRemoteThreadEx == NULL) ||
++        (func_GetNumaNodeProcessorMaskEx == NULL) ||
++        (func_GetNumaProcessorNodeEx == NULL) ||
++        (func_GetCurrentProcessorNumberEx == NULL) ||
++        (func_GetActiveProcessorCount == NULL) ||
++        (func_GetActiveProcessorGroupCount == NULL) ||
++        (func_InitializeProcThreadAttributeList == NULL) ||
++        (func_UpdateProcThreadAttribute == NULL) ||
++        (func_DeleteProcThreadAttributeList == NULL) )
++    {
++        /* if any addresses couldn't be located, assume NUMA functionality 
++           isn't supported */
++        return 0;
++    }
++
++    /* count the active processors across the groups */
++
++    func_GetCurrentProcessorNumberEx(&CurrentProcessorNumber);
++
++    wActiveGroupCount = func_GetActiveProcessorGroupCount();
++    
++    dwTotalProcessors = func_GetActiveProcessorCount( ALL_PROCESSOR_GROUPS );
++
++#if !((defined WIN64 || defined _WIN64))
++    /* WOW64 doesn't allow setting the affinity correctly beyond 32 
++       processors -- the KAFFINITY mask is only 32 bits wide
++       This check is only here for completeness -- large systems should be 
++       running 64bit Gromacs code, where the processor quantity is not 
++       constrained.
++       By failing here, the WOW64 32bit client will use normal CreateThread(), 
++       which can schedule up to 64 un-affinitized threads
++    */
++
++    if( dwTotalProcessors > 32 )
++    {
++        return 0;
++    }
++#endif
++
++    /* allocate array of processor info blocks */
++
++    pMPI_ProcessorInfo = tMPI_Malloc( sizeof(MPI_NUMA_PROCESSOR_INFO) * 
++                                      dwTotalProcessors );
++    if(pMPI_ProcessorInfo == NULL)
++    {
++        tMPI_Fatal_error(TMPI_FARGS,"tMPI_Malloc failed for processor information");
++        goto cleanup;
++    }
++
++    /* zero fill to cover reserved must be-zero fields */
++    memset(pMPI_ProcessorInfo, 0, sizeof(MPI_NUMA_PROCESSOR_INFO) * dwTotalProcessors);
++
++    /* loop through each processor group, and for each group, capture the 
++       processor numbers and NUMA node information. */
++
++    for(GroupIndex = 0 ; GroupIndex < wActiveGroupCount ; GroupIndex++)
++    {
++        DWORD dwGroupProcessorCount;
++        BYTE ProcessorIndex;
++
++        dwGroupProcessorCount = func_GetActiveProcessorCount( GroupIndex );
++
++        for(ProcessorIndex = 0 ; ProcessorIndex < dwGroupProcessorCount ; 
++            ProcessorIndex++)
++        {
++            PROCESSOR_NUMBER *pProcessorNumber = &(pMPI_ProcessorInfo[i].ProcessorNumber);
++            GROUP_AFFINITY *pGroupAffinity = &(pMPI_ProcessorInfo[i].GroupAffinity);
++            USHORT *pNodeNumber = &(pMPI_ProcessorInfo[i].NumaNodeNumber);
++
++            pProcessorNumber->Group = GroupIndex;
++            pProcessorNumber->Number = ProcessorIndex;
++
++            /* save an index to the processor array entry for the current processor
++               this is used to enable subsequent threads to be created in a round 
++               robin fashion starting at the next array entry
++            */
++
++            if( (CurrentProcessorNumber.Group == pProcessorNumber->Group ) &&
++                (CurrentProcessorNumber.Number == pProcessorNumber->Number) )
++            {
++                /* set global: current thread index into processor array */
++                g_ulThreadIndex = i;
++            }
++
++            /* capture the node number and group affinity associated with processor entry
++               any failures here are assumed to be catastrophic and disable 
++               the group & NUMA aware thread support
++            */
++
++            if(!func_GetNumaProcessorNodeEx(pProcessorNumber, pNodeNumber))
++            {
++                tMPI_Fatal_error(TMPI_FARGS,
++                                 "Processor enumeration, GetNumaProcessorNodeEx failed, error code=%d",
++                                 GetLastError());
++                goto cleanup;
++            }
++
++            if(!func_GetNumaNodeProcessorMaskEx(*pNodeNumber, pGroupAffinity))
++            {
++                tMPI_Fatal_error(TMPI_FARGS,
++                                 "Processor enumeration, GetNumaNodeProcessorMaskEx failed, error code=%d",
++                                 GetLastError());
++                goto cleanup;
++            }
++
++            /* future enhancement: construct GroupAffinity (single) processor 
++               mask within NUMA node for this processor entry */
++
++            /* increment processor array index */
++            i++;
++
++            /* sanity check, should never happen */
++
++            if(i > dwTotalProcessors)
++            {
++                tMPI_Fatal_error(TMPI_FARGS,"Processor enumeration exceeds allocated memory!");
++                goto cleanup;
++            }
++        }
++    }
++
++#if 0
++    /* set the NUMA node affinity for the current thread
++       failures to set the current thread affinity are ignored, 
++       as a fringe case can arise on >32 processor systems with a 32bit 
++       build/code.
++    */
++    func_SetThreadIdealProcessorEx(GetCurrentThread(), 
++                                   &CurrentProcessorNumber, 
++                                   NULL);
++
++    if(func_GetNumaProcessorNodeEx(&CurrentProcessorNumber, 
++                                   &CurrentNumaNodeNumber))
++    {
++        /* for the NUMA node number associated with the current processor 
++           number, get the group affinity mask */
++        if(func_GetNumaNodeProcessorMaskEx(CurrentNumaNodeNumber, 
++                                           &CurrentThreadGroupAffinity))
++        {
++            /* set the current thread affinity to prevent it from running on 
++               other NUMA nodes */
++            func_SetThreadGroupAffinity(GetCurrentThread(), 
++                                        &CurrentThreadGroupAffinity, 
++                                        NULL);
++        }
++    }
++#endif
++ 
++    /* capture number of processors, highest NUMA node number, and processor 
++       array */
++    g_ulTotalProcessors = dwTotalProcessors;
++    g_ulHighestNumaNodeNumber = ulHighestNumaNodeNumber;
++    g_MPI_ProcessorInfo = pMPI_ProcessorInfo;
++
++    iRet = 0 ;
++
++#if 0   
++    // TODO: debug DISCARD                        
++    printf("primary thread tid=%lu group=%lu mask=0x%I64x group=%lu number=%lu ulThreadIndex=%lu\n",
++        GetCurrentThreadId(),
++        CurrentThreadGroupAffinity.Group,
++        (ULONGLONG)CurrentThreadGroupAffinity.Mask,
++        (ULONG)CurrentProcessorNumber.Group,
++        (ULONG)CurrentProcessorNumber.Number,
++        g_ulThreadIndex);
++#endif
++
++cleanup:
++
++    if( iRet != 0 )
++    {
++        if( pMPI_ProcessorInfo )
++        {
++            tMPI_Free( pMPI_ProcessorInfo );
++        }
++    }
++
++    return 0;
++}
+ 
+ static void tMPI_Init_initers(void)
+ {
+@@ -108,6 +543,9 @@ static void tMPI_Init_initers(void)
+             InitializeCriticalSection(&cond_init);
+             InitializeCriticalSection(&barrier_init);
+ 
++            /* fatal errors are handled by the routine by calling tMPI_Fatal_error() */
++            tMPI_Init_NUMA();	
++
+             tMPI_Atomic_memory_barrier_rel();
+             tMPI_Atomic_set(&init_inited, 1);
+         }
+@@ -116,7 +554,8 @@ static void tMPI_Init_initers(void)
+     }
+ }
+ 
+-
++/* TODO: this needs to go away!  (there's another one in pthreads.c)
++   fatal errors are thankfully really rare*/
+ void tMPI_Fatal_error(const char *file, int line, const char *message, ...)
+ {
+     va_list ap;
+@@ -151,6 +590,159 @@ static DWORD WINAPI tMPI_Win32_thread_starter( LPVOID lpParam )
+     return 0;
+ }
+ 
++HANDLE tMPI_Thread_create_NUMA(LPSECURITY_ATTRIBUTES lpThreadAttributes,
++                               SIZE_T dwStackSize,
++                               LPTHREAD_START_ROUTINE lpStartAddress,
++                               LPVOID lpParameter,
++                               DWORD dwCreationFlags,
++                               LPDWORD lpThreadId)
++{
++    LPPROC_THREAD_ATTRIBUTE_LIST pAttributeList = NULL;
++    HANDLE hThread = NULL;
++    SIZE_T cbAttributeList = 0;
++    GROUP_AFFINITY GroupAffinity;
++    PROCESSOR_NUMBER IdealProcessorNumber;
++    ULONG CurrentProcessorIndex;
++
++    /* for each thread created, round-robin through the set of valid 
++       processors and affinity masks.
++       the assumption is that callers of tMPI_Thread_create_NUMA are creating 
++       threads that saturate a given processor.
++       for cases where threads are being created that rarely do work, standard 
++       thread creation (eg: CreateThread) should be invoked instead.
++    */
++
++    CurrentProcessorIndex = (ULONG)InterlockedIncrement((volatile LONG *)&g_ulThreadIndex);
++    CurrentProcessorIndex = CurrentProcessorIndex % g_ulTotalProcessors;
++
++    /* group, mask. */
++
++    memcpy(&GroupAffinity, 
++           &(g_MPI_ProcessorInfo[CurrentProcessorIndex].GroupAffinity), 
++           sizeof(GROUP_AFFINITY));
++
++    /* group, processor number */
++    
++    memcpy(&IdealProcessorNumber, 
++           &(g_MPI_ProcessorInfo[CurrentProcessorIndex].ProcessorNumber), 
++           sizeof(PROCESSOR_NUMBER)); 
++
++    /* determine size of allocation for AttributeList */
++
++    if(!func_InitializeProcThreadAttributeList(pAttributeList,
++                                               2,
++                                               0,
++                                               &cbAttributeList))
++    {
++        DWORD dwLastError = GetLastError();
++        if( dwLastError != ERROR_INSUFFICIENT_BUFFER )
++        {
++            tMPI_Fatal_error(TMPI_FARGS,
++                             "InitializeProcThreadAttributeList, error code=%d",
++                             dwLastError);
++            goto cleanup;
++        }
++    }
++
++    pAttributeList = (LPPROC_THREAD_ATTRIBUTE_LIST)tMPI_Malloc( cbAttributeList );
++    if( pAttributeList == NULL )
++    {
++        tMPI_Fatal_error(TMPI_FARGS,"Failed to allocate pAttributeList");
++        goto cleanup;
++    }
++
++    memset( pAttributeList, 0, cbAttributeList );
++
++    if(!func_InitializeProcThreadAttributeList(pAttributeList,
++                                               2,
++                                               0,
++                                               &cbAttributeList))
++    {
++        tMPI_Fatal_error(TMPI_FARGS,
++                         "InitializeProcThreadAttributeList, error code=%d",
++                         GetLastError());
++        goto cleanup;
++    }
++
++    if(!func_UpdateProcThreadAttribute(pAttributeList,
++                                       0,
++                                       PROC_THREAD_ATTRIBUTE_GROUP_AFFINITY,
++                                       &GroupAffinity,
++                                       sizeof(GroupAffinity),
++                                       NULL,
++                                       NULL))
++    {
++        tMPI_Fatal_error(TMPI_FARGS,"UpdateProcThreadAttribute, error code=%d",
++                         GetLastError());
++        goto cleanup;
++    }
++
++    if(!func_UpdateProcThreadAttribute(pAttributeList,
++                                       0,
++                                       PROC_THREAD_ATTRIBUTE_IDEAL_PROCESSOR,
++                                       &IdealProcessorNumber,
++                                       sizeof(IdealProcessorNumber),
++                                       NULL,
++                                       NULL))
++    {
++        tMPI_Fatal_error(TMPI_FARGS,"UpdateProcThreadAttribute, error code=%d",
++                         GetLastError());
++        goto cleanup;
++    }
++
++
++    hThread = func_CreateRemoteThreadEx( GetCurrentProcess(),
++                                         lpThreadAttributes,
++                                         dwStackSize,
++                                         lpStartAddress,
++                                         lpParameter,
++                                         dwCreationFlags,
++                                         pAttributeList,
++                                         lpThreadId);
++            
++    func_DeleteProcThreadAttributeList( pAttributeList );
++
++#if 0   
++	// TODO: debug only or DISCARD
++    if( hThread )
++    {
++        PROCESSOR_NUMBER ProcNumber;
++        USHORT NodeNumber;
++
++        GetThreadIdealProcessorEx(hThread, &ProcNumber);
++        GetNumaProcessorNodeEx(&ProcNumber, &NodeNumber);
++
++        printf("started thread tid=%lu group=%lu mask=0x%I64x number=%lu numanode=%lu\n",
++            *lpThreadId,
++            GroupAffinity.Group,
++            (ULONGLONG)GroupAffinity.Mask,
++            ProcNumber.Number,
++            NodeNumber
++            );
++    }
++#endif
++
++cleanup:
++    
++    if( pAttributeList )
++    {
++        tMPI_Free( pAttributeList );
++    }
++
++    return hThread;
++}
++
++int tMPI_Thread_get_hw_number(void)
++{
++    int ret;
++
++    SYSTEM_INFO sysinfo;
++    GetSystemInfo( &sysinfo );
++
++    ret=sysinfo.dwNumberOfProcessors;
++    return ret;
++}
++
+ 
+ int tMPI_Thread_create(tMPI_Thread_t *thread,
+                        void *(*start_routine)(void *), void *arg)
+@@ -161,30 +753,104 @@ int tMPI_Thread_create(tMPI_Thread_t *thread,
+     tMPI_Init_initers();
+ 
+     /* a small memory leak to be sure that it doesn't get deallocated 
+-       once this function ends */
++       once this function ends, before the newly created thread uses it. */
+     prm=(struct tMPI_Thread_starter_param*)
+-              malloc(sizeof(struct tMPI_Thread_starter_param));
++              tMPI_Malloc(sizeof(struct tMPI_Thread_starter_param));
+     prm->start_routine= start_routine;
+     prm->param=arg;
+ 
+-    *thread=(struct tMPI_Thread*)malloc(sizeof(struct tMPI_Thread)*1);
++    *thread=(struct tMPI_Thread*)tMPI_Malloc(sizeof(struct tMPI_Thread)*1);
+ 
+     if(thread==NULL)
+     {
+         tMPI_Fatal_error(TMPI_FARGS,"Invalid thread pointer.");
+         return EINVAL;
+     }
+-
+-    (*thread)->th = CreateThread(NULL, 0, tMPI_Win32_thread_starter, prm, 0, 
++    /* just create a plain thread. */
++    (*thread)->th = CreateThread(NULL,
++                                 0,
++                                 tMPI_Win32_thread_starter,
++                                 prm,
++                                 0, 
+                                  &thread_id);
+ 
+     if((*thread)->th==NULL)
+     {
++        tMPI_Free(thread);
+         tMPI_Fatal_error(TMPI_FARGS,"Failed to create thread, error code=%d",
+                          GetLastError());
+         return -1;
+     }
+-    /* inherit the thread priority from the paren thread. */
++
++    /* inherit the thread priority from the parent thread. */
++    /* TODO: is there value in setting this, vs. just allowing it to default 
++       from the process?  currently, this limits the effectivenes of changing 
++       the priority in eg: TaskManager. */
++    SetThreadPriority(((*thread)->th), GetThreadPriority(GetCurrentThread()));
++
++    return 0;
++}
++
++
++
++
++
++int tMPI_Thread_create_aff(tMPI_Thread_t *thread,
++                           void *(*start_routine)(void *), void *arg)
++{
++    DWORD thread_id;
++    struct tMPI_Thread_starter_param *prm;
++
++    tMPI_Init_initers();
++    tMPI_Set_main_thread_affinity();
++
++    /* a small memory leak to be sure that it doesn't get deallocated 
++       once this function ends, before the newly created thread uses it. */
++    prm=(struct tMPI_Thread_starter_param*)
++              tMPI_Malloc(sizeof(struct tMPI_Thread_starter_param));
++    prm->start_routine= start_routine;
++    prm->param=arg;
++
++    *thread=(struct tMPI_Thread*)tMPI_Malloc(sizeof(struct tMPI_Thread)*1);
++
++    if(thread==NULL)
++    {
++        tMPI_Fatal_error(TMPI_FARGS,"Invalid thread pointer.");
++        return EINVAL;
++    }
++
++    if( g_ulHighestNumaNodeNumber != 0 )
++    {
++        /* if running on a NUMA system, use the group and NUMA aware thread 
++           creation logic */
++        (*thread)->th = tMPI_Thread_create_NUMA(NULL,
++                                                0,
++                                                tMPI_Win32_thread_starter,
++                                                prm,
++                                                0, 
++                                                &thread_id);
++    } else {
++        /* TODO: for now, non-NUMA systems don't set thread affinity. */
++        (*thread)->th = CreateThread(NULL,
++                                     0,
++                                     tMPI_Win32_thread_starter,
++                                     prm,
++                                     0, 
++                                     &thread_id);
++    }
++
++    if((*thread)->th==NULL)
++    {
++        tMPI_Free(thread);
++        tMPI_Fatal_error(TMPI_FARGS,"Failed to create thread, error code=%d",
++                         GetLastError());
++        return -1;
++    }
++
++    /* inherit the thread priority from the parent thread. */
++    /* TODO: is there value in setting this, vs. just allowing it to default 
++       from the process?  currently, this limits the effectivenes of changing 
++       the priority in eg: TaskManager. */
+     SetThreadPriority(((*thread)->th), GetThreadPriority(GetCurrentThread()));
+ 
+     return 0;
+@@ -217,7 +883,7 @@ int tMPI_Thread_join(tMPI_Thread_t thread, void **value_ptr)
+         }
+     }
+     CloseHandle(thread->th);
+-    free(thread);
++    tMPI_Free(thread);
+ 
+     return 0;
+ }
+@@ -269,7 +935,7 @@ int tMPI_Thread_mutex_destroy(tMPI_Thread_mutex_t *mtx)
+     }
+ 
+     DeleteCriticalSection(&(mtx->mutex->cs));
+-    free(mtx->mutex);
++    tMPI_Free(mtx->mutex);
+ 
+     return 0;
+ }
+@@ -383,7 +1049,7 @@ int tMPI_Thread_key_create(tMPI_Thread_key_t *key, void (*destructor)(void *))
+ int tMPI_Thread_key_delete(tMPI_Thread_key_t key)
+ {
+     TlsFree(key.key->wkey);
+-    free(key.key);
++    tMPI_Free(key.key);
+ 
+     return 0;
+ }
+@@ -490,7 +1156,7 @@ int tMPI_Thread_cond_destroy(tMPI_Thread_cond_t *cond)
+     /* windows doesnt have this function */
+ #else
+     DeleteCriticalSection(&(cond->condp->wtr_lock));
+-    free(cond->condp);
++    tMPI_Free(cond->condp);
+ #endif
+     return 0;
+ }
+@@ -732,7 +1398,7 @@ int tMPI_Thread_barrier_destroy(tMPI_Thread_barrier_t *barrier)
+ 
+     tMPI_Thread_cond_destroy(&(barrier->barrierp->cv));
+ 
+-    free(barrier->barrierp);
++    tMPI_Free(barrier->barrierp);
+ 
+     return 0;
+ }
+diff --git a/src/gmxlib/typedefs.c b/src/gmxlib/typedefs.c
+index a0029be..15fcbdc 100644
+--- a/src/gmxlib/typedefs.c
++++ b/src/gmxlib/typedefs.c
+@@ -468,7 +468,6 @@ void done_energyhistory(energyhistory_t * enerhist)
+     sfree(enerhist->ener_ave);
+     sfree(enerhist->ener_sum);
+     sfree(enerhist->ener_sum_sim);
+-    sfree(enerhist->dht);
+ 
+     if (enerhist->dht != NULL)
+     {
+diff --git a/src/gmxlib/wman.c b/src/gmxlib/wman.c
+index c569583..4b42bb1 100644
+--- a/src/gmxlib/wman.c
++++ b/src/gmxlib/wman.c
+@@ -90,6 +90,10 @@ const t_sandr_const sandrTeX[] = {
+   { "[BR]", "\\\\"   },
+   { "%",    "\\%"    },
+   { "&",    "\\&"    },
++  /* The next couple of lines allow true Greek symbols to be written to the 
++     manual, which makes it look pretty */
++  { "[GRK]", "$\\"   },
++  { "[grk]", "$"     },
+   /* The next two lines used to substitute "|" and "||" to "or", but only
+    * g_angle used that functionality, so that was changed to a textual
+    * "or" there, so that other places could use those symbols to indicate
+@@ -107,7 +111,9 @@ const t_sandr_const sandrTty[] = {
+   { "[IT]", "" },
+   { "[it]", "" },
+   { "[PAR]","\n\n" },
+-  { "[BR]", "\n"}
++  { "[BR]", "\n"},
++  { "[GRK]", "" },
++  { "[grk]", "" }
+ };
+ #define NSRTTY asize(sandrTty)
+ 
+@@ -122,7 +128,9 @@ const t_sandr_const sandrWiki[] = {
+   { "[IT]", "''" },
+   { "[it]", "''" },
+   { "[PAR]","\n\n" },
+-  { "[BR]", "\n"}
++  { "[BR]", "\n" },
++  { "[GRK]", "&" },
++  { "[grk]", ";" }
+ };
+ #define NSRWIKI asize(sandrWiki)
+ 
+@@ -140,7 +148,9 @@ const t_sandr_const sandrNROFF[] = {
+   { "^",    "" },
+   { "#",    "" },
+   { "[BR]", "\n"},
+-  { "-",    "\\-"}
++  { "-",    "\\-"},
++  { "[GRK]", "" },
++  { "[grk]", "" }
+ };
+ #define NSRNROFF asize(sandrNROFF)
+ 
+@@ -154,7 +164,9 @@ const t_sandr_const sandrHTML[] = {
+   { "[IT]", "<it>" },
+   { "[it]", "</it>" },
+   { "[PAR]","<p>" },
+-  { "[BR]", "<br>" }
++  { "[BR]", "<br>" },
++  { "[GRK]", "&"  },
++  { "[grk]", ";"  }
+ };
+ #define NSRHTML asize(sandrHTML)
+ 
+@@ -168,7 +180,9 @@ const t_sandr_const sandrXML[] = {
+   { "[IT]", "<it>" },
+   { "[it]", "</it>" },
+   { "[PAR]","</par>\n<par>" },
+-  { "[BR]", "<br />" }
++  { "[BR]", "<br />" },
++  { "[GRK]", "" },
++  { "[grk]", "" }
+ };
+ #define NSRXML asize(sandrXML)
+ 
+diff --git a/src/kernel/g_protonate.c b/src/kernel/g_protonate.c
+index 01ee6d1..6ccd59a 100644
+--- a/src/kernel/g_protonate.c
++++ b/src/kernel/g_protonate.c
+@@ -37,6 +37,7 @@
+ #endif
+ 
+ #include <math.h>
++#include "string2.h"
+ #include "typedefs.h"
+ #include "macros.h"
+ #include "copyrite.h"
+@@ -55,7 +56,7 @@ int main (int argc,char *argv[])
+     "[TT]g_protonate[tt] reads (a) conformation(s) and adds all missing",
+     "hydrogens as defined in [TT]gmx2.ff/aminoacids.hdb[tt]. If only [TT]-s[tt] is",
+     "specified, this conformation will be protonated, if also [TT]-f[tt]",
+-    "is specified, the conformation(s) will be read from this file",
++    "is specified, the conformation(s) will be read from this file, ",
+     "which can be either a single conformation or a trajectory.",
+     "[PAR]",
+     "If a [TT].pdb[tt] file is supplied, residue names might not correspond to",
+@@ -65,7 +66,7 @@ int main (int argc,char *argv[])
+     "If an index file is specified, please note that the atom numbers",
+     "should correspond to the [BB]protonated[bb] state."
+   };
+-  
++ 
+   char        title[STRLEN+1];  
+   const char  *infile;
+   char        *grpnm;
+@@ -84,6 +85,10 @@ int main (int argc,char *argv[])
+   gmx_bool        bReadMultiple;
+   output_env_t oenv;
+   
++  const char *bugs[] = {
++    "For the moment, only .pdb files are accepted to the -s flag"
++  };
++ 
+   t_filenm fnm[] = {
+     { efTPS, NULL, NULL,         ffREAD  },
+     { efTRX, "-f", NULL,         ffOPTRD },
+@@ -94,7 +99,7 @@ int main (int argc,char *argv[])
+   
+   CopyRight(stderr,argv[0]);
+   parse_common_args(&argc,argv,PCA_CAN_TIME,
+-		    NFILE,fnm,0,NULL,asize(desc),desc,0,NULL,&oenv);
++		    NFILE,fnm,0,NULL,asize(desc),desc,asize(bugs),bugs,&oenv);
+   
+   infile=opt2fn("-s",NFILE,fnm);
+   read_tps_conf(infile,title,&top,&ePBC,&x,NULL,box,FALSE);
+@@ -104,8 +109,9 @@ int main (int argc,char *argv[])
+   bReadMultiple = opt2bSet("-f",NFILE,fnm);
+   if (bReadMultiple) {
+     infile = opt2fn("-f",NFILE,fnm);
+-    if ( !read_first_frame(oenv,&status, infile, &fr, TRX_NEED_X ) )
++    if ( !read_first_frame(oenv,&status, infile, &fr, TRX_NEED_X ) ) {
+       gmx_fatal(FARGS,"cannot read coordinate file %s",infile);
++    }
+     natoms = fr.natoms;
+   } else {
+     clear_trxframe(&fr,TRUE);
+@@ -120,16 +126,22 @@ int main (int argc,char *argv[])
+   }
+   
+   /* check input */
+-  if ( natoms == 0 )
++  if ( natoms == 0 ) {
+     gmx_fatal(FARGS,"no atoms in coordinate file %s",infile);
+-  if ( natoms > atoms->nr )
++  }
++
++  if ( natoms > atoms->nr ) {
+     gmx_fatal(FARGS,"topology with %d atoms does not match "
+ 		"coordinates with %d atoms",atoms->nr,natoms);
+-  for(i=0; i<nidx; i++)
+-    if (index[i] > natoms)
++  }
++
++  for(i=0; i<nidx; i++) {
++    if (index[i] > natoms) {
+       gmx_fatal(FARGS,"An atom number in group %s is larger than the number of "
+ 		  "atoms (%d) in the coordinate file %s",grpnm,natoms,infile);
+-  
++    }
++  }  
++
+   /* get indexed copy of atoms */
+   snew(iatoms,1);
+   init_t_atoms(iatoms,nidx,FALSE);
+@@ -138,10 +150,15 @@ int main (int argc,char *argv[])
+   for(i=0; i<nidx; i++) {
+     iatoms->atom[i] = atoms->atom[index[i]];
+     iatoms->atomname[i] = atoms->atomname[index[i]];
+-    if ( i>0 && (atoms->atom[index[i]].resind!=atoms->atom[index[i-1]].resind) )
++    if ( i>0 && (atoms->atom[index[i]].resind!=atoms->atom[index[i-1]].resind) ) {
+       resind++;
++    }
+     iatoms->atom[i].resind = resind;
+     iatoms->resinfo[resind] = atoms->resinfo[atoms->atom[index[i]].resind];
++    /* allocate some space for the rtp name and copy from name */
++    snew(iatoms->resinfo[resind].rtp,1);
++    iatoms->resinfo[resind].rtp = gmx_strdup(atoms->resinfo[resind].name);
++
+     iatoms->nres = max(iatoms->nres, iatoms->atom[i].resind+1);
+   }
+   
+@@ -151,10 +168,13 @@ int main (int argc,char *argv[])
+   snew(ix, nidx);
+   frame=0;
+   do {
+-    if (debug) fprintf(debug,"FRAME %d (%d %g)\n",frame,fr.step,fr.time);
++    if (debug) {
++        fprintf(debug,"FRAME %d (%d %g)\n",frame,fr.step,fr.time);
++    }
+     /* get indexed copy of x */
+-    for(i=0; i<nidx; i++)
++    for(i=0; i<nidx; i++) {
+       copy_rvec(fr.x[index[i]], ix[i]);
++    }
+     /* protonate */
+     natoms_out = protonate(&iatoms, &ix, &protdata);
+     
+@@ -171,6 +191,9 @@ int main (int argc,char *argv[])
+     write_trxframe(out,&frout,NULL);
+     frame++;
+   } while ( bReadMultiple && read_next_frame(oenv,status, &fr) );
++
++  sfree(ix);
++  sfree(iatoms);
+   
+   thanx(stderr);
+ 
+diff --git a/src/kernel/g_x2top.c b/src/kernel/g_x2top.c
+index 0df1e7a..cdac5a0 100644
+--- a/src/kernel/g_x2top.c
++++ b/src/kernel/g_x2top.c
+@@ -379,17 +379,17 @@ int main(int argc, char *argv[])
+     "G53a5  GROMOS96 53a5 Forcefield (official distribution)[PAR]",
+     "oplsaa OPLS-AA/L all-atom force field (2001 aminoacid dihedrals)[PAR]",
+     "The corresponding data files can be found in the library directory",
+-    "with name atomname2type.n2t. Check chapter 5 of the manual for more",
+-    "information about file formats. By default the forcefield selection",
++    "with name [TT]atomname2type.n2t[tt]. Check Chapter 5 of the manual for more",
++    "information about file formats. By default, the force field selection",
+     "is interactive, but you can use the [TT]-ff[tt] option to specify",
+     "one of the short names above on the command line instead. In that",
+-    "case [TT]pdb2gmx[tt] just looks for the corresponding file.[PAR]",
++    "case [TT]g_x2top[tt] just looks for the corresponding file.[PAR]",
+   };
+   const char *bugs[] = {
+     "The atom type selection is primitive. Virtually no chemical knowledge is used",
+     "Periodic boundary conditions screw up the bonding",
+     "No improper dihedrals are generated",
+-    "The atoms to atomtype translation table is incomplete (atomname2type.n2t files in the data directory). Please extend it and send the results back to the GROMACS crew."
++    "The atoms to atomtype translation table is incomplete ([TT]atomname2type.n2t[tt] file in the data directory). Please extend it and send the results back to the GROMACS crew."
+   };
+   FILE       *fp;
+   t_params   plist[F_NRE];
+diff --git a/src/kernel/genhydro.c b/src/kernel/genhydro.c
+index 54f9088..94997bf 100644
+--- a/src/kernel/genhydro.c
++++ b/src/kernel/genhydro.c
+@@ -146,8 +146,9 @@ static t_hackblock *get_hackblocks(t_atoms *pdba, int nah, t_hackblock ah[],
+   for(rnr=0; rnr < pdba->nres; rnr++) {
+     ahptr=search_h_db(nah,ah,*pdba->resinfo[rnr].rtp);
+     if ( ahptr ) {
+-      if (hb[rnr].name==NULL)
+-	hb[rnr].name=strdup(ahptr->name);
++      if (hb[rnr].name==NULL) {
++	    hb[rnr].name=strdup(ahptr->name);
++      }
+       merge_hacks(ahptr, &hb[rnr]);
+     }
+   }
+@@ -166,17 +167,22 @@ static void expand_hackblocks_one(t_hackblock *hbr, char *atomname,
+        all hacks involving atoms from resp. previous or next residue
+        (i.e. which name begins with '-' (N) or '+' (C) */
+     bIgnore = FALSE;
+-    if ( bN ) /* N-terminus: ignore '-' */
+-      for(k=0; k<4 && hbr->hack[j].a[k] && !bIgnore; k++)
+-	bIgnore = hbr->hack[j].a[k][0]=='-';
+-    if ( bC ) /* C-terminus: ignore '+' */
+-      for(k=0; k<4 && hbr->hack[j].a[k] && !bIgnore; k++)
+-	bIgnore = hbr->hack[j].a[k][0]=='+';
++    if ( bN ) { /* N-terminus: ignore '-' */
++      for(k=0; k<4 && hbr->hack[j].a[k] && !bIgnore; k++) {
++	    bIgnore = hbr->hack[j].a[k][0]=='-';
++      }
++    }
++    if ( bC ) { /* C-terminus: ignore '+' */
++      for(k=0; k<4 && hbr->hack[j].a[k] && !bIgnore; k++) {
++	    bIgnore = hbr->hack[j].a[k][0]=='+';
++      }
++    }
+     /* must be either hdb entry (tp>0) or add from tdb (oname==NULL)
+        and first control aton (AI) matches this atom or
+        delete/replace from tdb (oname!=NULL) and oname matches this atom */
+-    if (debug) fprintf(debug," %s",
+-		       hbr->hack[j].oname?hbr->hack[j].oname:hbr->hack[j].AI);
++    if (debug) {
++        fprintf(debug," %s",hbr->hack[j].oname?hbr->hack[j].oname:hbr->hack[j].AI);
++    }
+ 
+     if ( !bIgnore &&
+          ( ( ( hbr->hack[j].tp > 0 || hbr->hack[j].oname==NULL ) &&
+@@ -184,56 +190,60 @@ static void expand_hackblocks_one(t_hackblock *hbr, char *atomname,
+            ( hbr->hack[j].oname!=NULL &&
+              strcmp(atomname, hbr->hack[j].oname) == 0) ) ) {
+       /* now expand all hacks for this atom */
+-      if (debug) fprintf(debug," +%dh",hbr->hack[j].nr);
++      if (debug) {
++         fprintf(debug," +%dh",hbr->hack[j].nr);
++      }
+       srenew(*abi,*nabi + hbr->hack[j].nr);
+       for(k=0; k < hbr->hack[j].nr; k++) {
+-	copy_t_hack(&hbr->hack[j], &(*abi)[*nabi + k]);
+-	(*abi)[*nabi + k].bXSet = FALSE;
+-	/* if we're adding (oname==NULL) and don't have a new name (nname) 
+-	   yet, build it from atomname */
+-	if ( (*abi)[*nabi + k].nname==NULL ) {
+-	  if ( (*abi)[*nabi + k].oname==NULL ) {
+-	    (*abi)[*nabi + k].nname=strdup(atomname);
+-	    (*abi)[*nabi + k].nname[0]='H';
+-	  }
+-	} else {
+-	  if (gmx_debug_at) {
+-	    fprintf(debug,"Hack '%s' %d, replacing nname '%s' with '%s' (old name '%s')\n",
+-		    atomname,j,
+-		    (*abi)[*nabi + k].nname,hbr->hack[j].nname,
+-		    (*abi)[*nabi + k].oname ? (*abi)[*nabi + k].oname : "");
+-	  }
+-	  sfree((*abi)[*nabi + k].nname);
+-	  (*abi)[*nabi + k].nname=strdup(hbr->hack[j].nname);
+-	}
++	    copy_t_hack(&hbr->hack[j], &(*abi)[*nabi + k]);
++	    (*abi)[*nabi + k].bXSet = FALSE;
++	    /* if we're adding (oname==NULL) and don't have a new name (nname) 
++	    yet, build it from atomname */
++	    if ( (*abi)[*nabi + k].nname==NULL ) {
++	        if ( (*abi)[*nabi + k].oname==NULL ) {
++	            (*abi)[*nabi + k].nname=strdup(atomname);
++	            (*abi)[*nabi + k].nname[0]='H';
++	        }
++	    } else {
++	        if (gmx_debug_at) {
++	            fprintf(debug,"Hack '%s' %d, replacing nname '%s' with '%s' (old name '%s')\n",
++		            atomname,j,
++		            (*abi)[*nabi + k].nname,hbr->hack[j].nname,
++		            (*abi)[*nabi + k].oname ? (*abi)[*nabi + k].oname : "");
++	        }
++	    sfree((*abi)[*nabi + k].nname);
++	    (*abi)[*nabi + k].nname=strdup(hbr->hack[j].nname);
++	    }
+ 
+-	if (hbr->hack[j].tp == 10 && k == 2) {
+-	  /* This is a water virtual site, not a hydrogen */
+-	  /* Ugly hardcoded name hack */
+-	  (*abi)[*nabi + k].nname[0] = 'M';
+-	} else if (hbr->hack[j].tp == 11 && k >= 2) {
+-	  /* This is a water lone pair, not a hydrogen */
+-	  /* Ugly hardcoded name hack */
+-	  srenew((*abi)[*nabi + k].nname,4);
+-	  (*abi)[*nabi + k].nname[0] = 'L';
+-	  (*abi)[*nabi + k].nname[1] = 'P';
+-	  (*abi)[*nabi + k].nname[2] = '1' + k - 2;
+-	  (*abi)[*nabi + k].nname[3] = '\0';
+-	} else if ( hbr->hack[j].nr > 1 ) {
+-	  /* adding more than one atom, number them */
+-	  l = strlen((*abi)[*nabi + k].nname);
+-	  srenew((*abi)[*nabi + k].nname, l+2);
+-	  (*abi)[*nabi + k].nname[l]   = '1' + k;
+-	  (*abi)[*nabi + k].nname[l+1] = '\0';
+-	}
++	    if (hbr->hack[j].tp == 10 && k == 2) {
++	        /* This is a water virtual site, not a hydrogen */
++	        /* Ugly hardcoded name hack */
++	        (*abi)[*nabi + k].nname[0] = 'M';
++	    } else if (hbr->hack[j].tp == 11 && k >= 2) {
++	        /* This is a water lone pair, not a hydrogen */
++	        /* Ugly hardcoded name hack */
++	        srenew((*abi)[*nabi + k].nname,4);
++	        (*abi)[*nabi + k].nname[0] = 'L';
++	        (*abi)[*nabi + k].nname[1] = 'P';
++	        (*abi)[*nabi + k].nname[2] = '1' + k - 2;
++	        (*abi)[*nabi + k].nname[3] = '\0';
++	    } else if ( hbr->hack[j].nr > 1 ) {
++	        /* adding more than one atom, number them */
++	        l = strlen((*abi)[*nabi + k].nname);
++	        srenew((*abi)[*nabi + k].nname, l+2);
++	        (*abi)[*nabi + k].nname[l]   = '1' + k;
++	        (*abi)[*nabi + k].nname[l+1] = '\0';
++	    }
+       }
+       (*nabi) += hbr->hack[j].nr;
+       
+       /* add hacks to atoms we've just added */
+-      if ( hbr->hack[j].tp > 0 || hbr->hack[j].oname==NULL )
+-	for(k=0; k < hbr->hack[j].nr; k++)
+-	  expand_hackblocks_one(hbr, (*abi)[*nabi-hbr->hack[j].nr+k].nname, 
++      if ( hbr->hack[j].tp > 0 || hbr->hack[j].oname==NULL ) {
++	      for(k=0; k < hbr->hack[j].nr; k++) {
++	        expand_hackblocks_one(hbr, (*abi)[*nabi-hbr->hack[j].nr+k].nname, 
+ 				nabi, abi, bN, bC);
++          }
++      }
+     }
+   }
+ }
+@@ -313,30 +323,31 @@ static void calc_all_pos(t_atoms *pdba, rvec x[], int nab[], t_hack *ab[],
+     for(j=0; j < nab[i]; j+=ab[i][j].nr) {
+       /* check if we're adding: */
+       if (ab[i][j].oname==NULL && ab[i][j].tp > 0) {
+-	bFoundAll = TRUE;
+-	for(m=0; (m<ab[i][j].nctl && bFoundAll); m++) {
+-	  ia = pdbasearch_atom(ab[i][j].a[m], rnr, pdba,
++	    bFoundAll = TRUE;
++	    for(m=0; (m<ab[i][j].nctl && bFoundAll); m++) {
++	        ia = pdbasearch_atom(ab[i][j].a[m], rnr, pdba,
+ 			       bCheckMissing ? "atom" : "check",
+ 			       !bCheckMissing);
+-	  if (ia < 0) {
+-	    /* not found in original atoms, might still be in t_hack (ab) */
+-	    hacksearch_atom(&ii, &jj, ab[i][j].a[m], nab, ab, rnr, pdba);
+-	    if (ii >= 0) {
+-	      copy_rvec(ab[ii][jj].newx, xa[m]);
+-	    } else {
+-	      bFoundAll = FALSE;
+-	      if (bCheckMissing) {
+-		gmx_fatal(FARGS,"Atom %s not found in residue %s %d"
+-			  ", rtp entry %s"
+-			  " while adding hydrogens",
+-			  ab[i][j].a[m],
+-			  *pdba->resinfo[rnr].name,
+-			  pdba->resinfo[rnr].nr,
+-			  *pdba->resinfo[rnr].rtp);
+-	      }
+-	    }
+-	  } else
++	    if (ia < 0) {
++	        /* not found in original atoms, might still be in t_hack (ab) */
++	        hacksearch_atom(&ii, &jj, ab[i][j].a[m], nab, ab, rnr, pdba);
++	        if (ii >= 0) {
++	            copy_rvec(ab[ii][jj].newx, xa[m]);
++	        } else {
++	            bFoundAll = FALSE;
++	            if (bCheckMissing) {
++		            gmx_fatal(FARGS,"Atom %s not found in residue %s %d"
++			            ", rtp entry %s"
++			            " while adding hydrogens",
++			            ab[i][j].a[m],
++			            *pdba->resinfo[rnr].name,
++			            pdba->resinfo[rnr].nr,
++			            *pdba->resinfo[rnr].rtp);
++	            }
++	        }
++	  } else {
+ 	    copy_rvec(x[ia], xa[m]);
++      }
+ 	}
+ 	if (bFoundAll) {
+ 	  for(m=0; (m<MAXH); m++)
+@@ -636,19 +647,25 @@ int protonate(t_atoms **atomsptr,rvec **xptr,t_protonate *protdata)
+   
+   atoms=NULL;
+   if ( !protdata->bInit ) {
+-    if (debug) fprintf(debug,"protonate: Initializing protdata\n");
++    if (debug) {
++         fprintf(debug,"protonate: Initializing protdata\n");
++    }
++
+     /* set forcefield to use: */
+-    strcpy(protdata->FF,"ffgmx2");
++    strcpy(protdata->FF,"gmx2.ff");
++
+     /* get the databases: */
+     protdata->nah = read_h_db(protdata->FF,&protdata->ah);
+     open_symtab(&protdata->tab); 
+     protdata->atype = read_atype(protdata->FF,&protdata->tab);
+     nntdb = read_ter_db(protdata->FF,'n',&protdata->ntdb,protdata->atype);
+-    if (nntdb < 1)
+-      gmx_fatal(FARGS,"no n-terminus db");
++    if (nntdb < 1) {
++      gmx_fatal(FARGS,"no N-terminus database");
++    }
+     nctdb = read_ter_db(protdata->FF,'c',&protdata->ctdb,protdata->atype);
+-    if (nctdb < 1)
+-      gmx_fatal(FARGS,"no c-terminus db");
++    if (nctdb < 1) {
++      gmx_fatal(FARGS,"no C-terminus database");
++    }
+     
+     /* set terminus types: -NH3+ (different for Proline) and -COO- */
+     atoms=*atomsptr;
+@@ -656,15 +673,16 @@ int protonate(t_atoms **atomsptr,rvec **xptr,t_protonate *protdata)
+     snew(protdata->sel_ctdb, NTERPAIRS);
+ 
+     if (nntdb>=4 && nctdb>=2) {
+-      /* Yuk, yuk, hardcoded default termini selections !!! */
+-      if (strncmp(*atoms->resinfo[atoms->atom[atoms->nr-1].resind].name,"PRO",3)==0)
+-	nt = 3;
+-      else
+-	nt = 1;
+-      ct = 1;
++        /* Yuk, yuk, hardcoded default termini selections !!! */
++        if (strncmp(*atoms->resinfo[atoms->atom[atoms->nr-1].resind].name,"PRO",3)==0) {
++	        nt = 3;
++        } else {
++    	    nt = 1;
++        }
++        ct = 1;
+     } else {
+-      nt = 0;
+-      ct = 0;
++        nt = 0;
++        ct = 0;
+     }
+     protdata->sel_ntdb[0]=&(protdata->ntdb[nt]);
+     protdata->sel_ctdb[0]=&(protdata->ctdb[ct]);
+@@ -689,8 +707,10 @@ int protonate(t_atoms **atomsptr,rvec **xptr,t_protonate *protdata)
+     /* set flag to show we're initialized: */
+     protdata->bInit=TRUE;
+   } else {
+-    if (debug) fprintf(debug,"protonate: using available protdata\n");
+-    /* add_h will need the unprotonated topoloy again: */
++    if (debug) {
++        fprintf(debug,"protonate: using available protdata\n");
++    }
++    /* add_h will need the unprotonated topology again: */
+     atoms = protdata->upatoms;
+     bUpdate_pdba=FALSE;
+     bKeep_old_pdba=FALSE;
+@@ -701,12 +721,15 @@ int protonate(t_atoms **atomsptr,rvec **xptr,t_protonate *protdata)
+ 	       NTERPAIRS, protdata->sel_ntdb, protdata->sel_ctdb,
+ 	       protdata->rN, protdata->rC, TRUE,
+ 	       &protdata->nab, &protdata->ab, bUpdate_pdba, bKeep_old_pdba);
+-  if ( ! protdata->patoms )
++  if ( ! protdata->patoms ) {
+     /* store protonated topology */
+     protdata->patoms = atoms;
++  }
+   *atomsptr = protdata->patoms;
+-  if (debug) fprintf(debug,"natoms: %d -> %d (nadd=%d)\n",
+-		     protdata->upatoms->nr, protdata->patoms->nr, nadd);
++  if (debug) {
++    fprintf(debug,"natoms: %d -> %d (nadd=%d)\n",
++		    protdata->upatoms->nr, protdata->patoms->nr, nadd);
++  }
+   return nadd;
+ #undef NTERPAIRS  
+ }
+diff --git a/src/kernel/genhydro.h b/src/kernel/genhydro.h
+index fb20ab0..ba90543 100644
+--- a/src/kernel/genhydro.h
++++ b/src/kernel/genhydro.h
+@@ -51,7 +51,7 @@ extern int add_h(t_atoms **pdbaptr, rvec *xptr[],
+  * ntdb[i] and ctdb[i] may be NULL, no replacement will be done then.
+  * rN[i] is the residue number of the N-terminus of chain i,
+  * rC[i] is the residue number of the C-terminus of chain i
+- * if bMissing==TRUE, conitue when atoms are not found
++ * if bMissing==TRUE, continue when atoms are not found
+  * if nabptr && abptrb, the hack array will be returned in them to be used
+  * a second time
+  * if bUpdate_pdba, hydrogens are added to *pdbaptr, else it is unchanged
+@@ -59,10 +59,10 @@ extern int add_h(t_atoms **pdbaptr, rvec *xptr[],
+  */
+ 
+ extern int protonate(t_atoms **atoms, rvec **x, t_protonate *protdata);
+-/* Protonate molecule according to ffgmx2 
++/* Protonate molecule according to gmx2.ff/aminoacids.hdb 
+  * when called the first time, new atoms are added to atoms, 
+  * second time only coordinates are generated
+- * return the New total number of atoms 
++ * return the new total number of atoms 
+  */
+ 
+ extern void deprotonate(t_atoms *atoms,rvec *x);
+diff --git a/src/kernel/gmxdump.c b/src/kernel/gmxdump.c
+index 7cda183..4e99088 100644
+--- a/src/kernel/gmxdump.c
++++ b/src/kernel/gmxdump.c
+@@ -466,7 +466,7 @@ int main(int argc,char *argv[])
+     "This program is essential for checking your run input file in case of",
+     "problems.[PAR]",
+     "The program can also preprocess a topology to help finding problems.",
+-    "Note that currently setting GMXLIB is the only way to customize",
++    "Note that currently setting [TT]GMXLIB[tt] is the only way to customize",
+     "directories used for searching include files.",
+   };
+   t_filenm fnm[] = {
+diff --git a/src/kernel/grompp.c b/src/kernel/grompp.c
+index a987b50..2d3b716 100644
+--- a/src/kernel/grompp.c
++++ b/src/kernel/grompp.c
+@@ -1152,8 +1152,8 @@ int main (int argc, char *argv[])
+     "Note that the atom names are irrelevant for the simulation as",
+     "only the atom types are used for generating interaction parameters.[PAR]",
+ 
+-    "[TT]grompp[tt] uses a built-in preprocessor to resolve includes, macros ",
+-    "etcetera. The preprocessor supports the following keywords:[BR]",
++    "[TT]grompp[tt] uses a built-in preprocessor to resolve includes, macros, ",
++    "etc. The preprocessor supports the following keywords:[PAR]",
+     "#ifdef VARIABLE[BR]",
+     "#ifndef VARIABLE[BR]",
+     "#else[BR]",
+@@ -1161,19 +1161,21 @@ int main (int argc, char *argv[])
+     "#define VARIABLE[BR]",
+     "#undef VARIABLE[BR]"
+     "#include \"filename\"[BR]",
+-    "#include <filename>[BR]",
++    "#include <filename>[PAR]",
+     "The functioning of these statements in your topology may be modulated by",
+-    "using the following two flags in your [TT]mdp[tt] file:[BR]",
+-    "define = -DVARIABLE1 -DVARIABLE2[BR]",
+-    "include = -I/home/john/doe[BR]",
++    "using the following two flags in your [TT].mdp[tt] file:[PAR]",
++    "[TT]define = -DVARIABLE1 -DVARIABLE2[BR]",
++    "include = -I/home/john/doe[tt][BR]",
+     "For further information a C-programming textbook may help you out.",
+     "Specifying the [TT]-pp[tt] flag will get the pre-processed",
+     "topology file written out so that you can verify its contents.[PAR]",
+-    
+-    "If your system does not have a c-preprocessor, you can still",
+-    "use [TT]grompp[tt], but you do not have access to the features ",
+-    "from the cpp. Command line options to the c-preprocessor can be given",
+-    "in the [TT].mdp[tt] file. See your local manual (man cpp).[PAR]",
++   
++    /* cpp has been unnecessary for some time, hasn't it?
++        "If your system does not have a C-preprocessor, you can still",
++        "use [TT]grompp[tt], but you do not have access to the features ",
++        "from the cpp. Command line options to the C-preprocessor can be given",
++        "in the [TT].mdp[tt] file. See your local manual (man cpp).[PAR]",
++    */
+     
+     "When using position restraints a file with restraint coordinates",
+     "can be supplied with [TT]-r[tt], otherwise restraining will be done",
+@@ -1191,8 +1193,8 @@ int main (int argc, char *argv[])
+     "[TT]-e[tt] to read Nose-Hoover and/or Parrinello-Rahman coupling",
+     "variables.[PAR]",
+ 
+-    "[TT]grompp[tt] can be used to restart simulations preserving",
+-    "continuity by supplying just a checkpoint file with [TT]-t[tt].",
++    "[TT]grompp[tt] can be used to restart simulations (preserving",
++    "continuity) by supplying just a checkpoint file with [TT]-t[tt].",
+     "However, for simply changing the number of run steps to extend",
+     "a run, using [TT]tpbconv[tt] is more convenient than [TT]grompp[tt].",
+     "You then supply the old checkpoint file directly to [TT]mdrun[tt]",
+@@ -1209,10 +1211,10 @@ int main (int argc, char *argv[])
+     "of virtual site constructions will be removed. If any constraints remain",
+     "which involve virtual sites, a fatal error will result.[PAR]"
+     
+-    "To verify your run input file, please make notice of all warnings",
++    "To verify your run input file, please take note of all warnings",
+     "on the screen, and correct where necessary. Do also look at the contents",
+-    "of the [TT]mdout.mdp[tt] file, this contains comment lines, as well as",
+-    "the input that [TT]grompp[tt] has read. If in doubt you can start grompp",
++    "of the [TT]mdout.mdp[tt] file; this contains comment lines, as well as",
++    "the input that [TT]grompp[tt] has read. If in doubt, you can start [TT]grompp[tt]",
+     "with the [TT]-debug[tt] option which will give you more information",
+     "in a file called [TT]grompp.log[tt] (along with real debug info). You",
+     "can see the contents of the run input file with the [TT]gmxdump[tt]",
+diff --git a/src/kernel/md.c b/src/kernel/md.c
+index 1346ef9..8ae0b4c 100644
+--- a/src/kernel/md.c
++++ b/src/kernel/md.c
+@@ -37,9 +37,6 @@
+ #include <config.h>
+ #endif
+ 
+-#include <signal.h>
+-#include <stdlib.h>
+-
+ #if ((defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __CYGWIN__ && !defined __CYGWIN32__)
+ /* _isnan() */
+ #include <float.h>
+@@ -103,1009 +100,6 @@
+ #endif
+ 
+ 
+-/* simulation conditions to transmit. Keep in mind that they are 
+-   transmitted to other nodes through an MPI_Reduce after
+-   casting them to a real (so the signals can be sent together with other 
+-   data). This means that the only meaningful values are positive, 
+-   negative or zero. */
+-enum { eglsNABNSB, eglsCHKPT, eglsSTOPCOND, eglsRESETCOUNTERS, eglsNR };
+-/* Is the signal in one simulation independent of other simulations? */
+-gmx_bool gs_simlocal[eglsNR] = { TRUE, FALSE, FALSE, TRUE };
+-
+-typedef struct {
+-    int nstms;       /* The frequency for intersimulation communication */
+-    int sig[eglsNR]; /* The signal set by one process in do_md */
+-    int set[eglsNR]; /* The communicated signal, equal for all processes */
+-} globsig_t;
+-
+-
+-
+-/* check which of the multisim simulations has the shortest number of
+-   steps and return that number of nsteps */
+-static gmx_large_int_t get_multisim_nsteps(const t_commrec *cr,
+-                                           gmx_large_int_t nsteps)
+-{
+-    gmx_large_int_t steps_out;
+-
+-    if MASTER(cr)
+-    {
+-        gmx_large_int_t *buf;
+-        int s;
+-
+-        snew(buf,cr->ms->nsim);
+-
+-        buf[cr->ms->sim] = nsteps;
+-        gmx_sumli_sim(cr->ms->nsim, buf, cr->ms);
+-
+-        steps_out=-1;
+-        for(s=0; s<cr->ms->nsim; s++)
+-        {
+-            /* find the smallest positive number */
+-            if (buf[s]>= 0 && ((steps_out < 0) || (buf[s]<steps_out)) )
+-            {
+-                steps_out=buf[s];
+-            }
+-        }
+-        sfree(buf);
+-
+-        /* if we're the limiting simulation, don't do anything */
+-        if (steps_out>=0 && steps_out<nsteps) 
+-        {
+-            char strbuf[255];
+-            snprintf(strbuf, 255, "Will stop simulation %%d after %s steps (another simulation will end then).\n", gmx_large_int_pfmt);
+-            fprintf(stderr, strbuf, cr->ms->sim, steps_out);
+-        }
+-    }
+-    /* broadcast to non-masters */
+-    gmx_bcast(sizeof(gmx_large_int_t), &steps_out, cr);
+-    return steps_out;
+-}
+-
+-static int multisim_min(const gmx_multisim_t *ms,int nmin,int n)
+-{
+-    int  *buf;
+-    gmx_bool bPos,bEqual;
+-    int  s,d;
+-
+-    snew(buf,ms->nsim);
+-    buf[ms->sim] = n;
+-    gmx_sumi_sim(ms->nsim,buf,ms);
+-    bPos   = TRUE;
+-    bEqual = TRUE;
+-    for(s=0; s<ms->nsim; s++)
+-    {
+-        bPos   = bPos   && (buf[s] > 0);
+-        bEqual = bEqual && (buf[s] == buf[0]);
+-    }
+-    if (bPos)
+-    {
+-        if (bEqual)
+-        {
+-            nmin = min(nmin,buf[0]);
+-        }
+-        else
+-        {
+-            /* Find the least common multiple */
+-            for(d=2; d<nmin; d++)
+-            {
+-                s = 0;
+-                while (s < ms->nsim && d % buf[s] == 0)
+-                {
+-                    s++;
+-                }
+-                if (s == ms->nsim)
+-                {
+-                    /* We found the LCM and it is less than nmin */
+-                    nmin = d;
+-                    break;
+-                }
+-            }
+-        }
+-    }
+-    sfree(buf);
+-
+-    return nmin;
+-}
+-
+-static int multisim_nstsimsync(const t_commrec *cr,
+-                               const t_inputrec *ir,int repl_ex_nst)
+-{
+-    int nmin;
+-
+-    if (MASTER(cr))
+-    {
+-        nmin = INT_MAX;
+-        nmin = multisim_min(cr->ms,nmin,ir->nstlist);
+-        nmin = multisim_min(cr->ms,nmin,ir->nstcalcenergy);
+-        nmin = multisim_min(cr->ms,nmin,repl_ex_nst);
+-        if (nmin == INT_MAX)
+-        {
+-            gmx_fatal(FARGS,"Can not find an appropriate interval for inter-simulation communication, since nstlist, nstcalcenergy and -replex are all <= 0");
+-        }
+-        /* Avoid inter-simulation communication at every (second) step */
+-        if (nmin <= 2)
+-        {
+-            nmin = 10;
+-        }
+-    }
+-
+-    gmx_bcast(sizeof(int),&nmin,cr);
+-
+-    return nmin;
+-}
+-
+-static void init_global_signals(globsig_t *gs,const t_commrec *cr,
+-                                const t_inputrec *ir,int repl_ex_nst)
+-{
+-    int i;
+-
+-    if (MULTISIM(cr))
+-    {
+-        gs->nstms = multisim_nstsimsync(cr,ir,repl_ex_nst);
+-        if (debug)
+-        {
+-            fprintf(debug,"Syncing simulations for checkpointing and termination every %d steps\n",gs->nstms);
+-        }
+-    }
+-    else
+-    {
+-        gs->nstms = 1;
+-    }
+-
+-    for(i=0; i<eglsNR; i++)
+-    {
+-        gs->sig[i] = 0;
+-        gs->set[i] = 0;
+-    }
+-}
+-
+-static void copy_coupling_state(t_state *statea,t_state *stateb, 
+-                                gmx_ekindata_t *ekinda,gmx_ekindata_t *ekindb, t_grpopts* opts) 
+-{
+-    
+-    /* MRS note -- might be able to get rid of some of the arguments.  Look over it when it's all debugged */
+-    
+-    int i,j,nc;
+-
+-    /* Make sure we have enough space for x and v */
+-    if (statea->nalloc > stateb->nalloc)
+-    {
+-        stateb->nalloc = statea->nalloc;
+-        srenew(stateb->x,stateb->nalloc);
+-        srenew(stateb->v,stateb->nalloc);
+-    }
+-
+-    stateb->natoms     = statea->natoms;
+-    stateb->ngtc       = statea->ngtc;
+-    stateb->nnhpres    = statea->nnhpres;
+-    stateb->veta       = statea->veta;
+-    if (ekinda) 
+-    {
+-        copy_mat(ekinda->ekin,ekindb->ekin);
+-        for (i=0; i<stateb->ngtc; i++) 
+-        {
+-            ekindb->tcstat[i].T = ekinda->tcstat[i].T;
+-            ekindb->tcstat[i].Th = ekinda->tcstat[i].Th;
+-            copy_mat(ekinda->tcstat[i].ekinh,ekindb->tcstat[i].ekinh);
+-            copy_mat(ekinda->tcstat[i].ekinf,ekindb->tcstat[i].ekinf);
+-            ekindb->tcstat[i].ekinscalef_nhc =  ekinda->tcstat[i].ekinscalef_nhc;
+-            ekindb->tcstat[i].ekinscaleh_nhc =  ekinda->tcstat[i].ekinscaleh_nhc;
+-            ekindb->tcstat[i].vscale_nhc =  ekinda->tcstat[i].vscale_nhc;
+-        }
+-    }
+-    copy_rvecn(statea->x,stateb->x,0,stateb->natoms);
+-    copy_rvecn(statea->v,stateb->v,0,stateb->natoms);
+-    copy_mat(statea->box,stateb->box);
+-    copy_mat(statea->box_rel,stateb->box_rel);
+-    copy_mat(statea->boxv,stateb->boxv);
+-
+-    for (i = 0; i<stateb->ngtc; i++) 
+-    { 
+-        nc = i*opts->nhchainlength;
+-        for (j=0; j<opts->nhchainlength; j++) 
+-        {
+-            stateb->nosehoover_xi[nc+j]  = statea->nosehoover_xi[nc+j];
+-            stateb->nosehoover_vxi[nc+j] = statea->nosehoover_vxi[nc+j];
+-        }
+-    }
+-    if (stateb->nhpres_xi != NULL)
+-    {
+-        for (i = 0; i<stateb->nnhpres; i++) 
+-        {
+-            nc = i*opts->nhchainlength;
+-            for (j=0; j<opts->nhchainlength; j++) 
+-            {
+-                stateb->nhpres_xi[nc+j]  = statea->nhpres_xi[nc+j];
+-                stateb->nhpres_vxi[nc+j] = statea->nhpres_vxi[nc+j];
+-            }
+-        }
+-    }
+-}
+-
+-static real compute_conserved_from_auxiliary(t_inputrec *ir, t_state *state, t_extmass *MassQ)
+-{
+-    real quantity = 0;
+-    switch (ir->etc) 
+-    {
+-    case etcNO:
+-        break;
+-    case etcBERENDSEN:
+-        break;
+-    case etcNOSEHOOVER:
+-        quantity = NPT_energy(ir,state,MassQ);                
+-        break;
+-    case etcVRESCALE:
+-        quantity = vrescale_energy(&(ir->opts),state->therm_integral);
+-        break;
+-    default:
+-        break;
+-    }
+-    return quantity;
+-}
+-
+-static void compute_globals(FILE *fplog, gmx_global_stat_t gstat, t_commrec *cr, t_inputrec *ir, 
+-                            t_forcerec *fr, gmx_ekindata_t *ekind, 
+-                            t_state *state, t_state *state_global, t_mdatoms *mdatoms, 
+-                            t_nrnb *nrnb, t_vcm *vcm, gmx_wallcycle_t wcycle,
+-                            gmx_enerdata_t *enerd,tensor force_vir, tensor shake_vir, tensor total_vir, 
+-                            tensor pres, rvec mu_tot, gmx_constr_t constr, 
+-                            globsig_t *gs,gmx_bool bInterSimGS,
+-                            matrix box, gmx_mtop_t *top_global, real *pcurr, 
+-                            int natoms, gmx_bool *bSumEkinhOld, int flags)
+-{
+-    int  i,gsi;
+-    real gs_buf[eglsNR];
+-    tensor corr_vir,corr_pres,shakeall_vir;
+-    gmx_bool bEner,bPres,bTemp, bVV;
+-    gmx_bool bRerunMD, bStopCM, bGStat, bIterate, 
+-        bFirstIterate,bReadEkin,bEkinAveVel,bScaleEkin, bConstrain;
+-    real ekin,temp,prescorr,enercorr,dvdlcorr;
+-    
+-    /* translate CGLO flags to gmx_booleans */
+-    bRerunMD = flags & CGLO_RERUNMD;
+-    bStopCM = flags & CGLO_STOPCM;
+-    bGStat = flags & CGLO_GSTAT;
+-
+-    bReadEkin = (flags & CGLO_READEKIN);
+-    bScaleEkin = (flags & CGLO_SCALEEKIN);
+-    bEner = flags & CGLO_ENERGY;
+-    bTemp = flags & CGLO_TEMPERATURE;
+-    bPres  = (flags & CGLO_PRESSURE);
+-    bConstrain = (flags & CGLO_CONSTRAINT);
+-    bIterate = (flags & CGLO_ITERATE);
+-    bFirstIterate = (flags & CGLO_FIRSTITERATE);
+-
+-    /* we calculate a full state kinetic energy either with full-step velocity verlet
+-       or half step where we need the pressure */
+-    
+-    bEkinAveVel = (ir->eI==eiVV || (ir->eI==eiVVAK && bPres) || bReadEkin);
+-    
+-    /* in initalization, it sums the shake virial in vv, and to 
+-       sums ekinh_old in leapfrog (or if we are calculating ekinh_old) for other reasons */
+-
+-    /* ########## Kinetic energy  ############## */
+-    
+-    if (bTemp) 
+-    {
+-        /* Non-equilibrium MD: this is parallellized, but only does communication
+-         * when there really is NEMD.
+-         */
+-        
+-        if (PAR(cr) && (ekind->bNEMD)) 
+-        {
+-            accumulate_u(cr,&(ir->opts),ekind);
+-        }
+-        debug_gmx();
+-        if (bReadEkin)
+-        {
+-            restore_ekinstate_from_state(cr,ekind,&state_global->ekinstate);
+-        }
+-        else 
+-        {
+-
+-            calc_ke_part(state,&(ir->opts),mdatoms,ekind,nrnb,bEkinAveVel,bIterate);
+-        }
+-        
+-        debug_gmx();
+-        
+-        /* Calculate center of mass velocity if necessary, also parallellized */
+-        if (bStopCM && !bRerunMD && bEner) 
+-        {
+-            calc_vcm_grp(fplog,mdatoms->start,mdatoms->homenr,mdatoms,
+-                         state->x,state->v,vcm);
+-        }
+-    }
+-
+-    if (bTemp || bPres || bEner || bConstrain) 
+-    {
+-        if (!bGStat)
+-        {
+-            /* We will not sum ekinh_old,                                                            
+-             * so signal that we still have to do it.                                                
+-             */
+-            *bSumEkinhOld = TRUE;
+-
+-        }
+-        else
+-        {
+-            if (gs != NULL)
+-            {
+-                for(i=0; i<eglsNR; i++)
+-                {
+-                    gs_buf[i] = gs->sig[i];
+-                }
+-            }
+-            if (PAR(cr)) 
+-            {
+-                wallcycle_start(wcycle,ewcMoveE);
+-                GMX_MPE_LOG(ev_global_stat_start);
+-                global_stat(fplog,gstat,cr,enerd,force_vir,shake_vir,mu_tot,
+-                            ir,ekind,constr,vcm,
+-                            gs != NULL ? eglsNR : 0,gs_buf,
+-                            top_global,state,
+-                            *bSumEkinhOld,flags);
+-                GMX_MPE_LOG(ev_global_stat_finish);
+-                wallcycle_stop(wcycle,ewcMoveE);
+-            }
+-            if (gs != NULL)
+-            {
+-                if (MULTISIM(cr) && bInterSimGS)
+-                {
+-                    if (MASTER(cr))
+-                    {
+-                        /* Communicate the signals between the simulations */
+-                        gmx_sum_sim(eglsNR,gs_buf,cr->ms);
+-                    }
+-                    /* Communicate the signals form the master to the others */
+-                    gmx_bcast(eglsNR*sizeof(gs_buf[0]),gs_buf,cr);
+-                }
+-                for(i=0; i<eglsNR; i++)
+-                {
+-                    if (bInterSimGS || gs_simlocal[i])
+-                    {
+-                        /* Set the communicated signal only when it is non-zero,
+-                         * since signals might not be processed at each MD step.
+-                         */
+-                        gsi = (gs_buf[i] >= 0 ?
+-                               (int)(gs_buf[i] + 0.5) :
+-                               (int)(gs_buf[i] - 0.5));
+-                        if (gsi != 0)
+-                        {
+-                            gs->set[i] = gsi;
+-                        }
+-                        /* Turn off the local signal */
+-                        gs->sig[i] = 0;
+-                    }
+-                }
+-            }
+-            *bSumEkinhOld = FALSE;
+-        }
+-    }
+-    
+-    if (!ekind->bNEMD && debug && bTemp && (vcm->nr > 0))
+-    {
+-        correct_ekin(debug,
+-                     mdatoms->start,mdatoms->start+mdatoms->homenr,
+-                     state->v,vcm->group_p[0],
+-                     mdatoms->massT,mdatoms->tmass,ekind->ekin);
+-    }
+-    
+-    if (bEner) {
+-        /* Do center of mass motion removal */
+-        if (bStopCM && !bRerunMD) /* is this correct?  Does it get called too often with this logic? */
+-        {
+-            check_cm_grp(fplog,vcm,ir,1);
+-            do_stopcm_grp(fplog,mdatoms->start,mdatoms->homenr,mdatoms->cVCM,
+-                          state->x,state->v,vcm);
+-            inc_nrnb(nrnb,eNR_STOPCM,mdatoms->homenr);
+-        }
+-
+-        /* Calculate the amplitude of the cosine velocity profile */
+-        ekind->cosacc.vcos = ekind->cosacc.mvcos/mdatoms->tmass;
+-    }
+-
+-    if (bTemp) 
+-    {
+-        /* Sum the kinetic energies of the groups & calc temp */
+-        /* compute full step kinetic energies if vv, or if vv-avek and we are computing the pressure with IR_NPT_TROTTER */
+-        /* three maincase:  VV with AveVel (md-vv), vv with AveEkin (md-vv-avek), leap with AveEkin (md).  
+-           Leap with AveVel is not supported; it's not clear that it will actually work.  
+-           bEkinAveVel: If TRUE, we simply multiply ekin by ekinscale to get a full step kinetic energy. 
+-           If FALSE, we average ekinh_old and ekinh*ekinscale_nhc to get an averaged half step kinetic energy.
+-           bSaveEkinOld: If TRUE (in the case of iteration = bIterate is TRUE), we don't reset the ekinscale_nhc.  
+-           If FALSE, we go ahead and erase over it.
+-        */ 
+-        enerd->term[F_TEMP] = sum_ekin(&(ir->opts),ekind,&(enerd->term[F_DKDL]),
+-                                       bEkinAveVel,bIterate,bScaleEkin);
+- 
+-        enerd->term[F_EKIN] = trace(ekind->ekin);
+-    }
+-    
+-    /* ##########  Long range energy information ###### */
+-    
+-    if (bEner || bPres || bConstrain) 
+-    {
+-        calc_dispcorr(fplog,ir,fr,0,top_global->natoms,box,state->lambda,
+-                      corr_pres,corr_vir,&prescorr,&enercorr,&dvdlcorr);
+-    }
+-    
+-    if (bEner && bFirstIterate) 
+-    {
+-        enerd->term[F_DISPCORR] = enercorr;
+-        enerd->term[F_EPOT] += enercorr;
+-        enerd->term[F_DVDL] += dvdlcorr;
+-        if (fr->efep != efepNO) {
+-            enerd->dvdl_lin += dvdlcorr;
+-        }
+-    }
+-    
+-    /* ########## Now pressure ############## */
+-    if (bPres || bConstrain) 
+-    {
+-        
+-        m_add(force_vir,shake_vir,total_vir);
+-        
+-        /* Calculate pressure and apply LR correction if PPPM is used.
+-         * Use the box from last timestep since we already called update().
+-         */
+-        
+-        enerd->term[F_PRES] = calc_pres(fr->ePBC,ir->nwall,box,ekind->ekin,total_vir,pres,
+-                                        (fr->eeltype==eelPPPM)?enerd->term[F_COUL_RECIP]:0.0);
+-        
+-        /* Calculate long range corrections to pressure and energy */
+-        /* this adds to enerd->term[F_PRES] and enerd->term[F_ETOT], 
+-           and computes enerd->term[F_DISPCORR].  Also modifies the 
+-           total_vir and pres tesors */
+-        
+-        m_add(total_vir,corr_vir,total_vir);
+-        m_add(pres,corr_pres,pres);
+-        enerd->term[F_PDISPCORR] = prescorr;
+-        enerd->term[F_PRES] += prescorr;
+-        *pcurr = enerd->term[F_PRES];
+-        /* calculate temperature using virial */
+-        enerd->term[F_VTEMP] = calc_temp(trace(total_vir),ir->opts.nrdf[0]);
+-        
+-    }    
+-}
+-
+-
+-/* Definitions for convergence of iterated constraints */
+-
+-/* iterate constraints up to 50 times  */
+-#define MAXITERCONST       50
+-
+-/* data type */
+-typedef struct
+-{
+-    real f,fprev,x,xprev;  
+-    int iter_i;
+-    gmx_bool bIterate;
+-    real allrelerr[MAXITERCONST+2];
+-    int num_close; /* number of "close" violations, caused by limited precision. */
+-} gmx_iterate_t;
+-  
+-#ifdef GMX_DOUBLE
+-#define CONVERGEITER  0.000000001
+-#define CLOSE_ENOUGH  0.000001000
+-#else
+-#define CONVERGEITER  0.0001
+-#define CLOSE_ENOUGH  0.0050
+-#endif
+-
+-/* we want to keep track of the close calls.  If there are too many, there might be some other issues.
+-   so we make sure that it's either less than some predetermined number, or if more than that number,
+-   only some small fraction of the total. */
+-#define MAX_NUMBER_CLOSE        50
+-#define FRACTION_CLOSE       0.001
+-  
+-/* maximum length of cyclic traps to check, emerging from limited numerical precision  */
+-#define CYCLEMAX            20
+-
+-static void gmx_iterate_init(gmx_iterate_t *iterate,gmx_bool bIterate)
+-{
+-    int i;
+-
+-    iterate->iter_i = 0;
+-    iterate->bIterate = bIterate;
+-    iterate->num_close = 0;
+-    for (i=0;i<MAXITERCONST+2;i++) 
+-    {
+-        iterate->allrelerr[i] = 0;
+-    }
+-}
+-
+-static gmx_bool done_iterating(const t_commrec *cr,FILE *fplog, int nsteps, gmx_iterate_t *iterate, gmx_bool bFirstIterate, real fom, real *newf) 
+-{    
+-    /* monitor convergence, and use a secant search to propose new
+-       values.  
+-                                                                  x_{i} - x_{i-1}
+-       The secant method computes x_{i+1} = x_{i} - f(x_{i}) * ---------------------
+-                                                                f(x_{i}) - f(x_{i-1})
+-       
+-       The function we are trying to zero is fom-x, where fom is the
+-       "figure of merit" which is the pressure (or the veta value) we
+-       would get by putting in an old value of the pressure or veta into
+-       the incrementor function for the step or half step.  I have
+-       verified that this gives the same answer as self consistent
+-       iteration, usually in many fewer steps, especially for small tau_p.
+-       
+-       We could possibly eliminate an iteration with proper use
+-       of the value from the previous step, but that would take a bit
+-       more bookkeeping, especially for veta, since tests indicate the
+-       function of veta on the last step is not sufficiently close to
+-       guarantee convergence this step. This is
+-       good enough for now.  On my tests, I could use tau_p down to
+-       0.02, which is smaller that would ever be necessary in
+-       practice. Generally, 3-5 iterations will be sufficient */
+-
+-    real relerr,err,xmin;
+-    char buf[256];
+-    int i;
+-    gmx_bool incycle;
+-    
+-    if (bFirstIterate) 
+-    {
+-        iterate->x = fom;
+-        iterate->f = fom-iterate->x;
+-        iterate->xprev = 0;
+-        iterate->fprev = 0;
+-        *newf = fom;
+-    } 
+-    else 
+-    {
+-        iterate->f = fom-iterate->x; /* we want to zero this difference */
+-        if ((iterate->iter_i > 1) && (iterate->iter_i < MAXITERCONST)) 
+-        {
+-            if (iterate->f==iterate->fprev) 
+-            {
+-                *newf = iterate->f;
+-            } 
+-            else 
+-            {
+-                *newf = iterate->x - (iterate->x-iterate->xprev)*(iterate->f)/(iterate->f-iterate->fprev); 
+-            }
+-        } 
+-        else 
+-        {
+-            /* just use self-consistent iteration the first step to initialize, or 
+-               if it's not converging (which happens occasionally -- need to investigate why) */
+-            *newf = fom; 
+-        }
+-    }
+-    /* Consider a slight shortcut allowing us to exit one sooner -- we check the
+-       difference between the closest of x and xprev to the new
+-       value. To be 100% certain, we should check the difference between
+-       the last result, and the previous result, or
+-       
+-       relerr = (fabs((x-xprev)/fom));
+-       
+-       but this is pretty much never necessary under typical conditions.
+-       Checking numerically, it seems to lead to almost exactly the same
+-       trajectories, but there are small differences out a few decimal
+-       places in the pressure, and eventually in the v_eta, but it could
+-       save an interation.
+-       
+-       if (fabs(*newf-x) < fabs(*newf - xprev)) { xmin = x;} else { xmin = xprev;}
+-       relerr = (fabs((*newf-xmin) / *newf));
+-    */
+-    
+-    err = fabs((iterate->f-iterate->fprev));
+-    relerr = fabs(err/fom);
+-
+-    iterate->allrelerr[iterate->iter_i] = relerr;
+-    
+-    if (iterate->iter_i > 0) 
+-    {
+-        if (debug) 
+-        {
+-            fprintf(debug,"Iterating NPT constraints: %6i %20.12f%14.6g%20.12f\n",
+-                    iterate->iter_i,fom,relerr,*newf);
+-        }
+-        
+-        if ((relerr < CONVERGEITER) || (err < CONVERGEITER) || (fom==0) || ((iterate->x == iterate->xprev) && iterate->iter_i > 1))
+-        {
+-            iterate->bIterate = FALSE;
+-            if (debug) 
+-            {
+-                fprintf(debug,"Iterating NPT constraints: CONVERGED\n");
+-            }
+-            return TRUE;
+-        }
+-        if (iterate->iter_i > MAXITERCONST)
+-        {
+-            if (relerr < CLOSE_ENOUGH)
+-            {
+-                incycle = FALSE;
+-                for (i=1;i<CYCLEMAX;i++) {
+-                    if ((iterate->allrelerr[iterate->iter_i-(1+i)] == iterate->allrelerr[iterate->iter_i-1]) &&
+-                        (iterate->allrelerr[iterate->iter_i-(1+i)] == iterate->allrelerr[iterate->iter_i-(1+2*i)])) {
+-                        incycle = TRUE;
+-                        if (debug) 
+-                        {
+-                            fprintf(debug,"Exiting from an NPT iterating cycle of length %d\n",i);
+-                        }
+-                        break;
+-                    }
+-                }
+-                
+-                if (incycle) {
+-                    /* step 1: trapped in a numerical attractor */
+-                    /* we are trapped in a numerical attractor, and can't converge any more, and are close to the final result.
+-                       Better to give up convergence here than have the simulation die.
+-                    */
+-                    iterate->num_close++;
+-                    return TRUE;
+-                } 
+-                else 
+-                {
+-                    /* Step #2: test if we are reasonably close for other reasons, then monitor the number.  If not, die */
+-                    
+-                    /* how many close calls have we had?  If less than a few, we're OK */
+-                    if (iterate->num_close < MAX_NUMBER_CLOSE) 
+-                    {
+-                        sprintf(buf,"Slight numerical convergence deviation with NPT at step %d, relative error only %10.5g, likely not a problem, continuing\n",nsteps,relerr);
+-                        md_print_warning(cr,fplog,buf);
+-                        iterate->num_close++;
+-                        return TRUE;
+-                        /* if more than a few, check the total fraction.  If too high, die. */
+-                    } else if (iterate->num_close/(double)nsteps > FRACTION_CLOSE) {
+-                        gmx_fatal(FARGS,"Could not converge NPT constraints, too many exceptions (%d%%\n",iterate->num_close/(double)nsteps);
+-                    } 
+-                }
+-            }
+-            else 
+-            {
+-                gmx_fatal(FARGS,"Could not converge NPT constraints\n");
+-            }
+-        }
+-    }
+-    
+-    iterate->xprev = iterate->x;
+-    iterate->x = *newf;
+-    iterate->fprev = iterate->f;
+-    iterate->iter_i++;
+-    
+-    return FALSE;
+-}
+-
+-static void check_nst_param(FILE *fplog,t_commrec *cr,
+-                            const char *desc_nst,int nst,
+-                            const char *desc_p,int *p)
+-{
+-    char buf[STRLEN];
+-
+-    if (*p > 0 && *p % nst != 0)
+-    {
+-        /* Round up to the next multiple of nst */
+-        *p = ((*p)/nst + 1)*nst;
+-        sprintf(buf,"NOTE: %s changes %s to %d\n",desc_nst,desc_p,*p);
+-        md_print_warning(cr,fplog,buf);
+-    }
+-}
+-
+-static void reset_all_counters(FILE *fplog,t_commrec *cr,
+-                               gmx_large_int_t step,
+-                               gmx_large_int_t *step_rel,t_inputrec *ir,
+-                               gmx_wallcycle_t wcycle,t_nrnb *nrnb,
+-                               gmx_runtime_t *runtime)
+-{
+-    char buf[STRLEN],sbuf[STEPSTRSIZE];
+-
+-    /* Reset all the counters related to performance over the run */
+-    sprintf(buf,"Step %s: resetting all time and cycle counters\n",
+-            gmx_step_str(step,sbuf));
+-    md_print_warning(cr,fplog,buf);
+-
+-    wallcycle_stop(wcycle,ewcRUN);
+-    wallcycle_reset_all(wcycle);
+-    if (DOMAINDECOMP(cr))
+-    {
+-        reset_dd_statistics_counters(cr->dd);
+-    }
+-    init_nrnb(nrnb);
+-    ir->init_step += *step_rel;
+-    ir->nsteps    -= *step_rel;
+-    *step_rel = 0;
+-    wallcycle_start(wcycle,ewcRUN);
+-    runtime_start(runtime);
+-    print_date_and_time(fplog,cr->nodeid,"Restarted time",runtime);
+-}
+-
+-static void min_zero(int *n,int i)
+-{
+-    if (i > 0 && (*n == 0 || i < *n))
+-    {
+-        *n = i;
+-    }
+-}
+-
+-static int lcd4(int i1,int i2,int i3,int i4)
+-{
+-    int nst;
+-
+-    nst = 0;
+-    min_zero(&nst,i1);
+-    min_zero(&nst,i2);
+-    min_zero(&nst,i3);
+-    min_zero(&nst,i4);
+-    if (nst == 0)
+-    {
+-        gmx_incons("All 4 inputs for determininig nstglobalcomm are <= 0");
+-    }
+-    
+-    while (nst > 1 && ((i1 > 0 && i1 % nst != 0)  ||
+-                       (i2 > 0 && i2 % nst != 0)  ||
+-                       (i3 > 0 && i3 % nst != 0)  ||
+-                       (i4 > 0 && i4 % nst != 0)))
+-    {
+-        nst--;
+-    }
+-
+-    return nst;
+-}
+-
+-static int check_nstglobalcomm(FILE *fplog,t_commrec *cr,
+-                               int nstglobalcomm,t_inputrec *ir)
+-{
+-    char buf[STRLEN];
+-
+-    if (!EI_DYNAMICS(ir->eI))
+-    {
+-        nstglobalcomm = 1;
+-    }
+-
+-    if (nstglobalcomm == -1)
+-    {
+-        if (!(ir->nstcalcenergy > 0 ||
+-              ir->nstlist > 0 ||
+-              ir->etc != etcNO ||
+-              ir->epc != epcNO))
+-        {
+-            nstglobalcomm = 10;
+-            if (ir->nstenergy > 0 && ir->nstenergy < nstglobalcomm)
+-            {
+-                nstglobalcomm = ir->nstenergy;
+-            }
+-        }
+-        else
+-        {
+-            /* Ensure that we do timely global communication for
+-             * (possibly) each of the four following options.
+-             */
+-            nstglobalcomm = lcd4(ir->nstcalcenergy,
+-                                 ir->nstlist,
+-                                 ir->etc != etcNO ? ir->nsttcouple : 0,
+-                                 ir->epc != epcNO ? ir->nstpcouple : 0);
+-        }
+-    }
+-    else
+-    {
+-        if (ir->nstlist > 0 &&
+-            nstglobalcomm > ir->nstlist && nstglobalcomm % ir->nstlist != 0)
+-        {
+-            nstglobalcomm = (nstglobalcomm / ir->nstlist)*ir->nstlist;
+-            sprintf(buf,"WARNING: nstglobalcomm is larger than nstlist, but not a multiple, setting it to %d\n",nstglobalcomm);
+-            md_print_warning(cr,fplog,buf);
+-        }
+-        if (ir->nstcalcenergy > 0)
+-        {
+-            check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
+-                            "nstcalcenergy",&ir->nstcalcenergy);
+-        }
+-        if (ir->etc != etcNO && ir->nsttcouple > 0)
+-        {
+-            check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
+-                            "nsttcouple",&ir->nsttcouple);
+-        }
+-        if (ir->epc != epcNO && ir->nstpcouple > 0)
+-        {
+-            check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
+-                            "nstpcouple",&ir->nstpcouple);
+-        }
+-
+-        check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
+-                        "nstenergy",&ir->nstenergy);
+-
+-        check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
+-                        "nstlog",&ir->nstlog);
+-    }
+-
+-    if (ir->comm_mode != ecmNO && ir->nstcomm < nstglobalcomm)
+-    {
+-        sprintf(buf,"WARNING: Changing nstcomm from %d to %d\n",
+-                ir->nstcomm,nstglobalcomm);
+-        md_print_warning(cr,fplog,buf);
+-        ir->nstcomm = nstglobalcomm;
+-    }
+-
+-    return nstglobalcomm;
+-}
+-
+-void check_ir_old_tpx_versions(t_commrec *cr,FILE *fplog,
+-                               t_inputrec *ir,gmx_mtop_t *mtop)
+-{
+-    /* Check required for old tpx files */
+-    if (IR_TWINRANGE(*ir) && ir->nstlist > 1 &&
+-        ir->nstcalcenergy % ir->nstlist != 0)
+-    {
+-        md_print_warning(cr,fplog,"Old tpr file with twin-range settings: modifying energy calculation and/or T/P-coupling frequencies");
+-
+-        if (gmx_mtop_ftype_count(mtop,F_CONSTR) +
+-            gmx_mtop_ftype_count(mtop,F_CONSTRNC) > 0 &&
+-            ir->eConstrAlg == econtSHAKE)
+-        {
+-            md_print_warning(cr,fplog,"With twin-range cut-off's and SHAKE the virial and pressure are incorrect");
+-            if (ir->epc != epcNO)
+-            {
+-                gmx_fatal(FARGS,"Can not do pressure coupling with twin-range cut-off's and SHAKE");
+-            }
+-        }
+-        check_nst_param(fplog,cr,"nstlist",ir->nstlist,
+-                        "nstcalcenergy",&ir->nstcalcenergy);
+-        if (ir->epc != epcNO)
+-        {
+-            check_nst_param(fplog,cr,"nstlist",ir->nstlist,
+-                            "nstpcouple",&ir->nstpcouple);
+-        }
+-        check_nst_param(fplog,cr,"nstcalcenergy",ir->nstcalcenergy,
+-                        "nstenergy",&ir->nstenergy);
+-        check_nst_param(fplog,cr,"nstcalcenergy",ir->nstcalcenergy,
+-                        "nstlog",&ir->nstlog);
+-        if (ir->efep != efepNO)
+-        {
+-            check_nst_param(fplog,cr,"nstcalcenergy",ir->nstcalcenergy,
+-                            "nstdhdl",&ir->nstdhdl);
+-        }
+-    }
+-}
+-
+-typedef struct {
+-    gmx_bool       bGStatEveryStep;
+-    gmx_large_int_t step_ns;
+-    gmx_large_int_t step_nscheck;
+-    gmx_large_int_t nns;
+-    matrix     scale_tot;
+-    int        nabnsb;
+-    double     s1;
+-    double     s2;
+-    double     ab;
+-    double     lt_runav;
+-    double     lt_runav2;
+-} gmx_nlheur_t;
+-
+-static void reset_nlistheuristics(gmx_nlheur_t *nlh,gmx_large_int_t step)
+-{
+-    nlh->lt_runav  = 0;
+-    nlh->lt_runav2 = 0;
+-    nlh->step_nscheck = step;
+-}
+-
+-static void init_nlistheuristics(gmx_nlheur_t *nlh,
+-                                 gmx_bool bGStatEveryStep,gmx_large_int_t step)
+-{
+-    nlh->bGStatEveryStep = bGStatEveryStep;
+-    nlh->nns       = 0;
+-    nlh->nabnsb    = 0;
+-    nlh->s1        = 0;
+-    nlh->s2        = 0;
+-    nlh->ab        = 0;
+-
+-    reset_nlistheuristics(nlh,step);
+-}
+-
+-static void update_nliststatistics(gmx_nlheur_t *nlh,gmx_large_int_t step)
+-{
+-    gmx_large_int_t nl_lt;
+-    char sbuf[STEPSTRSIZE],sbuf2[STEPSTRSIZE];
+-
+-    /* Determine the neighbor list life time */
+-    nl_lt = step - nlh->step_ns;
+-    if (debug)
+-    {
+-        fprintf(debug,"%d atoms beyond ns buffer, updating neighbor list after %s steps\n",nlh->nabnsb,gmx_step_str(nl_lt,sbuf));
+-    }
+-    nlh->nns++;
+-    nlh->s1 += nl_lt;
+-    nlh->s2 += nl_lt*nl_lt;
+-    nlh->ab += nlh->nabnsb;
+-    if (nlh->lt_runav == 0)
+-    {
+-        nlh->lt_runav  = nl_lt;
+-        /* Initialize the fluctuation average
+-         * such that at startup we check after 0 steps.
+-         */
+-        nlh->lt_runav2 = sqr(nl_lt/2.0);
+-    }
+-    /* Running average with 0.9 gives an exp. history of 9.5 */
+-    nlh->lt_runav2 = 0.9*nlh->lt_runav2 + 0.1*sqr(nlh->lt_runav - nl_lt);
+-    nlh->lt_runav  = 0.9*nlh->lt_runav  + 0.1*nl_lt;
+-    if (nlh->bGStatEveryStep)
+-    {
+-        /* Always check the nlist validity */
+-        nlh->step_nscheck = step;
+-    }
+-    else
+-    {
+-        /* We check after:  <life time> - 2*sigma
+-         * The factor 2 is quite conservative,
+-         * but we assume that with nstlist=-1 the user
+-         * prefers exact integration over performance.
+-         */
+-        nlh->step_nscheck = step
+-                  + (int)(nlh->lt_runav - 2.0*sqrt(nlh->lt_runav2)) - 1;
+-    }
+-    if (debug)
+-    {
+-        fprintf(debug,"nlist life time %s run av. %4.1f sig %3.1f check %s check with -gcom %d\n",
+-                gmx_step_str(nl_lt,sbuf),nlh->lt_runav,sqrt(nlh->lt_runav2),
+-                gmx_step_str(nlh->step_nscheck-step+1,sbuf2),
+-                (int)(nlh->lt_runav - 2.0*sqrt(nlh->lt_runav2)));
+-    }
+-}
+-
+-static void set_nlistheuristics(gmx_nlheur_t *nlh,gmx_bool bReset,gmx_large_int_t step)
+-{
+-    int d;
+-
+-    if (bReset)
+-    {
+-        reset_nlistheuristics(nlh,step);
+-    }
+-    else
+-    {
+-        update_nliststatistics(nlh,step);
+-    }
+-
+-    nlh->step_ns = step;
+-    /* Initialize the cumulative coordinate scaling matrix */
+-    clear_mat(nlh->scale_tot);
+-    for(d=0; d<DIM; d++)
+-    {
+-        nlh->scale_tot[d][d] = 1.0;
+-    }
+-}
+-
+-static void rerun_parallel_comm(t_commrec *cr,t_trxframe *fr,
+-                                gmx_bool *bNotLastFrame)
+-{
+-    gmx_bool bAlloc;
+-    rvec *xp,*vp;
+-
+-    bAlloc = (fr->natoms == 0);
+-
+-    if (MASTER(cr) && !*bNotLastFrame)
+-    {
+-        fr->natoms = -1;
+-    }
+-    xp = fr->x;
+-    vp = fr->v;
+-    gmx_bcast(sizeof(*fr),fr,cr);
+-    fr->x = xp;
+-    fr->v = vp;
+-
+-    *bNotLastFrame = (fr->natoms >= 0);
+-
+-    if (*bNotLastFrame && PARTDECOMP(cr))
+-    {
+-        /* x and v are the only variable size quantities stored in trr
+-         * that are required for rerun (f is not needed).
+-         */
+-        if (bAlloc)
+-        {
+-            snew(fr->x,fr->natoms);
+-            snew(fr->v,fr->natoms);
+-        }
+-        if (fr->bX)
+-        {
+-            gmx_bcast(fr->natoms*sizeof(fr->x[0]),fr->x[0],cr);
+-        }
+-        if (fr->bV)
+-        {
+-            gmx_bcast(fr->natoms*sizeof(fr->v[0]),fr->v[0],cr);
+-        }
+-    }
+-}
+-
+ double do_md(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
+              const output_env_t oenv, gmx_bool bVerbose,gmx_bool bCompact,
+              int nstglobalcomm,
+diff --git a/src/kernel/md_openmm.c b/src/kernel/md_openmm.c
+index 908fd03..bbc9d1d 100644
+--- a/src/kernel/md_openmm.c
++++ b/src/kernel/md_openmm.c
+@@ -98,105 +98,6 @@
+ /* include even when OpenMM not used to force compilation of do_md_openmm */
+ #include "openmm_wrapper.h"
+ 
+-/* simulation conditions to transmit */
+-enum { eglsNABNSB, eglsCHKPT, eglsSTOPCOND, eglsRESETCOUNTERS, eglsNR };
+-
+-typedef struct
+-{
+-    int nstms;       /* The frequency for intersimulation communication */
+-    int sig[eglsNR]; /* The signal set by one process in do_md */
+-    int set[eglsNR]; /* The communicated signal, equal for all processes */
+-} globsig_t;
+-
+-
+-static int multisim_min(const gmx_multisim_t *ms,int nmin,int n)
+-{
+-    int  *buf;
+-    gmx_bool bPos,bEqual;
+-    int  s,d;
+-
+-    snew(buf,ms->nsim);
+-    buf[ms->sim] = n;
+-    gmx_sumi_sim(ms->nsim,buf,ms);
+-    bPos   = TRUE;
+-    bEqual = TRUE;
+-    for (s=0; s<ms->nsim; s++)
+-    {
+-        bPos   = bPos   && (buf[s] > 0);
+-        bEqual = bEqual && (buf[s] == buf[0]);
+-    }
+-    if (bPos)
+-    {
+-        if (bEqual)
+-        {
+-            nmin = min(nmin,buf[0]);
+-        }
+-        else
+-        {
+-            /* Find the least common multiple */
+-            for (d=2; d<nmin; d++)
+-            {
+-                s = 0;
+-                while (s < ms->nsim && d % buf[s] == 0)
+-                {
+-                    s++;
+-                }
+-                if (s == ms->nsim)
+-                {
+-                    /* We found the LCM and it is less than nmin */
+-                    nmin = d;
+-                    break;
+-                }
+-            }
+-        }
+-    }
+-    sfree(buf);
+-
+-    return nmin;
+-}
+-
+-static int multisim_nstsimsync(const t_commrec *cr,
+-                               const t_inputrec *ir,int repl_ex_nst)
+-{
+-    int nmin;
+-
+-    if (MASTER(cr))
+-    {
+-        nmin = INT_MAX;
+-        nmin = multisim_min(cr->ms,nmin,ir->nstlist);
+-        nmin = multisim_min(cr->ms,nmin,ir->nstcalcenergy);
+-        nmin = multisim_min(cr->ms,nmin,repl_ex_nst);
+-        if (nmin == INT_MAX)
+-        {
+-            gmx_fatal(FARGS,"Can not find an appropriate interval for inter-simulation communication, since nstlist, nstcalcenergy and -replex are all <= 0");
+-        }
+-        /* Avoid inter-simulation communication at every (second) step */
+-        if (nmin <= 2)
+-        {
+-            nmin = 10;
+-        }
+-    }
+-
+-    gmx_bcast(sizeof(int),&nmin,cr);
+-
+-    return nmin;
+-}
+-
+-static void init_global_signals(globsig_t *gs,const t_commrec *cr,
+-                                const t_inputrec *ir,int repl_ex_nst)
+-{
+-    int i;
+-
+-    gs->nstms = 1;
+-
+-    for (i=0; i<eglsNR; i++)
+-    {
+-        gs->sig[i] = 0;
+-        gs->set[i] = 0;
+-    }
+-}
+-
+-
+ double do_md_openmm(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
+                     const output_env_t oenv, gmx_bool bVerbose,gmx_bool bCompact,
+                     int nstglobalcomm,
+diff --git a/src/kernel/mdrun.c b/src/kernel/mdrun.c
+index 6379a6d..8878331 100644
+--- a/src/kernel/mdrun.c
++++ b/src/kernel/mdrun.c
+@@ -189,7 +189,7 @@ int main(int argc,char *argv[])
+     "(the simulation will run correctly also when this is not the case).",
+     "[PAR]",
+     "This section lists all options that affect the domain decomposition.",
+-    "[BR]",
++    "[PAR]",
+     "Option [TT]-rdd[tt] can be used to set the required maximum distance",
+     "for inter charge-group bonded interactions.",
+     "Communication for two-body bonded interactions below the non-bonded",
+@@ -202,13 +202,13 @@ int main(int argc,char *argv[])
+     "By default [TT]-rdd[tt] is determined by [TT]mdrun[tt] based on",
+     "the initial coordinates. The chosen value will be a balance",
+     "between interaction range and communication cost.",
+-    "[BR]",
++    "[PAR]",
+     "When inter charge-group bonded interactions are beyond",
+     "the bonded cut-off distance, [TT]mdrun[tt] terminates with an error message.",
+     "For pair interactions and tabulated bonds",
+     "that do not generate exclusions, this check can be turned off",
+     "with the option [TT]-noddcheck[tt].",
+-    "[BR]",
++    "[PAR]",
+     "When constraints are present, option [TT]-rcon[tt] influences",
+     "the cell size limit as well.",
+     "Atoms connected by NC constraints, where NC is the LINCS order plus 1,",
+@@ -218,7 +218,7 @@ int main(int argc,char *argv[])
+     "By default [TT]mdrun[tt] estimates the minimum cell size required for P-LINCS",
+     "in a conservative fashion. For high parallelization it can be useful",
+     "to set the distance required for P-LINCS with the option [TT]-rcon[tt].",
+-    "[BR]",
++    "[PAR]",
+     "The [TT]-dds[tt] option sets the minimum allowed x, y and/or z scaling",
+     "of the cells with dynamic load balancing. [TT]mdrun[tt] will ensure that",
+     "the cells can scale down by at least this factor. This option is used",
+@@ -248,17 +248,17 @@ int main(int argc,char *argv[])
+     "When user-defined potential functions have been selected in the",
+     "[TT].mdp[tt] file the [TT]-table[tt] option is used to pass [TT]mdrun[tt]",
+     "a formatted table with potential functions. The file is read from",
+-    "either the current directory or from the GMXLIB directory.",
+-    "A number of pre-formatted tables are presented in the GMXLIB dir,",
+-    "for 6-8, 6-9, 6-10, 6-11, 6-12 Lennard Jones potentials with",
++    "either the current directory or from the [TT]GMXLIB[tt] directory.",
++    "A number of pre-formatted tables are presented in the [TT]GMXLIB[tt] dir,",
++    "for 6-8, 6-9, 6-10, 6-11, 6-12 Lennard-Jones potentials with",
+     "normal Coulomb.",
+-    "When pair interactions are present a separate table for pair interaction",
++    "When pair interactions are present, a separate table for pair interaction",
+     "functions is read using the [TT]-tablep[tt] option.[PAR]",
+     "When tabulated bonded functions are present in the topology,",
+     "interaction functions are read using the [TT]-tableb[tt] option.",
+     "For each different tabulated interaction type the table file name is",
+     "modified in a different way: before the file extension an underscore is",
+-    "appended, then a b for bonds, an a for angles or a d for dihedrals",
++    "appended, then a 'b' for bonds, an 'a' for angles or a 'd' for dihedrals",
+     "and finally the table number of the interaction type.[PAR]",
+     "The options [TT]-px[tt] and [TT]-pf[tt] are used for writing pull COM",
+     "coordinates and forces when pulling is selected",
+@@ -287,7 +287,7 @@ int main(int argc,char *argv[])
+     "is performed after every exchange.[PAR]",
+     "Finally some experimental algorithms can be tested when the",
+     "appropriate options have been given. Currently under",
+-    "investigation are: polarizability, and X-Ray bombardments.",
++    "investigation are: polarizability and X-ray bombardments.",
+     "[PAR]",
+     "The option [TT]-pforce[tt] is useful when you suspect a simulation",
+     "crashes due to too large forces. With this option coordinates and",
+@@ -309,11 +309,11 @@ int main(int argc,char *argv[])
+     "will be appending to the existing output files. The checkpoint file",
+     "contains checksums of all output files, such that you will never",
+     "loose data when some output files are modified, corrupt or removed.",
+-    "There are three scenarios with [TT]-cpi[tt]:[BR]",
+-    "* no files with matching names are present: new output files are written[BR]",
+-    "* all files are present with names and checksums matching those stored",
+-    "in the checkpoint file: files are appended[BR]",
+-    "* otherwise no files are modified and a fatal error is generated[BR]",
++    "There are three scenarios with [TT]-cpi[tt]:[PAR]",
++    "[TT]*[tt] no files with matching names are present: new output files are written[PAR]",
++    "[TT]*[tt] all files are present with names and checksums matching those stored",
++    "in the checkpoint file: files are appended[PAR]",
++    "[TT]*[tt] otherwise no files are modified and a fatal error is generated[PAR]",
+     "With [TT]-noappend[tt] new output files are opened and the simulation",
+     "part number is added to all output file names.",
+     "Note that in all cases the checkpoint file itself is not renamed",
+diff --git a/src/kernel/pdb2gmx.c b/src/kernel/pdb2gmx.c
+index 0489572..269bcb7 100644
+--- a/src/kernel/pdb2gmx.c
++++ b/src/kernel/pdb2gmx.c
+@@ -948,13 +948,13 @@ int main(int argc, char *argv[])
+   const char *desc[] = {
+     "This program reads a [TT].pdb[tt] (or [TT].gro[tt]) file, reads",
+     "some database files, adds hydrogens to the molecules and generates",
+-    "coordinates in Gromacs (Gromos), or optionally [TT].pdb[tt], format",
+-    "and a topology in Gromacs format.",
++    "coordinates in GROMACS (GROMOS), or optionally [TT].pdb[tt], format",
++    "and a topology in GROMACS format.",
+     "These files can subsequently be processed to generate a run input file.",
+     "[PAR]",
+     "[TT]pdb2gmx[tt] will search for force fields by looking for",
+     "a [TT]forcefield.itp[tt] file in subdirectories [TT]<forcefield>.ff[tt]",
+-    "of the current working directory and of the Gromacs library directory",
++    "of the current working directory and of the GROMACS library directory",
+     "as inferred from the path of the binary or the [TT]GMXLIB[tt] environment",
+     "variable.",
+     "By default the forcefield selection is interactive,",
+@@ -965,12 +965,12 @@ int main(int argc, char *argv[])
+     "After choosing a force field, all files will be read only from",
+     "the corresponding force field directory.",
+     "If you want to modify or add a residue types, you can copy the force",
+-    "field directory from the Gromacs library directory to your current",
++    "field directory from the GROMACS library directory to your current",
+     "working directory. If you want to add new protein residue types,",
+     "you will need to modify [TT]residuetypes.dat[tt] in the library directory",
+     "or copy the whole library directory to a local directory and set",
+     "the environment variable [TT]GMXLIB[tt] to the name of that directory.",
+-    "Check chapter 5 of the manual for more information about file formats.",
++    "Check Chapter 5 of the manual for more information about file formats.",
+     "[PAR]",
+     
+     "Note that a [TT].pdb[tt] file is nothing more than a file format, and it",
+@@ -981,24 +981,29 @@ int main(int argc, char *argv[])
+     "The program has limited intelligence, it reads a number of database",
+     "files, that allow it to make special bonds (Cys-Cys, Heme-His, etc.),",
+     "if necessary this can be done manually. The program can prompt the",
+-    "user to select which kind of LYS, ASP, GLU, CYS or HIS residue she",
+-    "wants. For LYS the choice is between neutral (two protons on NZ) or",
+-    "protonated (three protons, default), for ASP and GLU unprotonated",
+-    "(default) or protonated, for HIS the proton can be either on ND1,",
++    "user to select which kind of LYS, ASP, GLU, CYS or HIS residue is",
++    "desired. For Lys the choice is between neutral (two protons on NZ) or",
++    "protonated (three protons, default), for Asp and Glu unprotonated",
++    "(default) or protonated, for His the proton can be either on ND1,",
+     "on NE2 or on both. By default these selections are done automatically.",
+     "For His, this is based on an optimal hydrogen bonding",
+     "conformation. Hydrogen bonds are defined based on a simple geometric",
+     "criterion, specified by the maximum hydrogen-donor-acceptor angle",
+     "and donor-acceptor distance, which are set by [TT]-angle[tt] and",
+     "[TT]-dist[tt] respectively.[PAR]",
+-      
++     
++    "The protonation state of N- and C-termini can be chosen interactively",
++    "with the [TT]-ter[tt] flag.  Default termini are ionized (NH3+ and COO-),",
++    "respectively.  Some force fields support zwitterionic forms for chains of",
++    "one residue, but for polypeptides these options should NOT be selected.[PAR]",
++ 
+     "The separation of chains is not entirely trivial since the markup",
+     "in user-generated PDB files frequently varies and sometimes it",
+     "is desirable to merge entries across a TER record, for instance",
+     "if you want a disulfide bridge or distance restraints between",
+     "two protein chains or if you have a HEME group bound to a protein.",
+     "In such cases multiple chains should be contained in a single",
+-    "[TT]molecule_type[tt] definition.",
++    "[TT]moleculetype[tt] definition.",
+     "To handle this, [TT]pdb2gmx[tt] has an option [TT]-chainsep[tt] so you can",
+     "choose whether a new chain should start when we find a TER record,",
+     "when the chain id changes, combinations of either or both of these",
+@@ -1007,14 +1012,14 @@ int main(int argc, char *argv[])
+     "[TT]pdb2gmx[tt] will also check the occupancy field of the [TT].pdb[tt] file.",
+     "If any of the occupancies are not one, indicating that the atom is",
+     "not resolved well in the structure, a warning message is issued.",
+-    "When a [TT].pdb[tt] file does not originate from an X-Ray structure determination",
++    "When a [TT].pdb[tt] file does not originate from an X-ray structure determination",
+     "all occupancy fields may be zero. Either way, it is up to the user",
+     "to verify the correctness of the input data (read the article!).[PAR]", 
+     
+-    "During processing the atoms will be reordered according to Gromacs",
++    "During processing the atoms will be reordered according to GROMACS",
+     "conventions. With [TT]-n[tt] an index file can be generated that",
+     "contains one group reordered in the same way. This allows you to",
+-    "convert a Gromos trajectory and coordinate file to Gromos. There is",
++    "convert a GROMOS trajectory and coordinate file to GROMOS. There is",
+     "one limitation: reordering is done after the hydrogens are stripped",
+     "from the input and before new hydrogens are added. This means that",
+     "you should not use [TT]-ignh[tt].[PAR]",
+@@ -1030,7 +1035,7 @@ int main(int argc, char *argv[])
+     "position relative to neighboring atoms. Additionally, all atoms in the",
+     "aromatic rings of the standard amino acids (i.e. PHE, TRP, TYR and HIS)",
+     "can be converted into virtual sites, eliminating the fast improper dihedral",
+-    "fluctuations in these rings. Note that in this case all other hydrogen",
++    "fluctuations in these rings. [BB]Note[bb] that in this case all other hydrogen",
+     "atoms are also converted to virtual sites. The mass of all atoms that are",
+     "converted into virtual sites, is added to the heavy atoms.[PAR]",
+     "Also slowing down of dihedral motion can be done with [TT]-heavyh[tt]",
+@@ -1157,24 +1162,24 @@ int main(int argc, char *argv[])
+     { "-ter",    FALSE, etBOOL, {&bTerMan}, 
+       "Interactive termini selection, iso charged" },
+     { "-lys",    FALSE, etBOOL, {&bLysMan}, 
+-      "Interactive Lysine selection, iso charged" },
++      "Interactive lysine selection, iso charged" },
+     { "-arg",    FALSE, etBOOL, {&bArgMan}, 
+-      "Interactive Arganine selection, iso charged" },
++      "Interactive arginine selection, iso charged" },
+     { "-asp",    FALSE, etBOOL, {&bAspMan}, 
+-      "Interactive Aspartic Acid selection, iso charged" },
++      "Interactive aspartic Acid selection, iso charged" },
+     { "-glu",    FALSE, etBOOL, {&bGluMan}, 
+-      "Interactive Glutamic Acid selection, iso charged" },
++      "Interactive glutamic Acid selection, iso charged" },
+     { "-gln",    FALSE, etBOOL, {&bGlnMan}, 
+-      "Interactive Glutamine selection, iso neutral" },
++      "Interactive glutamine selection, iso neutral" },
+     { "-his",    FALSE, etBOOL, {&bHisMan},
+-      "Interactive Histidine selection, iso checking H-bonds" },
++      "Interactive histidine selection, iso checking H-bonds" },
+     { "-angle",  FALSE, etREAL, {&angle}, 
+       "Minimum hydrogen-donor-acceptor angle for a H-bond (degrees)" },
+     { "-dist",   FALSE, etREAL, {&distance},
+       "Maximum donor-acceptor distance for a H-bond (nm)" },
+     { "-una",    FALSE, etBOOL, {&bUnA}, 
+-      "Select aromatic rings with united CH atoms on Phenylalanine, "
+-      "Tryptophane and Tyrosine" },
++      "Select aromatic rings with united CH atoms on phenylalanine, "
++      "tryptophane and tyrosine" },
+     { "-sort",   FALSE, etBOOL, {&bSort}, 
+       "HIDDENSort the residues according to database, turning this off is dangerous as charge groups might be broken in parts" },
+     { "-ignh",   FALSE, etBOOL, {&bRemoveH}, 
+diff --git a/src/kernel/repl_ex.c b/src/kernel/repl_ex.c
+index 8bff387..e4c9089 100644
+--- a/src/kernel/repl_ex.c
++++ b/src/kernel/repl_ex.c
+@@ -89,24 +89,20 @@ static void repl_quantity(FILE *fplog,const gmx_multisim_t *ms,
+         {
+             bDiff = TRUE;
+         }
+-
+-        if (bDiff)
++    }
++    if (bDiff)
++    {
++        if (re->type >= 0 && re->type < ereNR)
+         {
+-            if (re->type >= 0 && re->type < ereNR)
+-            {
+-                gmx_fatal(FARGS,"For replica exchange both %s and %s differ",
+-                          erename[re->type],erename[ere]);
+-            }
+-            else
+-            {
+-                /* Set the replica exchange type and quantities */
+-                re->type = ere;
+-                snew(re->q,re->nrepl);
+-                for(s=0; s<ms->nsim; s++)
+-                {
+-                    re->q[s] = qall[s];
+-                }
+-            }
++            gmx_fatal(FARGS,"For replica exchange both %s and %s differ",
++                      erename[re->type],erename[ere]);
++        }
++        /* Set the replica exchange type and quantities */
++        re->type = ere;
++        snew(re->q,re->nrepl);
++        for(s=0; s<ms->nsim; s++)
++        {
++            re->q[s] = qall[s];
+         }
+     }
+ 
+diff --git a/src/kernel/runner.c b/src/kernel/runner.c
+index 888fe31..cf2fd37 100644
+--- a/src/kernel/runner.c
++++ b/src/kernel/runner.c
+@@ -274,7 +274,7 @@ static int get_nthreads(int nthreads_requested, t_inputrec *inputrec,
+         }
+         else
+         {
+-            nthreads = tMPI_Get_recommended_nthreads();
++            nthreads = tMPI_Thread_get_hw_number();
+         }
+     }
+ 
+@@ -884,15 +884,3 @@ int mdrunner(int nthreads_requested, FILE *fplog,t_commrec *cr,int nfile,
+ 
+     return rc;
+ }
+-
+-void md_print_warning(const t_commrec *cr,FILE *fplog,const char *buf)
+-{
+-    if (MASTER(cr))
+-    {
+-        fprintf(stderr,"\n%s\n",buf);
+-    }
+-    if (fplog)
+-    {
+-        fprintf(fplog,"\n%s\n",buf);
+-    }
+-}
+diff --git a/src/kernel/tpbconv.c b/src/kernel/tpbconv.c
+index e5715c9..f423f9a 100644
+--- a/src/kernel/tpbconv.c
++++ b/src/kernel/tpbconv.c
+@@ -307,7 +307,7 @@ int main (int argc, char *argv[])
+     "of the original run.[PAR]",
+     "[BB]3.[bb] by creating a [TT].tpx[tt] file for a subset of your original",
+     "tpx file, which is useful when you want to remove the solvent from",
+-    "your [TT].tpx[tt] file, or when you want to make e.g. a pure Ca [TT].tpx[tt] file.",
++    "your [TT].tpx[tt] file, or when you want to make e.g. a pure C[GRK]alpha[grk] [TT].tpx[tt] file.",
+     "Note that you may need to use [TT]-nsteps -1[tt] (or similar) to get",
+     "this to work.",
+     "[BB]WARNING: this [TT].tpx[tt] file is not fully functional[bb].[PAR]",
+diff --git a/src/mdlib/Makefile.am b/src/mdlib/Makefile.am
+index a413744..6c4cd6d 100644
+--- a/src/mdlib/Makefile.am
++++ b/src/mdlib/Makefile.am
+@@ -24,8 +24,9 @@ libmd at LIBSUFFIX@_la_SOURCES = \
+ 	edsam.c		ewald.c         \
+ 	force.c  	forcerec.c	\
+ 	ghat.c		init.c		\
++    iteratedconstraints.c   md_support.c    \
+ 	mdatom.c	mdebin.c	minimize.c	\
+-	mvxvf.c		ns.c		nsgrid.c	\
++	mvxvf.c		ns.c		nlistheuristics.c    nsgrid.c	\
+ 	perf_est.c	genborn.c			\
+ 	genborn_sse2_single.c				\
+ 	genborn_sse2_single.h				\
+diff --git a/src/mdlib/edsam.c b/src/mdlib/edsam.c
+index 3fbc09d..ffae4c3 100644
+--- a/src/mdlib/edsam.c
++++ b/src/mdlib/edsam.c
+@@ -1,12 +1,12 @@
+ /* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
+- *  
+- * 
++ *
++ *
+  *                This source code is part of
+- * 
++ *
+  *                 G   R   O   M   A   C   S
+- * 
++ *
+  *          GROningen MAchine for Chemical Simulations
+- * 
++ *
+  *                        VERSION 3.2.0
+  * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
+  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+@@ -16,19 +16,19 @@
+  * 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:
+  * GROwing Monsters And Cloning Shrimps
+  */
+@@ -95,25 +95,28 @@ typedef struct
+     t_eigvec      linfix;         /* fixed linear constraints             */
+     t_eigvec      linacc;         /* acceptance linear constraints        */
+     t_eigvec      radfix;         /* fixed radial constraints (exp)       */
+-    t_eigvec      radacc;         /* acceptance radial constraints (exp)  */  
++    t_eigvec      radacc;         /* acceptance radial constraints (exp)  */
+     t_eigvec      radcon;         /* acceptance rad. contraction constr.  */
+ } t_edvecs;
+ 
+ 
+ typedef struct
+-{ 
++{
+     real deltaF0;
+-    gmx_bool bHarmonic; /* Use flooding for harmonic restraint on eigenvector */
++    gmx_bool bHarmonic;           /* Use flooding for harmonic restraint on
++                                     the eigenvector                          */
++    gmx_bool bConstForce;         /* Do not calculate a flooding potential,
++                                     instead flood with a constant force      */
+     real tau;
+     real deltaF;
+     real Efl;
+-    real kT; 
++    real kT;
+     real Vfl;
+     real dt;
+     real constEfl;
+-    real alpha2; 
++    real alpha2;
+     int flood_id;
+-    rvec *forces_cartesian;  
++    rvec *forces_cartesian;
+     t_eigvec vecs;         /* use flooding for these */
+ } t_edflood;
+ 
+@@ -126,14 +129,14 @@ typedef struct gmx_edx
+     int           *anrs;          /* atom index numbers                       */
+     int           *anrs_loc;      /* local atom index numbers                 */
+     int           nalloc_loc;     /* allocation size of anrs_loc              */
+-    int           *c_ind;         /* at which position of the whole anrs 
+-                                   * array is a local atom?, i.e. 
+-                                   * c_ind[0...nr_loc-1] gives the atom index 
+-                                   * with respect to the collective 
++    int           *c_ind;         /* at which position of the whole anrs
++                                   * array is a local atom?, i.e.
++                                   * c_ind[0...nr_loc-1] gives the atom index
++                                   * with respect to the collective
+                                    * anrs[0...nr-1] array                     */
+     rvec          *x;             /* positions for this structure             */
+     rvec          *x_old;         /* used to keep track of the shift vectors
+-                                     such that the ED molecule can always be 
++                                     such that the ED molecule can always be
+                                      made whole in the parallel case          */
+     real          *m;             /* masses                                   */
+     real          mtot;           /* total mass (only used in sref)           */
+@@ -147,7 +150,7 @@ typedef struct edpar
+     int            nini;           /* total Nr of atoms                    */
+     gmx_bool       fitmas;         /* true if trans fit with cm            */
+     gmx_bool       pcamas;         /* true if mass-weighted PCA            */
+-    int            presteps;       /* number of steps to run without any   
++    int            presteps;       /* number of steps to run without any
+                                     *    perturbations ... just monitoring */
+     int            outfrq;         /* freq (in steps) of writing to edo    */
+     int            maxedsteps;     /* max nr of steps per cycle            */
+@@ -189,9 +192,9 @@ struct t_do_edsam
+     matrix old_rotmat;
+     real oldrad;
+     rvec old_transvec,older_transvec,transvec_compact;
+-    rvec *xcoll;         /* Positions from all nodes, this is the 
++    rvec *xcoll;         /* Positions from all nodes, this is the
+                             collective set we work on.
+-                            These are the positions of atoms with 
++                            These are the positions of atoms with
+                             average structure indices */
+     rvec *xc_ref;        /* same but with reference structure indices */
+     ivec *shifts_xcoll;        /* Shifts for xcoll  */
+@@ -199,7 +202,7 @@ struct t_do_edsam
+     ivec *shifts_xc_ref;       /* Shifts for xc_ref */
+     ivec *extra_shifts_xc_ref; /* xc_ref shift changes since last NS step */
+     gmx_bool bUpdateShifts;    /* TRUE in NS steps to indicate that the
+-                                  ED shifts for this ED dataset need to 
++                                  ED shifts for this ED dataset need to
+                                   be updated */
+ };
+ 
+@@ -256,17 +259,17 @@ static void rad_project(t_edpar *edi, rvec *x, t_eigvec *vec, t_commrec *cr)
+         rad += pow((vec->refproj[i]-vec->xproj[i]),2);
+     }
+     vec->radius=sqrt(rad);
+-    
++
+     /* Add average positions */
+-    for (i = 0; i < edi->sav.nr; i++) 
++    for (i = 0; i < edi->sav.nr; i++)
+         rvec_inc(x[i], edi->sav.x[i]);
+ }
+ 
+ 
+-/* Project vector x, subtract average positions prior to projection and add 
++/* Project vector x, subtract average positions prior to projection and add
+  * them afterwards to retain the unchanged vector. Store in xproj. Mass-weighting
+  * is applied. */
+-static void project_to_eigvectors(rvec       *x,    /* The positions to project to an eigenvector */ 
++static void project_to_eigvectors(rvec       *x,    /* The positions to project to an eigenvector */
+                                   t_eigvec   *vec,  /* The eigenvectors */
+                                   t_edpar    *edi)
+ {
+@@ -276,20 +279,20 @@ static void project_to_eigvectors(rvec       *x,    /* The positions to project
+     if (!vec->neig) return;
+ 
+     /* Subtract average positions */
+-    for (i=0; i<edi->sav.nr; i++) 
++    for (i=0; i<edi->sav.nr; i++)
+         rvec_dec(x[i], edi->sav.x[i]);
+ 
+     for (i=0; i<vec->neig; i++)
+         vec->xproj[i] = projectx(edi, x, vec->vec[i]);
+ 
+     /* Add average positions */
+-    for (i=0; i<edi->sav.nr; i++) 
++    for (i=0; i<edi->sav.nr; i++)
+         rvec_inc(x[i], edi->sav.x[i]);
+ }
+ 
+ 
+ /* Project vector x onto all edi->vecs (mon, linfix,...) */
+-static void project(rvec      *x,     /* positions to project */ 
++static void project(rvec      *x,     /* positions to project */
+                     t_edpar   *edi)   /* edi data set */
+ {
+     /* It is not more work to subtract the average position in every
+@@ -309,7 +312,7 @@ static real calc_radius(t_eigvec *vec)
+     real rad=0.0;
+ 
+ 
+-    for (i=0; i<vec->neig; i++) 
++    for (i=0; i<vec->neig; i++)
+         rad += pow((vec->refproj[i]-vec->xproj[i]),2);
+ 
+     return rad=sqrt(rad);
+@@ -318,7 +321,7 @@ static real calc_radius(t_eigvec *vec)
+ 
+ /* Debug helper */
+ #ifdef DEBUGHELPERS
+-static void dump_xcoll(t_edpar *edi, struct t_do_edsam *buf, t_commrec *cr, 
++static void dump_xcoll(t_edpar *edi, struct t_do_edsam *buf, t_commrec *cr,
+                        int step)
+ {
+     int i;
+@@ -327,22 +330,22 @@ static void dump_xcoll(t_edpar *edi, struct t_do_edsam *buf, t_commrec *cr,
+     rvec *xcoll;
+     ivec *shifts, *eshifts;
+ 
+-    
++
+     if (!MASTER(cr))
+         return;
+-    
++
+     xcoll   = buf->xcoll;
+     shifts  = buf->shifts_xcoll;
+     eshifts = buf->extra_shifts_xcoll;
+-    
++
+     sprintf(fn, "xcolldump_step%d.txt", step);
+     fp = fopen(fn, "w");
+-    
++
+     for (i=0; i<edi->sav.nr; i++)
+-        fprintf(fp, "%d %9.5f %9.5f %9.5f   %d %d %d   %d %d %d\n", 
+-                edi->sav.anrs[i]+1, 
++        fprintf(fp, "%d %9.5f %9.5f %9.5f   %d %d %d   %d %d %d\n",
++                edi->sav.anrs[i]+1,
+                 xcoll[i][XX]  , xcoll[i][YY]  , xcoll[i][ZZ],
+-                shifts[i][XX] , shifts[i][YY] , shifts[i][ZZ], 
++                shifts[i][XX] , shifts[i][YY] , shifts[i][ZZ],
+                 eshifts[i][XX], eshifts[i][YY], eshifts[i][ZZ]);
+ 
+     fclose(fp);
+@@ -354,7 +357,7 @@ static void dump_edi_positions(FILE *out, struct gmx_edx *s, const char name[])
+ {
+     int i;
+ 
+-    
++
+     fprintf(out, "#%s positions:\n%d\n", name, s->nr);
+     if (s->nr == 0)
+         return;
+@@ -362,7 +365,7 @@ static void dump_edi_positions(FILE *out, struct gmx_edx *s, const char name[])
+     fprintf(out, "#index, x, y, z");
+     if (s->sqrtm)
+         fprintf(out, ", sqrt(m)");
+-    for (i=0; i<s->nr; i++) 
++    for (i=0; i<s->nr; i++)
+     {
+         fprintf(out, "\n%6d  %11.6f %11.6f %11.6f",s->anrs[i], s->x[i][XX], s->x[i][YY], s->x[i][ZZ]);
+         if (s->sqrtm)
+@@ -378,12 +381,12 @@ static void dump_edi_eigenvecs(FILE *out, t_eigvec *ev,
+ {
+     int i,j;
+ 
+-    
++
+     fprintf(out, "#%s eigenvectors:\n%d\n", name, ev->neig);
+     /* Dump the data for every eigenvector: */
+     for (i=0; i<ev->neig; i++)
+     {
+-        fprintf(out, "EV %4d\ncomponents %d\nstepsize %f\nxproj %f\nfproj %f\nrefproj %f\nradius %f\nComponents:\n", 
++        fprintf(out, "EV %4d\ncomponents %d\nstepsize %f\nxproj %f\nfproj %f\nrefproj %f\nradius %f\nComponents:\n",
+                 ev->ieig[i], length, ev->stpsz[i], ev->xproj[i], ev->fproj[i], ev->refproj[i], ev->radius);
+         for (j=0; j<length; j++)
+             fprintf(out, "%11.6f %11.6f %11.6f\n", ev->vec[i][j][XX], ev->vec[i][j][YY], ev->vec[i][j][ZZ]);
+@@ -445,11 +448,11 @@ static void dump_rotmat(FILE* out,matrix rotmat)
+ 
+ 
+ /* Debug helper */
+-static void dump_rvec(FILE *out, int dim, rvec *x) 
++static void dump_rvec(FILE *out, int dim, rvec *x)
+ {
+     int i;
+ 
+-    
++
+     for (i=0; i<dim; i++)
+         fprintf(out,"%4d   %f %f %f\n",i,x[i][XX],x[i][YY],x[i][ZZ]);
+ }
+@@ -460,7 +463,7 @@ static void dump_mat(FILE* out, int dim, double** mat)
+ {
+     int i,j;
+ 
+-    
++
+     fprintf(out,"MATRIX:\n");
+     for (i=0;i<dim;i++)
+     {
+@@ -472,7 +475,7 @@ static void dump_mat(FILE* out, int dim, double** mat)
+ #endif
+ 
+ 
+-struct t_do_edfit { 
++struct t_do_edfit {
+     double **omega;
+     double **om;
+ };
+@@ -498,7 +501,7 @@ static void do_edfit(int natoms,rvec *xp,rvec *x,matrix R,t_edpar *edi)
+     }
+     loc = edi->buf->do_edfit;
+ 
+-    if (bFirst) 
++    if (bFirst)
+     {
+         snew(loc->omega,2*DIM);
+         snew(loc->om,2*DIM);
+@@ -597,11 +600,11 @@ static void do_edfit(int natoms,rvec *xp,rvec *x,matrix R,t_edpar *edi)
+ }
+ 
+ 
+-static void rmfit(int nat, rvec *xcoll, rvec transvec, matrix rotmat) 
++static void rmfit(int nat, rvec *xcoll, rvec transvec, matrix rotmat)
+ {
+     rvec vec;
+     matrix tmat;
+-    
++
+ 
+     /* Remove rotation.
+      * The inverse rotation is described by the transposed rotation matrix */
+@@ -619,19 +622,19 @@ static void rmfit(int nat, rvec *xcoll, rvec transvec, matrix rotmat)
+ /**********************************************************************************
+  ******************** FLOODING ****************************************************
+  **********************************************************************************
+- 
+-The flooding ability was added later to edsam. Many of the edsam functionality could be reused for that purpose. 
+-The flooding covariance matrix, i.e. the selected eigenvectors and their corresponding eigenvalues are 
+-read as 7th Component Group. The eigenvalues are coded into the stepsize parameter (as used by -linfix or -linacc). 
++
++The flooding ability was added later to edsam. Many of the edsam functionality could be reused for that purpose.
++The flooding covariance matrix, i.e. the selected eigenvectors and their corresponding eigenvalues are
++read as 7th Component Group. The eigenvalues are coded into the stepsize parameter (as used by -linfix or -linacc).
+ 
+ do_md clls right in the beginning the function init_edsam, which reads the edi file, saves all the necessary information in
+ the edi structure and calls init_flood, to initialise some extra fields in the edi->flood structure.
+ 
+-since the flooding acts on forces do_flood is called from the function force() (force.c), while the other 
++since the flooding acts on forces do_flood is called from the function force() (force.c), while the other
+ edsam functionality is hooked into md via the update() (update.c) function acting as constraint on positions.
+ 
+ do_flood makes a copy of the positions,
+-fits them, projects them computes flooding_energy, and flooding forces. The forces are computed in the 
++fits them, projects them computes flooding_energy, and flooding forces. The forces are computed in the
+ space of the eigenvectors and are then blown up to the full cartesian space and rotated back to remove the
+ fit. Then do_flood adds these forces to the forcefield-forces
+ (given as parameter) and updates the adaptive flooding parameters Efl and deltaF.
+@@ -645,28 +648,28 @@ To use the flooding potential as restraint, make_edi has the option -restrain, w
+ signs of alpha2 and Efl, such that the sign in the exponential of Vfl is not inverted but the sign of
+ Vfl is inverted. Vfl = Efl * exp (- .../Efl/alpha2*x^2...) With tau>0 the negative Efl will grow slowly
+ so that the restraint is switched off slowly. When Efl==0 and inverted flooding is ON is reached no
+- further adaption is applied, Efl will stay constant at zero. 
++ further adaption is applied, Efl will stay constant at zero.
+ 
+-To use restraints with harmonic potentials switch -restrain and -harmonic. Then the eigenvalues are 
+-used as spring constants for the harmonic potential. 
++To use restraints with harmonic potentials switch -restrain and -harmonic. Then the eigenvalues are
++used as spring constants for the harmonic potential.
+ Note that eq3 in the flooding paper (J. Comp. Chem. 2006, 27, 1693-1702) defines the parameter lambda \
+ as the inverse of the spring constant, whereas the implementation uses lambda as the spring constant.
+ 
+ To use more than one flooding matrix just concatenate several .edi files (cat flood1.edi flood2.edi > flood_all.edi)
+ the routine read_edi_file reads all of theses flooding files.
+-The structure t_edi is now organized as a list of t_edis and the function do_flood cycles through the list 
+-calling the do_single_flood() routine for every single entry. Since every state variables have been kept in one 
+-edi there is no interdependence whatsoever. The forces are added together. 
++The structure t_edi is now organized as a list of t_edis and the function do_flood cycles through the list
++calling the do_single_flood() routine for every single entry. Since every state variables have been kept in one
++edi there is no interdependence whatsoever. The forces are added together.
+ 
+-  To write energies into the .edr file, call the function 
++  To write energies into the .edr file, call the function
+         get_flood_enx_names(char**, int *nnames) to get the Header (Vfl1 Vfl2... Vfln)
+ and call
+-        get_flood_energies(real Vfl[],int nnames); 
++        get_flood_energies(real Vfl[],int nnames);
+ 
+   TODO:
+ - one could program the whole thing such that Efl, Vfl and deltaF is written to the .edr file. -- i dont know how to do that, yet.
+ 
+-  Maybe one should give a range of atoms for which to remove motion, so that motion is removed with 
++  Maybe one should give a range of atoms for which to remove motion, so that motion is removed with
+   two edsam files from two peptide chains
+ */
+ 
+@@ -676,7 +679,7 @@ static void write_edo_flood(t_edpar *edi, FILE *fp, gmx_large_int_t step)
+     char buf[22];
+     gmx_bool bOutputRef=FALSE;
+ 
+-    
++
+     fprintf(fp,"%d.th FL: %s %12.5e %12.5e %12.5e\n",
+             edi->flood.flood_id, gmx_step_str(step,buf),
+             edi->flood.Efl, edi->flood.Vfl, edi->flood.deltaF);
+@@ -703,10 +706,10 @@ static void write_edo_flood(t_edpar *edi, FILE *fp, gmx_large_int_t step)
+         }
+     }
+     fprintf(fp,"FL_FORCES: ");
+-    
++
+     for (i=0; i<edi->flood.vecs.neig; i++)
+         fprintf(fp," %12.5e",edi->flood.vecs.fproj[i]);
+-    
++
+     fprintf(fp,"\n");
+ }
+ 
+@@ -737,12 +740,15 @@ static real flood_energy(t_edpar *edi, gmx_large_int_t step)
+             edi->flood.vecs.refproj[i] = edi->flood.vecs.refproj0[i] + step * edi->flood.vecs.refprojslope[i];
+         }
+     }
+-    
++
+     sum=0.0;
+     /* Compute sum which will be the exponent of the exponential */
+     for (i=0; i<edi->flood.vecs.neig; i++)
++    {
++        /* stpsz stores the reciprocal eigenvalue 1/sigma_i */
+         sum += edi->flood.vecs.stpsz[i]*(edi->flood.vecs.xproj[i]-edi->flood.vecs.refproj[i])*(edi->flood.vecs.xproj[i]-edi->flood.vecs.refproj[i]);
+-    
++    }
++
+     /* Compute the Gauss function*/
+     if (edi->flood.bHarmonic)
+     {
+@@ -762,7 +768,7 @@ static void flood_forces(t_edpar *edi)
+ {
+     /* compute the forces in the subspace of the flooding eigenvectors
+      * by the formula F_i= V_{fl}(c) * ( \frac {kT} {E_{fl}} \lambda_i c_i */
+-    
++
+     int i;
+     real energy=edi->flood.Vfl;
+ 
+@@ -785,31 +791,31 @@ static void flood_forces(t_edpar *edi)
+ static void flood_blowup(t_edpar *edi, rvec *forces_cart)
+ {
+     /* this function lifts the forces from the subspace to the cartesian space
+-     all the values not contained in the subspace are assumed to be zero and then 
+-     a coordinate transformation from eigenvector to cartesian vectors is performed 
+-     The nonexistent values don't have to be set to zero explicitly, they would occur 
++     all the values not contained in the subspace are assumed to be zero and then
++     a coordinate transformation from eigenvector to cartesian vectors is performed
++     The nonexistent values don't have to be set to zero explicitly, they would occur
+      as zero valued summands, hence we just stop to compute this part of the sum.
+ 
+      for every atom we add all the contributions to this atom from all the different eigenvectors.
+ 
+-     NOTE: one could add directly to the forcefield forces, would mean we wouldn't have to clear the 
+-     field forces_cart prior the computation, but momentarily we want to compute the forces separately 
++     NOTE: one could add directly to the forcefield forces, would mean we wouldn't have to clear the
++     field forces_cart prior the computation, but we compute the forces separately
+      to have them accessible for diagnostics
+      */
+     int  j,eig;
+     rvec dum;
+     real *forces_sub;
+-    
+-    
++
++
+     forces_sub = edi->flood.vecs.fproj;
+-    
+-    
++
++
+     /* Calculate the cartesian forces for the local atoms */
+-    
++
+     /* Clear forces first */
+-    for (j=0; j<edi->sav.nr_loc; j++) 
++    for (j=0; j<edi->sav.nr_loc; j++)
+         clear_rvec(forces_cart[j]);
+-        
++
+     /* Now compute atomwise */
+     for (j=0; j<edi->sav.nr_loc; j++)
+     {
+@@ -828,8 +834,8 @@ static void flood_blowup(t_edpar *edi, rvec *forces_cart)
+ /* Update the values of Efl, deltaF depending on tau and Vfl */
+ static void update_adaption(t_edpar *edi)
+ {
+-    /* this function updates the parameter Efl and deltaF according to the rules given in 
+-     * 'predicting unimolecular chemical reactions: chemical flooding' M Mueller et al, 
++    /* this function updates the parameter Efl and deltaF according to the rules given in
++     * 'predicting unimolecular chemical reactions: chemical flooding' M Mueller et al,
+      * J. chem Phys. */
+ 
+     if ((edi->flood.tau < 0 ? -edi->flood.tau : edi->flood.tau ) > 0.00000001)
+@@ -852,25 +858,25 @@ static void do_single_flood(
+         gmx_large_int_t step,
+         matrix box,
+         t_commrec *cr)
+-{  
++{
+     int i;
+     matrix  rotmat;         /* rotation matrix */
+     matrix  tmat;           /* inverse rotation */
+     rvec    transvec;       /* translation vector */
+     struct t_do_edsam *buf;
+ 
+-    
++
+     buf=edi->buf->do_edsam;
+-    
++
+     /* Broadcast the positions of the AVERAGE structure such that they are known on
+      * every processor. Each node contributes its local positions x and stores them in
+-     * the collective ED array buf->xcoll */  
+-    communicate_group_positions(cr, buf->xcoll, buf->shifts_xcoll, buf->extra_shifts_xcoll, buf->bUpdateShifts, x, 
+-                    edi->sav.nr, edi->sav.nr_loc, edi->sav.anrs_loc, edi->sav.c_ind, edi->sav.x_old, box);  
+-    
++     * the collective ED array buf->xcoll */
++    communicate_group_positions(cr, buf->xcoll, buf->shifts_xcoll, buf->extra_shifts_xcoll, buf->bUpdateShifts, x,
++                    edi->sav.nr, edi->sav.nr_loc, edi->sav.anrs_loc, edi->sav.c_ind, edi->sav.x_old, box);
++
+     /* Only assembly REFERENCE positions if their indices differ from the average ones */
+     if (!edi->bRefEqAv)
+-        communicate_group_positions(cr, buf->xc_ref, buf->shifts_xc_ref, buf->extra_shifts_xc_ref, buf->bUpdateShifts, x, 
++        communicate_group_positions(cr, buf->xc_ref, buf->shifts_xc_ref, buf->extra_shifts_xc_ref, buf->bUpdateShifts, x,
+                 edi->sref.nr, edi->sref.nr_loc, edi->sref.anrs_loc, edi->sref.c_ind, edi->sref.x_old, box);
+ 
+     /* If bUpdateShifts was TRUE, the shifts have just been updated in get_positions.
+@@ -879,26 +885,29 @@ static void do_single_flood(
+ 
+     /* Now all nodes have all of the ED/flooding positions in edi->sav->xcoll,
+      * as well as the indices in edi->sav.anrs */
+-  
++
+     /* Fit the reference indices to the reference structure */
+     if (edi->bRefEqAv)
+         fit_to_reference(buf->xcoll , transvec, rotmat, edi);
+     else
+         fit_to_reference(buf->xc_ref, transvec, rotmat, edi);
+-    
++
+     /* Now apply the translation and rotation to the ED structure */
+     translate_and_rotate(buf->xcoll, edi->sav.nr, transvec, rotmat);
+ 
+     /* Project fitted structure onto supbspace -> store in edi->flood.vecs.xproj */
+-    project_to_eigvectors(buf->xcoll,&edi->flood.vecs,edi); 
+-            
+-    /* Compute Vfl(x) from flood.xproj */
+-    edi->flood.Vfl = flood_energy(edi, step);
+-    
+-    update_adaption(edi);
++    project_to_eigvectors(buf->xcoll,&edi->flood.vecs,edi);
++
++    if (FALSE == edi->flood.bConstForce)
++    {
++        /* Compute Vfl(x) from flood.xproj */
++        edi->flood.Vfl = flood_energy(edi, step);
+ 
+-    /* Compute the flooding forces */
+-    flood_forces(edi);
++        update_adaption(edi);
++
++        /* Compute the flooding forces */
++        flood_forces(edi);
++    }
+ 
+     /* Translate them into cartesian positions */
+     flood_blowup(edi, edi->flood.forces_cartesian);
+@@ -930,10 +939,10 @@ extern void do_flood(
+ {
+     t_edpar *edi;
+ 
+-    
++
+     if (ed->eEDtype != eEDflood)
+         return;
+-    
++
+     edi = ed->edpar;
+     while (edi)
+     {
+@@ -945,10 +954,13 @@ extern void do_flood(
+ }
+ 
+ 
+-/* Called by init_edi, configure some flooding related variables and structures, 
++/* Called by init_edi, configure some flooding related variables and structures,
+  * print headers to output files */
+ static void init_flood(t_edpar *edi, gmx_edsam_t ed, real dt, t_commrec *cr)
+ {
++    int i;
++
++
+     edi->flood.Efl = edi->flood.constEfl;
+     edi->flood.Vfl = 0;
+     edi->flood.dt  = dt;
+@@ -957,12 +969,25 @@ static void init_flood(t_edpar *edi, gmx_edsam_t ed, real dt, t_commrec *cr)
+     {
+         /* If in any of the datasets we find a flooding vector, flooding is turned on */
+         ed->eEDtype = eEDflood;
+-        
++
++        fprintf(stderr,"ED: Flooding of matrix %d is switched on.\n", edi->flood.flood_id);
++
++        if (edi->flood.bConstForce)
++        {
++            /* We have used stpsz as a vehicle to carry the fproj values for constant
++             * force flooding. Now we copy that to flood.vecs.fproj. Note that
++             * in const force flooding, fproj is never changed. */
++            for (i=0; i<edi->flood.vecs.neig; i++)
++            {
++                edi->flood.vecs.fproj[i] = edi->flood.vecs.stpsz[i];
++
++                fprintf(stderr, "ED: applying on eigenvector %d a constant force of %g\n",
++                        edi->flood.vecs.ieig[i], edi->flood.vecs.fproj[i]);
++            }
++        }
+         fprintf(ed->edo,"FL_HEADER: Flooding of matrix %d is switched on! The flooding output will have the following format:\n",
+                 edi->flood.flood_id);
+-        fprintf(stderr,"ED: Flooding of matrix %d is switched on.\n", edi->flood.flood_id);
+-        if (edi->flood.flood_id<1)
+-            fprintf(ed->edo,"FL_HEADER: Step Efl Vfl deltaF\n");
++        fprintf(ed->edo,"FL_HEADER: Step     Efl          Vfl       deltaF\n");
+     }
+ }
+ 
+@@ -994,7 +1019,7 @@ static void get_flood_energies(t_edpar *edi, real Vfl[],int nnames)
+     t_edpar *actual;
+     int count;
+ 
+-    
++
+     actual=edi;
+     count = 1;
+     while (actual)
+@@ -1003,7 +1028,7 @@ static void get_flood_energies(t_edpar *edi, real Vfl[],int nnames)
+         actual=actual->next_edi;
+         count++;
+     }
+-    if (nnames!=count-1) 
++    if (nnames!=count-1)
+         gmx_fatal(FARGS,"Number of energies is not consistent with t_edi structure");
+ }
+ /************* END of FLOODING IMPLEMENTATION ****************************/
+@@ -1011,22 +1036,22 @@ static void get_flood_energies(t_edpar *edi, real Vfl[],int nnames)
+ 
+ 
+ gmx_edsam_t ed_open(int nfile,const t_filenm fnm[],unsigned long Flags,t_commrec *cr)
+-{   
++{
+     gmx_edsam_t ed;
+-    
+-    
++
++
+     /* Allocate space for the ED data structure */
+     snew(ed, 1);
+-    
++
+     /* We want to perform ED (this switch might later be upgraded to eEDflood) */
+     ed->eEDtype = eEDedsam;
+ 
+-    if (MASTER(cr)) 
++    if (MASTER(cr))
+     {
+         /* Open .edi input file: */
+         ed->edinam=ftp2fn(efEDI,nfile,fnm);
+         /* The master opens the .edo output file */
+-        fprintf(stderr,"ED sampling will be performed!\n");        
++        fprintf(stderr,"ED sampling will be performed!\n");
+         ed->edonam = ftp2fn(efEDO,nfile,fnm);
+         ed->edo    = gmx_fio_fopen(ed->edonam,(Flags & MD_APPENDFILES)? "a+" : "w+");
+         ed->bStartFromCpt = Flags & MD_STARTFROMCPT;
+@@ -1049,10 +1074,10 @@ static void bc_ed_positions(t_commrec *cr, struct gmx_edx *s, int stype)
+     {
+         /* We need these additional variables in the parallel case: */
+         snew(s->c_ind    , s->nr   );   /* Collective indices */
+-        /* Local atom indices get assigned in dd_make_local_group_indices. 
++        /* Local atom indices get assigned in dd_make_local_group_indices.
+          * There, also memory is allocated */
+         s->nalloc_loc = 0;              /* allocation size of s->anrs_loc */
+-        snew_bc(cr, s->x_old, s->nr);   /* To be able to always make the ED molecule whole, ...        */ 
++        snew_bc(cr, s->x_old, s->nr);   /* To be able to always make the ED molecule whole, ...        */
+         nblock_bc(cr, s->nr, s->x_old); /* ... keep track of shift changes with the help of old coords */
+     }
+ 
+@@ -1115,16 +1140,16 @@ static void broadcast_ed_data(t_commrec *cr, gmx_edsam_t ed, int numedis)
+ {
+     int     nr;
+     t_edpar *edi;
+-    
++
+ 
+     /* Master lets the other nodes know if its ED only or also flooding */
+     gmx_bcast(sizeof(ed->eEDtype), &(ed->eEDtype), cr);
+-    
++
+     snew_bc(cr, ed->edpar,1);
+     /* Now transfer the ED data set(s) */
+     edi = ed->edpar;
+     for (nr=0; nr<numedis; nr++)
+-    {      
++    {
+         /* Broadcast a single ED data set */
+         block_bc(cr, *edi);
+ 
+@@ -1143,7 +1168,7 @@ static void broadcast_ed_data(t_commrec *cr, gmx_edsam_t ed, int numedis)
+         bc_ed_vecs(cr, &edi->vecs.radcon, edi->sav.nr, FALSE);
+         /* Broadcast flooding eigenvectors and, if needed, values for the moving reference */
+         bc_ed_vecs(cr, &edi->flood.vecs,  edi->sav.nr, edi->flood.bHarmonic);
+-        
++
+         /* Set the pointer to the next ED dataset */
+         if (edi->next_edi)
+         {
+@@ -1156,22 +1181,22 @@ static void broadcast_ed_data(t_commrec *cr, gmx_edsam_t ed, int numedis)
+ 
+ /* init-routine called for every *.edi-cycle, initialises t_edpar structure */
+ static void init_edi(gmx_mtop_t *mtop,t_inputrec *ir,
+-                     t_commrec *cr,gmx_edsam_t ed,t_edpar *edi) 
++                     t_commrec *cr,gmx_edsam_t ed,t_edpar *edi)
+ {
+     int  i;
+     real totalmass = 0.0;
+     rvec com;
+     t_atom *atom;
+ 
+-    /* NOTE Init_edi is executed on the master process only 
++    /* NOTE Init_edi is executed on the master process only
+      * The initialized data sets are then transmitted to the
+      * other nodes in broadcast_ed_data */
+ 
+-    edi->bNeedDoEdsam = edi->vecs.mon.neig 
+-                     || edi->vecs.linfix.neig 
+-                     || edi->vecs.linacc.neig 
+-                     || edi->vecs.radfix.neig 
+-                     || edi->vecs.radacc.neig 
++    edi->bNeedDoEdsam = edi->vecs.mon.neig
++                     || edi->vecs.linfix.neig
++                     || edi->vecs.linacc.neig
++                     || edi->vecs.radfix.neig
++                     || edi->vecs.radacc.neig
+                      || edi->vecs.radcon.neig;
+ 
+     /* evaluate masses (reference structure) */
+@@ -1187,11 +1212,22 @@ static void init_edi(gmx_mtop_t *mtop,t_inputrec *ir,
+         {
+             edi->sref.m[i] = 1.0;
+         }
++
++        /* Check that every m > 0. Bad things will happen otherwise. */
++        if (edi->sref.m[i] <= 0.0)
++        {
++            gmx_fatal(FARGS, "Reference structure atom %d (sam.edi index %d) has a mass of %g.\n"
++                             "For a mass-weighted fit, all reference structure atoms need to have a mass >0.\n"
++                             "Either make the covariance analysis non-mass-weighted, or exclude massless\n"
++                             "atoms from the reference structure by creating a proper index group.\n",
++                      i, edi->sref.anrs[i]+1, edi->sref.m[i]);
++        }
++
+         totalmass += edi->sref.m[i];
+     }
+     edi->sref.mtot = totalmass;
+ 
+-    /* Masses m and sqrt(m) for the average structure. Note that m 
++    /* Masses m and sqrt(m) for the average structure. Note that m
+      * is needed if forces have to be evaluated in do_edsam */
+     snew(edi->sav.sqrtm, edi->sav.nr );
+     snew(edi->sav.m    , edi->sav.nr );
+@@ -1207,6 +1243,16 @@ static void init_edi(gmx_mtop_t *mtop,t_inputrec *ir,
+         {
+             edi->sav.sqrtm[i] = 1.0;
+         }
++
++        /* Check that every m > 0. Bad things will happen otherwise. */
++        if (edi->sav.sqrtm[i] <= 0.0)
++        {
++            gmx_fatal(FARGS, "Average structure atom %d (sam.edi index %d) has a mass of %g.\n"
++                             "For ED with mass-weighting, all average structure atoms need to have a mass >0.\n"
++                             "Either make the covariance analysis non-mass-weighted, or exclude massless\n"
++                             "atoms from the average structure by creating a proper index group.\n",
++                      i, edi->sav.anrs[i]+1, atom->m);
++        }
+     }
+ 
+     /* put reference structure in origin */
+@@ -1223,7 +1269,7 @@ static void init_edi(gmx_mtop_t *mtop,t_inputrec *ir,
+ 
+ static void check(const char *line, const char *label)
+ {
+-    if (!strstr(line,label)) 
++    if (!strstr(line,label))
+         gmx_fatal(FARGS,"Could not find input parameter %s at expected position in edsam input-file (.edi)\nline read instead is %s",label,line);
+ }
+ 
+@@ -1233,13 +1279,13 @@ static int read_checked_edint(FILE *file,const char *label)
+     char line[STRLEN+1];
+     int idum;
+ 
+-    
++
+     fgets2 (line,STRLEN,file);
+     check(line,label);
+     fgets2 (line,STRLEN,file);
+     sscanf (line,"%d",&idum);
+     return idum;
+-} 
++}
+ 
+ 
+ static int read_edint(FILE *file,gmx_bool *bEOF)
+@@ -1248,14 +1294,14 @@ static int read_edint(FILE *file,gmx_bool *bEOF)
+     int idum;
+     char *eof;
+ 
+-    
++
+     eof=fgets2 (line,STRLEN,file);
+     if (eof==NULL)
+     {
+         *bEOF = TRUE;
+         return -1;
+     }
+-    eof=fgets2 (line,STRLEN,file);  
++    eof=fgets2 (line,STRLEN,file);
+     if (eof==NULL)
+     {
+         *bEOF = TRUE;
+@@ -1272,7 +1318,7 @@ static real read_checked_edreal(FILE *file,const char *label)
+     char line[STRLEN+1];
+     double rdum;
+ 
+-    
++
+     fgets2 (line,STRLEN,file);
+     check(line,label);
+     fgets2 (line,STRLEN,file);
+@@ -1287,7 +1333,7 @@ static void read_edx(FILE *file,int number,int *anrs,rvec *x)
+     char line[STRLEN+1];
+     double d[3];
+ 
+-    
++
+     for(i=0; i<number; i++)
+     {
+         fgets2 (line,STRLEN,file);
+@@ -1305,7 +1351,7 @@ static void scan_edvec(FILE *in,int nr,rvec *vec)
+     int i;
+     double x,y,z;
+ 
+-    
++
+     for(i=0; (i < nr); i++)
+     {
+         fgets2 (line,STRLEN,in);
+@@ -1323,7 +1369,7 @@ static void read_edvec(FILE *in,int nr,t_eigvec *tvec,gmx_bool bReadRefproj)
+     double rdum,refproj_dum=0.0,refprojslope_dum=0.0;
+     char line[STRLEN+1];
+ 
+-    
++
+     tvec->neig=read_checked_edint(in,"NUMBER OF EIGENVECTORS");
+     if (tvec->neig >0)
+     {
+@@ -1404,7 +1450,7 @@ static gmx_bool check_if_same(struct gmx_edx sref, struct gmx_edx sav)
+ {
+     int i;
+ 
+-    
++
+     /* If the number of atoms differs between the two structures,
+      * they cannot be identical */
+     if (sref.nr != sav.nr)
+@@ -1426,10 +1472,10 @@ static gmx_bool check_if_same(struct gmx_edx sref, struct gmx_edx sav)
+ static int read_edi(FILE* in, gmx_edsam_t ed,t_edpar *edi,int nr_mdatoms, int edi_nr, t_commrec *cr)
+ {
+     int readmagic;
+-    const int magic=669;
++    const int magic=670;
+     gmx_bool bEOF;
+ 
+-    
++
+     /* the edi file is not free format, so expect problems if the input is corrupt. */
+ 
+     /* check the magic number */
+@@ -1442,6 +1488,8 @@ static int read_edi(FILE* in, gmx_edsam_t ed,t_edpar *edi,int nr_mdatoms, int ed
+     {
+         if (readmagic==666 || readmagic==667 || readmagic==668)
+             gmx_fatal(FARGS,"Wrong magic number: Use newest version of make_edi to produce edi file");
++        else if (readmagic == 669)
++            ;
+         else
+             gmx_fatal(FARGS,"Wrong magic number %d in %s",readmagic,ed->edinam);
+     }
+@@ -1450,7 +1498,7 @@ static int read_edi(FILE* in, gmx_edsam_t ed,t_edpar *edi,int nr_mdatoms, int ed
+     edi->nini=read_edint(in,&bEOF);
+     if (edi->nini != nr_mdatoms)
+         gmx_fatal(FARGS,"Nr of atoms in %s (%d) does not match nr of md atoms (%d)",
+-                ed->edinam,edi->nini,nr_mdatoms); 
++                ed->edinam,edi->nini,nr_mdatoms);
+ 
+     /* Done checking. For the rest we blindly trust the input */
+     edi->fitmas          = read_checked_edint(in,"FITMAS");
+@@ -1467,6 +1515,10 @@ static int read_edi(FILE* in, gmx_edsam_t ed,t_edpar *edi,int nr_mdatoms, int ed
+     edi->flood.alpha2    = read_checked_edreal(in,"ALPHA2");
+     edi->flood.kT        = read_checked_edreal(in,"KT");
+     edi->flood.bHarmonic = read_checked_edint(in,"HARMONIC");
++    if (readmagic > 669)
++        edi->flood.bConstForce = read_checked_edint(in,"CONST_FORCE_FLOODING");
++    else
++        edi->flood.bConstForce = FALSE;
+     edi->flood.flood_id  = edi_nr;
+     edi->sref.nr         = read_checked_edint(in,"NREF");
+ 
+@@ -1512,7 +1564,7 @@ static int read_edi(FILE* in, gmx_edsam_t ed,t_edpar *edi,int nr_mdatoms, int ed
+         edi->sori.sqrtm    =NULL;
+         read_edx(in,edi->sori.nr,edi->sori.anrs,edi->sori.x);
+     }
+-    
++
+     /* all done */
+     return 1;
+ }
+@@ -1522,18 +1574,18 @@ static int read_edi(FILE* in, gmx_edsam_t ed,t_edpar *edi,int nr_mdatoms, int ed
+ /* Read in the edi input file. Note that it may contain several ED data sets which were
+  * achieved by concatenating multiple edi files. The standard case would be a single ED
+  * data set, though. */
+-static void read_edi_file(gmx_edsam_t ed, t_edpar *edi, int nr_mdatoms, t_commrec *cr) 
++static void read_edi_file(gmx_edsam_t ed, t_edpar *edi, int nr_mdatoms, t_commrec *cr)
+ {
+     FILE    *in;
+     t_edpar *curr_edi,*last_edi;
+     t_edpar *edi_read;
+     int     edi_nr = 0;
+ 
+-    
++
+     /* This routine is executed on the master only */
+ 
+     /* Open the .edi parameter input file */
+-    in = gmx_fio_fopen(ed->edinam,"r");  
++    in = gmx_fio_fopen(ed->edinam,"r");
+     fprintf(stderr, "ED: Reading edi file %s\n", ed->edinam);
+ 
+     /* Now read a sequence of ED input parameter sets from the edi file */
+@@ -1544,7 +1596,7 @@ static void read_edi_file(gmx_edsam_t ed, t_edpar *edi, int nr_mdatoms, t_commre
+         edi_nr++;
+         /* Make shure that the number of atoms in each dataset is the same as in the tpr file */
+         if (edi->nini != nr_mdatoms)
+-            gmx_fatal(FARGS,"edi file %s (dataset #%d) was made for %d atoms, but the simulation contains %d atoms.", 
++            gmx_fatal(FARGS,"edi file %s (dataset #%d) was made for %d atoms, but the simulation contains %d atoms.",
+                     ed->edinam, edi_nr, edi->nini, nr_mdatoms);
+         /* Since we arrived within this while loop we know that there is still another data set to be read in */
+         /* We need to allocate space for the data: */
+@@ -1555,15 +1607,15 @@ static void read_edi_file(gmx_edsam_t ed, t_edpar *edi, int nr_mdatoms, t_commre
+         last_edi = curr_edi;
+         /* Let's prepare to read in the next edi data set: */
+         curr_edi = edi_read;
+-    }    
+-    if (edi_nr == 0) 
++    }
++    if (edi_nr == 0)
+         gmx_fatal(FARGS, "No complete ED data set found in edi file %s.", ed->edinam);
+ 
+     /* Terminate the edi dataset list with a NULL pointer: */
+     last_edi->next_edi = NULL;
+ 
+     fprintf(stderr, "ED: Found %d ED dataset%s.\n", edi_nr, edi_nr>1? "s" : "");
+-    
++
+     /* Close the .edi file again */
+     gmx_fio_fclose(in);
+ }
+@@ -1573,19 +1625,19 @@ struct t_fit_to_ref {
+     rvec *xcopy;       /* Working copy of the positions in fit_to_reference */
+ };
+ 
+-/* Fit the current positions to the reference positions 
++/* Fit the current positions to the reference positions
+  * Do not actually do the fit, just return rotation and translation.
+- * Note that the COM of the reference structure was already put into 
++ * Note that the COM of the reference structure was already put into
+  * the origin by init_edi. */
+ static void fit_to_reference(rvec      *xcoll,    /* The positions to be fitted */
+-                             rvec      transvec,  /* The translation vector */ 
++                             rvec      transvec,  /* The translation vector */
+                              matrix    rotmat,    /* The rotation matrix */
+                              t_edpar   *edi)      /* Just needed for do_edfit */
+ {
+     rvec com;          /* center of mass */
+     int  i;
+     struct t_fit_to_ref *loc;
+-    
++
+ 
+     GMX_MPE_LOG(ev_fit_to_reference_start);
+ 
+@@ -1596,7 +1648,7 @@ static void fit_to_reference(rvec      *xcoll,    /* The positions to be fitted
+         snew(edi->buf->fit_to_ref->xcopy, edi->sref.nr);
+     }
+     loc = edi->buf->fit_to_ref;
+- 
++
+     /* We do not touch the original positions but work on a copy. */
+     for (i=0; i<edi->sref.nr; i++)
+         copy_rvec(xcoll[i], loc->xcopy[i]);
+@@ -1620,7 +1672,7 @@ static void fit_to_reference(rvec      *xcoll,    /* The positions to be fitted
+ 
+ static void translate_and_rotate(rvec *x,         /* The positions to be translated and rotated */
+                                  int nat,         /* How many positions are there? */
+-                                 rvec transvec,   /* The translation vector */ 
++                                 rvec transvec,   /* The translation vector */
+                                  matrix rotmat)   /* The rotation matrix */
+ {
+     /* Translation */
+@@ -1633,7 +1685,7 @@ static void translate_and_rotate(rvec *x,         /* The positions to be transla
+ 
+ /* Gets the rms deviation of the positions to the structure s */
+ /* fit_to_structure has to be called before calling this routine! */
+-static real rmsd_from_structure(rvec           *x,  /* The positions under consideration */ 
++static real rmsd_from_structure(rvec           *x,  /* The positions under consideration */
+                                 struct gmx_edx *s)  /* The structure from which the rmsd shall be computed */
+ {
+     real  rmsd=0.0;
+@@ -1654,7 +1706,7 @@ void dd_make_local_ed_indices(gmx_domdec_t *dd, struct gmx_edsam *ed)
+ {
+     t_edpar *edi;
+ 
+-    
++
+     if (ed->eEDtype != eEDnone)
+     {
+         /* Loop over ED datasets (usually there is just one dataset, though) */
+@@ -1666,15 +1718,15 @@ void dd_make_local_ed_indices(gmx_domdec_t *dd, struct gmx_edsam *ed)
+             if (!edi->bRefEqAv)
+                 dd_make_local_group_indices(dd->ga2la, edi->sref.nr, edi->sref.anrs,
+                         &edi->sref.nr_loc, &edi->sref.anrs_loc, &edi->sref.nalloc_loc, edi->sref.c_ind);
+-            
++
+             /* Local atoms of the average structure (on these ED will be performed) */
+             dd_make_local_group_indices(dd->ga2la, edi->sav.nr, edi->sav.anrs,
+                     &edi->sav.nr_loc, &edi->sav.anrs_loc, &edi->sav.nalloc_loc, edi->sav.c_ind);
+ 
+-            /* Indicate that the ED shift vectors for this structure need to be updated 
++            /* Indicate that the ED shift vectors for this structure need to be updated
+              * at the next call to communicate_group_positions, since obviously we are in a NS step */
+             edi->buf->do_edsam->bUpdateShifts = TRUE;
+-            
++
+             /* Set the pointer to the next ED dataset (if any) */
+             edi=edi->next_edi;
+         }
+@@ -1694,7 +1746,7 @@ static inline void ed_unshift_single_coord(matrix box, const rvec x, const ivec
+     tz=is[ZZ];
+ 
+     if(TRICLINIC(box))
+-    {        
++    {
+         xu[XX] = x[XX]-tx*box[XX][XX]-ty*box[YY][XX]-tz*box[ZZ][XX];
+         xu[YY] = x[YY]-ty*box[YY][YY]-tz*box[ZZ][YY];
+         xu[ZZ] = x[ZZ]-tz*box[ZZ][ZZ];
+@@ -1783,7 +1835,7 @@ static void do_radfix(rvec *xcoll, t_edpar *edi, int step, t_commrec *cr)
+     rvec vec_dum;
+ 
+ 
+-    if (edi->vecs.radfix.neig == 0) 
++    if (edi->vecs.radfix.neig == 0)
+         return;
+ 
+     snew(proj, edi->vecs.radfix.neig);
+@@ -1825,7 +1877,7 @@ static void do_radacc(rvec *xcoll, t_edpar *edi, t_commrec *cr)
+     rvec vec_dum;
+ 
+ 
+-    if (edi->vecs.radacc.neig == 0) 
++    if (edi->vecs.radacc.neig == 0)
+         return;
+ 
+     snew(proj,edi->vecs.radacc.neig);
+@@ -1845,7 +1897,7 @@ static void do_radacc(rvec *xcoll, t_edpar *edi, t_commrec *cr)
+         ratio = edi->vecs.radacc.radius/rad - 1.0;
+         rad   = edi->vecs.radacc.radius;
+     }
+-    else 
++    else
+         edi->vecs.radacc.radius = rad;
+ 
+     /* loop over radacc vectors */
+@@ -1861,7 +1913,7 @@ static void do_radacc(rvec *xcoll, t_edpar *edi, t_commrec *cr)
+             svmul(proj[i], edi->vecs.radacc.vec[i][j], vec_dum);
+             rvec_inc(xcoll[j], vec_dum);
+         }
+-    }  
++    }
+     sfree(proj);
+ }
+ 
+@@ -1883,7 +1935,7 @@ static void do_radcon(rvec *xcoll, t_edpar *edi, t_commrec *cr)
+     {
+         bFirst = FALSE;
+         loc    = edi->buf->do_radcon;
+-    } 
++    }
+     else
+     {
+         bFirst = TRUE;
+@@ -1891,7 +1943,7 @@ static void do_radcon(rvec *xcoll, t_edpar *edi, t_commrec *cr)
+     }
+     loc = edi->buf->do_radcon;
+ 
+-    if (edi->vecs.radcon.neig == 0) 
++    if (edi->vecs.radcon.neig == 0)
+         return;
+ 
+     if (bFirst)
+@@ -1917,7 +1969,7 @@ static void do_radcon(rvec *xcoll, t_edpar *edi, t_commrec *cr)
+             loc->proj[i] -= edi->vecs.radcon.refproj[i];
+             loc->proj[i] /= edi->sav.sqrtm[i];
+             loc->proj[i] *= ratio;
+-            
++
+             for (j=0; j<edi->sav.nr; j++)
+             {
+                 svmul(loc->proj[i], edi->vecs.radcon.vec[i][j], vec_dum);
+@@ -1954,16 +2006,16 @@ static void ed_apply_constraints(rvec *xcoll, t_edpar *edi, gmx_large_int_t step
+         rvec_dec(xcoll[i], edi->sav.x[i]);
+ 
+     /* apply the constraints */
+-    if (step >= 0) 
++    if (step >= 0)
+         do_linfix(xcoll, edi, step, cr);
+     do_linacc(xcoll, edi, cr);
+-    if (step >= 0) 
++    if (step >= 0)
+         do_radfix(xcoll, edi, step, cr);
+     do_radacc(xcoll, edi, cr);
+     do_radcon(xcoll, edi, cr);
+ 
+     /* add back the average positions */
+-    for (i=0; i<edi->sav.nr; i++) 
++    for (i=0; i<edi->sav.nr; i++)
+         rvec_inc(xcoll[i], edi->sav.x[i]);
+ 
+     GMX_MPE_LOG(ev_ed_apply_cons_finish);
+@@ -1972,11 +2024,11 @@ static void ed_apply_constraints(rvec *xcoll, t_edpar *edi, gmx_large_int_t step
+ 
+ /* Write out the projections onto the eigenvectors */
+ static void write_edo(int nr_edi, t_edpar *edi, gmx_edsam_t ed, gmx_large_int_t step,real rmsd)
+-{  
++{
+     int i;
+     char buf[22];
+ 
+-       
++
+     if (edi->bNeedDoEdsam)
+     {
+         if (step == -1)
+@@ -1985,8 +2037,6 @@ static void write_edo(int nr_edi, t_edpar *edi, gmx_edsam_t ed, gmx_large_int_t
+         {
+             fprintf(ed->edo,"Step %s, ED #%d  ", gmx_step_str(step, buf), nr_edi);
+             fprintf(ed->edo,"  RMSD %f nm\n",rmsd);
+-            if (ed->eEDtype == eEDflood)
+-                fprintf(ed->edo, "  Efl=%f  deltaF=%f  Vfl=%f\n",edi->flood.Efl,edi->flood.deltaF,edi->flood.Vfl);
+         }
+ 
+         if (edi->vecs.mon.neig)
+@@ -2039,13 +2089,13 @@ static void write_edo(int nr_edi, t_edpar *edi, gmx_edsam_t ed, gmx_large_int_t
+ 
+ /* Returns if any constraints are switched on */
+ static int ed_constraints(gmx_bool edtype, t_edpar *edi)
+-{ 
+-    if (edtype == eEDedsam || edtype == eEDflood) 
++{
++    if (edtype == eEDedsam || edtype == eEDflood)
+     {
+-        return (edi->vecs.linfix.neig || edi->vecs.linacc.neig || 
+-                edi->vecs.radfix.neig || edi->vecs.radacc.neig ||  
++        return (edi->vecs.linfix.neig || edi->vecs.linacc.neig ||
++                edi->vecs.radfix.neig || edi->vecs.radacc.neig ||
+                 edi->vecs.radcon.neig);
+-    } 
++    }
+     return 0;
+ }
+ 
+@@ -2065,7 +2115,7 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+     rvec    *xstart = NULL; /* the positions which are subject to ED sampling */
+     rvec    fit_transvec;   /* translation ... */
+     matrix  fit_rotmat;     /* ... and rotation from fit to reference structure */
+-       
++
+ 
+     if (!DOMAINDECOMP(cr) && PAR(cr) && MASTER(cr))
+         gmx_fatal(FARGS, "Please switch on domain decomposition to use essential dynamics in parallel.");
+@@ -2074,7 +2124,7 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+ 
+     if (MASTER(cr))
+         fprintf(stderr, "ED: Initializing essential dynamics constraints.\n");
+-    
++
+     /* Needed for initializing radacc radius in do_edsam */
+     ed->bFirst = 1;
+ 
+@@ -2087,15 +2137,15 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+         /* Read the whole edi file at once: */
+         read_edi_file(ed,ed->edpar,mtop->natoms,cr);
+ 
+-        /* Initialization for every ED/flooding dataset. Flooding uses one edi dataset per 
++        /* Initialization for every ED/flooding dataset. Flooding uses one edi dataset per
+          * flooding vector, Essential dynamics can be applied to more than one structure
+-         * as well, but will be done in the order given in the edi file, so 
++         * as well, but will be done in the order given in the edi file, so
+          * expect different results for different order of edi file concatenation! */
+         edi=ed->edpar;
+         while(edi != NULL)
+         {
+             init_edi(mtop,ir,cr,ed,edi);
+-            
++
+             /* Init flooding parameters if needed */
+             init_flood(edi,ed,ir->delta_t,cr);
+ 
+@@ -2104,7 +2154,7 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+         }
+     }
+ 
+-    /* The master does the work here. The other nodes get the positions 
++    /* The master does the work here. The other nodes get the positions
+      * not before dd_partition_system which is called after init_edsam */
+     if (MASTER(cr))
+     {
+@@ -2117,11 +2167,11 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+ 
+         /* Reset pointer to first ED data set which contains the actual ED data */
+         edi=ed->edpar;
+-        
++
+         /* Loop over all ED/flooding data sets (usually only one, though) */
+         for (nr_edi = 1; nr_edi <= numedis; nr_edi++)
+         {
+-            /* We use srenew to allocate memory since the size of the buffers 
++            /* We use srenew to allocate memory since the size of the buffers
+              * is likely to change with every ED dataset */
+             srenew(xfit  , edi->sref.nr );
+             srenew(xstart, edi->sav.nr  );
+@@ -2130,29 +2180,29 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+             for (i=0; i < edi->sref.nr; i++)
+             {
+                 copy_rvec(x_pbc[edi->sref.anrs[i]], xfit[i]);
+-                
+-                /* Save the sref positions such that in the next time step the molecule can 
++
++                /* Save the sref positions such that in the next time step the molecule can
+                  * be made whole again (in the parallel case) */
+                 if (PAR(cr))
+                     copy_rvec(xfit[i], edi->sref.x_old[i]);
+             }
+-            
++
+             /* Extract the positions of the atoms subject to ED sampling */
+             for (i=0; i < edi->sav.nr; i++)
+             {
+                 copy_rvec(x_pbc[edi->sav.anrs[i]], xstart[i]);
+ 
+-                /* Save the sav positions such that in the next time step the molecule can 
++                /* Save the sav positions such that in the next time step the molecule can
+                  * be made whole again (in the parallel case) */
+                 if (PAR(cr))
+                     copy_rvec(xstart[i], edi->sav.x_old[i]);
+             }
+-            
++
+             /* Make the fit to the REFERENCE structure, get translation and rotation */
+             fit_to_reference(xfit, fit_transvec, fit_rotmat, edi);
+ 
+             /* Output how well we fit to the reference at the start */
+-            translate_and_rotate(xfit, edi->sref.nr, fit_transvec, fit_rotmat);        
++            translate_and_rotate(xfit, edi->sref.nr, fit_transvec, fit_rotmat);
+             fprintf(stderr, "ED: Initial RMSD from reference after fit = %f nm (dataset #%d)\n",
+                     rmsd_from_structure(xfit, &edi->sref), nr_edi);
+ 
+@@ -2175,7 +2225,7 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+                 rad_project(edi, xstart, &edi->vecs.radcon, cr);
+ 
+             /* process structure that will serve as origin of expansion circle */
+-            if (eEDflood == ed->eEDtype)
++            if ( (eEDflood == ed->eEDtype) && (FALSE == edi->flood.bConstForce) )
+                 fprintf(stderr, "ED: Setting center of flooding potential (0 = average structure)\n");
+             if (edi->sori.nr > 0)
+             {
+@@ -2186,7 +2236,7 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+                 translate_and_rotate(edi->sori.x, edi->sav.nr, fit_transvec, fit_rotmat);
+                 rad_project(edi, edi->sori.x, &edi->vecs.radacc, cr);
+                 rad_project(edi, edi->sori.x, &edi->vecs.radfix, cr);
+-                if (ed->eEDtype == eEDflood) 
++                if ( (eEDflood == ed->eEDtype) && (FALSE == edi->flood.bConstForce) )
+                 {
+                     fprintf(stderr, "ED: The ORIGIN structure will define the flooding potential center.\n");
+                     /* Set center of flooding potential to the ORIGIN structure */
+@@ -2197,7 +2247,7 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+             {
+                 rad_project(edi, xstart, &edi->vecs.radacc, cr);
+                 rad_project(edi, xstart, &edi->vecs.radfix, cr);
+-                if (ed->eEDtype == eEDflood)
++                if ( (eEDflood == ed->eEDtype) && (FALSE == edi->flood.bConstForce) )
+                 {
+                     if (edi->flood.bHarmonic)
+                     {
+@@ -2216,12 +2266,14 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+                 }
+             }
+             /* For convenience, output the center of the flooding potential for the eigenvectors */
+-            if (eEDflood == ed->eEDtype)
++            if ( (eEDflood == ed->eEDtype) && (FALSE == edi->flood.bConstForce) )
+             {
+                 for (i=0; i<edi->flood.vecs.neig; i++)
+                 {
+-                    fprintf(stdout, "ED: EV %d flooding potential center: %11.4e (adding %11.4e/timestep)\n",
+-                            i, edi->flood.vecs.refproj[i], edi->flood.vecs.refprojslope[i]);
++                    fprintf(stdout, "ED: EV %d flooding potential center: %11.4e", i, edi->flood.vecs.refproj[i]);
++                    if (edi->flood.bHarmonic)
++                        fprintf(stdout, " (adding %11.4e/timestep)", edi->flood.vecs.refprojslope[i]);
++                    fprintf(stdout, "\n");
+                 }
+             }
+ 
+@@ -2234,15 +2286,15 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+                 write_edo(nr_edi, edi, ed, -1, 0);
+ 
+             /* Prepare for the next edi data set: */
+-            edi=edi->next_edi;            
++            edi=edi->next_edi;
+         }
+         /* Cleaning up on the master node: */
+         sfree(x_pbc);
+         sfree(xfit);
+         sfree(xstart);
+-      
++
+     } /* end of MASTER only section */
+-    
++
+     if (PAR(cr))
+     {
+         /* First let everybody know how many ED data sets to expect */
+@@ -2252,9 +2304,9 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+     }
+     else
+     {
+-        /* In the single-CPU case, point the local atom numbers pointers to the global 
++        /* In the single-CPU case, point the local atom numbers pointers to the global
+          * one, so that we can use the same notation in serial and parallel case: */
+-        
++
+         /* Loop over all ED data sets (usually only one, though) */
+         edi=ed->edpar;
+         for (nr_edi = 1; nr_edi <= numedis; nr_edi++)
+@@ -2302,8 +2354,8 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+ 
+         /* Collective positions of atoms with the average indices */
+         snew(edi->buf->do_edsam->xcoll                  , edi->sav.nr);
+-        snew(edi->buf->do_edsam->shifts_xcoll           , edi->sav.nr); /* buffer for xcoll shifts */ 
+-        snew(edi->buf->do_edsam->extra_shifts_xcoll     , edi->sav.nr); 
++        snew(edi->buf->do_edsam->shifts_xcoll           , edi->sav.nr); /* buffer for xcoll shifts */
++        snew(edi->buf->do_edsam->extra_shifts_xcoll     , edi->sav.nr);
+         /* Collective positions of atoms with the reference indices */
+         if (!edi->bRefEqAv)
+         {
+@@ -2311,7 +2363,7 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+             snew(edi->buf->do_edsam->shifts_xc_ref      , edi->sref.nr); /* To store the shifts in */
+             snew(edi->buf->do_edsam->extra_shifts_xc_ref, edi->sref.nr);
+         }
+-        
++
+         /* Get memory for flooding forces */
+         snew(edi->flood.forces_cartesian                , edi->sav.nr);
+ 
+@@ -2323,8 +2375,8 @@ void init_edsam(gmx_mtop_t  *mtop,   /* global topology                    */
+         /* An on we go to the next edi dataset */
+         edi=edi->next_edi;
+     }
+-    
+-    /* Flush the edo file so that the user can check some things 
++
++    /* Flush the edo file so that the user can check some things
+      * when the simulation has started */
+     if (ed->edo)
+         fflush(ed->edo);
+@@ -2361,11 +2413,11 @@ void do_edsam(t_inputrec  *ir,
+      * two-step sd2 integrator is used */
+     if ( (ir->eI==eiSD2) && (v != NULL) )
+         bSuppress = TRUE;
+-    
++
+     dt_1 = 1.0/ir->delta_t;
+-    
++
+     /* Loop over all ED datasets (usually one) */
+-    edi  = ed->edpar;  
++    edi  = ed->edpar;
+     edinr = 0;
+     while (edi != NULL)
+     {
+@@ -2379,29 +2431,29 @@ void do_edsam(t_inputrec  *ir,
+                 /* initialise radacc radius for slope criterion */
+                 buf->oldrad=calc_radius(&edi->vecs.radacc);
+ 
+-            /* Copy the positions into buf->xc* arrays and after ED 
++            /* Copy the positions into buf->xc* arrays and after ED
+              * feed back corrections to the official positions */
+ 
+             /* Broadcast the ED positions such that every node has all of them
+              * Every node contributes its local positions xs and stores it in
+              * the collective buf->xcoll array. Note that for edinr > 1
+              * xs could already have been modified by an earlier ED */
+-            
+-            communicate_group_positions(cr, buf->xcoll, buf->shifts_xcoll, buf->extra_shifts_xcoll, buf->bUpdateShifts, xs, 
+-                    edi->sav.nr, edi->sav.nr_loc, edi->sav.anrs_loc, edi->sav.c_ind, edi->sav.x_old,  box);  
++
++            communicate_group_positions(cr, buf->xcoll, buf->shifts_xcoll, buf->extra_shifts_xcoll, buf->bUpdateShifts, xs,
++                    edi->sav.nr, edi->sav.nr_loc, edi->sav.anrs_loc, edi->sav.c_ind, edi->sav.x_old,  box);
+ 
+ #ifdef DEBUG_ED
+             dump_xcoll(edi, buf, cr, step);
+ #endif
+             /* Only assembly reference positions if their indices differ from the average ones */
+             if (!edi->bRefEqAv)
+-                communicate_group_positions(cr, buf->xc_ref, buf->shifts_xc_ref, buf->extra_shifts_xc_ref, buf->bUpdateShifts, xs, 
++                communicate_group_positions(cr, buf->xc_ref, buf->shifts_xc_ref, buf->extra_shifts_xc_ref, buf->bUpdateShifts, xs,
+                         edi->sref.nr, edi->sref.nr_loc, edi->sref.anrs_loc, edi->sref.c_ind, edi->sref.x_old, box);
+-            
++
+             /* If bUpdateShifts was TRUE then the shifts have just been updated in get_positions.
+              * We do not need to uptdate the shifts until the next NS step */
+             buf->bUpdateShifts = FALSE;
+-            
++
+             /* Now all nodes have all of the ED positions in edi->sav->xcoll,
+              * as well as the indices in edi->sav.anrs */
+ 
+@@ -2410,7 +2462,7 @@ void do_edsam(t_inputrec  *ir,
+                 fit_to_reference(buf->xcoll , transvec, rotmat, edi);
+             else
+                 fit_to_reference(buf->xc_ref, transvec, rotmat, edi);
+-            
++
+             /* Now apply the translation and rotation to the ED structure */
+             translate_and_rotate(buf->xcoll, edi->sav.nr, transvec, rotmat);
+ 
+@@ -2419,7 +2471,7 @@ void do_edsam(t_inputrec  *ir,
+             {
+                 if (edi->bRefEqAv)
+                 {
+-                    /* Indices of reference and average structures are identical, 
++                    /* Indices of reference and average structures are identical,
+                      * thus we can calculate the rmsd to SREF using xcoll */
+                     rmsdev = rmsd_from_structure(buf->xcoll,&edi->sref);
+                 }
+@@ -2468,7 +2520,7 @@ void do_edsam(t_inputrec  *ir,
+                 if (MASTER(cr) && !bSuppress)
+                     write_edo(edinr, edi, ed, step, rmsdev);
+             }
+-            
++
+             /* Copy back the positions unless monitoring only */
+             if (ed_constraints(ed->eEDtype, edi))
+             {
+@@ -2476,17 +2528,17 @@ void do_edsam(t_inputrec  *ir,
+                 rmfit(edi->sav.nr, buf->xcoll, transvec, rotmat);
+ 
+                 /* Copy the ED corrected positions into the coordinate array */
+-                /* Each node copies its local part. In the serial case, nat_loc is the 
++                /* Each node copies its local part. In the serial case, nat_loc is the
+                  * total number of ED atoms */
+                 for (i=0; i<edi->sav.nr_loc; i++)
+                 {
+                     /* Unshift local ED coordinate and store in x_unsh */
+-                    ed_unshift_single_coord(box, buf->xcoll[edi->sav.c_ind[i]], 
++                    ed_unshift_single_coord(box, buf->xcoll[edi->sav.c_ind[i]],
+                                             buf->shifts_xcoll[edi->sav.c_ind[i]], x_unsh);
+-                    
++
+                     /* dx is the ED correction to the positions: */
+                     rvec_sub(x_unsh, xs[edi->sav.anrs_loc[i]], dx);
+-                    
++
+                     if (v != NULL)
+                     {
+                         /* dv is the ED correction to the velocity: */
+@@ -2499,10 +2551,10 @@ void do_edsam(t_inputrec  *ir,
+                 }
+             }
+         } /* END of if (edi->bNeedDoEdsam) */
+-        
++
+         /* Prepare for the next ED dataset */
+         edi = edi->next_edi;
+-        
++
+     } /* END of loop over ED datasets */
+ 
+     ed->bFirst = FALSE;
+diff --git a/src/mdlib/iteratedconstraints.c b/src/mdlib/iteratedconstraints.c
+new file mode 100644
+index 0000000..d0cd8b4
+--- /dev/null
++++ b/src/mdlib/iteratedconstraints.c
+@@ -0,0 +1,232 @@
++/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
++ *
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.2.0
++ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
++ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
++ * Copyright (c) 2001-2004, The GROMACS development team,
++ * check out http://www.gromacs.org for more information.
++
++ * 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:
++ * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
++ */
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#if ((defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __CYGWIN__ && !defined __CYGWIN32__)
++/* _isnan() */
++#include <float.h>
++#endif
++
++#include "typedefs.h"
++#include "gmx_fatal.h"
++#include "mdrun.h"
++
++#ifdef GMX_DOUBLE
++#define CONVERGEITER  0.000000001
++#define CLOSE_ENOUGH  0.000001000
++#else
++#define CONVERGEITER  0.0001
++#define CLOSE_ENOUGH  0.0050
++#endif
++
++/* we want to keep track of the close calls.  If there are too many, there might be some other issues.
++   so we make sure that it's either less than some predetermined number, or if more than that number,
++   only some small fraction of the total. */
++#define MAX_NUMBER_CLOSE        50
++#define FRACTION_CLOSE       0.001
++  
++/* maximum length of cyclic traps to check, emerging from limited numerical precision  */
++#define CYCLEMAX            20
++
++void gmx_iterate_init(gmx_iterate_t *iterate,gmx_bool bIterate)
++{
++    int i;
++
++    iterate->iter_i = 0;
++    iterate->bIterate = bIterate;
++    iterate->num_close = 0;
++    for (i=0;i<MAXITERCONST+2;i++) 
++    {
++        iterate->allrelerr[i] = 0;
++    }
++}
++
++gmx_bool done_iterating(const t_commrec *cr,FILE *fplog, int nsteps, gmx_iterate_t *iterate, gmx_bool bFirstIterate, real fom, real *newf) 
++{    
++    /* monitor convergence, and use a secant search to propose new
++       values.  
++                                                                  x_{i} - x_{i-1}
++       The secant method computes x_{i+1} = x_{i} - f(x_{i}) * ---------------------
++                                                                f(x_{i}) - f(x_{i-1})
++       
++       The function we are trying to zero is fom-x, where fom is the
++       "figure of merit" which is the pressure (or the veta value) we
++       would get by putting in an old value of the pressure or veta into
++       the incrementor function for the step or half step.  I have
++       verified that this gives the same answer as self consistent
++       iteration, usually in many fewer steps, especially for small tau_p.
++       
++       We could possibly eliminate an iteration with proper use
++       of the value from the previous step, but that would take a bit
++       more bookkeeping, especially for veta, since tests indicate the
++       function of veta on the last step is not sufficiently close to
++       guarantee convergence this step. This is
++       good enough for now.  On my tests, I could use tau_p down to
++       0.02, which is smaller that would ever be necessary in
++       practice. Generally, 3-5 iterations will be sufficient */
++
++    real relerr,err,xmin;
++    char buf[256];
++    int i;
++    gmx_bool incycle;
++    
++    if (bFirstIterate) 
++    {
++        iterate->x = fom;
++        iterate->f = fom-iterate->x;
++        iterate->xprev = 0;
++        iterate->fprev = 0;
++        *newf = fom;
++    } 
++    else 
++    {
++        iterate->f = fom-iterate->x; /* we want to zero this difference */
++        if ((iterate->iter_i > 1) && (iterate->iter_i < MAXITERCONST)) 
++        {
++            if (iterate->f==iterate->fprev) 
++            {
++                *newf = iterate->f;
++            } 
++            else 
++            {
++                *newf = iterate->x - (iterate->x-iterate->xprev)*(iterate->f)/(iterate->f-iterate->fprev); 
++            }
++        } 
++        else 
++        {
++            /* just use self-consistent iteration the first step to initialize, or 
++               if it's not converging (which happens occasionally -- need to investigate why) */
++            *newf = fom; 
++        }
++    }
++    /* Consider a slight shortcut allowing us to exit one sooner -- we check the
++       difference between the closest of x and xprev to the new
++       value. To be 100% certain, we should check the difference between
++       the last result, and the previous result, or
++       
++       relerr = (fabs((x-xprev)/fom));
++       
++       but this is pretty much never necessary under typical conditions.
++       Checking numerically, it seems to lead to almost exactly the same
++       trajectories, but there are small differences out a few decimal
++       places in the pressure, and eventually in the v_eta, but it could
++       save an interation.
++       
++       if (fabs(*newf-x) < fabs(*newf - xprev)) { xmin = x;} else { xmin = xprev;}
++       relerr = (fabs((*newf-xmin) / *newf));
++    */
++    
++    err = fabs((iterate->f-iterate->fprev));
++    relerr = fabs(err/fom);
++
++    iterate->allrelerr[iterate->iter_i] = relerr;
++    
++    if (iterate->iter_i > 0) 
++    {
++        if (debug) 
++        {
++            fprintf(debug,"Iterating NPT constraints: %6i %20.12f%14.6g%20.12f\n",
++                    iterate->iter_i,fom,relerr,*newf);
++        }
++        
++        if ((relerr < CONVERGEITER) || (err < CONVERGEITER) || (fom==0) || ((iterate->x == iterate->xprev) && iterate->iter_i > 1))
++        {
++            iterate->bIterate = FALSE;
++            if (debug) 
++            {
++                fprintf(debug,"Iterating NPT constraints: CONVERGED\n");
++            }
++            return TRUE;
++        }
++        if (iterate->iter_i > MAXITERCONST)
++        {
++            if (relerr < CLOSE_ENOUGH)
++            {
++                incycle = FALSE;
++                for (i=1;i<CYCLEMAX;i++) {
++                    if ((iterate->allrelerr[iterate->iter_i-(1+i)] == iterate->allrelerr[iterate->iter_i-1]) &&
++                        (iterate->allrelerr[iterate->iter_i-(1+i)] == iterate->allrelerr[iterate->iter_i-(1+2*i)])) {
++                        incycle = TRUE;
++                        if (debug) 
++                        {
++                            fprintf(debug,"Exiting from an NPT iterating cycle of length %d\n",i);
++                        }
++                        break;
++                    }
++                }
++                
++                if (incycle) {
++                    /* step 1: trapped in a numerical attractor */
++                    /* we are trapped in a numerical attractor, and can't converge any more, and are close to the final result.
++                       Better to give up convergence here than have the simulation die.
++                    */
++                    iterate->num_close++;
++                    return TRUE;
++                } 
++                else 
++                {
++                    /* Step #2: test if we are reasonably close for other reasons, then monitor the number.  If not, die */
++                    
++                    /* how many close calls have we had?  If less than a few, we're OK */
++                    if (iterate->num_close < MAX_NUMBER_CLOSE) 
++                    {
++                        sprintf(buf,"Slight numerical convergence deviation with NPT at step %d, relative error only %10.5g, likely not a problem, continuing\n",nsteps,relerr);
++                        md_print_warning(cr,fplog,buf);
++                        iterate->num_close++;
++                        return TRUE;
++                        /* if more than a few, check the total fraction.  If too high, die. */
++                    } else if (iterate->num_close/(double)nsteps > FRACTION_CLOSE) {
++                        gmx_fatal(FARGS,"Could not converge NPT constraints, too many exceptions (%d%%\n",iterate->num_close/(double)nsteps);
++                    } 
++                }
++            }
++            else 
++            {
++                gmx_fatal(FARGS,"Could not converge NPT constraints\n");
++            }
++        }
++    }
++    
++    iterate->xprev = iterate->x;
++    iterate->x = *newf;
++    iterate->fprev = iterate->f;
++    iterate->iter_i++;
++    
++    return FALSE;
++}
++
+diff --git a/src/mdlib/md_support.c b/src/mdlib/md_support.c
+new file mode 100644
+index 0000000..7551a76
+--- /dev/null
++++ b/src/mdlib/md_support.c
+@@ -0,0 +1,748 @@
++/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
++ *
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.2.0
++ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
++ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
++ * Copyright (c) 2001-2004, The GROMACS development team,
++ * check out http://www.gromacs.org for more information.
++
++ * 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:
++ * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
++ */
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#if ((defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __CYGWIN__ && !defined __CYGWIN32__)
++/* _isnan() */
++#include <float.h>
++#endif
++
++#include "typedefs.h"
++#include "string2.h"
++#include "smalloc.h"
++#include "mdrun.h"
++#include "domdec.h"
++#include "mtop_util.h"
++#include "gmx_wallcycle.h"
++#include "vcm.h"
++#include "nrnb.h"
++
++/* Is the signal in one simulation independent of other simulations? */
++gmx_bool gs_simlocal[eglsNR] = { TRUE, FALSE, FALSE, TRUE };
++
++/* check which of the multisim simulations has the shortest number of
++   steps and return that number of nsteps */
++gmx_large_int_t get_multisim_nsteps(const t_commrec *cr,
++                                    gmx_large_int_t nsteps)
++{
++    gmx_large_int_t steps_out;
++
++    if MASTER(cr)
++    {
++        gmx_large_int_t *buf;
++        int s;
++
++        snew(buf,cr->ms->nsim);
++
++        buf[cr->ms->sim] = nsteps;
++        gmx_sumli_sim(cr->ms->nsim, buf, cr->ms);
++
++        steps_out=-1;
++        for(s=0; s<cr->ms->nsim; s++)
++        {
++            /* find the smallest positive number */
++            if (buf[s]>= 0 && ((steps_out < 0) || (buf[s]<steps_out)) )
++            {
++                steps_out=buf[s];
++            }
++        }
++        sfree(buf);
++
++        /* if we're the limiting simulation, don't do anything */
++        if (steps_out>=0 && steps_out<nsteps) 
++        {
++            char strbuf[255];
++            snprintf(strbuf, 255, "Will stop simulation %%d after %s steps (another simulation will end then).\n", gmx_large_int_pfmt);
++            fprintf(stderr, strbuf, cr->ms->sim, steps_out);
++        }
++    }
++    /* broadcast to non-masters */
++    gmx_bcast(sizeof(gmx_large_int_t), &steps_out, cr);
++    return steps_out;
++}
++
++int multisim_min(const gmx_multisim_t *ms,int nmin,int n)
++{
++    int  *buf;
++    gmx_bool bPos,bEqual;
++    int  s,d;
++
++    snew(buf,ms->nsim);
++    buf[ms->sim] = n;
++    gmx_sumi_sim(ms->nsim,buf,ms);
++    bPos   = TRUE;
++    bEqual = TRUE;
++    for(s=0; s<ms->nsim; s++)
++    {
++        bPos   = bPos   && (buf[s] > 0);
++        bEqual = bEqual && (buf[s] == buf[0]);
++    }
++    if (bPos)
++    {
++        if (bEqual)
++        {
++            nmin = min(nmin,buf[0]);
++        }
++        else
++        {
++            /* Find the least common multiple */
++            for(d=2; d<nmin; d++)
++            {
++                s = 0;
++                while (s < ms->nsim && d % buf[s] == 0)
++                {
++                    s++;
++                }
++                if (s == ms->nsim)
++                {
++                    /* We found the LCM and it is less than nmin */
++                    nmin = d;
++                    break;
++                }
++            }
++        }
++    }
++    sfree(buf);
++
++    return nmin;
++}
++
++int multisim_nstsimsync(const t_commrec *cr,
++                        const t_inputrec *ir,int repl_ex_nst)
++{
++    int nmin;
++
++    if (MASTER(cr))
++    {
++        nmin = INT_MAX;
++        nmin = multisim_min(cr->ms,nmin,ir->nstlist);
++        nmin = multisim_min(cr->ms,nmin,ir->nstcalcenergy);
++        nmin = multisim_min(cr->ms,nmin,repl_ex_nst);
++        if (nmin == INT_MAX)
++        {
++            gmx_fatal(FARGS,"Can not find an appropriate interval for inter-simulation communication, since nstlist, nstcalcenergy and -replex are all <= 0");
++        }
++        /* Avoid inter-simulation communication at every (second) step */
++        if (nmin <= 2)
++        {
++            nmin = 10;
++        }
++    }
++
++    gmx_bcast(sizeof(int),&nmin,cr);
++
++    return nmin;
++}
++
++void init_global_signals(globsig_t *gs,const t_commrec *cr,
++                         const t_inputrec *ir,int repl_ex_nst)
++{
++    int i;
++
++    if (MULTISIM(cr))
++    {
++        gs->nstms = multisim_nstsimsync(cr,ir,repl_ex_nst);
++        if (debug)
++        {
++            fprintf(debug,"Syncing simulations for checkpointing and termination every %d steps\n",gs->nstms);
++        }
++    }
++    else
++    {
++        gs->nstms = 1;
++    }
++
++    for(i=0; i<eglsNR; i++)
++    {
++        gs->sig[i] = 0;
++        gs->set[i] = 0;
++    }
++}
++
++void copy_coupling_state(t_state *statea,t_state *stateb, 
++                         gmx_ekindata_t *ekinda,gmx_ekindata_t *ekindb, t_grpopts* opts) 
++{
++    
++    /* MRS note -- might be able to get rid of some of the arguments.  Look over it when it's all debugged */
++    
++    int i,j,nc;
++
++    /* Make sure we have enough space for x and v */
++    if (statea->nalloc > stateb->nalloc)
++    {
++        stateb->nalloc = statea->nalloc;
++        srenew(stateb->x,stateb->nalloc);
++        srenew(stateb->v,stateb->nalloc);
++    }
++
++    stateb->natoms     = statea->natoms;
++    stateb->ngtc       = statea->ngtc;
++    stateb->nnhpres    = statea->nnhpres;
++    stateb->veta       = statea->veta;
++    if (ekinda) 
++    {
++        copy_mat(ekinda->ekin,ekindb->ekin);
++        for (i=0; i<stateb->ngtc; i++) 
++        {
++            ekindb->tcstat[i].T = ekinda->tcstat[i].T;
++            ekindb->tcstat[i].Th = ekinda->tcstat[i].Th;
++            copy_mat(ekinda->tcstat[i].ekinh,ekindb->tcstat[i].ekinh);
++            copy_mat(ekinda->tcstat[i].ekinf,ekindb->tcstat[i].ekinf);
++            ekindb->tcstat[i].ekinscalef_nhc =  ekinda->tcstat[i].ekinscalef_nhc;
++            ekindb->tcstat[i].ekinscaleh_nhc =  ekinda->tcstat[i].ekinscaleh_nhc;
++            ekindb->tcstat[i].vscale_nhc =  ekinda->tcstat[i].vscale_nhc;
++        }
++    }
++    copy_rvecn(statea->x,stateb->x,0,stateb->natoms);
++    copy_rvecn(statea->v,stateb->v,0,stateb->natoms);
++    copy_mat(statea->box,stateb->box);
++    copy_mat(statea->box_rel,stateb->box_rel);
++    copy_mat(statea->boxv,stateb->boxv);
++
++    for (i = 0; i<stateb->ngtc; i++) 
++    { 
++        nc = i*opts->nhchainlength;
++        for (j=0; j<opts->nhchainlength; j++) 
++        {
++            stateb->nosehoover_xi[nc+j]  = statea->nosehoover_xi[nc+j];
++            stateb->nosehoover_vxi[nc+j] = statea->nosehoover_vxi[nc+j];
++        }
++    }
++    if (stateb->nhpres_xi != NULL)
++    {
++        for (i = 0; i<stateb->nnhpres; i++) 
++        {
++            nc = i*opts->nhchainlength;
++            for (j=0; j<opts->nhchainlength; j++) 
++            {
++                stateb->nhpres_xi[nc+j]  = statea->nhpres_xi[nc+j];
++                stateb->nhpres_vxi[nc+j] = statea->nhpres_vxi[nc+j];
++            }
++        }
++    }
++}
++
++real compute_conserved_from_auxiliary(t_inputrec *ir, t_state *state, t_extmass *MassQ)
++{
++    real quantity = 0;
++    switch (ir->etc) 
++    {
++    case etcNO:
++        break;
++    case etcBERENDSEN:
++        break;
++    case etcNOSEHOOVER:
++        quantity = NPT_energy(ir,state,MassQ);                
++        break;
++    case etcVRESCALE:
++        quantity = vrescale_energy(&(ir->opts),state->therm_integral);
++        break;
++    default:
++        break;
++    }
++    return quantity;
++}
++
++void compute_globals(FILE *fplog, gmx_global_stat_t gstat, t_commrec *cr, t_inputrec *ir, 
++                     t_forcerec *fr, gmx_ekindata_t *ekind, 
++                     t_state *state, t_state *state_global, t_mdatoms *mdatoms, 
++                     t_nrnb *nrnb, t_vcm *vcm, gmx_wallcycle_t wcycle,
++                     gmx_enerdata_t *enerd,tensor force_vir, tensor shake_vir, tensor total_vir, 
++                     tensor pres, rvec mu_tot, gmx_constr_t constr, 
++                     globsig_t *gs,gmx_bool bInterSimGS,
++                     matrix box, gmx_mtop_t *top_global, real *pcurr, 
++                     int natoms, gmx_bool *bSumEkinhOld, int flags)
++{
++    int  i,gsi;
++    real gs_buf[eglsNR];
++    tensor corr_vir,corr_pres,shakeall_vir;
++    gmx_bool bEner,bPres,bTemp, bVV;
++    gmx_bool bRerunMD, bStopCM, bGStat, bIterate, 
++        bFirstIterate,bReadEkin,bEkinAveVel,bScaleEkin, bConstrain;
++    real ekin,temp,prescorr,enercorr,dvdlcorr;
++    
++    /* translate CGLO flags to gmx_booleans */
++    bRerunMD = flags & CGLO_RERUNMD;
++    bStopCM = flags & CGLO_STOPCM;
++    bGStat = flags & CGLO_GSTAT;
++
++    bReadEkin = (flags & CGLO_READEKIN);
++    bScaleEkin = (flags & CGLO_SCALEEKIN);
++    bEner = flags & CGLO_ENERGY;
++    bTemp = flags & CGLO_TEMPERATURE;
++    bPres  = (flags & CGLO_PRESSURE);
++    bConstrain = (flags & CGLO_CONSTRAINT);
++    bIterate = (flags & CGLO_ITERATE);
++    bFirstIterate = (flags & CGLO_FIRSTITERATE);
++
++    /* we calculate a full state kinetic energy either with full-step velocity verlet
++       or half step where we need the pressure */
++    
++    bEkinAveVel = (ir->eI==eiVV || (ir->eI==eiVVAK && bPres) || bReadEkin);
++    
++    /* in initalization, it sums the shake virial in vv, and to 
++       sums ekinh_old in leapfrog (or if we are calculating ekinh_old) for other reasons */
++
++    /* ########## Kinetic energy  ############## */
++    
++    if (bTemp) 
++    {
++        /* Non-equilibrium MD: this is parallellized, but only does communication
++         * when there really is NEMD.
++         */
++        
++        if (PAR(cr) && (ekind->bNEMD)) 
++        {
++            accumulate_u(cr,&(ir->opts),ekind);
++        }
++        debug_gmx();
++        if (bReadEkin)
++        {
++            restore_ekinstate_from_state(cr,ekind,&state_global->ekinstate);
++        }
++        else 
++        {
++
++            calc_ke_part(state,&(ir->opts),mdatoms,ekind,nrnb,bEkinAveVel,bIterate);
++        }
++        
++        debug_gmx();
++        
++        /* Calculate center of mass velocity if necessary, also parallellized */
++        if (bStopCM && !bRerunMD && bEner) 
++        {
++            calc_vcm_grp(fplog,mdatoms->start,mdatoms->homenr,mdatoms,
++                         state->x,state->v,vcm);
++        }
++    }
++
++    if (bTemp || bPres || bEner || bConstrain) 
++    {
++        if (!bGStat)
++        {
++            /* We will not sum ekinh_old,                                                            
++             * so signal that we still have to do it.                                                
++             */
++            *bSumEkinhOld = TRUE;
++
++        }
++        else
++        {
++            if (gs != NULL)
++            {
++                for(i=0; i<eglsNR; i++)
++                {
++                    gs_buf[i] = gs->sig[i];
++                }
++            }
++            if (PAR(cr)) 
++            {
++                wallcycle_start(wcycle,ewcMoveE);
++                GMX_MPE_LOG(ev_global_stat_start);
++                global_stat(fplog,gstat,cr,enerd,force_vir,shake_vir,mu_tot,
++                            ir,ekind,constr,vcm,
++                            gs != NULL ? eglsNR : 0,gs_buf,
++                            top_global,state,
++                            *bSumEkinhOld,flags);
++                GMX_MPE_LOG(ev_global_stat_finish);
++                wallcycle_stop(wcycle,ewcMoveE);
++            }
++            if (gs != NULL)
++            {
++                if (MULTISIM(cr) && bInterSimGS)
++                {
++                    if (MASTER(cr))
++                    {
++                        /* Communicate the signals between the simulations */
++                        gmx_sum_sim(eglsNR,gs_buf,cr->ms);
++                    }
++                    /* Communicate the signals form the master to the others */
++                    gmx_bcast(eglsNR*sizeof(gs_buf[0]),gs_buf,cr);
++                }
++                for(i=0; i<eglsNR; i++)
++                {
++                    if (bInterSimGS || gs_simlocal[i])
++                    {
++                        /* Set the communicated signal only when it is non-zero,
++                         * since signals might not be processed at each MD step.
++                         */
++                        gsi = (gs_buf[i] >= 0 ?
++                               (int)(gs_buf[i] + 0.5) :
++                               (int)(gs_buf[i] - 0.5));
++                        if (gsi != 0)
++                        {
++                            gs->set[i] = gsi;
++                        }
++                        /* Turn off the local signal */
++                        gs->sig[i] = 0;
++                    }
++                }
++            }
++            *bSumEkinhOld = FALSE;
++        }
++    }
++    
++    if (!ekind->bNEMD && debug && bTemp && (vcm->nr > 0))
++    {
++        correct_ekin(debug,
++                     mdatoms->start,mdatoms->start+mdatoms->homenr,
++                     state->v,vcm->group_p[0],
++                     mdatoms->massT,mdatoms->tmass,ekind->ekin);
++    }
++    
++    if (bEner) {
++        /* Do center of mass motion removal */
++        if (bStopCM && !bRerunMD) /* is this correct?  Does it get called too often with this logic? */
++        {
++            check_cm_grp(fplog,vcm,ir,1);
++            do_stopcm_grp(fplog,mdatoms->start,mdatoms->homenr,mdatoms->cVCM,
++                          state->x,state->v,vcm);
++            inc_nrnb(nrnb,eNR_STOPCM,mdatoms->homenr);
++        }
++
++        /* Calculate the amplitude of the cosine velocity profile */
++        ekind->cosacc.vcos = ekind->cosacc.mvcos/mdatoms->tmass;
++    }
++
++    if (bTemp) 
++    {
++        /* Sum the kinetic energies of the groups & calc temp */
++        /* compute full step kinetic energies if vv, or if vv-avek and we are computing the pressure with IR_NPT_TROTTER */
++        /* three maincase:  VV with AveVel (md-vv), vv with AveEkin (md-vv-avek), leap with AveEkin (md).  
++           Leap with AveVel is not supported; it's not clear that it will actually work.  
++           bEkinAveVel: If TRUE, we simply multiply ekin by ekinscale to get a full step kinetic energy. 
++           If FALSE, we average ekinh_old and ekinh*ekinscale_nhc to get an averaged half step kinetic energy.
++           bSaveEkinOld: If TRUE (in the case of iteration = bIterate is TRUE), we don't reset the ekinscale_nhc.  
++           If FALSE, we go ahead and erase over it.
++        */ 
++        enerd->term[F_TEMP] = sum_ekin(&(ir->opts),ekind,&(enerd->term[F_DKDL]),
++                                       bEkinAveVel,bIterate,bScaleEkin);
++ 
++        enerd->term[F_EKIN] = trace(ekind->ekin);
++    }
++    
++    /* ##########  Long range energy information ###### */
++    
++    if (bEner || bPres || bConstrain) 
++    {
++        calc_dispcorr(fplog,ir,fr,0,top_global->natoms,box,state->lambda,
++                      corr_pres,corr_vir,&prescorr,&enercorr,&dvdlcorr);
++    }
++    
++    if (bEner && bFirstIterate) 
++    {
++        enerd->term[F_DISPCORR] = enercorr;
++        enerd->term[F_EPOT] += enercorr;
++        enerd->term[F_DVDL] += dvdlcorr;
++        if (fr->efep != efepNO) {
++            enerd->dvdl_lin += dvdlcorr;
++        }
++    }
++    
++    /* ########## Now pressure ############## */
++    if (bPres || bConstrain) 
++    {
++        
++        m_add(force_vir,shake_vir,total_vir);
++        
++        /* Calculate pressure and apply LR correction if PPPM is used.
++         * Use the box from last timestep since we already called update().
++         */
++        
++        enerd->term[F_PRES] = calc_pres(fr->ePBC,ir->nwall,box,ekind->ekin,total_vir,pres,
++                                        (fr->eeltype==eelPPPM)?enerd->term[F_COUL_RECIP]:0.0);
++        
++        /* Calculate long range corrections to pressure and energy */
++        /* this adds to enerd->term[F_PRES] and enerd->term[F_ETOT], 
++           and computes enerd->term[F_DISPCORR].  Also modifies the 
++           total_vir and pres tesors */
++        
++        m_add(total_vir,corr_vir,total_vir);
++        m_add(pres,corr_pres,pres);
++        enerd->term[F_PDISPCORR] = prescorr;
++        enerd->term[F_PRES] += prescorr;
++        *pcurr = enerd->term[F_PRES];
++        /* calculate temperature using virial */
++        enerd->term[F_VTEMP] = calc_temp(trace(total_vir),ir->opts.nrdf[0]);
++        
++    }    
++}
++
++void check_nst_param(FILE *fplog,t_commrec *cr,
++                     const char *desc_nst,int nst,
++                     const char *desc_p,int *p)
++{
++    char buf[STRLEN];
++
++    if (*p > 0 && *p % nst != 0)
++    {
++        /* Round up to the next multiple of nst */
++        *p = ((*p)/nst + 1)*nst;
++        sprintf(buf,"NOTE: %s changes %s to %d\n",desc_nst,desc_p,*p);
++        md_print_warning(cr,fplog,buf);
++    }
++}
++
++void reset_all_counters(FILE *fplog,t_commrec *cr,
++                        gmx_large_int_t step,
++                        gmx_large_int_t *step_rel,t_inputrec *ir,
++                        gmx_wallcycle_t wcycle,t_nrnb *nrnb,
++                        gmx_runtime_t *runtime)
++{
++    char buf[STRLEN],sbuf[STEPSTRSIZE];
++
++    /* Reset all the counters related to performance over the run */
++    sprintf(buf,"Step %s: resetting all time and cycle counters\n",
++            gmx_step_str(step,sbuf));
++    md_print_warning(cr,fplog,buf);
++
++    wallcycle_stop(wcycle,ewcRUN);
++    wallcycle_reset_all(wcycle);
++    if (DOMAINDECOMP(cr))
++    {
++        reset_dd_statistics_counters(cr->dd);
++    }
++    init_nrnb(nrnb);
++    ir->init_step += *step_rel;
++    ir->nsteps    -= *step_rel;
++    *step_rel = 0;
++    wallcycle_start(wcycle,ewcRUN);
++    runtime_start(runtime);
++    print_date_and_time(fplog,cr->nodeid,"Restarted time",runtime);
++}
++
++void min_zero(int *n,int i)
++{
++    if (i > 0 && (*n == 0 || i < *n))
++    {
++        *n = i;
++    }
++}
++
++int lcd4(int i1,int i2,int i3,int i4)
++{
++    int nst;
++
++    nst = 0;
++    min_zero(&nst,i1);
++    min_zero(&nst,i2);
++    min_zero(&nst,i3);
++    min_zero(&nst,i4);
++    if (nst == 0)
++    {
++        gmx_incons("All 4 inputs for determininig nstglobalcomm are <= 0");
++    }
++    
++    while (nst > 1 && ((i1 > 0 && i1 % nst != 0)  ||
++                       (i2 > 0 && i2 % nst != 0)  ||
++                       (i3 > 0 && i3 % nst != 0)  ||
++                       (i4 > 0 && i4 % nst != 0)))
++    {
++        nst--;
++    }
++
++    return nst;
++}
++
++int check_nstglobalcomm(FILE *fplog,t_commrec *cr,
++                        int nstglobalcomm,t_inputrec *ir)
++{
++    char buf[STRLEN];
++
++    if (!EI_DYNAMICS(ir->eI))
++    {
++        nstglobalcomm = 1;
++    }
++
++    if (nstglobalcomm == -1)
++    {
++        if (!(ir->nstcalcenergy > 0 ||
++              ir->nstlist > 0 ||
++              ir->etc != etcNO ||
++              ir->epc != epcNO))
++        {
++            nstglobalcomm = 10;
++            if (ir->nstenergy > 0 && ir->nstenergy < nstglobalcomm)
++            {
++                nstglobalcomm = ir->nstenergy;
++            }
++        }
++        else
++        {
++            /* Ensure that we do timely global communication for
++             * (possibly) each of the four following options.
++             */
++            nstglobalcomm = lcd4(ir->nstcalcenergy,
++                                 ir->nstlist,
++                                 ir->etc != etcNO ? ir->nsttcouple : 0,
++                                 ir->epc != epcNO ? ir->nstpcouple : 0);
++        }
++    }
++    else
++    {
++        if (ir->nstlist > 0 &&
++            nstglobalcomm > ir->nstlist && nstglobalcomm % ir->nstlist != 0)
++        {
++            nstglobalcomm = (nstglobalcomm / ir->nstlist)*ir->nstlist;
++            sprintf(buf,"WARNING: nstglobalcomm is larger than nstlist, but not a multiple, setting it to %d\n",nstglobalcomm);
++            md_print_warning(cr,fplog,buf);
++        }
++        if (ir->nstcalcenergy > 0)
++        {
++            check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
++                            "nstcalcenergy",&ir->nstcalcenergy);
++        }
++        if (ir->etc != etcNO && ir->nsttcouple > 0)
++        {
++            check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
++                            "nsttcouple",&ir->nsttcouple);
++        }
++        if (ir->epc != epcNO && ir->nstpcouple > 0)
++        {
++            check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
++                            "nstpcouple",&ir->nstpcouple);
++        }
++
++        check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
++                        "nstenergy",&ir->nstenergy);
++
++        check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
++                        "nstlog",&ir->nstlog);
++    }
++
++    if (ir->comm_mode != ecmNO && ir->nstcomm < nstglobalcomm)
++    {
++        sprintf(buf,"WARNING: Changing nstcomm from %d to %d\n",
++                ir->nstcomm,nstglobalcomm);
++        md_print_warning(cr,fplog,buf);
++        ir->nstcomm = nstglobalcomm;
++    }
++
++    return nstglobalcomm;
++}
++
++void check_ir_old_tpx_versions(t_commrec *cr,FILE *fplog,
++                               t_inputrec *ir,gmx_mtop_t *mtop)
++{
++    /* Check required for old tpx files */
++    if (IR_TWINRANGE(*ir) && ir->nstlist > 1 &&
++        ir->nstcalcenergy % ir->nstlist != 0)
++    {
++        md_print_warning(cr,fplog,"Old tpr file with twin-range settings: modifying energy calculation and/or T/P-coupling frequencies");
++
++        if (gmx_mtop_ftype_count(mtop,F_CONSTR) +
++            gmx_mtop_ftype_count(mtop,F_CONSTRNC) > 0 &&
++            ir->eConstrAlg == econtSHAKE)
++        {
++            md_print_warning(cr,fplog,"With twin-range cut-off's and SHAKE the virial and pressure are incorrect");
++            if (ir->epc != epcNO)
++            {
++                gmx_fatal(FARGS,"Can not do pressure coupling with twin-range cut-off's and SHAKE");
++            }
++        }
++        check_nst_param(fplog,cr,"nstlist",ir->nstlist,
++                        "nstcalcenergy",&ir->nstcalcenergy);
++        if (ir->epc != epcNO)
++        {
++            check_nst_param(fplog,cr,"nstlist",ir->nstlist,
++                            "nstpcouple",&ir->nstpcouple);
++        }
++        check_nst_param(fplog,cr,"nstcalcenergy",ir->nstcalcenergy,
++                        "nstenergy",&ir->nstenergy);
++        check_nst_param(fplog,cr,"nstcalcenergy",ir->nstcalcenergy,
++                        "nstlog",&ir->nstlog);
++        if (ir->efep != efepNO)
++        {
++            check_nst_param(fplog,cr,"nstcalcenergy",ir->nstcalcenergy,
++                            "nstdhdl",&ir->nstdhdl);
++        }
++    }
++}
++
++void rerun_parallel_comm(t_commrec *cr,t_trxframe *fr,
++                         gmx_bool *bNotLastFrame)
++{
++    gmx_bool bAlloc;
++    rvec *xp,*vp;
++
++    bAlloc = (fr->natoms == 0);
++
++    if (MASTER(cr) && !*bNotLastFrame)
++    {
++        fr->natoms = -1;
++    }
++    xp = fr->x;
++    vp = fr->v;
++    gmx_bcast(sizeof(*fr),fr,cr);
++    fr->x = xp;
++    fr->v = vp;
++
++    *bNotLastFrame = (fr->natoms >= 0);
++
++    if (*bNotLastFrame && PARTDECOMP(cr))
++    {
++        /* x and v are the only variable size quantities stored in trr
++         * that are required for rerun (f is not needed).
++         */
++        if (bAlloc)
++        {
++            snew(fr->x,fr->natoms);
++            snew(fr->v,fr->natoms);
++        }
++        if (fr->bX)
++        {
++            gmx_bcast(fr->natoms*sizeof(fr->x[0]),fr->x[0],cr);
++        }
++        if (fr->bV)
++        {
++            gmx_bcast(fr->natoms*sizeof(fr->v[0]),fr->v[0],cr);
++        }
++    }
++}
++
++void md_print_warning(const t_commrec *cr,FILE *fplog,const char *buf)
++{
++    if (MASTER(cr))
++    {
++        fprintf(stderr,"\n%s\n",buf);
++    }
++    if (fplog)
++    {
++        fprintf(fplog,"\n%s\n",buf);
++    }
++}
+diff --git a/src/mdlib/nlistheuristics.c b/src/mdlib/nlistheuristics.c
+new file mode 100644
+index 0000000..0848e24
+--- /dev/null
++++ b/src/mdlib/nlistheuristics.c
+@@ -0,0 +1,139 @@
++/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
++ *
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.2.0
++ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
++ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
++ * Copyright (c) 2001-2004, The GROMACS development team,
++ * check out http://www.gromacs.org for more information.
++
++ * 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:
++ * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon
++ */
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#if ((defined WIN32 || defined _WIN32 || defined WIN64 || defined _WIN64) && !defined __CYGWIN__ && !defined __CYGWIN32__)
++/* _isnan() */
++#include <float.h>
++#endif
++
++#include "typedefs.h"
++#include "gmx_fatal.h"
++#include "vec.h"
++
++void reset_nlistheuristics(gmx_nlheur_t *nlh,gmx_large_int_t step)
++{
++    nlh->lt_runav  = 0;
++    nlh->lt_runav2 = 0;
++    nlh->step_nscheck = step;
++}
++
++void init_nlistheuristics(gmx_nlheur_t *nlh,
++                          gmx_bool bGStatEveryStep,gmx_large_int_t step)
++{
++    nlh->bGStatEveryStep = bGStatEveryStep;
++    nlh->nns       = 0;
++    nlh->nabnsb    = 0;
++    nlh->s1        = 0;
++    nlh->s2        = 0;
++    nlh->ab        = 0;
++
++    reset_nlistheuristics(nlh,step);
++}
++
++void update_nliststatistics(gmx_nlheur_t *nlh,gmx_large_int_t step)
++{
++    gmx_large_int_t nl_lt;
++    char sbuf[STEPSTRSIZE],sbuf2[STEPSTRSIZE];
++
++    /* Determine the neighbor list life time */
++    nl_lt = step - nlh->step_ns;
++    if (debug)
++    {
++        fprintf(debug,"%d atoms beyond ns buffer, updating neighbor list after %s steps\n",nlh->nabnsb,gmx_step_str(nl_lt,sbuf));
++    }
++    nlh->nns++;
++    nlh->s1 += nl_lt;
++    nlh->s2 += nl_lt*nl_lt;
++    nlh->ab += nlh->nabnsb;
++    if (nlh->lt_runav == 0)
++    {
++        nlh->lt_runav  = nl_lt;
++        /* Initialize the fluctuation average
++         * such that at startup we check after 0 steps.
++         */
++        nlh->lt_runav2 = sqr(nl_lt/2.0);
++    }
++    /* Running average with 0.9 gives an exp. history of 9.5 */
++    nlh->lt_runav2 = 0.9*nlh->lt_runav2 + 0.1*sqr(nlh->lt_runav - nl_lt);
++    nlh->lt_runav  = 0.9*nlh->lt_runav  + 0.1*nl_lt;
++    if (nlh->bGStatEveryStep)
++    {
++        /* Always check the nlist validity */
++        nlh->step_nscheck = step;
++    }
++    else
++    {
++        /* We check after:  <life time> - 2*sigma
++         * The factor 2 is quite conservative,
++         * but we assume that with nstlist=-1 the user
++         * prefers exact integration over performance.
++         */
++        nlh->step_nscheck = step
++                  + (int)(nlh->lt_runav - 2.0*sqrt(nlh->lt_runav2)) - 1;
++    }
++    if (debug)
++    {
++        fprintf(debug,"nlist life time %s run av. %4.1f sig %3.1f check %s check with -gcom %d\n",
++                gmx_step_str(nl_lt,sbuf),nlh->lt_runav,sqrt(nlh->lt_runav2),
++                gmx_step_str(nlh->step_nscheck-step+1,sbuf2),
++                (int)(nlh->lt_runav - 2.0*sqrt(nlh->lt_runav2)));
++    }
++}
++
++void set_nlistheuristics(gmx_nlheur_t *nlh,gmx_bool bReset,gmx_large_int_t step)
++{
++    int d;
++
++    if (bReset)
++    {
++        reset_nlistheuristics(nlh,step);
++    }
++    else
++    {
++        update_nliststatistics(nlh,step);
++    }
++
++    nlh->step_ns = step;
++    /* Initialize the cumulative coordinate scaling matrix */
++    clear_mat(nlh->scale_tot);
++    for(d=0; d<DIM; d++)
++    {
++        nlh->scale_tot[d][d] = 1.0;
++    }
++}
+diff --git a/src/ngmx/ngmx.c b/src/ngmx/ngmx.c
+index 39f2428..5c39957 100644
+--- a/src/ngmx/ngmx.c
++++ b/src/ngmx/ngmx.c
+@@ -267,7 +267,7 @@ static gmx_bool MainCallBack(t_x11 *x11,XEvent *event, Window w, void *data)
+ int main(int argc, char *argv[])
+ {
+   const char *desc[] = {
+-    "[TT]ngmx[tt] is the Gromacs trajectory viewer. This program reads a",
++    "[TT]ngmx[tt] is the GROMACS trajectory viewer. This program reads a",
+     "trajectory file, a run input file and an index file and plots a",
+     "3D structure of your molecule on your standard X Window",
+     "screen. No need for a high end graphics workstation, it even",
+@@ -279,8 +279,8 @@ int main(int argc, char *argv[])
+     "runs on MIT-X (real X), open windows and motif,",
+     "user friendly menus, option to remove periodicity, option to",
+     "show computational box.[PAR]",
+-    "Some of the more common X command line options can be used:[BR]",
+-    "[TT]-bg[tt], [TT]-fg[tt] change colors, [TT]-font[tt] fontname, changes the font."
++    "Some of the more common X command line options can be used: ",
++    "[TT]-bg[tt], [TT]-fg[tt] change colors, [TT]-font fontname[tt] changes the font."
+   };
+   const char *bugs[] = {
+     "Balls option does not work",
+diff --git a/src/tools/Makefile.am b/src/tools/Makefile.am
+index bacf96f..6322b85 100644
+--- a/src/tools/Makefile.am
++++ b/src/tools/Makefile.am
+@@ -43,8 +43,12 @@ libgmxana at LIBSUFFIX@_la_SOURCES = \
+ 	gmx_trjconv.c	gmx_trjcat.c	gmx_trjorder.c	gmx_xpm2ps.c	\
+ 	gmx_editconf.c	gmx_genbox.c	gmx_genion.c	gmx_genconf.c	\
+ 	gmx_genpr.c	gmx_eneconv.c	gmx_vanhove.c	gmx_wheel.c	\
+-	addconf.c 	addconf.h	gmx_tune_pme.c  gmx_membed.c    \
+-	calcpot.c 	calcpot.h 	edittop.c
++	addconf.c 	addconf.h	gmx_tune_pme.c  gmx_membed.c     \
++	calcpot.c 	calcpot.h 	edittop.c	\
++	dens_filter.c	dens_filter.h	\
++	powerspect.c	powerspect.h	interf.h	\
++	gmx_densorder.c	gmx_hydorder.c	\
++	binsearch.h	binsearch.c
+ 
+ bin_PROGRAMS = \
+ 	do_dssp		editconf	eneconv		\
+@@ -71,12 +75,8 @@ bin_PROGRAMS = \
+ 	g_spatial	g_pme_error		g_options	\
+ 	g_tcaf      	g_traj      	g_tune_pme   \
+ 	g_vanhove	g_velacc    	g_membed      \
+-	g_clustsize 	g_mdmat     	g_wham		\
+-	g_sigeps
+-
+-# These programs are not compiled or installed by default - you will have to 
+-# issue "make <program>" and copy the binary to the correct location yourself! 
+-# Add new entries in Makefile.am!
++	g_clustsize 	g_mdmat     	g_wham		g_kinetics	\
++	g_sigeps	g_densorder	g_hydorder
+ 
+ EXTRA_DIST		=	libgmxana.pc.cmakein
+ 
+diff --git a/src/tools/binsearch.c b/src/tools/binsearch.c
+new file mode 100644
+index 0000000..1cded0c
+--- /dev/null
++++ b/src/tools/binsearch.c
+@@ -0,0 +1,171 @@
++/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
++ * $Id: densorder.c,v 0.9
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.0
++ * 
++ * Copyright (c) 1991-2001
++ * BIOSON Research Institute, Dept. of Biophysical Chemistry
++ * 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.
++ * 
++ * Do check out http://www.gromacs.org , or mail us at gromacs at gromacs.org .
++ * 
++ * And Hey:
++ * Gyas ROwers Mature At Cryogenic Speed
++ */
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++#include <stdio.h>
++#include "types/simple.h"
++
++/*Make range-array (Permutation identity) for sorting */
++void rangeArray(int *ar,int size)
++{
++    int i;	
++	for (i=0;i<size;i++){
++		ar[i]=i;
++	}
++}
++
++void pswap(int *v1, int *v2)
++{
++	int temp;
++	temp=*v1;
++	*v1=*v2;
++	*v2=temp;
++}
++
++
++void Swap (real *v1, real *v2)
++{
++    real temp;
++    temp = *v1;
++    *v1 = *v2;
++    *v2 = temp;
++}
++
++
++
++void insertionSort(real *arr, int *perm, int startndx, int endndx, int direction) {
++    int i, j;
++
++	if(direction>=0){
++        for (i = startndx; i <=endndx; i++) {
++            j = i;
++
++            while (j > startndx && arr[j - 1] > arr[j]) {
++                Swap(&arr[j],&arr[j-1]);
++				pswap(&perm[j],&perm[j-1]);
++                j--;
++            }
++
++        }
++
++	}
++
++	if(direction<0){
++        for (i = startndx; i <=endndx; i++) {
++            j = i;
++
++            while (j > startndx && arr[j - 1] < arr[j]) {
++                Swap(&arr[j],&arr[j-1]);
++				pswap(&perm[j],&perm[j-1]);
++                j--;
++            }
++
++        }
++	}
++}
++
++
++int BinarySearch (real *array, int low, int high, real key,int direction)
++{
++    int mid, max, min;
++    max=high+2;
++    min=low+1;
++
++/*Iterative implementation*/
++
++    if (direction>=0){
++        while (max-min>1){
++            mid=(min+max)>>1;
++            if(key<array[mid-1]) max=mid;
++            else min=mid;
++        }
++        return min;
++    }
++
++    else if (direction<0){
++        while(max-min>1){
++            mid=(min+max)>>1;
++            if(key>array[mid-1]) max=mid;
++            else min=mid;
++        }
++        return min-1;
++
++    }/*end -ifelse direction*/
++}
++
++
++int start_binsearch(real *array, int *perm, int low, int high, 
++                    real key, int direction)
++{
++	insertionSort(array,perm,low,high,direction);
++	return BinarySearch(array,low,high,key,direction);
++}
++
++int LinearSearch (double *array,int startindx, int stopindx, 
++                  double key,int *count, int direction)
++{
++    /*Iterative implementation - assume elements sorted*/
++    int i;
++    int keyindex;
++
++    if(direction>=0){
++        keyindex=startindx;
++        for (i=startindx;i<=stopindx;i++){
++            (*count)++;
++            if(array[i]>key) {	
++                keyindex=i-1;
++                return keyindex;
++            }
++        }
++    }
++    else if(direction<0 ){
++        keyindex=stopindx;
++        for(i=stopindx;i>=startindx;i--){
++            (*count)++;
++            if (array[i]>key){
++                keyindex=i+1;
++                return keyindex;
++            }
++        }
++    }
++
++    else 
++        fprintf(stderr,"Error: startindex=stopindex=%d\n",startindx);
++
++}
++		
+diff --git a/src/tools/binsearch.h b/src/tools/binsearch.h
+new file mode 100644
+index 0000000..973c5f2
+--- /dev/null
++++ b/src/tools/binsearch.h
+@@ -0,0 +1,54 @@
++/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
++ * $Id: densorder.c,v 0.9
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.0
++ * 
++ * Copyright (c) 1991-2001
++ * BIOSON Research Institute, Dept. of Biophysical Chemistry
++ * 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.
++ * 
++ * Do check out http://www.gromacs.org , or mail us at gromacs at gromacs.org .
++ * 
++ * And Hey:
++ * Gyas ROwers Mature At Cryogenic Speed
++ */
++
++#ifndef _binsearch_h
++#define _binsearch_h
++
++#include "types/simple.h"
++
++extern void rangeArray(int *ar,int size);
++
++extern void insertionSort(real *ar, int *perm, int start, int end, int direction);
++
++extern int BinarySearch(real *ar, int start, int end, real key, int direction);
++
++extern int start_binsearch(real *array, int *perm, int low, int high, 
++                           real key, int direction);
++			   
++extern int LinearSearch(double *array,int startindx, int stopindx, 
++                        double key,int *count, int direction);
++
++#endif
+diff --git a/src/tools/dens_filter.c b/src/tools/dens_filter.c
+new file mode 100644
+index 0000000..dca3192
+--- /dev/null
++++ b/src/tools/dens_filter.c
+@@ -0,0 +1,131 @@
++/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
++ * $Id: densorder.c,v 0.9
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.0
++ * 
++ * Copyright (c) 1991-2001
++ * BIOSON Research Institute, Dept. of Biophysical Chemistry
++ * 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.
++ * 
++ * Do check out http://www.gromacs.org , or mail us at gromacs at gromacs.org .
++ * 
++ * And Hey:
++ * Gyas ROwers Mature At Cryogenic Speed
++ */
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++/* dens_filter.c
++ * Routines for Filters and convolutions
++ */
++
++#include <math.h>
++#include "typedefs.h"
++#include "dens_filter.h"
++#include "smalloc.h"
++#include "vec.h"
++
++#ifdef GMX_DOUBLE
++#define EXP(x) (exp(x))
++#else
++#define EXP(x) (expf(x))
++#endif
++
++/* Modulo function assuming y>0 but with arbitrary INTEGER x */
++static int MOD(int x, int y){
++    if (x<0) x=x+y;
++    return (mod(x,y));
++}
++
++
++gmx_bool convolution(int dataSize,real *x, int kernelSize, real* kernel)
++{
++    int i, j, k;
++    real *out;
++    snew(out,dataSize);
++    /* check validity of params */
++    if(!x || !kernel) return FALSE;
++    if(dataSize <=0 || kernelSize <= 0) return FALSE;
++
++    /* start convolution from out[kernelSize-1] to out[dataSize-1] (last) */
++    for(i = kernelSize-1; i < dataSize; ++i)
++    {
++        for(j = i, k = 0; k < kernelSize; --j, ++k)
++            out[i] += x[j] * kernel[k];
++    }
++
++    /* convolution from out[0] to out[kernelSize-2] */
++    for(i = 0; i < kernelSize - 1; ++i)
++    {
++        for(j = i, k = 0; j >= 0; --j, ++k)
++            out[i] += x[j] * kernel[k];
++    }
++
++    for(i=0;i<dataSize;i++) x[i]=out[i];
++    sfree(out);	
++    return TRUE;
++}
++
++/* Assuming kernel is shorter than x */
++
++gmx_bool periodic_convolution(int datasize, real *x, int kernelsize, real *kernel)
++{
++    if (!x || !kernel) return FALSE;
++    if (kernelsize<=0|| datasize<=0|| kernelsize > datasize) return FALSE;
++
++    int i,j,k,nj;
++    real *filtered;
++    snew(filtered,datasize);
++    
++    for(i=0;(i<datasize); i++){
++        for(j=0; (j<kernelsize); j++){
++            filtered[i] += kernel[j]*x[MOD((i-j),datasize)];
++        }
++    }
++    for(i=0; i<datasize; i++) x[i]=filtered[i];
++    sfree(filtered);
++
++    return TRUE;
++}
++
++
++/* returns discrete gaussian kernel of size n in *out, where n=2k+1=3,5,7,9,11 and k=1,2,3 is the order
++ * NO checks are performed 
++ */
++void gausskernel(real *out, int n, real var){
++	int i,j=0,k;
++	real arg,tot=0;
++	k=n/2;
++	
++	for(i=-k; i<=k; i++){
++		arg=(i*i)/(2*var);
++		tot+=out[j++]=EXP(-arg);
++	}
++	for(i=0;i<j;i++){
++		out[i]/=tot;
++	}
++}
++
++
+diff --git a/src/tools/dens_filter.h b/src/tools/dens_filter.h
+new file mode 100644
+index 0000000..f5942f9
+--- /dev/null
++++ b/src/tools/dens_filter.h
+@@ -0,0 +1,48 @@
++/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
++ * $Id: densorder.c,v 0.9
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.0
++ * 
++ * Copyright (c) 1991-2001
++ * BIOSON Research Institute, Dept. of Biophysical Chemistry
++ * 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.
++ * 
++ * Do check out http://www.gromacs.org , or mail us at gromacs at gromacs.org .
++ * 
++ * And Hey:
++ * Gyas ROwers Mature At Cryogenic Speed
++ */
++
++#ifndef _dens_filter_h
++#define _dens_filter_h
++	
++#include "types/simple.h"
++
++extern gmx_bool convolution(int dataSize, real* in, int kernelSize, 
++			    real* kernel);
++extern gmx_bool periodic_convolution(int dsize, real *in, int ksize, 
++				     real* kernel);
++extern void gausskernel(real *out, int size, real var);
++
++#endif
+diff --git a/src/tools/do_dssp.c b/src/tools/do_dssp.c
+index 2789dfb..6e8cd79 100644
+--- a/src/tools/do_dssp.c
++++ b/src/tools/do_dssp.c
+@@ -388,9 +388,10 @@ int main(int argc,char *argv[])
+     "reads a trajectory file and computes the secondary structure for",
+     "each time frame ",
+     "calling the dssp program. If you do not have the dssp program,",
+-    "get it. [TT]do_dssp[tt] assumes that the dssp executable is",
+-    "/usr/local/bin/dssp. If this is not the case, then you should",
+-    "set an environment variable [BB]DSSP[bb] pointing to the dssp",
++    "get it from http://swift.cmbi.ru.nl/gv/dssp. [TT]do_dssp[tt] assumes ",
++    "that the dssp executable is located in ",
++    "[TT]/usr/local/bin/dssp[tt]. If this is not the case, then you should",
++    "set an environment variable [TT]DSSP[tt] pointing to the dssp",
+     "executable, e.g.: [PAR]",
+     "[TT]setenv DSSP /opt/dssp/bin/dssp[tt][PAR]",
+     "The structure assignment for each residue and time is written to an",
+diff --git a/src/tools/expfit.c b/src/tools/expfit.c
+index ce79bba..b22cc4c 100644
+--- a/src/tools/expfit.c
++++ b/src/tools/expfit.c
+@@ -1,4 +1,5 @@
+ /*
++ * $Id: expfit.c,v 1.33 2005/08/29 19:39:11 lindahl Exp $
+  * 
+  *                This source code is part of
+  * 
+@@ -49,10 +50,10 @@
+ #include "statutil.h"
+ #include "index.h"
+ 
+-int  nfp_ffn[effnNR] = { 0, 1, 2, 3, 2, 5, 7, 9, 3 };
++const int  nfp_ffn[effnNR] = { 0, 1, 2, 3, 2, 5, 7, 9, 4, 3};
+ 
+ const char *s_ffn[effnNR+2] = { NULL, "none", "exp", "aexp", "exp_exp", "vac", 
+-				"exp5", "exp7", "exp9", NULL, NULL };
++			  "exp5", "exp7", "exp9","erffit", NULL, NULL };
+ /* We don't allow errest as a choice on the command line */
+ 
+ const char *longs_ffn[effnNR] = {
+@@ -64,6 +65,7 @@ const char *longs_ffn[effnNR] = {
+   "y = a1 exp(-x/a2) +  a3 exp(-x/a4) + a5",
+   "y = a1 exp(-x/a2) +  a3 exp(-x/a4) + a5 exp(-x/a6) + a7",
+   "y = a1 exp(-x/a2) +  a3 exp(-x/a4) + a5 exp(-x/a6) + a7 exp(-x/a8) + a9",
++  "y = 1/2*(a1+a2) - 1/2*(a1-a2)*erf( (x-a3) /a4^2)",
+   "y = a2*ee(a1,x) + (1-a2)*ee(a2,x)"
+ };
+ 
+@@ -84,6 +86,42 @@ static real myexp(real x,real A,real tau)
+     return 0;
+   return A*exp(-x/tau);
+ }
++
++static real signum(real num){
++	real sign;
++	if(num<0){
++                 sign=-1.0;
++        }
++        else {
++                sign=1.0;
++        }
++        return sign;
++}
++
++void erffit (real x, real a[], real *y, real dyda[])
++{
++/* Fuction 
++ *	y=(a1+a2)/2-(a1-a2)/2*erf((x-a3)/a4^2)
++ */
++
++real erfarg;
++real erfval;
++real erfarg2;
++real derf;
++
++ erfarg=(x-a[3])/(a[4]*a[4]);
++        erfarg2=erfarg*erfarg;
++        erfval=gmx_erf(erfarg)/2;
++        derf=M_2_SQRTPI*(a[1]-a[2])/2*exp(-erfarg2)/(a[4]*a[4]);
++
++        *y=(a[1]+a[2])/2-(a[1]-a[2])*erfval;
++        dyda[1]=1/2-erfval;
++        dyda[2]=1/2+erfval;
++        dyda[3]=derf;
++        dyda[4]=2*derf*erfarg;
++}	
++	
++
+ 		   
+ static void exp_one_parm(real x,real a[],real *y,real dyda[])
+ {
+@@ -283,7 +321,7 @@ static void errest_3_parm(real x,real a[],real *y,real dyda[])
+ typedef void (*myfitfn)(real x,real a[],real *y,real dyda[]);
+ myfitfn mfitfn[effnNR] = { 
+   exp_one_parm, exp_one_parm, exp_two_parm, exp_3_parm, vac_2_parm,
+-  exp_5_parm,   exp_7_parm,   exp_9_parm,   errest_3_parm
++  exp_5_parm,   exp_7_parm,   exp_9_parm, erffit,  errest_3_parm
+ };
+ 
+ real fit_function(int eFitFn,real *parm,real x)
+@@ -318,7 +356,7 @@ static gmx_bool lmfit_exp(int nfit,real x[],real y[],real dy[],real ftol,
+   snew(dum,ma+1);
+   for(i=1; (i<ma+1); i++) {
+     lista[i] = i;
+-    ia[i] = i;
++    ia[i] = 1; /* fixed bug B.S.S 19/11  */
+     snew(covar[i],ma+1);
+     snew(alpha[i],ma+1);
+   }
+@@ -341,8 +379,8 @@ static gmx_bool lmfit_exp(int nfit,real x[],real y[],real dy[],real ftol,
+ 
+   j = 0;      
+   if (bVerbose)
+-    fprintf(stderr,"%4s  %10s  %10s  %10s  %10s  %10s\n",
+-	    "Step","chi^2","Lambda","A1","A2","A3");
++    fprintf(stderr,"%4s  %10s  %10s  %10s  %10s  %10s %10s\n",
++	    "Step","chi^2","Lambda","A1","A2","A3","A4");
+   do {
+     ochisq = chisq;
+     /* mrqmin(x-1,y-1,dy-1,nfit,a,ma,lista,mfit,covar,alpha,
+@@ -359,6 +397,8 @@ static gmx_bool lmfit_exp(int nfit,real x[],real y[],real dy[],real ftol,
+ 	fprintf(stderr,"  %10.5e",a[2]);
+       if (mfit > 2)
+ 	fprintf(stderr,"  %10.5e",a[3]);
++      if (mfit > 3)
++	 fprintf(stderr," %10.5e",a[4]);
+       fprintf(stderr,"\n");
+     }
+     j++;
+@@ -398,7 +438,7 @@ static gmx_bool lmfit_exp(int nfit,real x[],real y[],real dy[],real ftol,
+ 
+ real do_lmfit(int ndata,real c1[],real sig[],real dt,real x0[],
+ 	      real begintimefit,real endtimefit,const output_env_t oenv,
+-              gmx_bool bVerbose, int eFitFn,real fitparms[],int fix)
++	      gmx_bool bVerbose, int eFitFn,real fitparms[],int fix)
+ {
+   FILE *fp;
+   char buf[32];
+@@ -484,7 +524,7 @@ real do_lmfit(int ndata,real c1[],real sig[],real dt,real x0[],
+ 	  fprintf(fp,"%10.5e  %10.5e  %10.5e\n",
+ 		  ttt,c1[j],fit_function(eFitFn,parm,ttt));
+ 	}
+-	ffclose(fp);
++	fclose(fp);
+       }
+     }
+     for(i=0;(i<nparm);i++)
+diff --git a/src/tools/g_densorder.c b/src/tools/g_densorder.c
+new file mode 100644
+index 0000000..7a9fbcc
+--- /dev/null
++++ b/src/tools/g_densorder.c
+@@ -0,0 +1,56 @@
++/*
++ * $Id: g_densorder.c,v 0.95 2009/06/15  bjornss Exp $
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.2.0
++ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
++ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
++ * Copyright (c) 2001-2004, The GROMACS development team,
++ * check out http://www.gromacs.org for more information.
++
++ * 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:
++ * Green Red Orange Magenta Azure Cyan Skyblue
++ */
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#include <gmx_ana.h>
++
++
++
++/* This is just a wrapper binary.
++* The code that used to be in g_density.c is now in gmx_density.c,
++* where the old main function is called gmx_density().
++*/
++
++int main(int argc, char *argv[])
++{
++  gmx_densorder(argc,argv);
++  return 0;
++}
++
++
++  
+diff --git a/src/tools/g_hydorder.c b/src/tools/g_hydorder.c
+new file mode 100644
+index 0000000..91cdd5b
+--- /dev/null
++++ b/src/tools/g_hydorder.c
+@@ -0,0 +1,54 @@
++/*
++ * $Id: g_hydorder.c,v 1.1 2009/05/15 12:00:17 bjornss Exp $
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 4.0.99
++ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
++ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
++ * Copyright (c) 2001-2004, The GROMACS development team,
++ * check out http://www.gromacs.org for more information.
++
++ * 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:
++ * Green Red Orange Magenta Azure Cyan Skyblue
++ */
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#include <gmx_ana.h>
++
++
++
++/* This is just a wrapper binary.
++*/
++int
++main(int argc, char *argv[])
++{
++  gmx_hydorder(argc,argv);
++  return 0;
++}
++
++
++  
+diff --git a/src/tools/g_sigeps.c b/src/tools/g_sigeps.c
+index 9737220..34f3ded 100644
+--- a/src/tools/g_sigeps.c
++++ b/src/tools/g_sigeps.c
+@@ -73,10 +73,10 @@ real dpot(real x,real qq,real c6,real cn,int npow)
+ int main(int argc,char *argv[])
+ {
+   const char *desc[] = {
+-    "[TT]g_sigeps[tt] is a simple utility that converts c6/c12 or c6/cn combinations",
+-    "to sigma and epsilon, or vice versa. It can also plot the potential",
+-    "in  file. In addition it makes an approximation of a Buckingham potential",
+-    "to a Lennard Jones potential."
++    "[TT]g_sigeps[tt] is a simple utility that converts C6/C12 or C6/Cn combinations",
++    "to [GRK]sigma[grk] and [GRK]epsilon[grk], or vice versa. It can also plot the potential",
++    "in  file. In addition, it makes an approximation of a Buckingham potential",
++    "to a Lennard-Jones potential."
+   };
+   static real c6=1.0e-3,cn=1.0e-6,qi=0,qj=0,sig=0.3,eps=1,sigfac=0.7;
+   static real Abh=1e5,Bbh=32,Cbh=1e-3;
+diff --git a/src/tools/gmx_anaeig.c b/src/tools/gmx_anaeig.c
+index df3f0fe..81627fc 100644
+--- a/src/tools/gmx_anaeig.c
++++ b/src/tools/gmx_anaeig.c
+@@ -794,7 +794,7 @@ int gmx_anaeig(int argc,char *argv[])
+     "can use [TT]rasmol -nmrpdb[tt] to view such a [TT].pdb[tt] file).[PAR]",
+     
+     "  Overlap calculations between covariance analysis:[BR]",
+-    "  NOTE: the analysis should use the same fitting structure[PAR]",
++    "  [BB]Note:[bb] the analysis should use the same fitting structure[PAR]",
+     
+     "[TT]-over[tt]: calculate the subspace overlap of the eigenvectors in",
+     "file [TT]-v2[tt] with eigenvectors [TT]-first[tt] to [TT]-last[tt]",
+diff --git a/src/tools/gmx_analyze.c b/src/tools/gmx_analyze.c
+index 9b9f51a..08c16d1 100644
+--- a/src/tools/gmx_analyze.c
++++ b/src/tools/gmx_analyze.c
+@@ -888,21 +888,21 @@ static void do_geminate(const char *gemFile, int nData,
+ int gmx_analyze(int argc,char *argv[])
+ {
+   static const char *desc[] = {
+-    "[TT]g_analyze[tt] reads an ascii file and analyzes data sets.",
++    "[TT]g_analyze[tt] reads an ASCII file and analyzes data sets.",
+     "A line in the input file may start with a time",
+-    "(see option [TT]-time[tt]) and any number of y values may follow.",
++    "(see option [TT]-time[tt]) and any number of [IT]y[it]-values may follow.",
+     "Multiple sets can also be",
+-    "read when they are separated by & (option [TT]-n[tt]),",
+-    "in this case only one y value is read from each line.",
++    "read when they are separated by & (option [TT]-n[tt]);",
++    "in this case only one [IT]y[it]-value is read from each line.",
+     "All lines starting with # and @ are skipped.",
+     "All analyses can also be done for the derivative of a set",
+     "(option [TT]-d[tt]).[PAR]",
+ 
+-    "All options, except for [TT]-av[tt] and [TT]-power[tt] assume that the",
++    "All options, except for [TT]-av[tt] and [TT]-power[tt], assume that the",
+     "points are equidistant in time.[PAR]",
+ 
+     "[TT]g_analyze[tt] always shows the average and standard deviation of each",
+-    "set. For each set it also shows the relative deviation of the third",
++    "set, as well as the relative deviation of the third",
+     "and fourth cumulant from those of a Gaussian distribution with the same",
+     "standard deviation.[PAR]",
+ 
+@@ -910,7 +910,7 @@ int gmx_analyze(int argc,char *argv[])
+     
+     "Option [TT]-cc[tt] plots the resemblance of set i with a cosine of",
+     "i/2 periods. The formula is:[BR]"
+-    "2 (int0-T y(t) cos(i pi t) dt)^2 / int0-T y(t) y(t) dt[BR]",
++    "2 (int0-T y(t) cos(i [GRK]pi[grk] t) dt)^2 / int0-T y(t) y(t) dt[BR]",
+     "This is useful for principal components obtained from covariance",
+     "analysis, since the principal components of random diffusion are",
+     "pure cosines.[PAR]",
+@@ -935,12 +935,12 @@ int gmx_analyze(int argc,char *argv[])
+     "Also an analytical block average curve is plotted, assuming",
+     "that the autocorrelation is a sum of two exponentials.",
+     "The analytical curve for the block average is:[BR]",
+-    "f(t) = sigma sqrt(2/T (  a   (tau1 ((exp(-t/tau1) - 1) tau1/t + 1)) +[BR]",
+-    "                       (1-a) (tau2 ((exp(-t/tau2) - 1) tau2/t + 1)))),[BR]"
++    "f(t) = [GRK]sigma[grk][TT]*[tt]sqrt(2/T (  [GRK]alpha[grk]   ([GRK]tau[grk]1 ((exp(-t/[GRK]tau[grk]1) - 1) [GRK]tau[grk]1/t + 1)) +[BR]",
++    "                       (1-[GRK]alpha[grk]) ([GRK]tau[grk]2 ((exp(-t/[GRK]tau[grk]2) - 1) [GRK]tau[grk]2/t + 1)))),[BR]"
+     "where T is the total time.",
+-    "a, tau1 and tau2 are obtained by fitting f^2(t) to error^2.",
++    "[GRK]alpha[grk], [GRK]tau[grk]1 and [GRK]tau[grk]2 are obtained by fitting f^2(t) to error^2.",
+     "When the actual block average is very close to the analytical curve,",
+-    "the error is sigma*sqrt(2/T (a tau1 + (1-a) tau2)).",
++    "the error is [GRK]sigma[grk][TT]*[tt]sqrt(2/T (a [GRK]tau[grk]1 + (1-a) [GRK]tau[grk]2)).",
+     "The complete derivation is given in",
+     "B. Hess, J. Chem. Phys. 116:209-217, 2002.[PAR]",
+ 
+@@ -960,7 +960,7 @@ int gmx_analyze(int argc,char *argv[])
+ 
+     "Option [TT]-filter[tt] prints the RMS high-frequency fluctuation",
+     "of each set and over all sets with respect to a filtered average.",
+-    "The filter is proportional to cos(pi t/len) where t goes from -len/2",
++    "The filter is proportional to cos([GRK]pi[grk] t/len) where t goes from -len/2",
+     "to len/2. len is supplied with the option [TT]-filter[tt].",
+     "This filter reduces oscillations with period len/2 and len by a factor",
+     "of 0.79 and 0.33 respectively.[PAR]",
+@@ -970,7 +970,7 @@ int gmx_analyze(int argc,char *argv[])
+     
+     "Option [TT]-power[tt] fits the data to b t^a, which is accomplished",
+     "by fitting to a t + b on log-log scale. All points after the first",
+-    "zero or negative value are ignored.[PAR]"
++    "zero or with a negative value are ignored.[PAR]"
+     
+     "Option [TT]-luzar[tt] performs a Luzar & Chandler kinetics analysis",
+     "on output from [TT]g_hbond[tt]. The input file can be taken directly",
+@@ -1012,7 +1012,7 @@ int gmx_analyze(int argc,char *argv[])
+     { "-xydy",    FALSE, etBOOL, {&bXYdy},
+       "Interpret second data set as error in the y values for integrating" },
+     { "-regression",FALSE,etBOOL,{&bRegression},
+-      "Perform a linear regression analysis on the data. If [TT]-xydy[tt] is set a second set will be interpreted as the error bar in the Y value. Otherwise, if multiple data sets are present a multilinear regression will be performed yielding the constant A that minimize chi^2 = (y - A0 x0 - A1 x1 - ... - AN xN)^2 where now Y is the first data set in the input file and xi the others. Do read the information at the option [TT]-time[tt]." },
++      "Perform a linear regression analysis on the data. If [TT]-xydy[tt] is set a second set will be interpreted as the error bar in the Y value. Otherwise, if multiple data sets are present a multilinear regression will be performed yielding the constant A that minimize [GRK]chi[grk]^2 = (y - A0 x0 - A1 x1 - ... - AN xN)^2 where now Y is the first data set in the input file and xi the others. Do read the information at the option [TT]-time[tt]." },
+     { "-luzar",   FALSE, etBOOL, {&bLuzar},
+       "Do a Luzar and Chandler analysis on a correlation function and related as produced by [TT]g_hbond[tt]. When in addition the [TT]-xydy[tt] flag is given the second and fourth column will be interpreted as errors in c(t) and n(t)." },
+     { "-temp",    FALSE, etREAL, {&temp},
+@@ -1022,7 +1022,7 @@ int gmx_analyze(int argc,char *argv[])
+     { "-fitend", FALSE, etREAL, {&fit_end},
+       "Time (ps) where to stop fitting the correlation functions in order to obtain the forward and backward rate constants for HB breaking and formation. Only with [TT]-gem[tt]" }, 
+     { "-smooth",FALSE, etREAL, {&smooth_tail_start},
+-      "If >= 0, the tail of the ACF will be smoothed by fitting it to an exponential function: y = A exp(-x/tau)" },
++      "If >= 0, the tail of the ACF will be smoothed by fitting it to an exponential function: y = A exp(-x/[GRK]tau[grk])" },
+     { "-nbmin",   FALSE, etINT, {&nb_min},
+       "HIDDENMinimum number of blocks for block averaging" },
+     { "-resol", FALSE, etINT, {&resol},
+diff --git a/src/tools/gmx_bar.c b/src/tools/gmx_bar.c
+index 4d54b38..649ea0e 100644
+--- a/src/tools/gmx_bar.c
++++ b/src/tools/gmx_bar.c
+@@ -56,6 +56,11 @@
+ #include "gmx_ana.h"
+ #include "maths.h"
+ 
++/* Suppress Cygwin compiler warnings from using newlib version of
++ * ctype.h */
++#ifdef GMX_CYGWIN
++#undef isdigit
++#endif
+ 
+ /* the dhdl.xvg data from a simulation (actually obsolete, but still
+     here for reading the dhdl.xvg file*/
+@@ -2482,54 +2487,54 @@ int gmx_bar(int argc,char *argv[])
+ 
+         "Every individual BAR free energy difference relies on two ",
+         "simulations at different states: say state A and state B, as",
+-        "controlled by a parameter, lambda (see the mdp parameter",
++        "controlled by a parameter, [GRK]lambda[grk] (see the [TT].mdp[tt] parameter",
+         "[TT]init_lambda[tt]). The BAR method calculates a ratio of weighted",
+         "average of the Hamiltonian difference of state B given state A and",
+-        "vice versa. If the Hamiltonian does not linearly depend on lambda",
++        "vice versa. If the Hamiltonian does not depend linearly on [GRK]lambda[grk]",
+         "(in which case we can extrapolate the derivative of the Hamiltonian",
+-        "with respect to lambda, as is the default when [TT]free_energy[tt] is on),",
++        "with respect to [GRK]lambda[grk], as is the default when [TT]free_energy[tt] is on),",
+         "the energy differences to the other state need to be calculated",
+         "explicitly during the simulation. This can be controlled with",
+-        "the mdp option [TT]foreign_lambda[tt].[PAR]",
++        "the [TT].mdp[tt] option [TT]foreign_lambda[tt].[PAR]",
+ 
+-        "Input option [TT]-f[tt] expects multiple dhdl files. ",
++        "Input option [TT]-f[tt] expects multiple [TT]dhdl.xvg[tt] files. ",
+         "Two types of input files are supported:[BR]",
+-        "[TT]*[tt]  Files with only one y-value, for such files it is assumed ",
+-        "   that the y-value is dH/dlambda and that the Hamiltonian depends ",
+-        "   linearly on lambda. The lambda value of the simulation is inferred ",
+-        "   from the subtitle if present, otherwise from a number in the",
++        "[TT]*[tt]  Files with only one [IT]y[it]-value, for such files it is assumed ",
++        "   that the [IT]y[it]-value is dH/d[GRK]lambda[grk] and that the Hamiltonian depends ",
++        "   linearly on [GRK]lambda[grk]. The [GRK]lambda[grk] value of the simulation is inferred ",
++        "   from the subtitle (if present), otherwise from a number in the",
+         "   subdirectory in the file name.",
+         "[BR]",
+-        "[TT]*[tt]  Files with more than one y-value. The files should have columns ",
+-        "   with dH/dlambda and Delta lambda. The lambda values are inferred ",
+-        "   from the legends: lambda of the simulation from the legend of dH/dlambda ",
+-        "   and the foreign lambda's from the legends of Delta H.[PAR]",
+-        "The lambda of the simulation is parsed from dhdl.xvg file's legend ",
+-        "containing the string 'dH', the foreign lambdas from the legend ",
++        "[TT]*[tt]  Files with more than one [IT]y[it]-value. The files should have columns ",
++        "   with dH/d[GRK]lambda[grk] and [GRK]Delta[grk][GRK]lambda[grk]. The [GRK]lambda[grk] values are inferred ",
++        "   from the legends: [GRK]lambda[grk] of the simulation from the legend of dH/d[GRK]lambda[grk] ",
++        "   and the foreign [GRK]lambda[grk] values from the legends of Delta H.[PAR]",
++        "The [GRK]lambda[grk] of the simulation is parsed from [TT]dhdl.xvg[tt] file's legend ",
++        "containing the string 'dH', the foreign [GRK]lambda[grk] values from the legend ",
+         "containing the capitalized letters 'D' and 'H'. The temperature ",
+         "is parsed from the legend line containing 'T ='.[PAR]",
+ 
+-        "The input option [TT]-g[tt] expects multiple .edr files. ",
++        "The input option [TT]-g[tt] expects multiple [TT].edr[tt] files. ",
+         "These can contain either lists of energy differences (see the",
+-        "mdp option separate_dhdl_file), or a series of histograms",
+-        "(see the mdp options [TT]dh_hist_size[tt] and [TT]dh_hist_spacing[tt]).",
+-        "The temperature and lambda values are automatically deduced from",
+-        "the ener.edr file.[PAR]"
++        "[TT].mdp[tt] option [TT]separate_dhdl_file[tt]), or a series of histograms",
++        "(see the [TT].mdp[tt] options [TT]dh_hist_size[tt] and [TT]dh_hist_spacing[tt]).",
++        "The temperature and [GRK]lambda[grk] values are automatically deduced from",
++        "the [TT]ener.edr[tt] file.[PAR]"
+ 
+         "The free energy estimates are determined using BAR with bisection, ",
+-        "the precision of the output is set with [TT]-prec[tt]. ",
++        "with the precision of the output set with [TT]-prec[tt]. ",
+         "An error estimate taking into account time correlations ",
+         "is made by splitting the data into blocks and determining ",
+         "the free energy differences over those blocks and assuming ",
+         "the blocks are independent. ",
+         "The final error estimate is determined from the average variance ",
+-        "over 5 blocks. A range of blocks numbers for error estimation can ",
++        "over 5 blocks. A range of block numbers for error estimation can ",
+         "be provided with the options [TT]-nbmin[tt] and [TT]-nbmax[tt].[PAR]",
+ 
+         "[TT]g_bar[tt] tries to aggregate samples with the same 'native' and 'foreign'",
+-        "lambda values, but always assumes independent samples: note that",
++        "[GRK]lambda[grk] values, but always assumes independent samples. [BB]Note[bb] that",
+         "when aggregating energy differences/derivatives with different",
+-        "sampling intervals, this is almost certainly not correct: usually",
++        "sampling intervals, this is almost certainly not correct. Usually",
+         "subsequent energies are correlated and different time intervals mean",
+         "different degrees of correlation between samples.[PAR]",
+ 
+@@ -2539,8 +2544,8 @@ int gmx_bar(int argc,char *argv[])
+         "difference estimates and phase space overlap measures in units of ",
+         "kT (together with their computed error estimate). The printed ",
+         "values are:[BR]",
+-        "[TT]*[tt]  lam_A: the lambda values for point A.[BR]",
+-        "[TT]*[tt]  lam_B: the lambda values for point B.[BR]",
++        "[TT]*[tt]  lam_A: the [GRK]lambda[grk] values for point A.[BR]",
++        "[TT]*[tt]  lam_B: the [GRK]lambda[grk] values for point B.[BR]",
+         "[TT]*[tt]     DG: the free energy estimate.[BR]",
+         "[TT]*[tt]    s_A: an estimate of the relative entropy of B in A.[BR]",
+         "[TT]*[tt]    s_A: an estimate of the relative entropy of A in B.[BR]",
+diff --git a/src/tools/gmx_bundle.c b/src/tools/gmx_bundle.c
+index 06810d8..a0a002c 100644
+--- a/src/tools/gmx_bundle.c
++++ b/src/tools/gmx_bundle.c
+@@ -185,7 +185,7 @@ int gmx_bundle(int argc,char *argv[])
+     "With option [TT]-oa[tt] the top, mid (or kink when [TT]-ok[tt] is set)",
+     "and bottom points of each axis",
+     "are written to a [TT].pdb[tt] file each frame. The residue numbers correspond",
+-    "to the axis numbers. When viewing this file with [TT]rasmol[tt], use the",
++    "to the axis numbers. When viewing this file with Rasmol, use the",
+     "command line option [TT]-nmrpdb[tt], and type [TT]set axis true[tt] to",
+     "display the reference axis."
+   };
+@@ -195,7 +195,7 @@ int gmx_bundle(int argc,char *argv[])
+     { "-na", FALSE, etINT, {&n},
+ 	"Number of axes" },
+     { "-z", FALSE, etBOOL, {&bZ},
+-	"Use the Z-axis as reference iso the average axis" }
++	"Use the [IT]z[it]-axis as reference instead of the average axis" }
+   };
+   FILE       *out,*flen,*fdist,*fz,*ftilt,*ftiltr,*ftiltl;
+   FILE       *fkink=NULL,*fkinkr=NULL,*fkinkl=NULL;
+diff --git a/src/tools/gmx_chi.c b/src/tools/gmx_chi.c
+index ca5873a..c3971e5 100644
+--- a/src/tools/gmx_chi.c
++++ b/src/tools/gmx_chi.c
+@@ -1006,14 +1006,14 @@ static void order_params(FILE *log,
+ int gmx_chi(int argc,char *argv[])
+ {
+   const char *desc[] = {
+-    "[TT]g_chi[tt] computes phi, psi, omega and chi dihedrals for all your ",
++    "[TT]g_chi[tt] computes [GRK]phi[grk], [GRK]psi[grk], [GRK]omega[grk], and [GRK]chi[grk] dihedrals for all your ",
+     "amino acid backbone and sidechains.",
+     "It can compute dihedral angle as a function of time, and as",
+     "histogram distributions.",
+     "The distributions [TT](histo-(dihedral)(RESIDUE).xvg[tt]) are cumulative over all residues of each type.[PAR]", 
+     "If option [TT]-corr[tt] is given, the program will",
+     "calculate dihedral autocorrelation functions. The function used",
+-    "is C(t) = < cos(chi(tau)) cos(chi(tau+t)) >. The use of cosines",
++    "is C(t) = < cos([GRK]chi[grk]([GRK]tau[grk])) cos([GRK]chi[grk]([GRK]tau[grk]+t)) >. The use of cosines",
+     "rather than angles themselves, resolves the problem of periodicity.",
+     "(Van der Spoel & Berendsen (1997), Biophys. J. 72, 2032-2041).",
+     "Separate files for each dihedral of each residue", 
+@@ -1024,27 +1024,27 @@ int gmx_chi(int argc,char *argv[])
+     "These can be in radians or degrees.[PAR]", 
+     "A log file (argument [TT]-g[tt]) is also written. This contains [BR]",
+     "(a) information about the number of residues of each type.[BR]", 
+-    "(b) The NMR 3J coupling constants from the Karplus equation.[BR]", 
++    "(b) The NMR ^3J coupling constants from the Karplus equation.[BR]", 
+     "(c) a table for each residue of the number of transitions between ", 
+-    "rotamers per nanosecond,  and the order parameter S2 of each dihedral.[BR]",
+-    "(d) a table for each residue of the rotamer occupancy.[BR]", 
+-    "All rotamers are taken as 3-fold, except for omegas and chi-dihedrals",
+-    "to planar groups (i.e. chi2 of aromatics Asp and Asn, chi3 of Glu", 
+-    "and Gln, and chi4 of Arg), which are 2-fold. \"rotamer 0\" means ", 
++    "rotamers per nanosecond,  and the order parameter S^2 of each dihedral.[BR]",
++    "(d) a table for each residue of the rotamer occupancy.[PAR]", 
++    "All rotamers are taken as 3-fold, except for [GRK]omega[grk] and [GRK]chi[grk] dihedrals",
++    "to planar groups (i.e. [GRK]chi[grk]2 of aromatics, Asp and Asn; [GRK]chi[grk]3 of Glu", 
++    "and Gln; and [GRK]chi[grk]4 of Arg), which are 2-fold. \"rotamer 0\" means ", 
+     "that the dihedral was not in the core region of each rotamer. ", 
+     "The width of the core region can be set with [TT]-core_rotamer[tt][PAR]", 
+ 
+-    "The S2 order parameters are also output to an [TT].xvg[tt] file", 
++    "The S^2 order parameters are also output to an [TT].xvg[tt] file", 
+     "(argument [TT]-o[tt] ) and optionally as a [TT].pdb[tt] file with", 
+-    "the S2 values as B-factor (argument [TT]-p[tt]). ", 
++    "the S^2 values as B-factor (argument [TT]-p[tt]). ", 
+     "The total number of rotamer transitions per timestep", 
+     "(argument [TT]-ot[tt]), the number of transitions per rotamer", 
+-    "(argument [TT]-rt[tt]), and the 3J couplings (argument [TT]-jc[tt]), ", 
++    "(argument [TT]-rt[tt]), and the ^3J couplings (argument [TT]-jc[tt]), ", 
+     "can also be written to [TT].xvg[tt] files.[PAR]", 
+ 
+-    "If [TT]-chi_prod[tt] is set (and maxchi > 0), cumulative rotamers, e.g.", 
+-    "1+9(chi1-1)+3(chi2-1)+(chi3-1) (if the residue has three 3-fold ", 
+-    "dihedrals and maxchi >= 3)", 
++    "If [TT]-chi_prod[tt] is set (and [TT]-maxchi[tt] > 0), cumulative rotamers, e.g.", 
++    "1+9([GRK]chi[grk]1-1)+3([GRK]chi[grk]2-1)+([GRK]chi[grk]3-1) (if the residue has three 3-fold ", 
++    "dihedrals and [TT]-maxchi[tt] >= 3)", 
+     "are calculated. As before, if any dihedral is not in the core region,", 
+     "the rotamer is taken to be 0. The occupancies of these cumulative ",
+     "rotamers (starting with rotamer 0) are written to the file", 
+@@ -1053,17 +1053,17 @@ int gmx_chi(int argc,char *argv[])
+     "are written to [TT]chiproduct(RESIDUE)(nresnr).xvg[tt] ", 
+     "and their occupancies to [TT]histo-chiproduct(RESIDUE)(nresnr).xvg[tt].[PAR]", 
+ 
+-    "The option [TT]-r[tt] generates a contour plot of the average omega angle",
+-    "as a function of the phi and psi angles, that is, in a Ramachandran plot",
+-    "the average omega angle is plotted using color coding.", 
++    "The option [TT]-r[tt] generates a contour plot of the average [GRK]omega[grk] angle",
++    "as a function of the [GRK]phi[grk] and [GRK]psi[grk] angles, that is, in a Ramachandran plot",
++    "the average [GRK]omega[grk] angle is plotted using color coding.", 
+ 
+   };
+   
+   const char *bugs[] = {
+     "Produces MANY output files (up to about 4 times the number of residues in the protein, twice that if autocorrelation functions are calculated). Typically several hundred files are output.",
+-    "Phi and psi dihedrals are calculated in a non-standard way, using H-N-CA-C for phi instead of C(-)-N-CA-C, and N-CA-C-O for psi instead of N-CA-C-N(+). This causes (usually small) discrepancies with the output of other tools like [TT]g_rama[tt].", 
++    "[GRK]phi[grk] and [GRK]psi[grk] dihedrals are calculated in a non-standard way, using H-N-CA-C for [GRK]phi[grk] instead of C(-)-N-CA-C, and N-CA-C-O for [GRK]psi[grk] instead of N-CA-C-N(+). This causes (usually small) discrepancies with the output of other tools like [TT]g_rama[tt].", 
+     "[TT]-r0[tt] option does not work properly", 
+-    "Rotamers with multiplicity 2 are printed in chi.log as if they had multiplicity 3, with the 3rd (g(+)) always having probability 0" 
++    "Rotamers with multiplicity 2 are printed in [TT]chi.log[tt] as if they had multiplicity 3, with the 3rd (g(+)) always having probability 0" 
+   };
+ 
+   /* defaults */ 
+@@ -1079,13 +1079,13 @@ int gmx_chi(int argc,char *argv[])
+     { "-r0",  FALSE, etINT, {&r0},
+       "starting residue" },
+     { "-phi",  FALSE, etBOOL, {&bPhi},
+-      "Output for Phi dihedral angles" },
++      "Output for [GRK]phi[grk] dihedral angles" },
+     { "-psi",  FALSE, etBOOL, {&bPsi},
+-      "Output for Psi dihedral angles" },
++      "Output for [GRK]psi[grk] dihedral angles" },
+     { "-omega",FALSE, etBOOL, {&bOmega},  
+-      "Output for Omega dihedrals (peptide bonds)" },
++      "Output for [GRK]omega[grk] dihedrals (peptide bonds)" },
+     { "-rama", FALSE, etBOOL, {&bRama},
+-      "Generate Phi/Psi and Chi1/Chi2 ramachandran plots" },
++      "Generate [GRK]phi[grk]/[GRK]psi[grk] and [GRK]chi[grk]1/[GRK]chi[grk]2 Ramachandran plots" },
+     { "-viol", FALSE, etBOOL, {&bViol},
+       "Write a file that gives 0 or 1 for violated Ramachandran angles" },
+     { "-periodic", FALSE, etBOOL, {&bPBC},
+@@ -1095,13 +1095,13 @@ int gmx_chi(int argc,char *argv[])
+     { "-rad",  FALSE, etBOOL, {&bRAD},
+       "in angle vs time files, use radians rather than degrees."}, 
+     { "-shift", FALSE, etBOOL, {&bShift},
+-	"Compute chemical shifts from Phi/Psi angles" },
++	"Compute chemical shifts from [GRK]phi[grk]/[GRK]psi[grk] angles" },
+     { "-binwidth", FALSE, etINT, {&ndeg},
+       "bin width for histograms (degrees)" },
+     { "-core_rotamer", FALSE, etREAL, {&core_frac},
+       "only the central [TT]-core_rotamer[tt]*(360/multiplicity) belongs to each rotamer (the rest is assigned to rotamer 0)" },
+     { "-maxchi", FALSE, etENUM, {maxchistr},
+-      "calculate first ndih Chi dihedrals" },
++      "calculate first ndih [GRK]chi[grk] dihedrals" },
+     { "-normhisto", FALSE, etBOOL, {&bNormHisto},
+       "Normalize histograms" },
+     { "-ramomega",FALSE,etBOOL, {&bRamOmega},
+diff --git a/src/tools/gmx_cluster.c b/src/tools/gmx_cluster.c
+index 1717052..c7652ef 100644
+--- a/src/tools/gmx_cluster.c
++++ b/src/tools/gmx_cluster.c
+@@ -1256,9 +1256,10 @@ int gmx_cluster(int argc,char *argv[])
+       for(i=0; i<nf; i++)
+ 	reset_x(ifsize,fitidx,isize,NULL,xx[i],mass);
+     }
+-  }
+-  if (bPBC) {
+-    gmx_rmpbc_done(gpbc);
++    if (bPBC)
++    {
++      gmx_rmpbc_done(gpbc);
++    }
+   }
+ 
+   if (bReadMat) {
+diff --git a/src/tools/gmx_current.c b/src/tools/gmx_current.c
+index c4df1fe..c0a7f0f 100644
+--- a/src/tools/gmx_current.c
++++ b/src/tools/gmx_current.c
+@@ -685,7 +685,7 @@ int gmx_current(int argc,char *argv[])
+     { "-nojump", FALSE, etBOOL, {&bNoJump},
+       "Removes jumps of atoms across the box."},
+     { "-eps", FALSE, etREAL, {&eps_rf},
+-		"Dielectric constant of the surrounding medium. eps=0.0 corresponds to eps=infinity (thinfoil boundary conditions)."},
++		"Dielectric constant of the surrounding medium. eps=0.0 corresponds to eps=infinity (tin-foil boundary conditions)."},
+ 	{ "-bfit", FALSE, etREAL, {&bfit},
+ 		"Begin of the fit of the straight line to the MSD of the translational fraction of the dipole moment."},
+ 	{ "-efit", FALSE, etREAL, {&efit},
+@@ -751,16 +751,16 @@ int gmx_current(int argc,char *argv[])
+ 
+ 
+     const char *desc[] = {
+-    "This is a tool for calculating the current autocorrelation function, the correlation",
++    "[TT]g_current[tt] is a tool for calculating the current autocorrelation function, the correlation",
+     "of the rotational and translational dipole moment of the system, and the resulting static",
+-    "dielectric constant. To obtain a reasonable result the index group has to be neutral.",
+-    "Furthermore the routine is capable of extracting the static conductivity from the current ",
+-    "autocorrelation function, if velocities are given. Additionally an Einstein-Helfand fit also",
+-    "allows to get the static conductivity."
++    "dielectric constant. To obtain a reasonable result, the index group has to be neutral.",
++    "Furthermore, the routine is capable of extracting the static conductivity from the current ",
++    "autocorrelation function, if velocities are given. Additionally, an Einstein-Helfand fit ",
++    "can be used to obtain the static conductivity."
+     "[PAR]",
+     "The flag [TT]-caf[tt] is for the output of the current autocorrelation function and [TT]-mc[tt] writes the",
+     "correlation of the rotational and translational part of the dipole moment in the corresponding",
+-    "file. However this option is only available for trajectories containing velocities.",
++    "file. However, this option is only available for trajectories containing velocities.",
+     "Options [TT]-sh[tt] and [TT]-tr[tt] are responsible for the averaging and integration of the",
+     "autocorrelation functions. Since averaging proceeds by shifting the starting point",
+     "through the trajectory, the shift can be modified with [TT]-sh[tt] to enable the choice of uncorrelated",
+@@ -776,10 +776,10 @@ int gmx_current(int argc,char *argv[])
+     "tin-foil boundary conditions).",
+     "[PAR]",
+     "[TT]-[no]nojump[tt] unfolds the coordinates to allow free diffusion. This is required to get a continuous",
+-    "translational dipole moment, required for the Einstein-Helfand fit. The resuls from the fit allow to",
+-    "determine the dielectric constant for system of charged molecules. However it is also possible to extract",
++    "translational dipole moment, required for the Einstein-Helfand fit. The results from the fit allow",
++    "the determination of the dielectric constant for system of charged molecules. However, it is also possible to extract",
+     "the dielectric constant from the fluctuations of the total dipole moment in folded coordinates. But this",
+-    "options has to be used with care, since only very short time spans fulfill the approximation, that the density",
++    "option has to be used with care, since only very short time spans fulfill the approximation that the density",
+     "of the molecules is approximately constant and the averages are already converged. To be on the safe side,",
+     "the dielectric constant should be calculated with the help of the Einstein-Helfand method for",
+     "the translational part of the dielectric constant."
+diff --git a/src/tools/gmx_densorder.c b/src/tools/gmx_densorder.c
+new file mode 100644
+index 0000000..3fa0903
+--- /dev/null
++++ b/src/tools/gmx_densorder.c
+@@ -0,0 +1,809 @@
++/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
++ * $Id: densorder.c,v 0.9
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.0
++ * 
++ * Copyright (c) 1991-2001
++ * BIOSON Research Institute, Dept. of Biophysical Chemistry
++ * 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.
++ * 
++ * Do check out http://www.gromacs.org , or mail us at gromacs at gromacs.org .
++ * 
++ * And Hey:
++ * Gyas ROwers Mature At Cryogenic Speed
++ */
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++#include <math.h>
++#include "sysstuff.h"
++#include "string.h"
++#include "string2.h"
++#include "typedefs.h"
++#include "smalloc.h"
++#include "macros.h"
++#include "gstat.h"
++#include "vec.h"
++#include "xvgr.h"
++#include "pbc.h"
++#include "copyrite.h"
++#include "futil.h"
++#include "statutil.h"
++#include "index.h"
++#include "tpxio.h"
++#include "physics.h"
++#include "matio.h"
++#include "dens_filter.h"
++#include "binsearch.h"
++#include "powerspect.h"
++#include "gmx_ana.h"
++
++#ifdef GMX_DOUBLE
++#define FLOOR(x) ((int) floor(x))
++#else
++#define FLOOR(x) ((int) floorf(x))
++#endif
++
++enum {methSEL, methBISECT, methFUNCFIT, methNR};
++
++static void center_coords(t_atoms *atoms,matrix box,rvec x0[],int axis)
++{
++    int  i,m;
++    real tmass,mm;
++    rvec com,shift,box_center;
++  
++    tmass = 0;
++    clear_rvec(com);
++    for(i=0; (i<atoms->nr); i++) 
++    {
++        mm     = atoms->atom[i].m;
++        tmass += mm;
++        for(m=0; (m<DIM); m++) 
++            com[m] += mm*x0[i][m];
++    }
++    for(m=0; (m<DIM); m++) 
++        com[m] /= tmass;
++    calc_box_center(ecenterDEF,box,box_center);
++    rvec_sub(box_center,com,shift);
++    shift[axis] -= box_center[axis];
++  
++    for(i=0; (i<atoms->nr); i++) 
++        rvec_dec(x0[i],shift);
++}
++
++
++static void density_in_time (const char *fn, atom_id **index ,int gnx[], int grpn, real bw, real bwz, int nsttblock, real *****Densdevel, int *xslices, int *yslices, int *zslices,int *tblock, t_topology *top, int ePBC, int axis,gmx_bool bCenter, gmx_bool bps1d, const output_env_t oenv)
++
++{
++/*  
++ * *****Densdevel pointer to array of density values in slices and frame-blocks Densdevel[*nsttblock][*xslices][*yslices][*zslices]
++ * Densslice[x][y][z]
++ * nsttblock - nr of frames in each time-block 
++ * bw  widths of normal slices 
++ *
++ * axis	 - axis direction (normal to slices)
++ * nndx - number ot atoms in **index
++ * grpn	 - group number in index
++ */
++	t_trxstatus *status;
++    gmx_rmpbc_t gpbc=NULL;
++	matrix box; /* Box - 3x3 -each step*/
++	rvec *x0; /* List of Coord without PBC*/ 
++	int natoms,i,j,k,n, /* loop indices, checks etc*/
++        ax1=0,ax2=0, /* tangent directions */
++        framenr=0, /* frame number in trajectory*/
++        slicex, slicey, slicez; /*slice # of x y z position */
++	real ***Densslice; /* Density-slice in one frame*/
++	real dscale; /*physical scaling factor*/
++	real t,x,y,z; /* time and coordinates*/
++	rvec bbww;
++	
++	*tblock=0;/* blocknr in block average - initialise to 0*/
++	/* Axis: X=0, Y=1,Z=2 */
++	switch(axis)	
++	{
++	case 0:
++		ax1=YY; ax2=ZZ; /*Surface: YZ*/
++		break;
++	case 1:
++		ax1=ZZ; ax2=XX; /* Surface : XZ*/
++		break;
++ 	case 2:
++        ax1 = XX; ax2 = YY; /* Surface XY*/
++        break;
++  	default:
++        gmx_fatal(FARGS,"Invalid axes. Terminating\n");
++	}
++	
++	if( (natoms= read_first_x(oenv,&status,fn,&t,&x0,box)==0))
++        gmx_fatal(FARGS, "Could not read coordinates from file"); /* Open trajectory for read*/
++	
++
++	*zslices=1+FLOOR(box[axis][axis]/bwz);
++	*yslices=1+FLOOR(box[ax2][ax2]/bw);
++	*xslices=1+FLOOR(box[ax1][ax1]/bw);
++	if(bps1d)
++    {
++		if(*xslices<*yslices) *xslices=1;
++		else *yslices=1; 
++    }  
++	fprintf(stderr,
++            "\nDividing the box in %5d x %5d x %5d slices with binw %f along axis %d\n",*xslices,*yslices,*zslices,bw,axis );
++	
++		
++	/****Start trajectory processing***/
++	
++	/*Initialize Densdevel and PBC-remove*/
++	gpbc=gmx_rmpbc_init(&top->idef,ePBC,top->atoms.nr,box);
++
++	*Densdevel=NULL;		
++	
++	do 	
++    {
++        bbww[XX] = box[ax1][ax1]/ *xslices;
++        bbww[YY] = box[ax2][ax2]/ *yslices;
++        bbww[ZZ] = box[axis][axis]/ *zslices;
++        gmx_rmpbc(gpbc,top->atoms.nr,box,x0);
++        /*Reset Densslice every nsttblock steps*/
++		if   ( framenr % nsttblock==0  )
++        { 
++			snew(Densslice,*xslices);
++            for (i=0;i<*xslices;i++) 
++            {
++                snew(Densslice[i],*yslices);
++                for (j=0;j<*yslices;j++)
++                {
++                    snew(Densslice[i][j],*zslices);
++                }
++            }
++	
++            /*Allocate Memory to  extra frame in Densdevel -  rather stupid approach:				  	  			*A single frame each time, although only every nsttblock steps.*/
++			srenew(*Densdevel,*tblock+1);
++				
++		}
++
++	
++		dscale=(*xslices)*(*yslices)*(*zslices)*AMU/ (box[ax1][ax1]*box[ax2][ax2]*box[axis][axis]*nsttblock*(NANO*NANO*NANO));
++		
++		if (bCenter)
++			center_coords(&top->atoms,box,x0,axis);
++
++
++		for (j=0;j<gnx[0];j++) 
++        { /*Loop over all atoms in selected index*/
++			x=x0[index[0][j]][ax1];
++			y=x0[index[0][j]][ax2];
++			z=x0[index[0][j]][axis];
++			while (x<0)
++				x+=box[ax1][ax1];
++			while(x>box[ax1][ax1])
++				x-=box[ax1][ax1];
++			
++			while (y<0)
++				y+=box[ax2][ax2];
++			while(y>box[ax2][ax2])
++				y-=box[ax2][ax2];
++			
++			while (z<0)
++				z+=box[axis][axis];
++			while(z>box[axis][axis])
++				z-=box[axis][axis];
++			
++			slicex=((int) (x/bbww[XX])) % *xslices;
++			slicey=((int) (y/bbww[YY])) % *yslices;
++			slicez=((int) (z/bbww[ZZ])) % *zslices;
++			Densslice[slicex][slicey][slicez]+=(top->atoms.atom[index[0][j]].m*dscale);
++		
++			
++		}
++			
++		framenr++;
++	
++		if(framenr % nsttblock == 0)
++        {
++            /*Implicit incrementation of Densdevel via renewal of Densslice*/
++            /*only every nsttblock steps*/
++			(*Densdevel)[*tblock]=Densslice; 			     
++			(*tblock)++;
++		}	
++			
++    } while(read_next_x(oenv,status,&t,natoms,x0,box));
++		
++
++	/*Free memory we no longer need and exit.*/
++	gmx_rmpbc_done(gpbc);
++	close_trj(status);
++	
++	if (0)
++	{
++        FILE *fp;
++        fp = fopen("koko.xvg","w");
++        for(j=0; (j<*zslices); j++) 
++        {
++            fprintf(fp,"%5d",j);
++            for(i=0; (i<*tblock); i++) 
++            {
++                fprintf(fp,"  %10g",(*Densdevel)[i][9][1][j]);
++            }
++            fprintf(fp,"\n");
++        }
++        fclose(fp); 
++	}
++	
++}
++
++
++
++static void printdensavg(char *fldfn, real ****Densmap, int xslices, int yslices, int zslices, int tdim)
++{
++/*Debug-filename and filehandle*/
++    FILE *fldH;
++    int n,i,j,k;
++    real totdens=0;
++    fldH=ffopen(fldfn,"w");
++    fprintf(fldH,"%i  %i  %i  %i\n",tdim, xslices,yslices,zslices);
++    for(n=0;n<tdim;n++)
++    {
++        for(i=0;i<xslices;i++)
++        {
++            for (j=0;j<yslices;j++)
++            {
++                for (k=0;k<zslices;k++)
++                {
++                    fprintf(fldH,"%i %i %i %f\n",i,j,k,Densmap[n][i][j][k]);
++                    totdens+=(Densmap[n][i][j][k]);
++                }
++            }
++        }
++    }
++    totdens/=(xslices*yslices*zslices*tdim);
++    fprintf(stderr,"Total density [kg/m^3]  %8f",totdens);
++    ffclose(fldH);
++}
++
++
++static void outputfield(const char *fldfn, real ****Densmap, 
++                        int xslices, int yslices, int zslices, int tdim)
++{
++/*Debug-filename and filehandle*/
++    FILE *fldH;
++    int n,i,j,k;
++    int dim[4];
++    real totdens=0;
++    
++    dim[0] = tdim;
++    dim[1] = xslices;
++    dim[2] = yslices;
++    dim[3] = zslices;
++    
++    fldH=ffopen(fldfn,"w");
++    fwrite(dim,sizeof(int),4,fldH);
++    for(n=0;n<tdim;n++)
++    {
++        for(i=0;i<xslices;i++)
++        {
++            for (j=0;j<yslices;j++)
++            {
++                for (k=0;k<zslices;k++)
++                {
++                    fwrite(&(Densmap[n][i][j][k]),sizeof(real),1,fldH);
++                    totdens+=(Densmap[n][i][j][k]);
++                }
++            }
++        }
++    }
++    totdens/=(xslices*yslices*zslices*tdim);
++    fprintf(stderr,"Total density [kg/m^3]  %8f",totdens);
++    ffclose(fldH);
++}
++
++static void periodic_running_average(int npoints,real *x,int naver)
++{
++    int i,j,nj;
++    real *aver;
++  
++    snew(aver,npoints);
++    for(i=0; (i<npoints); i++)  
++    {
++        nj = 0;
++        for(j=i-naver/2; (j<i+naver/2); j++) 
++        {
++            aver[i] += x[(j+npoints) % npoints];
++            nj++;
++        }
++        aver[i] /= nj;
++    }
++    for(i=0; (i<npoints); i++) 
++        x[i] = aver[i];
++    sfree(aver);
++}
++
++static void filterdensmap(real ****Densmap, int xslices, int yslices, int zslices,int tblocks,int ftsize)
++{
++    real *kernel;
++    real *output;
++    real std,var;
++    int i,j,k,n, order;
++    order=ftsize/2;
++    std=((real)order/2.0);
++    var=std*std;
++    snew(kernel,ftsize);
++    gausskernel(kernel,ftsize,var);
++    for(n=0;n<tblocks;n++)
++    {	
++        for(i=0;i<xslices;i++)
++        {
++            for (j=0;j<yslices;j++)
++            {
++                periodic_convolution(zslices,Densmap[n][i][j],ftsize,kernel);
++            }
++        }
++    }
++}
++
++	
++ 
++
++static void interfaces_txy (real ****Densmap, int xslices, int yslices, int zslices,
++                            int tblocks, real binwidth,int method, 
++                            real dens1, real dens2, t_interf ****intf1, 
++                            t_interf ****intf2,const output_env_t oenv)
++{
++    /*Returns two pointers to 3D arrays of t_interf structs containing (position,thickness) of the interface(s)*/
++	FILE *xvg;
++	real *zDensavg; /* zDensavg[z]*/
++	int i,j,k,n;
++	int xysize;
++	int  ndx1, ndx2, deltandx, *zperm;
++	real densmid, densl, densr, alpha, pos, spread;
++	real splitpoint, startpoint, endpoint;
++	real *sigma1, *sigma2;
++    real beginfit1[4];
++    real beginfit2[4];
++    real *fit1=NULL,*fit2=NULL;
++    const real *avgfit1;
++    const real *avgfit2;
++	const real onehalf= 1.00/2.00;
++	t_interf ***int1=NULL,***int2=NULL; /*Interface matrices [t][x,y] - last index in row-major order*/
++    /*Create int1(t,xy) and int2(t,xy) arrays with correct number of interf_t elements*/
++	xysize=xslices*yslices;
++	snew(int1,tblocks);
++	snew(int2,tblocks);
++	for (i=0;i<tblocks;i++)
++    {
++		snew(int1[i],xysize);
++		snew(int2[i],xysize);
++		for(j=0;j<xysize;j++)
++        {
++			snew(int1[i][j],1);
++			snew(int2[i][j],1);
++			init_interf(int1[i][j]);
++			init_interf(int2[i][j]);
++		}		
++	}	
++
++    if(method==methBISECT)
++    {
++        densmid= onehalf*(dens1+dens2);	
++        snew(zperm,zslices);
++        for(n=0;n<tblocks;n++)
++        {
++            for(i=0;i<xslices;i++)
++            {
++                for (j=0;j<yslices;j++)
++                {
++                    rangeArray(zperm,zslices); /*reset permutation array to identity*/
++                    /*Binsearch returns slice-nr where the order param is  <= setpoint sgmid*/
++                    ndx1=start_binsearch(Densmap[n][i][j],zperm,0,zslices/2-1,densmid,1);
++                    ndx2=start_binsearch(Densmap[n][i][j],zperm,zslices/2,zslices-1,densmid,-1);
++		
++                    /* Linear interpolation (for use later if time allows) 
++                     * rho_1s= Densmap[n][i][j][zperm[ndx1]]
++                     * rho_1e =Densmap[n][i][j][zperm[ndx1+1]] - in worst case might be far off
++                     * rho_2s =Densmap[n][i][j][zperm[ndx2+1]]
++                     * rho_2e =Densmap[n][i][j][zperm[ndx2]]
++                     * For 1st interface we have:
++                     densl= Densmap[n][i][j][zperm[ndx1]];
++                     densr= Densmap[n][i][j][zperm[ndx1+1]];
++                     alpha=(densmid-densl)/(densr-densl);
++                     deltandx=zperm[ndx1+1]-zperm[ndx1];
++
++                     if(debug){
++                     printf("Alpha, Deltandx  %f %i\n", alpha,deltandx);
++                     }
++                     if(abs(alpha)>1.0 || abs(deltandx)>3){
++                     pos=zperm[ndx1];
++                     spread=-1;
++                     }
++                     else {
++                     pos=zperm[ndx1]+alpha*deltandx;
++                     spread=binwidth*deltandx;
++                     }
++                     * For the 2nd interface  can use the same formulation, since alpha should become negative ie: 
++                     * alpha=(densmid-Densmap[n][i][j][zperm[ndx2]])/(Densmap[n][i][j][zperm[nxd2+1]]-Densmap[n][i][j][zperm[ndx2]]);
++                     * deltandx=zperm[ndx2+1]-zperm[ndx2];
++                     * pos=zperm[ndx2]+alpha*deltandx;   */
++
++                    /*After filtering we use the direct approach	*/
++                    int1[n][j+(i*yslices)]->Z=(zperm[ndx1]+onehalf)*binwidth;
++                    int1[n][j+(i*yslices)]->t=binwidth;
++                    int2[n][j+(i*yslices)]->Z=(zperm[ndx2]+onehalf)*binwidth;
++                    int2[n][j+(i*yslices)]->t=binwidth;
++                }
++            }
++        }				
++    }	
++
++    if(method==methFUNCFIT)
++    {
++        /*Assume a box divided in 2 along midpoint of z for starters*/
++        startpoint=0.0;
++        endpoint = binwidth*zslices;
++        splitpoint = (startpoint+endpoint)/2.0;
++        /*Initial fit proposals*/
++        beginfit1[0] = dens1;
++        beginfit1[1] = dens2;
++        beginfit1[2] = (splitpoint/2);
++        beginfit1[3] = 0.5;
++        
++        beginfit2[0] = dens2;
++        beginfit2[1] = dens1;
++        beginfit2[2] = (3*splitpoint/2);
++        beginfit2[3] = 0.5;
++
++        snew(zDensavg,zslices);
++        snew(sigma1,zslices);
++        snew(sigma2,zslices);
++
++        for(k=0;k<zslices;k++) sigma1[k]=sigma2[k]=1;	
++        /*Calculate average density along z - avoid smoothing by using coarse-grained-mesh*/
++        for(k=0;k<zslices;k++)
++        {
++            for(n=0;n<tblocks;n++)
++            {
++                for (i=0;i<xslices;i++)
++                {
++                    for(j=0;j<yslices;j++)
++                    {
++                        zDensavg[k]+=(Densmap[n][i][j][k]/(xslices*yslices*tblocks));
++                    }
++                }
++            }
++        }
++
++        if(debug){
++            xvg=xvgropen("DensprofileonZ.xvg", "Averaged Densityprofile on Z","z[nm]","Density[kg/m^3]",oenv);
++            for(k=0;k<zslices;k++) fprintf(xvg, "%4f.3   %8f.4\n", k*binwidth,zDensavg[k]);
++            fclose(xvg);
++        }
++	
++        /*Fit average density in z over whole trajectory to obtain tentative fit-parameters in fit1 and fit2*/
++	
++        /*Fit 1st half of box*/
++        do_lmfit(zslices, zDensavg,sigma1,binwidth,NULL,startpoint,splitpoint,oenv,FALSE,effnERF,beginfit1,3);
++        /*Fit 2nd half of box*/
++        do_lmfit(zslices ,zDensavg,sigma2,binwidth,NULL,splitpoint,endpoint,oenv,FALSE,effnERF,beginfit2,3);
++	
++        /*Initialise the const arrays for storing the average fit parameters*/
++        avgfit1=beginfit1;
++        avgfit2=beginfit2;
++
++		
++		
++		/*Now do fit over each x  y and t slice to get Zint(x,y,t) - loop is very large, we potentially should average over time directly*/
++        for(n=0;n<tblocks;n++)
++        {
++            for(i=0;i<xslices;i++)
++            {
++                for (j=0;j<yslices;j++)
++                {
++                    /*Reinitialise fit for each mesh-point*/
++                    srenew(fit1,4);
++                    srenew(fit2,4);
++                    for (k=0;k<4;k++)
++                    {
++                        fit1[k]=avgfit1[k];
++                        fit2[k]=avgfit2[k];
++                    }
++                    /*Now fit and store in structures in row-major order int[n][i][j]*/
++                    do_lmfit(zslices,Densmap[n][i][j],sigma1,binwidth,NULL,startpoint,splitpoint,oenv,FALSE,effnERF,fit1,1);
++                    int1[n][j+(yslices*i)]->Z=fit1[2];
++                    int1[n][j+(yslices*i)]->t=fit1[3];
++                    do_lmfit(zslices,Densmap[n][i][j],sigma2,binwidth,NULL,splitpoint,endpoint,oenv,FALSE,effnERF,fit2,2);
++                    int2[n][j+(yslices*i)]->Z=fit2[2];
++                    int2[n][j+(yslices*i)]->t=fit2[3];
++                }
++            }
++        }
++    }
++
++
++    *intf1=int1;
++    *intf2=int2;
++
++}
++
++static void writesurftoxpms(t_interf ***surf1,t_interf ***surf2, int tblocks,int xbins, int ybins, int zbins, real bw,real bwz, char **outfiles,int maplevels ) 
++{
++    char numbuf[12];
++    int n, i, j;
++    real **profile1, **profile2;
++    real max1, max2, min1, min2, *xticks, *yticks;
++    t_rgb lo={0,0,0};
++    t_rgb hi={1,1,1};
++    FILE *xpmfile1, *xpmfile2;
++
++/*Prepare xpm structures for output*/
++
++/*Allocate memory to tick's and matrices*/
++    snew (xticks,xbins+1);
++    snew (yticks,ybins+1);
++
++    profile1=mk_matrix(xbins,ybins,FALSE);
++    profile2=mk_matrix(xbins,ybins,FALSE);
++ 
++    for (i=0;i<xbins+1;i++) xticks[i]+=bw;			
++    for (j=0;j<ybins+1;j++) yticks[j]+=bw;
++
++    xpmfile1 = ffopen(outfiles[0],"w");
++    xpmfile2 = ffopen(outfiles[1],"w");
++
++    max1=max2=0.0;
++    min1=min2=zbins*bwz;
++
++    for(n=0;n<tblocks;n++)
++    {
++        sprintf(numbuf,"tblock: %4i",n);
++/*Filling matrices for inclusion in xpm-files*/
++        for(i=0;i<xbins;i++)
++        { 
++            for(j=0;j<ybins;j++)
++            {	
++				profile1[i][j]=(surf1[n][j+ybins*i])->Z;								 
++				profile2[i][j]=(surf2[n][j+ybins*i])->Z;
++				/*Finding max and min values*/
++				if(profile1[i][j]>max1) max1=profile1[i][j];
++				if(profile1[i][j]<min1) min1=profile1[i][j];
++				if(profile2[i][j]>max2) max2=profile2[i][j];
++				if(profile2[i][j]<min2) min2=profile2[i][j];
++            }	
++        }
++
++        write_xpm(xpmfile1,3,numbuf,"Height","x[nm]","y[nm]",xbins,ybins,xticks,yticks,profile1,min1,max1,lo,hi,&maplevels);
++        write_xpm(xpmfile2,3,numbuf,"Height","x[nm]","y[nm]",xbins,ybins,xticks,yticks,profile2,min2,max2,lo,hi,&maplevels);
++    }	
++
++    ffclose(xpmfile1);
++    ffclose(xpmfile2); 
++
++
++    sfree(profile1);
++    sfree(profile2);
++    sfree(xticks);
++    sfree(yticks);
++}
++
++static void writeraw(t_interf ***int1, t_interf ***int2, int tblocks,int xbins, int ybins,char **fnms)
++{
++	FILE *raw1, *raw2;
++    int i,j,n;
++	
++	raw1=ffopen(fnms[0],"w");
++	raw2=ffopen(fnms[1],"w");
++	fprintf(raw1,"#Produced by: %s #\n", command_line());
++	fprintf(raw2,"#Produced by: %s #\n", command_line());
++	fprintf(raw1,"#Legend: nt nx ny\n#Xbin Ybin Z t\n");
++	fprintf(raw2,"#Legend: nt nx ny\n#Xbin Ybin Z t\n");
++	fprintf(raw1,"%i %i %i\n", tblocks,xbins,ybins);
++	fprintf(raw2,"%i %i %i\n", tblocks,xbins,ybins);
++	for (n=0;n<tblocks;n++)
++    {
++		for(i=0;i<xbins;i++)
++        {
++			for(j=0;j<ybins;j++)
++            {
++				fprintf(raw1,"%i  %i  %8.5f  %6.4f\n",i,j,(int1[n][j+ybins*i])->Z,(int1[n][j+ybins*i])->t);
++				fprintf(raw2,"%i  %i  %8.5f  %6.4f\n",i,j,(int2[n][j+ybins*i])->Z,(int2[n][j+ybins*i])->t);
++			}
++		}
++	}
++
++	ffclose(raw1);
++	ffclose(raw2);
++}
++		
++
++	
++int gmx_densorder(int argc,char *argv[])
++{
++    static const char *desc[] = {
++        "A small program to reduce a two-phase density distribution", 
++        "along an axis, computed over a MD trajectory",
++        "to 2D surfaces fluctuating in time, by a fit to",
++        "a functional profile for interfacial densities",
++        "A time-averaged spatial representation of the" ,
++        "interfaces can be output with the option -tavg" 
++    };
++  
++    /* Extra arguments - but note how you always get the begin/end
++     * options when running the program, without mentioning them here!
++     */
++  
++    output_env_t oenv;
++    t_topology *top;
++    char       title[STRLEN],**grpname;
++    int        ePBC, *ngx;
++    static real binw=0.2;
++    static real binwz=0.05;
++    static real dens1=0.00;
++    static real dens2=1000.00;
++    static int ftorder=0;
++    static int nsttblock=100;
++    static int axis= 2;
++    static char *axtitle="Z";
++    static int ngrps=1;
++    atom_id **index; /* Index list for single group*/
++    int xslices, yslices, zslices, tblock;
++    static gmx_bool bGraph=FALSE;
++    static gmx_bool bCenter = FALSE;
++    static gmx_bool bFourier=FALSE;
++    static gmx_bool bRawOut=FALSE;
++    static gmx_bool bOut=FALSE;
++    static gmx_bool b1d=FALSE;
++    static int nlevels=100;
++    /*Densitymap - Densmap[t][x][y][z]*/
++    real ****Densmap=NULL;
++    /* Surfaces surf[t][surf_x,surf_y]*/
++    t_interf ***surf1, ***surf2;
++
++    static const char *meth[]={NULL,"bisect","functional",NULL};
++    int eMeth;	
++
++    char **graphfiles, **rawfiles, **spectra; /* Filenames for xpm-surface maps, rawdata and powerspectra */
++    int nfxpm,nfraw, nfspect; /* # files for interface maps and spectra = # interfaces */
++ 
++    t_pargs pa[] = {
++        { "-1d", FALSE, etBOOL, {&b1d},
++          "Pseudo-1d interface geometry"},
++        { "-bw",FALSE,etREAL,{&binw},
++          "Binwidth of density distribution tangential to interface"},
++        { "-bwn", FALSE, etREAL, {&binwz},
++          "Binwidth of density distribution normal to interface"},
++        { "-order", FALSE, etINT,{&ftorder},
++          "Order of Gaussian filter, order 0 equates to NO filtering"},
++        {"-axis", FALSE, etSTR,{&axtitle},
++         "Axis Direction - X, Y or Z"},
++        {"-method",FALSE ,etENUM,{meth},
++         "Interface location method"},
++        {"-d1", FALSE, etREAL,{&dens1},
++         "Bulk density phase 1 (at small z)"},
++        {"-d2", FALSE, etREAL,{&dens2},
++         "Bulk density phase 2 (at large z)"},
++        { "-tblock",FALSE,etINT,{&nsttblock},
++          "Number of frames in one time-block average"},
++        { "-nlevel", FALSE,etINT, {&nlevels},
++          "Number of Height levels in 2D - XPixMaps"}
++    };
++
++
++    t_filenm fnm[] = {
++        { efTPX, "-s",  NULL, ffREAD },   /* this is for the topology */
++        { efTRX, "-f", NULL, ffREAD },      /* and this for the trajectory */
++        { efNDX, "-n", NULL, ffREAD}, /* this is to select groups */
++        { efDAT, "-o", "Density4D",ffOPTWR}, /* This is for outputting the entire 4D densityfield in binary format */
++        { efOUT, "-or", NULL,ffOPTWRMULT}, /* This is for writing out the entire information in the t_interf arrays */
++        { efXPM, "-og" ,"interface",ffOPTWRMULT},/* This is for writing out the interface meshes - one xpm-file per tblock*/ 
++        { efOUT, "-Spect","intfspect",ffOPTWRMULT}, /* This is for the trajectory averaged Fourier-spectra*/		
++    };
++  
++#define NFILE asize(fnm)
++
++    CopyRight(stderr,argv[0]);
++
++    /* This is the routine responsible for adding default options,
++     * calling the X/motif interface, etc. */
++    parse_common_args(&argc,argv,PCA_CAN_TIME | PCA_CAN_VIEW,
++                      NFILE,fnm,asize(pa),pa,asize(desc),desc,0,NULL,&oenv);
++
++
++    eMeth=nenum(meth);	
++    bFourier=opt2bSet("-Spect",NFILE,fnm);
++    bRawOut=opt2bSet("-or",NFILE,fnm);
++    bGraph=opt2bSet("-og",NFILE,fnm);
++    bOut=opt2bSet("-o",NFILE,fnm);
++    top=read_top(ftp2fn(efTPX,NFILE,fnm),&ePBC);
++    snew(grpname,ngrps);
++    snew(index,ngrps);
++    snew(ngx,ngrps);
++
++/* Calculate axis */
++    axis = toupper(axtitle[0]) - 'X';
++
++    get_index(&top->atoms,ftp2fn_null(efNDX,NFILE,fnm),ngrps,ngx,index,grpname);
++
++    density_in_time(ftp2fn(efTRX,NFILE,fnm),index,ngx,ngrps,binw,binwz,nsttblock,&Densmap,&xslices,&yslices,&zslices,&tblock,top,ePBC,axis,bCenter,b1d,oenv);
++
++    if(ftorder>0)
++    {
++        filterdensmap(Densmap,xslices,yslices,zslices,tblock,2*ftorder+1);
++    }
++
++    if (bOut)
++    {
++        outputfield(opt2fn("-o",NFILE,fnm),Densmap,xslices,yslices,zslices,tblock);
++    }
++
++    interfaces_txy(Densmap,xslices,yslices,zslices,tblock,binwz,eMeth,dens1,dens2,&surf1,&surf2,oenv);
++
++    if(bGraph)
++    {
++
++        /*Output surface-xpms*/
++        nfxpm=opt2fns(&graphfiles,"-og",NFILE,fnm);
++        if(nfxpm!=2)
++        {
++            gmx_fatal(FARGS,"No or not correct number (2) of output-files: %d",nfxpm);
++        }
++        writesurftoxpms(surf1, surf2, tblock,xslices,yslices,zslices,binw,binwz,graphfiles,zslices);
++    }
++
++
++	
++
++
++/*Output raw-data*/
++    if (bRawOut)
++    {
++        nfraw=opt2fns(&rawfiles,"-or",NFILE,fnm);
++        if(nfraw!=2)
++        {
++            gmx_fatal(FARGS,"No or not correct number (2) of output-files: %d",nfxpm);
++        }
++        writeraw(surf1,surf2,tblock,xslices,yslices,rawfiles);
++    }
++
++
++
++    if(bFourier)
++    {
++        nfspect=opt2fns(&spectra,"-Spect",NFILE,fnm);
++        if(nfspect!=2)
++        {
++            gmx_fatal(FARGS,"No or not correct number (2) of output-file-series: %d"
++                      ,nfspect);
++        }
++        powerspectavg_intf(surf1, surf2, tblock,xslices,yslices,spectra);
++    }
++
++    sfree(Densmap);
++    if(bGraph || bFourier || bRawOut)
++    {
++        sfree(surf1);
++        sfree(surf2);
++    }
++
++    thanx(stderr);
++    return 0;
++}
+diff --git a/src/tools/gmx_dielectric.c b/src/tools/gmx_dielectric.c
+index 897155e..17e0ae3 100644
+--- a/src/tools/gmx_dielectric.c
++++ b/src/tools/gmx_dielectric.c
+@@ -239,9 +239,9 @@ int gmx_dielectric(int argc,char *argv[])
+     { "-fft", FALSE, etBOOL, {&bFour},
+       "use fast fourier transform for correlation function" },
+     { "-x1",  FALSE, etBOOL, {&bX},
+-      "use first column as X axis rather than first data set" },
++      "use first column as [IT]x[it]-axis rather than first data set" },
+     { "-eint", FALSE, etREAL, {&tendInt},
+-      "Time were to end the integration of the data and start to use the fit"},
++      "Time to end the integration of the data and start to use the fit"},
+     { "-bfit", FALSE, etREAL, {&tbegin},
+       "Begin time of fit" },
+     { "-efit", FALSE, etREAL, {&tend},
+@@ -251,13 +251,13 @@ int gmx_dielectric(int argc,char *argv[])
+     { "-A", FALSE, etREAL, {&A},
+       "Start value for fit parameter A" },
+     { "-tau1", FALSE, etREAL, {&tau1},
+-      "Start value for fit parameter tau1" },
++      "Start value for fit parameter [GRK]tau[grk]1" },
+     { "-tau2", FALSE, etREAL, {&tau2},
+-      "Start value for fit parameter tau2" },
++      "Start value for fit parameter [GRK]tau[grk]2" },
+     { "-eps0", FALSE, etREAL, {&eps0},
+-      "Epsilon 0 of your liquid" },
++      "[GRK]epsilon[grk]0 of your liquid" },
+     { "-epsRF", FALSE, etREAL, {&epsRF},
+-      "Epsilon of the reaction field used in your simulation. A value of 0 means infinity." },
++      "[GRK]epsilon[grk] of the reaction field used in your simulation. A value of 0 means infinity." },
+     { "-fix", FALSE, etINT,  {&fix},
+       "Fix parameters at their start values, A (2), tau1 (1), or tau2 (4)" },
+     { "-ffn",    FALSE, etENUM, {s_ffn},
+diff --git a/src/tools/gmx_dipoles.c b/src/tools/gmx_dipoles.c
+index 11f9aba..a7d0bbd 100644
+--- a/src/tools/gmx_dipoles.c
++++ b/src/tools/gmx_dipoles.c
+@@ -1268,7 +1268,7 @@ int gmx_dipoles(int argc,char *argv[])
+     const char *desc[] = {
+         "[TT]g_dipoles[tt] computes the total dipole plus fluctuations of a simulation",
+         "system. From this you can compute e.g. the dielectric constant for",
+-        "low dielectric media.",
++        "low-dielectric media.",
+         "For molecules with a net charge, the net charge is subtracted at",
+         "center of mass of the molecule.[PAR]",
+         "The file [TT]Mtot.xvg[tt] contains the total dipole moment of a frame, the",
+@@ -1277,8 +1277,8 @@ int gmx_dipoles(int argc,char *argv[])
+         "simulation.",
+         "The file [TT]dipdist.xvg[tt] contains the distribution of dipole moments during",
+         "the simulation",
+-        "The mu_max is used as the highest value in the distribution graph.[PAR]",
+-        "Furthermore the dipole autocorrelation function will be computed when",
++        "The value of [TT]-mumax[tt] is used as the highest value in the distribution graph.[PAR]",
++        "Furthermore, the dipole autocorrelation function will be computed when",
+         "option [TT]-corr[tt] is used. The output file name is given with the [TT]-c[tt]",
+         "option.",
+         "The correlation functions can be averaged over all molecules",
+@@ -1288,7 +1288,7 @@ int gmx_dipoles(int argc,char *argv[])
+         "Option [TT]-g[tt] produces a plot of the distance dependent Kirkwood",
+         "G-factor, as well as the average cosine of the angle between the dipoles",
+         "as a function of the distance. The plot also includes gOO and hOO",
+-        "according to Nymand & Linse, JCP 112 (2000) pp 6386-6395. In the same plot",
++        "according to Nymand & Linse, J. Chem. Phys. 112 (2000) pp 6386-6395. In the same plot, ",
+         "we also include the energy per scale computed by taking the inner product of",
+         "the dipoles divided by the distance to the third power.[PAR]",
+         "[PAR]",
+@@ -1297,8 +1297,8 @@ int gmx_dipoles(int argc,char *argv[])
+         "This will calculate the autocorrelation function of the molecular",
+         "dipoles using a first order Legendre polynomial of the angle of the",
+         "dipole vector and itself a time t later. For this calculation 1001",
+-        "frames will be used. Further the dielectric constant will be calculated",
+-        "using an epsilonRF of infinity (default), temperature of 300 K (default) and",
++        "frames will be used. Further, the dielectric constant will be calculated",
++        "using an [GRK]epsilon[grk]RF of infinity (default), temperature of 300 K (default) and",
+         "an average dipole moment of the molecule of 2.273 (SPC). For the",
+         "distribution function a maximum of 5.0 will be used."
+     };
+@@ -1325,7 +1325,7 @@ int gmx_dipoles(int argc,char *argv[])
+         { "-corr",     FALSE, etENUM, {corrtype},
+           "Correlation function to calculate" },
+         { "-pairs",    FALSE, etBOOL, {&bPairs},
+-          "Calculate |cos theta| between all pairs of molecules. May be slow" },
++          "Calculate |cos [GRK]theta[grk]| between all pairs of molecules. May be slow" },
+         { "-ncos",     FALSE, etINT, {&ncos},
+           "Must be 1 or 2. Determines whether the <cos> is computed between all molecules in one group, or between molecules in two different groups. This turns on the [TT]-gkr[tt] flag." }, 
+         { "-axis",     FALSE, etSTR, {&axtitle}, 
+@@ -1337,13 +1337,13 @@ int gmx_dipoles(int argc,char *argv[])
+         { "-gkratom2", FALSE, etINT, {&nFB},
+           "Same as previous option in case ncos = 2, i.e. dipole interaction between two groups of molecules" },
+         { "-rcmax",    FALSE, etREAL, {&rcmax},
+-          "Maximum distance to use in the dipole orientation distribution (with ncos == 2). If zero, a criterium based on the box length will be used." },
++          "Maximum distance to use in the dipole orientation distribution (with ncos == 2). If zero, a criterion based on the box length will be used." },
+         { "-phi",      FALSE, etBOOL, {&bPhi},
+           "Plot the 'torsion angle' defined as the rotation of the two dipole vectors around the distance vector between the two molecules in the [TT].xpm[tt] file from the [TT]-cmap[tt] option. By default the cosine of the angle between the dipoles is plotted." },
+         { "-nlevels",  FALSE, etINT, {&nlevels},
+           "Number of colors in the cmap output" },
+         { "-ndegrees", FALSE, etINT, {&ndegrees},
+-          "Number of divisions on the y-axis in the camp output (for 180 degrees)" }
++          "Number of divisions on the [IT]y[it]-axis in the cmap output (for 180 degrees)" }
+     };
+     int          *gnx;
+     int          nFF[2];
+diff --git a/src/tools/gmx_dist.c b/src/tools/gmx_dist.c
+index 99a9c59..eef0c91 100644
+--- a/src/tools/gmx_dist.c
++++ b/src/tools/gmx_dist.c
+@@ -71,7 +71,7 @@ int gmx_dist(int argc,char *argv[])
+   const char *desc[] = {
+     "[TT]g_dist[tt] can calculate the distance between the centers of mass of two",
+     "groups of atoms as a function of time. The total distance and its",
+-    "x, y and z components are plotted.[PAR]",
++    "[IT]x[it]-, [IT]y[it]-, and [IT]z[it]-components are plotted.[PAR]",
+     "Or when [TT]-dist[tt] is set, print all the atoms in group 2 that are",
+     "closer than a certain distance to the center of mass of group 1.[PAR]",
+     "With options [TT]-lt[tt] and [TT]-dist[tt] the number of contacts",
+diff --git a/src/tools/gmx_dyndom.c b/src/tools/gmx_dyndom.c
+index e84b12b..235a026 100644
+--- a/src/tools/gmx_dyndom.c
++++ b/src/tools/gmx_dyndom.c
+@@ -131,7 +131,7 @@ int gmx_dyndom(int argc,char *argv[])
+     "(http://www.cmp.uea.ac.uk/dyndom/).",
+     "It reads the coordinates, the coordinates of the rotation axis,",
+     "and an index file containing the domains.",
+-    "Furthermore it takes the first and last atom of the arrow file",
++    "Furthermore, it takes the first and last atom of the arrow file",
+     "as command line arguments (head and tail) and",
+     "finally it takes the translation vector (given in DynDom info file)",
+     "and the angle of rotation (also as command line arguments). If the angle",
+@@ -161,7 +161,7 @@ int gmx_dyndom(int argc,char *argv[])
+     { "-maxangle", FALSE, etREAL, {&maxangle},
+       "DymDom dtermined angle of rotation about rotation vector" },
+     { "-trans",    FALSE, etREAL, {&trans0},
+-      "Translation (Aangstroem) along rotation vector (see DynDom info file)" },
++      "Translation (Angstrom) along rotation vector (see DynDom info file)" },
+     { "-head",     FALSE, etRVEC, {head},
+       "First atom of the arrow vector" },
+     { "-tail",     FALSE, etRVEC, {tail},
+diff --git a/src/tools/gmx_editconf.c b/src/tools/gmx_editconf.c
+index 89702eb..3662585 100644
+--- a/src/tools/gmx_editconf.c
++++ b/src/tools/gmx_editconf.c
+@@ -485,20 +485,21 @@ int gmx_editconf(int argc, char *argv[])
+                 "The last two are special cases of a triclinic box.",
+                 "The length of the three box vectors of the truncated octahedron is the",
+                 "shortest distance between two opposite hexagons.",
+-                "The volume of a dodecahedron is 0.71 and that of a truncated octahedron",
+-                "is 0.77 of that of a cubic box with the same periodic image distance.",
++                "Relative to a cubic box with some periodic image distance, the volume of a ",
++                "dodecahedron with this same periodic distance is 0.71 times that of the cube, ",
++                "and that of a truncated octahedron is 0.77 times.",
+                 "[PAR]",
+                 "Option [TT]-box[tt] requires only",
+-                "one value for a cubic box, dodecahedron and a truncated octahedron.",
++                "one value for a cubic, rhombic dodecahedral, or truncated octahedral box.",
+                 "[PAR]",
+-                "With [TT]-d[tt] and a [TT]triclinic[tt] box the size of the system in the x, y",
+-                "and z directions is used. With [TT]-d[tt] and [TT]cubic[tt],",
++                "With [TT]-d[tt] and a [TT]triclinic[tt] box the size of the system in the [IT]x[it]-, [IT]y[it]-,",
++                "and [IT]z[it]-directions is used. With [TT]-d[tt] and [TT]cubic[tt],",
+                 "[TT]dodecahedron[tt] or [TT]octahedron[tt] boxes, the dimensions are set",
+                 "to the diameter of the system (largest distance between atoms) plus twice",
+                 "the specified distance.",
+                 "[PAR]",
+                 "Option [TT]-angles[tt] is only meaningful with option [TT]-box[tt] and",
+-                "a triclinic box and can not be used with option [TT]-d[tt].",
++                "a triclinic box and cannot be used with option [TT]-d[tt].",
+                 "[PAR]",
+                 "When [TT]-n[tt] or [TT]-ndef[tt] is set, a group",
+                 "can be selected for calculating the size and the geometric center,",
+@@ -507,14 +508,14 @@ int gmx_editconf(int argc, char *argv[])
+                 "[TT]-rotate[tt] rotates the coordinates and velocities.",
+                 "[PAR]",
+                 "[TT]-princ[tt] aligns the principal axes of the system along the",
+-                "coordinate axes, with the longest axis aligned with the x axis. ",
++                "coordinate axes, with the longest axis aligned with the [IT]x[it]-axis. ",
+                 "This may allow you to decrease the box volume,",
+                 "but beware that molecules can rotate significantly in a nanosecond.",
+                 "[PAR]",
+                 "Scaling is applied before any of the other operations are",
+                 "performed. Boxes and coordinates can be scaled to give a certain density (option",
+-                "[TT]-density[tt]). Note that this may be inaccurate in case a gro",
+-                "file is given as input. A special feature of the scaling option, when the",
++                "[TT]-density[tt]). Note that this may be inaccurate in case a [TT].gro[tt]",
++                "file is given as input. A special feature of the scaling option is that when the",
+                 "factor -1 is given in one dimension, one obtains a mirror image,",
+                 "mirrored in one of the planes. When one uses -1 in three dimensions, ",
+                 "a point-mirror image is obtained.[PAR]",
+@@ -548,8 +549,8 @@ int gmx_editconf(int argc, char *argv[])
+                 "of the principal axis of a specified group against the given vector, ",
+ 				"with an optional center of rotation specified by [TT]-aligncenter[tt].",
+                 "[PAR]",
+-                "Finally with option [TT]-label[tt], [TT]editconf[tt] can add a chain identifier",
+-                "to a [TT].pdb[tt] file, which can be useful for analysis with e.g. rasmol.",
++                "Finally, with option [TT]-label[tt], [TT]editconf[tt] can add a chain identifier",
++                "to a [TT].pdb[tt] file, which can be useful for analysis with e.g. Rasmol.",
+                 "[PAR]",
+                 "To convert a truncated octrahedron file produced by a package which uses",
+                 "a cubic box with the corners cut off (such as GROMOS), use:[BR]",
+diff --git a/src/tools/gmx_eneconv.c b/src/tools/gmx_eneconv.c
+index 540ef48..0d0edab 100644
+--- a/src/tools/gmx_eneconv.c
++++ b/src/tools/gmx_eneconv.c
+@@ -463,11 +463,11 @@ int gmx_eneconv(int argc,char *argv[])
+   const char *desc[] = {
+     "With [IT]multiple files[it] specified for the [TT]-f[tt] option:[BR]",
+     "Concatenates several energy files in sorted order.",
+-    "In case of double time frames the one",
++    "In the case of double time frames, the one",
+     "in the later file is used. By specifying [TT]-settime[tt] you will be",
+     "asked for the start time of each file. The input files are taken",
+     "from the command line,",
+-    "such that the command [TT]eneconv -o fixed.edr *.edr[tt] should do",
++    "such that the command [TT]eneconv -f *.edr -o fixed.edr[tt] should do",
+     "the trick. [PAR]",
+     "With [IT]one file[it] specified for [TT]-f[tt]:[BR]",
+     "Reads one energy file and writes another, applying the [TT]-dt[tt],",
+diff --git a/src/tools/gmx_enemat.c b/src/tools/gmx_enemat.c
+index e4a4bfe..480e4de 100644
+--- a/src/tools/gmx_enemat.c
++++ b/src/tools/gmx_enemat.c
+@@ -79,7 +79,7 @@ int gmx_enemat(int argc,char *argv[])
+     "line a group of atoms to be used. For these groups matrix of",
+     "interaction energies will be extracted from the energy file",
+     "by looking for energy groups with names corresponding to pairs",
+-    "of groups of atoms. E.g. if your [TT]-groups[tt] file contains:[BR]",
++    "of groups of atoms, e.g. if your [TT]-groups[tt] file contains:[BR]",
+     "[TT]2[tt][BR]",
+     "[TT]Protein[tt][BR]",
+     "[TT]SOL[tt][BR]",
+diff --git a/src/tools/gmx_energy.c b/src/tools/gmx_energy.c
+index deaf1a3..f78590f 100644
+--- a/src/tools/gmx_energy.c
++++ b/src/tools/gmx_energy.c
+@@ -1480,21 +1480,21 @@ int gmx_energy(int argc,char *argv[])
+     
+     "[TT]g_energy[tt] extracts energy components or distance restraint",
+     "data from an energy file. The user is prompted to interactively",
+-    "select the energy terms she wants.[PAR]",
++    "select the desired energy terms.[PAR]",
+     
+-    "Average, RMSD and drift are calculated with full precision from the",
++    "Average, RMSD, and drift are calculated with full precision from the",
+     "simulation (see printed manual). Drift is calculated by performing",
+     "a least-squares fit of the data to a straight line. The reported total drift",
+     "is the difference of the fit at the first and last point.",
+     "An error estimate of the average is given based on a block averages",
+-    "over 5 blocks using the full precision averages. The error estimate",
++    "over 5 blocks using the full-precision averages. The error estimate",
+     "can be performed over multiple block lengths with the options",
+     "[TT]-nbmin[tt] and [TT]-nbmax[tt].",
+-    "Note that in most cases the energy files contains averages over all",
++    "[BB]Note[bb] that in most cases the energy files contains averages over all",
+     "MD steps, or over many more points than the number of frames in",
+     "energy file. This makes the [TT]g_energy[tt] statistics output more accurate",
+     "than the [TT].xvg[tt] output. When exact averages are not present in the energy",
+-    "file the statistics mentioned above are simply over the single, per-frame",
++    "file, the statistics mentioned above are simply over the single, per-frame",
+     "energy values.[PAR]",
+ 
+     "The term fluctuation gives the RMSD around the least-squares fit.[PAR]",
+@@ -1529,23 +1529,24 @@ int gmx_energy(int argc,char *argv[])
+ 
+     "With [TT]-fee[tt] an estimate is calculated for the free-energy",
+     "difference with an ideal gas state: [BR]",
+-    "  Delta A = A(N,V,T) - A_idgas(N,V,T) = kT ln < e^(Upot/kT) >[BR]",
+-    "  Delta G = G(N,p,T) - G_idgas(N,p,T) = kT ln < e^(Upot/kT) >[BR]",
++    "  [GRK]Delta[grk] A = A(N,V,T) - A_idgas(N,V,T) = kT ln < e^(Upot/kT) >[BR]",
++    "  [GRK]Delta[grk] G = G(N,p,T) - G_idgas(N,p,T) = kT ln < e^(Upot/kT) >[BR]",
+     "where k is Boltzmann's constant, T is set by [TT]-fetemp[tt] and",
+     "the average is over the ensemble (or time in a trajectory).",
+     "Note that this is in principle",
+     "only correct when averaging over the whole (Boltzmann) ensemble",
+     "and using the potential energy. This also allows for an entropy",
+     "estimate using:[BR]",
+-    "  Delta S(N,V,T) = S(N,V,T) - S_idgas(N,V,T) = (<Upot> - Delta A)/T[BR]",
+-    "  Delta S(N,p,T) = S(N,p,T) - S_idgas(N,p,T) = (<Upot> + pV - Delta G)/T",
++    "  [GRK]Delta[grk] S(N,V,T) = S(N,V,T) - S_idgas(N,V,T) = (<Upot> - [GRK]Delta[grk] A)/T[BR]",
++    "  [GRK]Delta[grk] S(N,p,T) = S(N,p,T) - S_idgas(N,p,T) = (<Upot> + pV - [GRK]Delta[grk] G)/T",
+     "[PAR]",
+     
+     "When a second energy file is specified ([TT]-f2[tt]), a free energy",
+     "difference is calculated dF = -kT ln < e ^ -(EB-EA)/kT >A ,",
+     "where EA and EB are the energies from the first and second energy",
+-    "files, and the average is over the ensemble A. [BB]NOTE[bb] that",
+-    "the energies must both be calculated from the same trajectory."
++    "files, and the average is over the ensemble A. The running average",
++    "of the free energy difference is printed to a file specified by [TT]-ravg[tt].",
++    "[BB]Note[bb] that the energies must both be calculated from the same trajectory."
+     
+   };
+   static gmx_bool bSum=FALSE,bFee=FALSE,bPrAll=FALSE,bFluct=FALSE;
+diff --git a/src/tools/gmx_filter.c b/src/tools/gmx_filter.c
+index 95646e9..ba2e4d5 100644
+--- a/src/tools/gmx_filter.c
++++ b/src/tools/gmx_filter.c
+@@ -58,14 +58,14 @@ int gmx_filter(int argc,char *argv[])
+ {
+   const char *desc[] = {
+     "[TT]g_filter[tt] performs frequency filtering on a trajectory.",
+-    "The filter shape is cos(pi t/A) + 1 from -A to +A, where A is given",
++    "The filter shape is cos([GRK]pi[grk] t/A) + 1 from -A to +A, where A is given",
+     "by the option [TT]-nf[tt] times the time step in the input trajectory.",
+     "This filter reduces fluctuations with period A by 85%, with period",
+     "2*A by 50% and with period 3*A by 17% for low-pass filtering.",
+     "Both a low-pass and high-pass filtered trajectory can be written.[PAR]",
+ 
+     "Option [TT]-ol[tt] writes a low-pass filtered trajectory.",
+-    "A frame is written every [TT]nf[tt] input frames.",
++    "A frame is written every [TT]-nf[tt] input frames.",
+     "This ratio of filter length and output interval ensures a good",
+     "suppression of aliasing of high-frequency motion, which is useful for",
+     "making smooth movies. Also averages of properties which are linear",
+diff --git a/src/tools/gmx_genbox.c b/src/tools/gmx_genbox.c
+index 223a63f..61bf59f 100644
+--- a/src/tools/gmx_genbox.c
++++ b/src/tools/gmx_genbox.c
+@@ -87,7 +87,8 @@ static gmx_bool in_box(t_pbc *pbc,rvec x)
+   rvec box_center,dx;
+   int  shift;
+   
+-  calc_box_center(ecenterTRIC,pbc->box,box_center);
++  /* pbc_dx_aiuc only works correctly with the rectangular box center */
++  calc_box_center(ecenterRECT,pbc->box,box_center);
+   
+   shift = pbc_dx_aiuc(pbc,x,box_center,dx);
+   
+@@ -627,8 +628,8 @@ int gmx_genbox(int argc,char *argv[])
+     "The program iterates until [TT]nmol[tt] molecules",
+     "have been inserted in the box. To test whether an insertion is ",
+     "successful the same van der Waals criterium is used as for removal of ",
+-    "solvent molecules. When no appropriately ",
+-    "sized holes (holes that can hold an extra molecule) are available the ",
++    "solvent molecules. When no appropriately-sized ",
++    "holes (holes that can hold an extra molecule) are available, the ",
+     "program tries for [TT]-nmol[tt] * [TT]-try[tt] times before giving up. ",
+     "Increase [TT]-try[tt] if you have several small holes to fill.[PAR]",
+ 
+diff --git a/src/tools/gmx_genconf.c b/src/tools/gmx_genconf.c
+index 20af7d9..69afd39 100644
+--- a/src/tools/gmx_genconf.c
++++ b/src/tools/gmx_genconf.c
+@@ -111,13 +111,13 @@ int gmx_genconf(int argc, char *argv[])
+   const char *desc[] = {
+     "[TT]genconf[tt] multiplies a given coordinate file by simply stacking them",
+     "on top of each other, like a small child playing with wooden blocks.",
+-    "The program makes a grid of [IT]user defined[it]",
++    "The program makes a grid of [IT]user-defined[it]",
+     "proportions ([TT]-nbox[tt]), ",
+     "and interspaces the grid point with an extra space [TT]-dist[tt].[PAR]",
+     "When option [TT]-rot[tt] is used the program does not check for overlap",
+     "between molecules on grid points. It is recommended to make the box in",
+     "the input file at least as big as the coordinates + ",
+-    "Van der Waals radius.[PAR]",
++    "van der Waals radius.[PAR]",
+     "If the optional trajectory file is given, conformations are not",
+     "generated, but read from this file and translated appropriately to",
+     "build the grid."
+diff --git a/src/tools/gmx_genion.c b/src/tools/gmx_genion.c
+index 5cff773..2a89cea 100644
+--- a/src/tools/gmx_genion.c
++++ b/src/tools/gmx_genion.c
+@@ -341,7 +341,7 @@ int gmx_genion(int argc, char *argv[])
+     "[PAR]Ions which can have multiple charge states get the multiplicity",
+     "added, without sign, for the uncommon states only.[PAR]",
+     "With the option [TT]-pot[tt] the potential can be written as B-factors",
+-    "in a [TT].pdb[tt] file (for visualisation using e.g. rasmol).",
++    "in a [TT].pdb[tt] file (for visualisation using e.g. Rasmol).",
+     "The unit of the potential is 1000 kJ/(mol e), the scaling be changed",
+     "with the [TT]-scale[tt] option.[PAR]",
+     "For larger ions, e.g. sulfate we recommended using [TT]genbox[tt]."
+diff --git a/src/tools/gmx_genpr.c b/src/tools/gmx_genpr.c
+index e55e961..6463fbd 100644
+--- a/src/tools/gmx_genpr.c
++++ b/src/tools/gmx_genpr.c
+@@ -56,20 +56,20 @@ int gmx_genpr(int argc,char *argv[])
+   const char *desc[] = {
+     "[TT]genrestr[tt] produces an include file for a topology containing",
+     "a list of atom numbers and three force constants for the",
+-    "X, Y and Z direction. A single isotropic force constant may",
++    "[IT]x[it]-, [IT]y[it]-, and [IT]z[it]-direction. A single isotropic force constant may",
+     "be given on the command line instead of three components.[PAR]",
+     "WARNING: position restraints only work for the one molecule at a time.",
+     "Position restraints are interactions within molecules, therefore",
+     "they should be included within the correct [TT][ moleculetype ][tt]",
+     "block in the topology. Since the atom numbers in every moleculetype",
+     "in the topology start at 1 and the numbers in the input file for",
+-    "genpr number consecutively from 1, genpr will only produce a useful",
+-    "file for the first molecule.[PAR]",
++    "[TT]genrestr[tt] number consecutively from 1, [TT]genrestr[tt] will only",
++    "produce a useful file for the first molecule.[PAR]",
+     "The [TT]-of[tt] option produces an index file that can be used for",
+     "freezing atoms. In this case, the input file must be a [TT].pdb[tt] file.[PAR]",
+     "With the [TT]-disre[tt] option, half a matrix of distance restraints",
+     "is generated instead of position restraints. With this matrix, that",
+-    "one typically would apply to C-alpha atoms in a protein, one can",
++    "one typically would apply to C[GRK]alpha[grk] atoms in a protein, one can",
+     "maintain the overall conformation of a protein without tieing it to",
+     "a specific position (as with position restraints)."
+   };
+@@ -84,7 +84,7 @@ int gmx_genpr(int argc,char *argv[])
+ 	
+   t_pargs pa[] = {
+     { "-fc", FALSE, etRVEC, {fc}, 
+-      "force constants (kJ mol-1 nm-2)" },
++      "force constants (kJ/mol nm^2)" },
+     { "-freeze", FALSE, etREAL, {&freeze_level},
+       "if the [TT]-of[tt] option or this one is given an index file will be written containing atom numbers of all atoms that have a B-factor less than the level given here" },
+     { "-disre", FALSE, etBOOL, {&bDisre},
+diff --git a/src/tools/gmx_gyrate.c b/src/tools/gmx_gyrate.c
+index 1507daa..546ab2f 100644
+--- a/src/tools/gmx_gyrate.c
++++ b/src/tools/gmx_gyrate.c
+@@ -152,13 +152,13 @@ int gmx_gyrate(int argc,char *argv[])
+ {
+   const char *desc[] = {
+     "[TT]g_gyrate[tt] computes the radius of gyration of a group of atoms",
+-    "and the radii of gyration about the x, y and z axes,",
++    "and the radii of gyration about the [IT]x[it]-, [IT]y[it]- and [IT]z[it]-axes,",
+     "as a function of time. The atoms are explicitly mass weighted.[PAR]",
+     "With the [TT]-nmol[tt] option the radius of gyration will be calculated",
+     "for multiple molecules by splitting the analysis group in equally",
+     "sized parts.[PAR]",
+-    "With the option [TT]-nz[tt] 2D radii of gyration in the x-y plane",
+-    "of slices along the z-axis are calculated."
++    "With the option [TT]-nz[tt] 2D radii of gyration in the [IT]x-y[it] plane",
++    "of slices along the [IT]z[it]-axis are calculated."
+   };
+   static int  nmol=1,nz=0;
+   static gmx_bool bQ=FALSE,bRot=FALSE,bMOI=FALSE;
+diff --git a/src/tools/gmx_hbond.c b/src/tools/gmx_hbond.c
+index 99158e3..d649ecf 100644
+--- a/src/tools/gmx_hbond.c
++++ b/src/tools/gmx_hbond.c
+@@ -3180,7 +3180,7 @@ int gmx_hbond(int argc,char *argv[])
+         { "-temp",  FALSE, etREAL, {&temp},
+           "Temperature (K) for computing the Gibbs energy corresponding to HB breaking and reforming" },
+         { "-smooth",FALSE, etREAL, {&smooth_tail_start},
+-          "If >= 0, the tail of the ACF will be smoothed by fitting it to an exponential function: y = A exp(-x/tau)" },
++          "If >= 0, the tail of the ACF will be smoothed by fitting it to an exponential function: y = A exp(-x/[GRK]tau[grk])" },
+         { "-dump",  FALSE, etINT, {&nDump},
+           "Dump the first N hydrogen bond ACFs in a single [TT].xvg[tt] file for debugging" },
+         { "-max_hb",FALSE, etREAL, {&maxnhb},
+@@ -3190,7 +3190,7 @@ int gmx_hbond(int argc,char *argv[])
+         { "-geminate", FALSE, etENUM, {gemType},
+           "Use reversible geminate recombination for the kinetics/thermodynamics calclations. See Markovitch et al., J. Chem. Phys 129, 084505 (2008) for details."},
+         { "-diff", FALSE, etREAL, {&D},
+-          "Dffusion coefficient to use in the rev. gem. recomb. kinetic model. If non-positive, then it will be fitted to the ACF along with ka and kd."},
++          "Dffusion coefficient to use in the reversible geminate recombination kinetic model. If negative, then it will be fitted to the ACF along with ka and kd."},
+ #ifdef HAVE_OPENMP
+         { "-nthreads", FALSE, etINT, {&nThreads},
+           "Number of threads used for the parallel loop over autocorrelations. nThreads <= 0 means maximum number of threads. Requires linking with OpenMP. The number of threads is limited by the number of processors (before OpenMP v.3 ) or environment variable OMP_THREAD_LIMIT (OpenMP v.3)"},
+diff --git a/src/tools/gmx_helix.c b/src/tools/gmx_helix.c
+index 45bbbc3..ca64bc5 100644
+--- a/src/tools/gmx_helix.c
++++ b/src/tools/gmx_helix.c
+@@ -122,35 +122,35 @@ void dump_otrj(FILE *otrj,int natoms,atom_id all_index[],rvec x[],
+ int gmx_helix(int argc,char *argv[])
+ {
+   const char *desc[] = {
+-    "[TT]g_helix[tt] computes all kind of helix properties. First, the peptide",
+-    "is checked to find the longest helical part. This is determined by",
+-    "Hydrogen bonds and Phi/Psi angles.",
++    "[TT]g_helix[tt] computes all kinds of helix properties. First, the peptide",
++    "is checked to find the longest helical part, as determined by",
++    "hydrogen bonds and [GRK]phi[grk]/[GRK]psi[grk] angles.",
+     "That bit is fitted",
+-    "to an ideal helix around the Z-axis and centered around the origin.",
++    "to an ideal helix around the [IT]z[it]-axis and centered around the origin.",
+     "Then the following properties are computed:[PAR]",
+     "[BB]1.[bb] Helix radius (file [TT]radius.xvg[tt]). This is merely the",
+-    "RMS deviation in two dimensions for all Calpha atoms.",
++    "RMS deviation in two dimensions for all C[GRK]alpha[grk] atoms.",
+     "it is calced as sqrt((SUM i(x^2(i)+y^2(i)))/N), where N is the number",
+     "of backbone atoms. For an ideal helix the radius is 0.23 nm[BR]",
+     "[BB]2.[bb] Twist (file [TT]twist.xvg[tt]). The average helical angle per",
+-    "residue is calculated. For alpha helix it is 100 degrees,",
+-    "for 3-10 helices it will be smaller,", 
++    "residue is calculated. For an [GRK]alpha[grk]-helix it is 100 degrees,",
++    "for 3-10 helices it will be smaller, and ", 
+     "for 5-helices it will be larger.[BR]",
+     "[BB]3.[bb] Rise per residue (file [TT]rise.xvg[tt]). The helical rise per", 
+-    "residue is plotted as the difference in Z-coordinate between Ca", 
+-    "atoms. For an ideal helix this is 0.15 nm[BR]",
++    "residue is plotted as the difference in [IT]z[it]-coordinate between C[GRK]alpha[grk]", 
++    "atoms. For an ideal helix, this is 0.15 nm[BR]",
+     "[BB]4.[bb] Total helix length (file [TT]len-ahx.xvg[tt]). The total length", 
+     "of the", 
+     "helix in nm. This is simply the average rise (see above) times the",  
+     "number of helical residues (see below).[BR]",
+     "[BB]5.[bb] Number of helical residues (file [TT]n-ahx.xvg[tt]). The title says",
+     "it all.[BR]",
+-    "[BB]6.[bb] Helix Dipole, backbone only (file [TT]dip-ahx.xvg[tt]).[BR]",
+-    "[BB]7.[bb] RMS deviation from ideal helix, calculated for the Calpha",
++    "[BB]6.[bb] Helix dipole, backbone only (file [TT]dip-ahx.xvg[tt]).[BR]",
++    "[BB]7.[bb] RMS deviation from ideal helix, calculated for the C[GRK]alpha[grk]",
+     "atoms only (file [TT]rms-ahx.xvg[tt]).[BR]",
+-    "[BB]8.[bb] Average Calpha-Calpha dihedral angle (file [TT]phi-ahx.xvg[tt]).[BR]",
+-    "[BB]9.[bb] Average Phi and Psi angles (file [TT]phipsi.xvg[tt]).[BR]",
+-    "[BB]10.[bb] Ellipticity at 222 nm according to [IT]Hirst and Brooks[it]",
++    "[BB]8.[bb] Average C[GRK]alpha[grk] - C[GRK]alpha[grk] dihedral angle (file [TT]phi-ahx.xvg[tt]).[BR]",
++    "[BB]9.[bb] Average [GRK]phi[grk] and [GRK]psi[grk] angles (file [TT]phipsi.xvg[tt]).[BR]",
++    "[BB]10.[bb] Ellipticity at 222 nm according to Hirst and Brooks.",
+     "[PAR]"
+   };
+   static const char *ppp[efhNR+2] = { 
+diff --git a/src/tools/gmx_helixorient.c b/src/tools/gmx_helixorient.c
+index 60e6636..973d9d2 100644
+--- a/src/tools/gmx_helixorient.c
++++ b/src/tools/gmx_helixorient.c
+@@ -60,17 +60,17 @@ int gmx_helixorient(int argc,char *argv[])
+   const char *desc[] = {
+     "[TT]g_helixorient[tt] calculates the coordinates and direction of the average",
+     "axis inside an alpha helix, and the direction/vectors of both the",
+-    "alpha carbon and (optionally) a sidechain atom relative to the axis.[PAR]",
+-    "As input, you need to specify an index group with alpha carbon atoms",
+-    "corresponding to an alpha helix of continuous residues. Sidechain",
++    "C[GRK]alpha[grk] and (optionally) a sidechain atom relative to the axis.[PAR]",
++    "As input, you need to specify an index group with C[GRK]alpha[grk] atoms",
++    "corresponding to an [GRK]alpha[grk]-helix of continuous residues. Sidechain",
+     "directions require a second index group of the same size, containing",
+     "the heavy atom in each residue that should represent the sidechain.[PAR]",
+-    "Note that this program does not do any fitting of structures.[PAR]",
+-    "We need four Calpha coordinates to define the local direction of the helix",
++    "[BB]Note[bb] that this program does not do any fitting of structures.[PAR]",
++    "We need four C[GRK]alpha[grk] coordinates to define the local direction of the helix",
+     "axis.[PAR]",
+     "The tilt/rotation is calculated from Euler rotations, where we define",
+-    "the helix axis as the local X axis, the residues/CA-vector as Y, and the",
+-    "Z axis from their cross product. We use the Euler Y-Z-X rotation, meaning",
++    "the helix axis as the local [IT]x[it]-axis, the residues/C[GRK]alpha[grk] vector as [IT]y[it], and the",
++    "[IT]z[it]-axis from their cross product. We use the Euler Y-Z-X rotation, meaning",
+     "we first tilt the helix axis (1) around and (2) orthogonal to the residues",
+     "vector, and finally apply the (3) rotation around it. For debugging or other",
+     "purposes, we also write out the actual Euler rotation angles as [TT]theta[1-3].xvg[tt]"
+diff --git a/src/tools/gmx_hydorder.c b/src/tools/gmx_hydorder.c
+new file mode 100644
+index 0000000..01cee67
+--- /dev/null
++++ b/src/tools/gmx_hydorder.c
+@@ -0,0 +1,680 @@
++/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
++ * $Id: densorder.c,v 0.9
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.0
++ * 
++ * Copyright (c) 1991-2001
++ * BIOSON Research Institute, Dept. of Biophysical Chemistry
++ * 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.
++ * 
++ * Do check out http://www.gromacs.org , or mail us at gromacs at gromacs.org .
++ * 
++ * And Hey:
++ * Gyas ROwers Mature At Cryogenic Speed
++ */
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++
++#include <math.h>
++#include <ctype.h>
++
++#include "sysstuff.h"
++#include "string.h"
++#include "typedefs.h"
++#include "statutil.h"
++#include "smalloc.h"
++#include "macros.h"
++#include "gstat.h"
++#include "vec.h"
++#include "xvgr.h"
++#include "pbc.h"
++#include "copyrite.h"
++#include "futil.h"
++#include "statutil.h"
++#include "index.h"
++#include "tpxio.h"
++#include "matio.h"
++#include "binsearch.h"
++#include "powerspect.h"
++
++/* Print name of first atom in all groups in index file */
++static void print_types(atom_id index[], atom_id a[], int ngrps, 
++                        char *groups[], t_topology *top)
++{
++    int i;
++
++    fprintf(stderr,"Using following groups: \n");
++    for(i = 0; i < ngrps; i++)
++        fprintf(stderr,"Groupname: %s First atomname: %s First atomnr %u\n", 
++                groups[i], *(top->atoms.atomname[a[index[i]]]), a[index[i]]);
++    fprintf(stderr,"\n");
++}
++
++static void check_length(real length, int a, int b)
++{
++    if (length > 0.3)
++        fprintf(stderr,"WARNING: distance between atoms %d and "
++                "%d > 0.3 nm (%f). Index file might be corrupt.\n", 
++                a, b, length);
++}
++
++static void find_tetra_order_grid(t_topology top, int ePBC,
++                                  int natoms, matrix box,
++                                  rvec x[],int maxidx,atom_id index[], 
++                                  real time, real *sgmean, real *skmean, 
++                                  int nslicex, int nslicey, int nslicez,  
++                                  real ***sggrid,real ***skgrid)
++{
++    int     ix,jx,i,j,k,l,n,*nn[4];
++    rvec    dx,rj,rk,urk,urj;
++    real    cost,cost2,*sgmol,*skmol,rmean,rmean2,r2,box2,*r_nn[4];
++    t_pbc   pbc;
++    int    slindex_x,slindex_y,slindex_z;
++    int    ***sl_count;
++    real   onethird=1.0/3.0;
++    gmx_rmpbc_t gpbc;
++  
++    /*  dmat = init_mat(maxidx, FALSE); */
++
++    box2 = box[XX][XX] * box[XX][XX];
++
++    /* Initialize expanded sl_count array */
++    snew(sl_count,nslicex);
++    for(i=0;i<nslicex;i++)
++    {
++        snew(sl_count[i],nslicey);
++        for(j=0;j<nslicey;j++)
++        {
++            snew(sl_count[i][j],nslicez);
++        }
++    }
++		
++	
++    for (i=0; (i<4); i++) 
++    {
++        snew(r_nn[i],natoms);
++        snew(nn[i],natoms);
++    
++        for (j=0; (j<natoms); j++) 
++        {
++            r_nn[i][j] = box2;
++        }
++    }
++  
++    snew(sgmol,maxidx);
++    snew(skmol,maxidx);
++
++    /* Must init pbc every step because of pressure coupling */
++    gpbc = gmx_rmpbc_init(&top.idef,ePBC,natoms,box);
++    gmx_rmpbc(gpbc,natoms,box,x);
++
++    *sgmean = 0.0;
++    *skmean = 0.0;
++    l=0;
++    for (i=0; (i<maxidx); i++) 
++    { /* loop over index file */
++        ix = index[i];
++        for (j=0; (j<maxidx); j++)
++        {
++        
++            if (i == j) continue;
++
++            jx = index[j];
++      
++            pbc_dx(&pbc,x[ix],x[jx],dx);
++            r2=iprod(dx,dx);
++
++            /* set_mat_entry(dmat,i,j,r2); */
++
++            /* determine the nearest neighbours */
++            if (r2 < r_nn[0][i]) 
++            {
++                r_nn[3][i] = r_nn[2][i]; nn[3][i] = nn[2][i];
++                r_nn[2][i] = r_nn[1][i]; nn[2][i] = nn[1][i];
++                r_nn[1][i] = r_nn[0][i]; nn[1][i] = nn[0][i];
++                r_nn[0][i] = r2;         nn[0][i] = j; 
++            } else if (r2 < r_nn[1][i]) 
++            {
++                r_nn[3][i] = r_nn[2][i]; nn[3][i] = nn[2][i];
++                r_nn[2][i] = r_nn[1][i]; nn[2][i] = nn[1][i];
++                r_nn[1][i] = r2;         nn[1][i] = j;
++            } else if (r2 < r_nn[2][i]) 
++            {
++                r_nn[3][i] = r_nn[2][i]; nn[3][i] = nn[2][i];
++                r_nn[2][i] = r2;         nn[2][i] = j;
++            } else if (r2 < r_nn[3][i]) 
++            {
++                r_nn[3][i] = r2;         nn[3][i] = j;
++            }
++        }
++
++
++        /* calculate mean distance between nearest neighbours */
++        rmean = 0;
++        for (j=0; (j<4); j++) 
++        {
++            r_nn[j][i] = sqrt(r_nn[j][i]);
++            rmean += r_nn[j][i];
++        }
++        rmean /= 4;
++    
++        n = 0;
++        sgmol[i] = 0.0;
++        skmol[i] = 0.0;
++
++        /* Chau1998a eqn 3 */
++        /* angular part tetrahedrality order parameter per atom */
++        for (j=0; (j<3); j++) 
++        {
++            for (k=j+1; (k<4); k++) 
++            {
++                pbc_dx(&pbc,x[ix],x[index[nn[k][i]]],rk);
++                pbc_dx(&pbc,x[ix],x[index[nn[j][i]]],rj);
++
++                unitv(rk,urk);
++                unitv(rj,urj);
++	
++                cost = iprod(urk,urj) + onethird;
++                cost2 = cost * cost;
++
++                sgmol[i] += cost2; 
++                l++;
++                n++;
++            }
++        }
++        /* normalize sgmol between 0.0 and 1.0 */
++        sgmol[i] = 3*sgmol[i]/32;
++        *sgmean += sgmol[i];
++
++        /* distance part tetrahedrality order parameter per atom */
++        rmean2 = 4 * 3 * rmean * rmean;
++        for (j=0; (j<4); j++) 
++        {
++            skmol[i] += (rmean - r_nn[j][i]) * (rmean - r_nn[j][i]) / rmean2;
++            /*      printf("%d %f (%f %f %f %f) \n",
++                    i, skmol[i], rmean, rmean2, r_nn[j][i], (rmean - r_nn[j][i]) );
++            */
++        }
++    
++        *skmean += skmol[i];
++    
++        /* Compute sliced stuff in x y z*/
++        slindex_x = gmx_nint((1+x[i][XX]/box[XX][XX])*nslicex) % nslicex;
++        slindex_y = gmx_nint((1+x[i][YY]/box[YY][YY])*nslicey) % nslicey;
++        slindex_z = gmx_nint((1+x[i][ZZ]/box[ZZ][ZZ])*nslicez) % nslicez;
++        sggrid[slindex_x][slindex_y][slindex_z] += sgmol[i];
++        skgrid[slindex_x][slindex_y][slindex_z] += skmol[i];
++        (sl_count[slindex_x][slindex_y][slindex_z])++;
++    } /* loop over entries in index file */
++  
++    *sgmean /= maxidx;
++    *skmean /= maxidx;
++  
++    for(i=0; (i<nslicex); i++) 
++    {
++        for(j=0; j<nslicey; j++)
++        {
++            for(k=0;k<nslicez;k++)
++            {
++    			if (sl_count[i][j][k] > 0) 
++                {
++      				sggrid[i][j][k] /= sl_count[i][j][k];
++      				skgrid[i][j][k] /= sl_count[i][j][k];
++    			}
++            }
++        }
++    }
++
++    sfree(sl_count);
++    sfree(sgmol);
++    sfree(skmol);
++    for (i=0; (i<4); i++) 
++    {
++        sfree(r_nn[i]);
++        sfree(nn[i]);
++    }
++}
++
++/*Determines interface from tetrahedral order parameter in box with specified binwidth.  */
++/*Outputs interface positions(bins), the number of timeframes, and the number of surface-mesh points in xy*/ 
++
++static void calc_tetra_order_interface(const char *fnNDX,const char *fnTPS,const char *fnTRX, real binw, int tblock, 
++                                       int *nframes,  int *nslicex, int *nslicey, 
++                                       real sgang1,real sgang2,real ****intfpos,
++                                       output_env_t oenv)
++{
++    FILE       *fpsg=NULL,*fpsk=NULL;
++    char 	     *sgslfn="sg_ang_mesh";  /* Hardcoded filenames for debugging*/
++    char       *skslfn="sk_dist_mesh";
++    t_topology top;
++    int        ePBC;
++    char       title[STRLEN],subtitle[STRLEN];
++    t_trxstatus *status;
++    int        natoms;
++    real       t;
++    rvec       *xtop,*x;
++    matrix     box;
++    real       sg,sk, sgintf, pos; 
++    atom_id    **index;
++    char       **grpname;
++    int        i,j,k,n,*isize,ng, nslicez, framenr;
++    real       ***sg_grid,***sk_grid, ***sg_fravg, ***sk_fravg, ****sk_4d, ****sg_4d;
++    int 	     *perm;
++    int         ndx1, ndx2;
++    int       bins;
++    const real onehalf=1.0/2.0;
++    /* real   ***intfpos[2]; pointers to arrays of two interface positions zcoord(framenr,xbin,ybin): intfpos[interface_index][t][nslicey*x+y] 
++     * i.e 1D Row-major order in (t,x,y) */
++  
++  
++    read_tps_conf(fnTPS,title,&top,&ePBC,&xtop,NULL,box,FALSE);
++
++    *nslicex= (int)(box[XX][XX]/binw + onehalf); /*Calculate slicenr from binwidth*/
++    *nslicey= (int)(box[YY][YY]/binw + onehalf);
++    nslicez= (int)(box[ZZ][ZZ]/binw +  onehalf);
++
++ 
++  
++    ng = 1;
++    /* get index groups */
++    printf("Select the group that contains the atoms you want to use for the tetrahedrality order parameter calculation:\n");
++    snew(grpname,ng);
++    snew(index,ng);
++    snew(isize,ng);
++    get_index(&top.atoms,fnNDX,ng,isize,index,grpname);
++
++    /* Analyze trajectory */
++    natoms=read_first_x(oenv,&status,fnTRX,&t,&x,box);
++    if ( natoms > top.atoms.nr )
++        gmx_fatal(FARGS,"Topology (%d atoms) does not match trajectory (%d atoms)",
++                  top.atoms.nr,natoms);
++    check_index(NULL,ng,index[0],NULL,natoms);
++
++    
++	/*Prepare structures for temporary storage of frame info*/
++    snew(sg_grid,*nslicex);
++    snew(sk_grid,*nslicex);
++    for(i=0;i<*nslicex;i++)
++    {
++        snew(sg_grid[i],*nslicey);
++        snew(sk_grid[i],*nslicey);
++        for(j=0;j<*nslicey;j++)
++        {
++            snew(sg_grid[i][j],nslicez);
++            snew(sk_grid[i][j],nslicez);
++        }
++    }
++
++    sg_4d=NULL;
++    sk_4d=NULL;
++    *nframes = 0;
++    framenr=0;
++
++/* Loop over frames*/
++    do 
++    {
++        /*Initialize box meshes (temporary storage for each tblock frame -reinitialise every tblock steps */
++        if(framenr%tblock ==0)
++        {
++            srenew(sk_4d,*nframes+1);
++            srenew(sg_4d,*nframes+1);
++            snew(sg_fravg,*nslicex);
++            snew(sk_fravg,*nslicex);
++            for(i=0;i<*nslicex;i++)
++            {
++                snew(sg_fravg[i],*nslicey);
++                snew(sk_fravg[i],*nslicey);
++                for(j=0;j<*nslicey;j++)
++                {
++                    snew(sg_fravg[i][j],nslicez);
++                    snew(sk_fravg[i][j],nslicez);	
++                }
++            }
++        }
++	
++        find_tetra_order_grid(top,ePBC,natoms,box,x,isize[0],index[0],t,
++                              &sg,&sk,*nslicex,*nslicey,nslicez,sg_grid,sk_grid);		    
++        for(i=0;i<*nslicex;i++)
++        {
++            for(j=0;j<*nslicey;j++)
++            {
++                for(k=0;k<nslicez;k++)
++                {
++                    sk_fravg[i][j][k]+=sk_grid[i][j][k]/tblock;
++                    sg_fravg[i][j][k]+=sg_grid[i][j][k]/tblock;
++                }
++            }
++        }
++
++        framenr++;
++
++        if(framenr%tblock== 0)
++        {
++            sk_4d[*nframes] = sk_fravg;
++            sg_4d[*nframes] = sg_fravg; 
++    		(*nframes)++;
++		}
++    
++    } while (read_next_x(oenv,status,&t,natoms,x,box));
++    close_trj(status);
++ 
++    sfree(grpname);
++    sfree(index);
++    sfree(isize);
++
++    /*Debugging for printing out the entire order parameter meshes.*/
++    if(debug)
++    {
++        fpsg = xvgropen(sgslfn,"S\\sg\\N Angle Order Parameter / Meshpoint","(nm)","S\\sg\\N",oenv);
++        fpsk = xvgropen(skslfn,"S\\sk\\N Distance Order Parameter / Meshpoint","(nm)","S\\sk\\N",oenv);
++        for(n=0;n<(*nframes);n++)
++        {
++            fprintf(fpsg,"%i\n",n);
++            fprintf(fpsk,"%i\n",n);
++            for(i=0; (i<*nslicex); i++) 
++            {
++                for(j=0;j<*nslicey;j++)
++                {
++                    for(k=0;k<nslicez;k++)
++                    {
++                        fprintf(fpsg,"%4f  %4f  %4f  %8f\n",(i+0.5)*box[XX][XX]/(*nslicex),(j+0.5)*box[YY][YY]/(*nslicey),(k+0.5)*box[ZZ][ZZ]/nslicez,sg_4d[n][i][j][k]);
++                        fprintf(fpsk,"%4f  %4f  %4f  %8f\n",(i+0.5)*box[XX][XX]/(*nslicex),(j+0.5)*box[YY][YY]/(*nslicey),(k+0.5)*box[ZZ][ZZ]/nslicez,sk_4d[n][i][j][k]);
++                    }
++                }
++            }
++        }
++        fclose(fpsg);
++        fclose(fpsk);   
++    } 
++
++  
++    /* Find positions of interface z by scanning orderparam for each frame and for each xy-mesh cylinder along z*/
++
++    /*Simple trial: assume interface is in the middle of -sgang1 and sgang2*/
++    sgintf=0.5*(sgang1+sgang2);
++   
++
++    /*Allocate memory for interface arrays; */
++    snew((*intfpos),2);
++    snew((*intfpos)[0],*nframes);
++    snew((*intfpos)[1],*nframes);
++
++    bins=(*nslicex)*(*nslicey);
++
++
++    snew(perm,nslicez);  /*permutation array for sorting along normal coordinate*/
++
++
++	for (n=0;n<*nframes;n++)
++    {
++		snew((*intfpos)[0][n],bins);
++		snew((*intfpos)[1][n],bins);
++		for(i=0;i<*nslicex;i++)
++        {
++			for(j=0;j<*nslicey;j++)
++            {
++                rangeArray(perm,nslicez); /*reset permutation array to identity*/
++                /*Binsearch returns 2 bin-numbers where the order param is  <= setpoint sgintf*/
++				ndx1=start_binsearch(sg_4d[n][i][j],perm,0,nslicez/2-1,sgintf,1);
++				ndx2=start_binsearch(sg_4d[n][i][j],perm,nslicez/2,nslicez-1,sgintf,-1);
++                /*Use linear interpolation to smooth out the interface position*/
++				
++				/*left interface (0)*/
++                /*if((sg_4d[n][i][j][perm[ndx1+1]]-sg_4d[n][i][j][perm[ndx1]])/sg_4d[n][i][j][perm[ndx1]] > 0.01){
++                  pos=( (sgintf-sg_4d[n][i][j][perm[ndx1]])*perm[ndx1+1]+(sg_4d[n][i][j][perm[ndx1+1]]-sgintf)*perm[ndx1 ])*/ 
++                (*intfpos)[0][n][j+*nslicey*i]=(perm[ndx1]+onehalf)*binw;				
++                /*right interface (1)*/
++                /*alpha=(sgintf-sg_4d[n][i][j][perm[ndx2]])/(sg_4d[n][i][j][perm[ndx2]+1]-sg_4d[n][i][j][perm[ndx2]]);*/
++                /*(*intfpos)[1][n][j+*nslicey*i]=((1-alpha)*perm[ndx2]+alpha*(perm[ndx2]+1)+onehalf)*box[ZZ][ZZ]/nslicez;*/
++                (*intfpos)[1][n][j+*nslicey*i]=(perm[ndx2]+onehalf)*binw;
++            }
++        }
++    }
++
++
++	/*sfree(perm);*/
++    sfree(sk_4d);
++    sfree(sg_4d);
++    /*sfree(sg_grid);*/
++    /*sfree(sk_grid);*/
++
++
++}
++
++static void writesurftoxpms(real ***surf, int tblocks,int xbins, int ybins, real bw,char **outfiles,int maplevels ) 
++{
++
++    char numbuf[8];
++    int n, i, j;
++    real **profile1, **profile2;
++    real max1, max2, min1, min2, *xticks, *yticks;
++    t_rgb lo={1,1,1};
++    t_rgb hi={0,0,0};
++    FILE *xpmfile1, *xpmfile2;
++
++/*Prepare xpm structures for output*/
++
++/*Allocate memory to tick's and matrices*/
++    snew (xticks,xbins+1);
++    snew (yticks,ybins+1);
++
++    profile1=mk_matrix(xbins,ybins,FALSE);
++    profile2=mk_matrix(xbins,ybins,FALSE);
++ 
++    for (i=0;i<xbins+1;i++) xticks[i]+=bw;			
++    for (j=0;j<ybins+1;j++) yticks[j]+=bw;
++
++    xpmfile1 = ffopen(outfiles[0],"w");
++    xpmfile2 = ffopen(outfiles[1],"w");
++
++    max1=max2=0.0;
++    min1=min2=1000.00;
++
++    for(n=0;n<tblocks;n++)
++    {
++        sprintf(numbuf,"%5d",n);
++        /*Filling matrices for inclusion in xpm-files*/
++        for(i=0;i<xbins;i++)
++        { 
++            for(j=0;j<ybins;j++)
++            {	
++				profile1[i][j]=(surf[0][n][j+ybins*i]);								 
++				profile2[i][j]=(surf[1][n][j+ybins*i]);
++				/*Finding max and min values*/
++				if(profile1[i][j]>max1) max1=profile1[i][j];
++				if(profile1[i][j]<min1) min1=profile1[i][j];
++				if(profile2[i][j]>max2) max2=profile2[i][j];
++				if(profile2[i][j]<min2) min2=profile2[i][j];
++            }	
++        }
++
++        write_xpm(xpmfile1,3,numbuf,"Height","x[nm]","y[nm]",xbins,ybins,xticks,yticks,profile1,min1,max1,lo,hi,&maplevels);
++        write_xpm(xpmfile2,3,numbuf,"Height","x[nm]","y[nm]",xbins,ybins,xticks,yticks,profile2,min2,max2,lo,hi,&maplevels);
++    }	
++
++    ffclose(xpmfile1);
++    ffclose(xpmfile2); 
++
++
++
++    sfree(profile1);
++    sfree(profile2);
++    sfree(xticks);
++    sfree(yticks);
++}
++
++
++static void writeraw(real ***surf, int tblocks,int xbins, int ybins,char **fnms){
++	FILE *raw1, *raw2;
++    int i,j,n;
++	
++	raw1=ffopen(fnms[0],"w");
++	raw2=ffopen(fnms[1],"w");
++	fprintf(raw1,"#Legend\n#TBlock\n#Xbin Ybin Z t\n");
++	fprintf(raw2,"#Legend\n#TBlock\n#Xbin Ybin Z t\n");
++	for (n=0;n<tblocks;n++)
++    {
++		fprintf(raw1,"%5d\n",n);
++		fprintf(raw2,"%5d\n",n);
++		for(i=0;i<xbins;i++)
++        {
++			for(j=0;j<ybins;j++)
++            {
++				fprintf(raw1,"%i  %i  %8.5f\n",i,j,(surf[0][n][j+ybins*i]));
++				fprintf(raw2,"%i  %i  %8.5f\n",i,j,(surf[1][n][j+ybins*i]));
++			}
++		}
++	}
++
++	ffclose(raw1);
++	ffclose(raw2);
++}
++
++
++
++int gmx_hydorder(int argc,char *argv[])
++{
++    static const char *desc[] = {
++        "The tetrahedrality order parameters can be determined",
++        "around an atom. Both angle an distance order parameters are calculated. See",
++        "P.-L. Chau and A.J. Hardwick, Mol. Phys., 93, (1998), 511-518.",
++        "for more details.[BR]"
++        "This application calculates the orderparameter in a 3d-mesh in the box, and",
++        "with 2 phases in the box gives the user the option to define a 2D interface in time",
++        "separating the faces by specifying parameters -sgang1 and -sgang2 (It is important",
++        "to select these judiciously)"};	
++  
++    int axis = 0;
++    static int nsttblock=1;
++    static int nlevels=100;
++    static real binwidth = 1.0;                  /* binwidth in mesh           */
++    static real sg1     = 1;
++    static real sg2     = 1;		   /* order parameters for bulk phases */
++    static gmx_bool bFourier = FALSE;
++    static gmx_bool bRawOut = FALSE;
++    int frames,xslices,yslices;			/* Dimensions of interface arrays*/
++    real ***intfpos;				/* Interface arrays (intfnr,t,xy) -potentially large */
++    static char *normal_axis[] = { NULL, "z", "x", "y", NULL };
++  
++    t_pargs pa[] = {
++        { "-d",   FALSE, etENUM, {normal_axis}, 
++          "Direction of the normal on the membrane" },
++        { "-bw",  FALSE, etREAL, {&binwidth},
++          "Binwidth of box mesh" },
++        { "-sgang1",FALSE,etREAL, {&sg1},
++          "tetrahedral angle parameter in Phase 1 (bulk)" },
++        { "-sgang2",FALSE,etREAL, {&sg2},
++          "tetrahedral angle parameter in Phase 2 (bulk)" },
++        { "-tblock",FALSE,etINT,{&nsttblock},
++          "Number of frames in one time-block average"},
++        { "-nlevel", FALSE,etINT, {&nlevels},
++          "Number of Height levels in 2D - XPixMaps"}
++    };
++
++    t_filenm  fnm[] = {             	    /* files for g_order 	  */
++        { efTRX, "-f", NULL,  ffREAD },    	    /* trajectory file 	          */
++        { efNDX, "-n", NULL,  ffREAD },    	    /* index file 		  */
++        { efTPX, "-s", NULL,  ffREAD },	    /* topology file           	  */
++        { efXPM, "-o", "intf",  ffWRMULT},   	    /* XPM- surface maps	*/
++        { efOUT,"-or","raw", ffOPTWRMULT },   /* xvgr output file           */
++        { efOUT,"-Spect","intfspect",ffOPTWRMULT},   /* Fourier spectrum interfaces */
++    };
++#define NFILE asize(fnm)
++  
++    /*Filenames*/
++    const char *ndxfnm,*tpsfnm,*trxfnm;
++    char **spectra,**intfn, **raw;
++    int nfspect,nfxpm, nfraw;	
++    output_env_t oenv;
++  
++    CopyRight(stderr,argv[0]);
++  
++    parse_common_args(&argc,argv,PCA_CAN_VIEW | PCA_CAN_TIME | PCA_BE_NICE,
++                      NFILE,fnm,asize(pa),pa,asize(desc),desc,0,NULL,&oenv);
++    bFourier= opt2bSet("-Spect",NFILE,fnm);
++    bRawOut = opt2bSet("-or",NFILE,fnm);
++  
++    if (binwidth < 0.0)
++        gmx_fatal(FARGS,"Can not have binwidth < 0");
++  
++    ndxfnm = ftp2fn(efNDX,NFILE,fnm);
++    tpsfnm = ftp2fn(efTPX,NFILE,fnm);
++    trxfnm = ftp2fn(efTRX,NFILE,fnm);
++  
++    /* Calculate axis */
++    if (strcmp(normal_axis[0],"x") == 0) axis = XX;
++    else if (strcmp(normal_axis[0],"y") == 0) axis = YY;
++    else if (strcmp(normal_axis[0],"z") == 0) axis = ZZ;
++    else gmx_fatal(FARGS,"Invalid axis, use x, y or z");
++  
++    switch (axis) {
++    case 0:
++        fprintf(stderr,"Taking x axis as normal to the membrane\n");
++        break;
++    case 1:
++        fprintf(stderr,"Taking y axis as normal to the membrane\n");
++        break;
++    case 2:
++        fprintf(stderr,"Taking z axis as normal to the membrane\n");
++        break;
++    }
++  
++    /* tetraheder order parameter */
++    /* If either of the options is set we compute both */
++    nfxpm=opt2fns(&intfn,"-o",NFILE,fnm);
++    if(nfxpm!=2)
++    {
++        gmx_fatal(FARGS,"No or not correct number (2) of output-files: %d",nfxpm);
++    }
++    calc_tetra_order_interface(ndxfnm,tpsfnm,trxfnm,binwidth,nsttblock,&frames,&xslices,&yslices,sg1,sg2,&intfpos,oenv);
++    writesurftoxpms(intfpos,frames,xslices,yslices,binwidth,intfn,nlevels);
++    
++    if(bFourier)
++    {
++        nfspect=opt2fns(&spectra,"-Spect",NFILE,fnm);
++    	if(nfspect!=2)
++        {
++            gmx_fatal(FARGS,"No or not correct number (2) of output-files: %d",nfspect);
++        }
++        powerspectavg(intfpos, frames,xslices,yslices,spectra);
++    }
++     
++    if (bRawOut)
++    {
++        nfraw=opt2fns(&raw,"-or",NFILE,fnm);
++        if(nfraw!=2)
++        {
++            gmx_fatal(FARGS,"No or not correct number (2) of output-files: %d",nfraw);
++        }
++        writeraw(intfpos,frames,xslices,yslices,raw);
++    }
++   	
++  
++
++    thanx(stderr);
++  
++    return 0;
++}
+diff --git a/src/tools/gmx_kinetics.c b/src/tools/gmx_kinetics.c
+index 562c6b3..f2c599a 100644
+--- a/src/tools/gmx_kinetics.c
++++ b/src/tools/gmx_kinetics.c
+@@ -731,11 +731,11 @@ int gmx_kinetics(int argc,char *argv[])
+     { "-ucut",    FALSE, etREAL, {&ucut},
+       "Cut-off (max) value for regarding a structure as intermediate (if not folded)" },
+     { "-euf",     FALSE, etREAL, {&Euf},
+-      "Initial guess for energy of activation for folding (kJ/mole)" },
++      "Initial guess for energy of activation for folding (kJ/mol)" },
+     { "-efu",     FALSE, etREAL, {&Efu},
+-      "Initial guess for energy of activation for unfolding (kJ/mole)" },
++      "Initial guess for energy of activation for unfolding (kJ/mol)" },
+     { "-ei",      FALSE, etREAL, {&Ei},
+-      "Initial guess for energy of activation for intermediates (kJ/mole)" },
++      "Initial guess for energy of activation for intermediates (kJ/mol)" },
+     { "-maxiter", FALSE, etINT, {&maxiter},
+       "Max number of iterations" },
+     { "-back",    FALSE, etBOOL, {&bBack},
+@@ -747,9 +747,9 @@ int gmx_kinetics(int argc,char *argv[])
+     { "-split",   FALSE, etBOOL,{&bSplit},
+       "Estimate error by splitting the number of replicas in two and refitting" },
+     { "-sum",     FALSE, etBOOL,{&bSum},
+-      "Average folding before computing chi^2" },
++      "Average folding before computing [GRK]chi[grk]^2" },
+     { "-discrete", FALSE, etBOOL, {&bDiscrete},
+-      "Use a discrete folding criterium (F <-> U) or a continuous one" },
++      "Use a discrete folding criterion (F <-> U) or a continuous one" },
+     { "-mult",    FALSE, etINT, {&nmult},
+       "Factor to multiply the data with before discretization" }
+   };
+diff --git a/src/tools/gmx_membed.c b/src/tools/gmx_membed.c
+index 2b573bd..d834478 100644
+--- a/src/tools/gmx_membed.c
++++ b/src/tools/gmx_membed.c
+@@ -956,854 +956,6 @@ void md_print_warning(const t_commrec *cr,FILE *fplog,const char *buf)
+     }
+ }
+ 
+-/*  simulation conditions to transmit. Keep in mind that they are
+-    transmitted to other nodes through an MPI_Reduce after
+-    casting them to a real (so the signals can be sent together with other
+-    data). This means that the only meaningful values are positive,
+-    negative or zero. */
+-enum { eglsNABNSB, eglsCHKPT, eglsSTOPCOND, eglsRESETCOUNTERS, eglsNR };
+-/* Is the signal in one simulation independent of other simulations? */
+-gmx_bool gs_simlocal[eglsNR] = { TRUE, FALSE, FALSE, TRUE };
+-
+-typedef struct {
+-    int nstms;       /* The frequency for intersimulation communication */
+-    int sig[eglsNR]; /* The signal set by one process in do_md */
+-    int set[eglsNR]; /* The communicated signal, equal for all processes */
+-} globsig_t;
+-
+-
+-static int multisim_min(const gmx_multisim_t *ms,int nmin,int n)
+-{
+-    int  *buf;
+-    gmx_bool bPos,bEqual;
+-    int  s,d;
+-
+-    snew(buf,ms->nsim);
+-    buf[ms->sim] = n;
+-    gmx_sumi_sim(ms->nsim,buf,ms);
+-    bPos   = TRUE;
+-    bEqual = TRUE;
+-    for(s=0; s<ms->nsim; s++)
+-    {
+-        bPos   = bPos   && (buf[s] > 0);
+-        bEqual = bEqual && (buf[s] == buf[0]);
+-    }
+-    if (bPos)
+-    {
+-        if (bEqual)
+-        {
+-            nmin = min(nmin,buf[0]);
+-        }
+-        else
+-        {
+-            /* Find the least common multiple */
+-            for(d=2; d<nmin; d++)
+-            {
+-                s = 0;
+-                while (s < ms->nsim && d % buf[s] == 0)
+-                {
+-                    s++;
+-                }
+-                if (s == ms->nsim)
+-                {
+-                    /* We found the LCM and it is less than nmin */
+-                    nmin = d;
+-                    break;
+-                }
+-            }
+-        }
+-    }
+-    sfree(buf);
+-
+-    return nmin;
+-}
+-
+-static int multisim_nstsimsync(const t_commrec *cr,
+-                               const t_inputrec *ir,int repl_ex_nst)
+-{
+-    int nmin;
+-
+-    if (MASTER(cr))
+-    {
+-        nmin = INT_MAX;
+-        nmin = multisim_min(cr->ms,nmin,ir->nstlist);
+-        nmin = multisim_min(cr->ms,nmin,ir->nstcalcenergy);
+-        nmin = multisim_min(cr->ms,nmin,repl_ex_nst);
+-        if (nmin == INT_MAX)
+-        {
+-            gmx_fatal(FARGS,"Can not find an appropriate interval for inter-simulation communication, since nstlist, nstcalcenergy and -replex are all <= 0");
+-        }
+-        /* Avoid inter-simulation communication at every (second) step */
+-        if (nmin <= 2)
+-        {
+-            nmin = 10;
+-        }
+-    }
+-
+-    gmx_bcast(sizeof(int),&nmin,cr);
+-
+-    return nmin;
+-}
+-
+-static void init_global_signals(globsig_t *gs,const t_commrec *cr,
+-                                const t_inputrec *ir,int repl_ex_nst)
+-{
+-    int i;
+-
+-    if (MULTISIM(cr))
+-    {
+-        gs->nstms = multisim_nstsimsync(cr,ir,repl_ex_nst);
+-        if (debug)
+-        {
+-            fprintf(debug,"Syncing simulations for checkpointing and termination every %d steps\n",gs->nstms);
+-        }
+-    }
+-    else
+-    {
+-        gs->nstms = 1;
+-    }
+-
+-    for(i=0; i<eglsNR; i++)
+-    {
+-        gs->sig[i] = 0;
+-        gs->set[i] = 0;
+-    }
+-}
+-
+-static void copy_coupling_state(t_state *statea,t_state *stateb,
+-                                gmx_ekindata_t *ekinda,gmx_ekindata_t *ekindb, t_grpopts* opts)
+-{
+-
+-    /* MRS note -- might be able to get rid of some of the arguments.  Look over it when it's all debugged */
+-
+-    int i,j,nc;
+-
+-    /* Make sure we have enough space for x and v */
+-    if (statea->nalloc > stateb->nalloc)
+-    {
+-        stateb->nalloc = statea->nalloc;
+-        srenew(stateb->x,stateb->nalloc);
+-        srenew(stateb->v,stateb->nalloc);
+-    }
+-
+-    stateb->natoms     = statea->natoms;
+-    stateb->ngtc       = statea->ngtc;
+-    stateb->nnhpres    = statea->nnhpres;
+-    stateb->veta       = statea->veta;
+-    if (ekinda)
+-    {
+-        copy_mat(ekinda->ekin,ekindb->ekin);
+-        for (i=0; i<stateb->ngtc; i++)
+-        {
+-            ekindb->tcstat[i].T = ekinda->tcstat[i].T;
+-            ekindb->tcstat[i].Th = ekinda->tcstat[i].Th;
+-            copy_mat(ekinda->tcstat[i].ekinh,ekindb->tcstat[i].ekinh);
+-            copy_mat(ekinda->tcstat[i].ekinf,ekindb->tcstat[i].ekinf);
+-            ekindb->tcstat[i].ekinscalef_nhc =  ekinda->tcstat[i].ekinscalef_nhc;
+-            ekindb->tcstat[i].ekinscaleh_nhc =  ekinda->tcstat[i].ekinscaleh_nhc;
+-            ekindb->tcstat[i].vscale_nhc =  ekinda->tcstat[i].vscale_nhc;
+-        }
+-    }
+-    copy_rvecn(statea->x,stateb->x,0,stateb->natoms);
+-    copy_rvecn(statea->v,stateb->v,0,stateb->natoms);
+-    copy_mat(statea->box,stateb->box);
+-    copy_mat(statea->box_rel,stateb->box_rel);
+-    copy_mat(statea->boxv,stateb->boxv);
+-
+-    for (i = 0; i<stateb->ngtc; i++)
+-    {
+-        nc = i*opts->nhchainlength;
+-        for (j=0; j<opts->nhchainlength; j++)
+-        {
+-            stateb->nosehoover_xi[nc+j]  = statea->nosehoover_xi[nc+j];
+-            stateb->nosehoover_vxi[nc+j] = statea->nosehoover_vxi[nc+j];
+-        }
+-    }
+-    if (stateb->nhpres_xi != NULL)
+-    {
+-        for (i = 0; i<stateb->nnhpres; i++)
+-        {
+-            nc = i*opts->nhchainlength;
+-            for (j=0; j<opts->nhchainlength; j++)
+-            {
+-                stateb->nhpres_xi[nc+j]  = statea->nhpres_xi[nc+j];
+-                stateb->nhpres_vxi[nc+j] = statea->nhpres_vxi[nc+j];
+-            }
+-        }
+-    }
+-}
+-
+-static void compute_globals(FILE *fplog, gmx_global_stat_t gstat, t_commrec *cr, t_inputrec *ir,
+-                            t_forcerec *fr, gmx_ekindata_t *ekind,
+-                            t_state *state, t_state *state_global, t_mdatoms *mdatoms,
+-                            t_nrnb *nrnb, t_vcm *vcm, gmx_wallcycle_t wcycle,
+-                            gmx_enerdata_t *enerd,tensor force_vir, tensor shake_vir, tensor total_vir,
+-                            tensor pres, rvec mu_tot, gmx_constr_t constr,
+-                            globsig_t *gs,gmx_bool bInterSimGS,
+-                            matrix box, gmx_mtop_t *top_global, real *pcurr,
+-                            int natoms, gmx_bool *bSumEkinhOld, int flags)
+-{
+-    int  i,gsi;
+-    real gs_buf[eglsNR];
+-    tensor corr_vir,corr_pres;
+-    gmx_bool bEner,bPres,bTemp;
+-    gmx_bool bRerunMD, bStopCM, bGStat, bIterate,
+-        bFirstIterate,bReadEkin,bEkinAveVel,bScaleEkin, bConstrain;
+-    real prescorr,enercorr,dvdlcorr;
+-
+-    /* translate CGLO flags to gmx_booleans */
+-    bRerunMD = flags & CGLO_RERUNMD;
+-    bStopCM = flags & CGLO_STOPCM;
+-    bGStat = flags & CGLO_GSTAT;
+-    bReadEkin = (flags & CGLO_READEKIN);
+-    bScaleEkin = (flags & CGLO_SCALEEKIN);
+-    bEner = flags & CGLO_ENERGY;
+-    bTemp = flags & CGLO_TEMPERATURE;
+-    bPres  = (flags & CGLO_PRESSURE);
+-    bConstrain = (flags & CGLO_CONSTRAINT);
+-    bIterate = (flags & CGLO_ITERATE);
+-    bFirstIterate = (flags & CGLO_FIRSTITERATE);
+-
+-    /* we calculate a full state kinetic energy either with full-step velocity verlet
+-       or half step where we need the pressure */
+-    bEkinAveVel = (ir->eI==eiVV || (ir->eI==eiVVAK && IR_NPT_TROTTER(ir) && bPres) || bReadEkin);
+-
+-    /* in initalization, it sums the shake virial in vv, and to
+-       sums ekinh_old in leapfrog (or if we are calculating ekinh_old for other reasons */
+-
+-    /* ########## Kinetic energy  ############## */
+-
+-    if (bTemp)
+-    {
+-        /* Non-equilibrium MD: this is parallellized, but only does communication
+-         * when there really is NEMD.
+-         */
+-
+-        if (PAR(cr) && (ekind->bNEMD))
+-        {
+-            accumulate_u(cr,&(ir->opts),ekind);
+-        }
+-        debug_gmx();
+-        if (bReadEkin)
+-        {
+-            restore_ekinstate_from_state(cr,ekind,&state_global->ekinstate);
+-        }
+-        else
+-        {
+-
+-            calc_ke_part(state,&(ir->opts),mdatoms,ekind,nrnb,bEkinAveVel,bIterate);
+-        }
+-
+-        debug_gmx();
+-
+-        /* Calculate center of mass velocity if necessary, also parallellized */
+-        if (bStopCM && !bRerunMD && bEner)
+-        {
+-            calc_vcm_grp(fplog,mdatoms->start,mdatoms->homenr,mdatoms,
+-                         state->x,state->v,vcm);
+-        }
+-    }
+-
+-    if (bTemp || bPres || bEner || bConstrain)
+-    {
+-        if (!bGStat)
+-        {
+-            /* We will not sum ekinh_old,
+-             * so signal that we still have to do it.
+-             */
+-            *bSumEkinhOld = TRUE;
+-
+-        }
+-        else
+-        {
+-            if (gs != NULL)
+-            {
+-                for(i=0; i<eglsNR; i++)
+-                {
+-                    gs_buf[i] = gs->sig[i];
+-                }
+-            }
+-            if (PAR(cr))
+-            {
+-                wallcycle_start(wcycle,ewcMoveE);
+-                GMX_MPE_LOG(ev_global_stat_start);
+-                global_stat(fplog,gstat,cr,enerd,force_vir,shake_vir,mu_tot,
+-                            ir,ekind,constr,vcm,
+-                            gs != NULL ? eglsNR : 0,gs_buf,
+-                            top_global,state,
+-                            *bSumEkinhOld,flags);
+-                GMX_MPE_LOG(ev_global_stat_finish);
+-                wallcycle_stop(wcycle,ewcMoveE);
+-            }
+-            if (gs != NULL)
+-            {
+-                if (MULTISIM(cr) && bInterSimGS)
+-                {
+-                    if (MASTER(cr))
+-                    {
+-                        /* Communicate the signals between the simulations */
+-                        gmx_sum_sim(eglsNR,gs_buf,cr->ms);
+-                    }
+-                    /* Communicate the signals form the master to the others */
+-                    gmx_bcast(eglsNR*sizeof(gs_buf[0]),gs_buf,cr);
+-                }
+-                for(i=0; i<eglsNR; i++)
+-                {
+-                    if (bInterSimGS || gs_simlocal[i])
+-                    {
+-                        /* Set the communicated signal only when it is non-zero,
+-                         * since signals might not be processed at each MD step.
+-                         */
+-                        gsi = (gs_buf[i] >= 0 ?
+-                               (int)(gs_buf[i] + 0.5) :
+-                               (int)(gs_buf[i] - 0.5));
+-                        if (gsi != 0)
+-                        {
+-                            gs->set[i] = gsi;
+-                        }
+-                        /* Turn off the local signal */
+-                        gs->sig[i] = 0;
+-                    }
+-                }
+-            }
+-            *bSumEkinhOld = FALSE;
+-        }
+-    }
+-
+-    if (!ekind->bNEMD && debug && bTemp && (vcm->nr > 0))
+-    {
+-        correct_ekin(debug,
+-                     mdatoms->start,mdatoms->start+mdatoms->homenr,
+-                     state->v,vcm->group_p[0],
+-                     mdatoms->massT,mdatoms->tmass,ekind->ekin);
+-    }
+-
+-    if (bEner) {
+-        /* Do center of mass motion removal */
+-        if (bStopCM && !bRerunMD) /* is this correct?  Does it get called too often with this logic? */
+-        {
+-            check_cm_grp(fplog,vcm,ir,1);
+-            do_stopcm_grp(fplog,mdatoms->start,mdatoms->homenr,mdatoms->cVCM,
+-                          state->x,state->v,vcm);
+-            inc_nrnb(nrnb,eNR_STOPCM,mdatoms->homenr);
+-        }
+-    }
+-
+-    if (bTemp)
+-    {
+-        /* Sum the kinetic energies of the groups & calc temp */
+-        /* compute full step kinetic energies if vv, or if vv-avek and we are computing the pressure with IR_NPT_TROTTER */
+-        /* three maincase:  VV with AveVel (md-vv), vv with AveEkin (md-vv-avek), leap with AveEkin (md).
+-           Leap with AveVel is also an option for the future but not supported now.
+-           bEkinAveVel: If TRUE, we simply multiply ekin by ekinscale to get a full step kinetic energy.
+-           If FALSE, we average ekinh_old and ekinh*ekinscale_nhc to get an averaged half step kinetic energy.
+-           bSaveEkinOld: If TRUE (in the case of iteration = bIterate is TRUE), we don't reset the ekinscale_nhc.
+-           If FALSE, we go ahead and erase over it.
+-        */
+-        enerd->term[F_TEMP] = sum_ekin(&(ir->opts),ekind,&(enerd->term[F_DKDL]),
+-                                       bEkinAveVel,bIterate,bScaleEkin);
+-
+-        enerd->term[F_EKIN] = trace(ekind->ekin);
+-    }
+-
+-    /* ##########  Long range energy information ###### */
+-
+-    if (bEner || bPres || bConstrain)
+-    {
+-        calc_dispcorr(fplog,ir,fr,0,top_global->natoms,box,state->lambda,
+-                      corr_pres,corr_vir,&prescorr,&enercorr,&dvdlcorr);
+-    }
+-
+-    if (bEner && bFirstIterate)
+-    {
+-        enerd->term[F_DISPCORR] = enercorr;
+-        enerd->term[F_EPOT] += enercorr;
+-        enerd->term[F_DVDL] += dvdlcorr;
+-        if (fr->efep != efepNO) {
+-            enerd->dvdl_lin += dvdlcorr;
+-        }
+-    }
+-
+-    /* ########## Now pressure ############## */
+-    if (bPres || bConstrain)
+-    {
+-
+-        m_add(force_vir,shake_vir,total_vir);
+-
+-        /* Calculate pressure and apply LR correction if PPPM is used.
+-         * Use the box from last timestep since we already called update().
+-         */
+-
+-        enerd->term[F_PRES] = calc_pres(fr->ePBC,ir->nwall,box,ekind->ekin,total_vir,pres,
+-                                        (fr->eeltype==eelPPPM)?enerd->term[F_COUL_RECIP]:0.0);
+-
+-        /* Calculate long range corrections to pressure and energy */
+-        /* this adds to enerd->term[F_PRES] and enerd->term[F_ETOT],
+-           and computes enerd->term[F_DISPCORR].  Also modifies the
+-           total_vir and pres tesors */
+-
+-        m_add(total_vir,corr_vir,total_vir);
+-        m_add(pres,corr_pres,pres);
+-        enerd->term[F_PDISPCORR] = prescorr;
+-        enerd->term[F_PRES] += prescorr;
+-        *pcurr = enerd->term[F_PRES];
+-        /* calculate temperature using virial */
+-        enerd->term[F_VTEMP] = calc_temp(trace(total_vir),ir->opts.nrdf[0]);
+-
+-    }
+-}
+-
+-
+-/* Definitions for convergence of iterated constraints */
+-
+-/* iterate constraints up to 50 times  */
+-#define MAXITERCONST       50
+-
+-/* data type */
+-typedef struct
+-{
+-    real f,fprev,x,xprev;
+-    int iter_i;
+-    gmx_bool bIterate;
+-    real allrelerr[MAXITERCONST+2];
+-    int num_close; /* number of "close" violations, caused by limited precision. */
+-} gmx_iterate_t;
+-
+-#ifdef GMX_DOUBLE
+-#define CONVERGEITER  0.000000001
+-#define CLOSE_ENOUGH  0.000001000
+-#else
+-#define CONVERGEITER  0.0001
+-#define CLOSE_ENOUGH  0.0050
+-#endif
+-
+-/* we want to keep track of the close calls.  If there are too many, there might be some other issues.
+-   so we make sure that it's either less than some predetermined number, or if more than that number,
+-   only some small fraction of the total. */
+-#define MAX_NUMBER_CLOSE        50
+-#define FRACTION_CLOSE       0.001
+-
+-/* maximum length of cyclic traps to check, emerging from limited numerical precision  */
+-#define CYCLEMAX            20
+-
+-static void gmx_iterate_init(gmx_iterate_t *iterate,gmx_bool bIterate)
+-{
+-    int i;
+-
+-    iterate->iter_i = 0;
+-    iterate->bIterate = bIterate;
+-    iterate->num_close = 0;
+-    for (i=0;i<MAXITERCONST+2;i++)
+-    {
+-        iterate->allrelerr[i] = 0;
+-    }
+-}
+-
+-static gmx_bool done_iterating(const t_commrec *cr,FILE *fplog, int nsteps, gmx_iterate_t *iterate, gmx_bool bFirstIterate, real fom, real *newf)
+-{
+-    /* monitor convergence, and use a secant search to propose new
+-       values.
+-                                                                  x_{i} - x_{i-1}
+-       The secant method computes x_{i+1} = x_{i} - f(x_{i}) * ---------------------
+-                                                                f(x_{i}) - f(x_{i-1})
+-
+-       The function we are trying to zero is fom-x, where fom is the
+-       "figure of merit" which is the pressure (or the veta value) we
+-       would get by putting in an old value of the pressure or veta into
+-       the incrementor function for the step or half step.  I have
+-       verified that this gives the same answer as self consistent
+-       iteration, usually in many fewer steps, especially for small tau_p.
+-
+-       We could possibly eliminate an iteration with proper use
+-       of the value from the previous step, but that would take a bit
+-       more bookkeeping, especially for veta, since tests indicate the
+-       function of veta on the last step is not sufficiently close to
+-       guarantee convergence this step. This is
+-       good enough for now.  On my tests, I could use tau_p down to
+-       0.02, which is smaller that would ever be necessary in
+-       practice. Generally, 3-5 iterations will be sufficient */
+-
+-    real relerr,err;
+-    char buf[256];
+-    int i;
+-    gmx_bool incycle;
+-
+-    if (bFirstIterate)
+-    {
+-        iterate->x = fom;
+-        iterate->f = fom-iterate->x;
+-        iterate->xprev = 0;
+-        iterate->fprev = 0;
+-        *newf = fom;
+-    }
+-    else
+-    {
+-        iterate->f = fom-iterate->x; /* we want to zero this difference */
+-        if ((iterate->iter_i > 1) && (iterate->iter_i < MAXITERCONST))
+-        {
+-            if (iterate->f==iterate->fprev)
+-            {
+-                *newf = iterate->f;
+-            }
+-            else
+-            {
+-                *newf = iterate->x - (iterate->x-iterate->xprev)*(iterate->f)/(iterate->f-iterate->fprev);
+-            }
+-        }
+-        else
+-        {
+-            /* just use self-consistent iteration the first step to initialize, or
+-               if it's not converging (which happens occasionally -- need to investigate why) */
+-            *newf = fom;
+-        }
+-    }
+-    /* Consider a slight shortcut allowing us to exit one sooner -- we check the
+-       difference between the closest of x and xprev to the new
+-       value. To be 100% certain, we should check the difference between
+-       the last result, and the previous result, or
+-
+-       relerr = (fabs((x-xprev)/fom));
+-
+-       but this is pretty much never necessary under typical conditions.
+-       Checking numerically, it seems to lead to almost exactly the same
+-       trajectories, but there are small differences out a few decimal
+-       places in the pressure, and eventually in the v_eta, but it could
+-       save an interation.
+-
+-       if (fabs(*newf-x) < fabs(*newf - xprev)) { xmin = x;} else { xmin = xprev;}
+-       relerr = (fabs((*newf-xmin) / *newf));
+-    */
+-
+-    err = fabs((iterate->f-iterate->fprev));
+-    relerr = fabs(err/fom);
+-
+-    iterate->allrelerr[iterate->iter_i] = relerr;
+-
+-    if (iterate->iter_i > 0)
+-    {
+-        if (debug)
+-        {
+-            fprintf(debug,"Iterating NPT constraints: %6i %20.12f%14.6g%20.12f\n",
+-                    iterate->iter_i,fom,relerr,*newf);
+-        }
+-
+-        if ((relerr < CONVERGEITER) || (err < CONVERGEITER) || (fom==0) || ((iterate->x == iterate->xprev) && iterate->iter_i > 1))
+-        {
+-            iterate->bIterate = FALSE;
+-            if (debug)
+-            {
+-                fprintf(debug,"Iterating NPT constraints: CONVERGED\n");
+-            }
+-            return TRUE;
+-        }
+-        if (iterate->iter_i > MAXITERCONST)
+-        {
+-            if (relerr < CLOSE_ENOUGH)
+-            {
+-                incycle = FALSE;
+-                for (i=1;i<CYCLEMAX;i++) {
+-                    if ((iterate->allrelerr[iterate->iter_i-(1+i)] == iterate->allrelerr[iterate->iter_i-1]) &&
+-                        (iterate->allrelerr[iterate->iter_i-(1+i)] == iterate->allrelerr[iterate->iter_i-(1+2*i)])) {
+-                        incycle = TRUE;
+-                        if (debug)
+-                        {
+-                            fprintf(debug,"Exiting from an NPT iterating cycle of length %d\n",i);
+-                        }
+-                        break;
+-                    }
+-                }
+-
+-                if (incycle) {
+-                    /* step 1: trapped in a numerical attractor */
+-                    /* we are trapped in a numerical attractor, and can't converge any more, and are close to the final result.
+-                       Better to give up convergence here than have the simulation die.
+-                    */
+-                    iterate->num_close++;
+-                    return TRUE;
+-                }
+-                else
+-                {
+-                    /* Step #2: test if we are reasonably close for other reasons, then monitor the number.  If not, die */
+-
+-                    /* how many close calls have we had?  If less than a few, we're OK */
+-                    if (iterate->num_close < MAX_NUMBER_CLOSE)
+-                    {
+-                        sprintf(buf,"Slight numerical convergence deviation with NPT at step %d, relative error only %10.5g, likely not a problem, continuing\n",nsteps,relerr);
+-                        md_print_warning(cr,fplog,buf);
+-                        iterate->num_close++;
+-                        return TRUE;
+-                        /* if more than a few, check the total fraction.  If too high, die. */
+-                    } else if (iterate->num_close/(double)nsteps > FRACTION_CLOSE) {
+-                        gmx_fatal(FARGS,"Could not converge NPT constraints, too many exceptions (%d%%\n",iterate->num_close/(double)nsteps);
+-                    }
+-                }
+-            }
+-            else
+-            {
+-                gmx_fatal(FARGS,"Could not converge NPT constraints\n");
+-            }
+-        }
+-    }
+-
+-    iterate->xprev = iterate->x;
+-    iterate->x = *newf;
+-    iterate->fprev = iterate->f;
+-    iterate->iter_i++;
+-
+-    return FALSE;
+-}
+-
+-static void check_nst_param(FILE *fplog,t_commrec *cr,
+-                            const char *desc_nst,int nst,
+-                            const char *desc_p,int *p)
+-{
+-    char buf[STRLEN];
+-
+-    if (*p > 0 && *p % nst != 0)
+-    {
+-        /* Round up to the next multiple of nst */
+-        *p = ((*p)/nst + 1)*nst;
+-        sprintf(buf,"NOTE: %s changes %s to %d\n",desc_nst,desc_p,*p);
+-        md_print_warning(cr,fplog,buf);
+-    }
+-}
+-
+-static void reset_all_counters(FILE *fplog,t_commrec *cr,
+-                               gmx_large_int_t step,
+-                               gmx_large_int_t *step_rel,t_inputrec *ir,
+-                               gmx_wallcycle_t wcycle,t_nrnb *nrnb,
+-                               gmx_runtime_t *runtime)
+-{
+-    char buf[STRLEN],sbuf[STEPSTRSIZE];
+-
+-    /* Reset all the counters related to performance over the run */
+-    sprintf(buf,"Step %s: resetting all time and cycle counters\n",
+-            gmx_step_str(step,sbuf));
+-    md_print_warning(cr,fplog,buf);
+-
+-    wallcycle_stop(wcycle,ewcRUN);
+-    wallcycle_reset_all(wcycle);
+-    if (DOMAINDECOMP(cr))
+-    {
+-        reset_dd_statistics_counters(cr->dd);
+-    }
+-    init_nrnb(nrnb);
+-    ir->init_step += *step_rel;
+-    ir->nsteps    -= *step_rel;
+-    *step_rel = 0;
+-    wallcycle_start(wcycle,ewcRUN);
+-    runtime_start(runtime);
+-    print_date_and_time(fplog,cr->nodeid,"Restarted time",runtime);
+-}
+-
+-static int check_nstglobalcomm(FILE *fplog,t_commrec *cr,
+-                               int nstglobalcomm,t_inputrec *ir)
+-{
+-    char buf[STRLEN];
+-
+-    if (!EI_DYNAMICS(ir->eI))
+-    {
+-        nstglobalcomm = 1;
+-    }
+-
+-    if (nstglobalcomm == -1)
+-    {
+-        if (ir->nstcalcenergy == 0 && ir->nstlist == 0)
+-        {
+-            nstglobalcomm = 10;
+-            if (ir->nstenergy > 0 && ir->nstenergy < nstglobalcomm)
+-            {
+-                nstglobalcomm = ir->nstenergy;
+-            }
+-        }
+-        else
+-        {
+-            /* We assume that if nstcalcenergy > nstlist,
+-             * nstcalcenergy is a multiple of nstlist.
+-             */
+-            if (ir->nstcalcenergy == 0 ||
+-                (ir->nstlist > 0 && ir->nstlist < ir->nstcalcenergy))
+-            {
+-                nstglobalcomm = ir->nstlist;
+-            }
+-            else
+-            {
+-                nstglobalcomm = ir->nstcalcenergy;
+-            }
+-        }
+-    }
+-    else
+-    {
+-        if (ir->nstlist > 0 &&
+-            nstglobalcomm > ir->nstlist && nstglobalcomm % ir->nstlist != 0)
+-        {
+-            nstglobalcomm = (nstglobalcomm / ir->nstlist)*ir->nstlist;
+-            sprintf(buf,"WARNING: nstglobalcomm is larger than nstlist, but not a multiple, setting it to %d\n",nstglobalcomm);
+-            md_print_warning(cr,fplog,buf);
+-        }
+-        if (nstglobalcomm > ir->nstcalcenergy)
+-        {
+-            check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
+-                            "nstcalcenergy",&ir->nstcalcenergy);
+-        }
+-
+-        check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
+-                        "nstenergy",&ir->nstenergy);
+-
+-        check_nst_param(fplog,cr,"-gcom",nstglobalcomm,
+-                        "nstlog",&ir->nstlog);
+-    }
+-
+-    if (ir->comm_mode != ecmNO && ir->nstcomm < nstglobalcomm)
+-    {
+-        sprintf(buf,"WARNING: Changing nstcomm from %d to %d\n",
+-                ir->nstcomm,nstglobalcomm);
+-        md_print_warning(cr,fplog,buf);
+-        ir->nstcomm = nstglobalcomm;
+-    }
+-
+-    return nstglobalcomm;
+-}
+-
+-void check_ir_old_tpx_versions(t_commrec *cr,FILE *fplog,
+-                               t_inputrec *ir,gmx_mtop_t *mtop)
+-{
+-    /* Check required for old tpx files */
+-    if (IR_TWINRANGE(*ir) && ir->nstlist > 1 &&
+-        ir->nstcalcenergy % ir->nstlist != 0)
+-    {
+-        md_print_warning(cr,fplog,"Old tpr file with twin-range settings: modifying energy calculation and/or T/P-coupling frequencies");
+-
+-        if (gmx_mtop_ftype_count(mtop,F_CONSTR) +
+-            gmx_mtop_ftype_count(mtop,F_CONSTRNC) > 0 &&
+-            ir->eConstrAlg == econtSHAKE)
+-        {
+-            md_print_warning(cr,fplog,"With twin-range cut-off's and SHAKE the virial and pressure are incorrect");
+-            if (ir->epc != epcNO)
+-            {
+-                gmx_fatal(FARGS,"Can not do pressure coupling with twin-range cut-off's and SHAKE");
+-            }
+-        }
+-        check_nst_param(fplog,cr,"nstlist",ir->nstlist,
+-                        "nstcalcenergy",&ir->nstcalcenergy);
+-    	check_nst_param(fplog,cr,"nstcalcenergy",ir->nstcalcenergy,
+-        	        "nstenergy",&ir->nstenergy);
+-        check_nst_param(fplog,cr,"nstcalcenergy",ir->nstcalcenergy,
+-                        "nstlog",&ir->nstlog);
+-        if (ir->efep != efepNO)
+-        {
+-            check_nst_param(fplog,cr,"nstcalcenergy",ir->nstcalcenergy,
+-                            "nstdhdl",&ir->nstdhdl);
+-        }
+-    }
+-}
+-
+-typedef struct {
+-    gmx_bool       bGStatEveryStep;
+-    gmx_large_int_t step_ns;
+-    gmx_large_int_t step_nscheck;
+-    gmx_large_int_t nns;
+-    matrix     scale_tot;
+-    int        nabnsb;
+-    double     s1;
+-    double     s2;
+-    double     ab;
+-    double     lt_runav;
+-    double     lt_runav2;
+-} gmx_nlheur_t;
+-
+-static void reset_nlistheuristics(gmx_nlheur_t *nlh,gmx_large_int_t step)
+-{
+-    nlh->lt_runav  = 0;
+-    nlh->lt_runav2 = 0;
+-    nlh->step_nscheck = step;
+-}
+-
+-static void init_nlistheuristics(gmx_nlheur_t *nlh,
+-                                 gmx_bool bGStatEveryStep,gmx_large_int_t step)
+-{
+-    nlh->bGStatEveryStep = bGStatEveryStep;
+-    nlh->nns       = 0;
+-    nlh->nabnsb    = 0;
+-    nlh->s1        = 0;
+-    nlh->s2        = 0;
+-    nlh->ab        = 0;
+-
+-    reset_nlistheuristics(nlh,step);
+-}
+-
+-static void update_nliststatistics(gmx_nlheur_t *nlh,gmx_large_int_t step)
+-{
+-    gmx_large_int_t nl_lt;
+-    char sbuf[STEPSTRSIZE],sbuf2[STEPSTRSIZE];
+-
+-    /* Determine the neighbor list life time */
+-    nl_lt = step - nlh->step_ns;
+-    if (debug)
+-    {
+-        fprintf(debug,"%d atoms beyond ns buffer, updating neighbor list after %s steps\n",nlh->nabnsb,gmx_step_str(nl_lt,sbuf));
+-    }
+-    nlh->nns++;
+-    nlh->s1 += nl_lt;
+-    nlh->s2 += nl_lt*nl_lt;
+-    nlh->ab += nlh->nabnsb;
+-    if (nlh->lt_runav == 0)
+-    {
+-        nlh->lt_runav  = nl_lt;
+-        /* Initialize the fluctuation average
+-         * such that at startup we check after 0 steps.
+-         */
+-        nlh->lt_runav2 = sqr(nl_lt/2.0);
+-    }
+-    /* Running average with 0.9 gives an exp. history of 9.5 */
+-    nlh->lt_runav2 = 0.9*nlh->lt_runav2 + 0.1*sqr(nlh->lt_runav - nl_lt);
+-    nlh->lt_runav  = 0.9*nlh->lt_runav  + 0.1*nl_lt;
+-    if (nlh->bGStatEveryStep)
+-    {
+-        /* Always check the nlist validity */
+-        nlh->step_nscheck = step;
+-    }
+-    else
+-    {
+-        /* We check after:  <life time> - 2*sigma
+-         * The factor 2 is quite conservative,
+-         * but we assume that with nstlist=-1 the user
+-         * prefers exact integration over performance.
+-         */
+-        nlh->step_nscheck = step
+-                  + (int)(nlh->lt_runav - 2.0*sqrt(nlh->lt_runav2)) - 1;
+-    }
+-    if (debug)
+-    {
+-        fprintf(debug,"nlist life time %s run av. %4.1f sig %3.1f check %s check with -gcom %d\n",
+-                gmx_step_str(nl_lt,sbuf),nlh->lt_runav,sqrt(nlh->lt_runav2),
+-                gmx_step_str(nlh->step_nscheck-step+1,sbuf2),
+-                (int)(nlh->lt_runav - 2.0*sqrt(nlh->lt_runav2)));
+-    }
+-}
+-
+-static void set_nlistheuristics(gmx_nlheur_t *nlh,gmx_bool bReset,gmx_large_int_t step)
+-{
+-    int d;
+-
+-    if (bReset)
+-    {
+-        reset_nlistheuristics(nlh,step);
+-    }
+-    else
+-    {
+-        update_nliststatistics(nlh,step);
+-    }
+-
+-    nlh->step_ns = step;
+-    /* Initialize the cumulative coordinate scaling matrix */
+-    clear_mat(nlh->scale_tot);
+-    for(d=0; d<DIM; d++)
+-    {
+-        nlh->scale_tot[d][d] = 1.0;
+-    }
+-}
+-
+ double do_md_membed(FILE *fplog,t_commrec *cr,int nfile,const t_filenm fnm[],
+              const output_env_t oenv, gmx_bool bVerbose,gmx_bool bCompact,
+              int nstglobalcomm,
+@@ -4283,14 +3435,13 @@ int gmx_membed(int argc,char *argv[])
+ {
+ 	const char *desc[] = {
+ 			"[TT]g_membed[tt] embeds a membrane protein into an equilibrated lipid bilayer at the position",
+-			"and orientation specified by the user.\n",
+-			"\n",
+-			"SHORT MANUAL\n------------\n",
++			"and orientation specified by the user.[PAR]",
++			"SHORT MANUAL[BR]------------[BR]",
+ 			"The user should merge the structure files of the protein and membrane (+solvent), creating a",
+ 			"single structure file with the protein overlapping the membrane at the desired position and",
+-			"orientation. Box size should be taken from the membrane structure file. The corresponding topology",
++			"orientation. The box size is taken from the membrane structure file. The corresponding topology",
+ 			"files should also be merged. Consecutively, create a [TT].tpr[tt] file (input for [TT]g_membed[tt]) from these files,"
+-			"with the following options included in the [TT].mdp[tt] file.\n",
++			"with the following options included in the [TT].mdp[tt] file.[BR]",
+ 			" - [TT]integrator      = md[tt][BR]",
+ 			" - [TT]energygrp       = Protein[tt] (or other group that you want to insert)[BR]",
+ 			" - [TT]freezegrps      = Protein[tt][BR]",
+@@ -4298,32 +3449,29 @@ int gmx_membed(int argc,char *argv[])
+ 			" - [TT]energygrp_excl  = Protein Protein[tt][BR]",
+ 			"The output is a structure file containing the protein embedded in the membrane. If a topology",
+ 			"file is provided, the number of lipid and ",
+-			"solvent molecules will be updated to match the new structure file.\n",
+-			"For a more extensive manual see Wolf et al, J Comp Chem 31 (2010) 2169-2174, Appendix.\n",
+-			"\n",
+-			"SHORT METHOD DESCRIPTION\n",
+-			"------------------------\n",
+-			"1. The protein is resized around its center of mass by a factor -xy in the xy-plane",
+-			"(the membrane plane) and a factor -z in the z-direction (if the size of the",
++			"solvent molecules will be updated to match the new structure file.[BR]",
++			"For a more extensive manual see Wolf et al, J Comp Chem 31 (2010) 2169-2174, Appendix.[PAR]",
++			"SHORT METHOD DESCRIPTION[BR]",
++			"------------------------[BR]",
++			"1. The protein is resized around its center of mass by a factor [TT]-xy[tt] in the xy-plane",
++			"(the membrane plane) and a factor [TT]-z[tt] in the [IT]z[it]-direction (if the size of the",
+ 			"protein in the z-direction is the same or smaller than the width of the membrane, a",
+-			"-z value larger than 1 can prevent that the protein will be enveloped by the lipids).\n",
++			"[TT]-z[tt] value larger than 1 can prevent that the protein will be enveloped by the lipids).[BR]",
+ 			"2. All lipid and solvent molecules overlapping with the resized protein are removed. All",
+-			"intraprotein interactions are turned off to prevent numerical issues for small values of -xy",
+-			" or -z\n",
+-			"3. One md step is performed.\n",
+-			"4. The resize factor (-xy or -z) is incremented by a small amount ((1-xy)/nxy or (1-z)/nz) and the",
++			"intraprotein interactions are turned off to prevent numerical issues for small values of [TT]-xy[tt]",
++			" or [TT]-z[tt][BR]",
++			"3. One md step is performed.[BR]",
++			"4. The resize factor ([TT]-xy[tt] or [TT]-z[tt]) is incremented by a small amount ((1-xy)/nxy or (1-z)/nz) and the",
+ 			"protein is resized again around its center of mass. The resize factor for the xy-plane",
+-			"is incremented first. The resize factor for the z-direction is not changed until the -xy factor",
+-			"is 1 (thus after -nxy iteration).\n",
+-			"5. Repeat step 3 and 4 until the protein reaches its original size (-nxy + -nz iterations).\n",
+-			"For a more extensive method descrition see Wolf et al, J Comp Chem, 31 (2010) 2169-2174.\n",
+-			"\n",
+-			"NOTE\n----\n",
+-			" - Protein can be any molecule you want to insert in the membrane.\n",
++			"is incremented first. The resize factor for the z-direction is not changed until the [TT]-xy[tt] factor",
++			"is 1 (thus after [TT]-nxy[tt] iterations).[BR]",
++			"5. Repeat step 3 and 4 until the protein reaches its original size ([TT]-nxy[tt] + [TT]-nz[tt] iterations).[BR]",
++			"For a more extensive method description see Wolf et al, J Comp Chem, 31 (2010) 2169-2174.[PAR]",
++			"NOTE[BR]----[BR]",
++			" - Protein can be any molecule you want to insert in the membrane.[BR]",
+ 			" - It is recommended to perform a short equilibration run after the embedding",
+-			"(see Wolf et al, J Comp Chem 31 (2010) 2169-2174, to re-equilibrate the membrane. Clearly",
+-			"protein equilibration might require longer.\n",
+-			"\n"
++			"(see Wolf et al, J Comp Chem 31 (2010) 2169-2174), to re-equilibrate the membrane. Clearly",
++			"protein equilibration might require longer.[PAR]"
+ 	};
+ 	t_commrec    *cr;
+ 	t_filenm fnm[] = {
+@@ -4543,7 +3691,7 @@ int gmx_membed(int argc,char *argv[])
+    only started at mdrunner_threads, though. */
+ 	if (nthreads<1)
+ 	{
+-		nthreads=tMPI_Get_recommended_nthreads();
++		nthreads=tMPI_Thread_get_hw_number();
+ 	}
+ #else
+ 	nthreads=1;
+diff --git a/src/tools/gmx_morph.c b/src/tools/gmx_morph.c
+index f7f11e2..e877e4e 100644
+--- a/src/tools/gmx_morph.c
++++ b/src/tools/gmx_morph.c
+@@ -74,13 +74,13 @@ int gmx_morph(int argc,char *argv[])
+     "the [TT]-ninterm[tt] flag. The first and last flag correspond to the way of",
+     "interpolating: 0 corresponds to input structure 1 while",
+     "1 corresponds to input structure 2.",
+-    "If you specify first < 0 or last > 1 extrapolation will be",
+-    "on the path from input structure x1 to x2. In general the coordinates",
++    "If you specify [TT]-first[tt] < 0 or [TT]-last[tt] > 1 extrapolation will be",
++    "on the path from input structure x1 to x2. In general, the coordinates",
+     "of the intermediate x(i) out of N total intermidates correspond to:[PAR]",
+     "x(i) = x1 + (first+(i/(N-1))*(last-first))*(x2-x1)[PAR]",
+     "Finally the RMSD with respect to both input structures can be computed",
+-    "if explicitly selected ([TT]-or[tt] option). In that case an index file may be",
+-    "read to select what group RMS is computed from."
++    "if explicitly selected ([TT]-or[tt] option). In that case, an index file may be",
++    "read to select the group from which the RMS is computed."
+   };
+   t_filenm fnm[] = {
+     { efSTX, "-f1", "conf1",  ffREAD },
+diff --git a/src/tools/gmx_nmeig.c b/src/tools/gmx_nmeig.c
+index e547e04..13793d1 100644
+--- a/src/tools/gmx_nmeig.c
++++ b/src/tools/gmx_nmeig.c
+@@ -267,19 +267,19 @@ int gmx_nmeig(int argc,char *argv[])
+     "output. In this case, they will no longer be exactly orthogonal in the",
+     "standard Cartesian norm, but in the mass-weighted norm they would be.[PAR]",
+     "This program can be optionally used to compute quantum corrections to heat capacity",
+-    "and enthalpy by providing an extra file argument -qcorr. See gromacs",
+-    "manual chapter 1 for details. The result includes subtracting a harmonic",
++    "and enthalpy by providing an extra file argument [TT]-qcorr[tt]. See the GROMACS",
++    "manual, Chapter 1, for details. The result includes subtracting a harmonic",
+     "degree of freedom at the given temperature.",
+     "The total correction is printed on the terminal screen.",
+-    "The recommended way of getting the corrections out is:",
+-    "g_nmeig -s topol.tpr -f nm.mtx -first 7 -last 10000 -T 300 -qc [-constr]",
+-    "The constr should be used when bond constraints were used during the",
+-    "simulation [BB]for all the covalent bonds[bb]. If this is not the case",
+-    "you need to analyse the quant_corr.xvg file yourself.[PAR]",
+-    "To make things more flexible, the program can also take vsites into account",
++    "The recommended way of getting the corrections out is:[PAR]",
++    "[TT]g_nmeig -s topol.tpr -f nm.mtx -first 7 -last 10000 -T 300 -qc [-constr][tt][PAR]",
++    "The [TT]-constr[tt] option should be used when bond constraints were used during the",
++    "simulation [BB]for all the covalent bonds[bb]. If this is not the case, ",
++    "you need to analyze the [TT]quant_corr.xvg[tt] file yourself.[PAR]",
++    "To make things more flexible, the program can also take virtual sites into account",
+     "when computing quantum corrections. When selecting [TT]-constr[tt] and",
+-    "[TT]-qc[tt] the [TT]-begin[tt] and [TT]-end[tt] options will be set automatically as well.",
+-    "Again, if you think you know it better, please check the eigenfreq.xvg",
++    "[TT]-qc[tt], the [TT]-begin[tt] and [TT]-end[tt] options will be set automatically as well.",
++    "Again, if you think you know it better, please check the [TT]eigenfreq.xvg[tt]",
+     "output." 
+   };
+     
+diff --git a/src/tools/gmx_order.c b/src/tools/gmx_order.c
+index 7723c09..3b21564 100644
+--- a/src/tools/gmx_order.c
++++ b/src/tools/gmx_order.c
+@@ -801,7 +801,7 @@ int gmx_order(int argc,char *argv[])
+     { "-d",      FALSE, etENUM, {normal_axis}, 
+       "Direction of the normal on the membrane" },
+     { "-sl",     FALSE, etINT, {&nslices},
+-      "Calculate order parameter as function of boxlength, dividing the box"
++      "Calculate order parameter as function of box length, dividing the box"
+       " in #nr slices." },
+     { "-szonly", FALSE, etBOOL,{&bSzonly},
+       "Only give Sz element of order tensor. (axis can be specified with [TT]-d[tt])" },
+diff --git a/src/tools/gmx_pme_error.c b/src/tools/gmx_pme_error.c
+index 387a764..42763cf 100644
+--- a/src/tools/gmx_pme_error.c
++++ b/src/tools/gmx_pme_error.c
+@@ -497,12 +497,12 @@ static real estimate_reciprocal(
+         x_per_core = xtot;
+     }
+ /*     
+-#ifdef GMX_MPI
++#ifdef GMX_LIB_MPI
+     MPI_Barrier(MPI_COMM_WORLD);
+ #endif
+ */
+ 
+-#ifdef GMX_MPI
++#ifdef GMX_LIB_MPI
+ #ifdef TAKETIME
+     if (MASTER(cr))
+         t0 = MPI_Wtime();
+@@ -728,7 +728,7 @@ static real estimate_reciprocal(
+     if (MASTER(cr))
+         fprintf(stderr, "\n");
+ 
+-
++#ifdef GMX_LIB_MPI
+ #ifdef TAKETIME
+     if (MASTER(cr))
+     {
+@@ -736,6 +736,7 @@ static real estimate_reciprocal(
+         fprintf(fp_out, "Recip. err. est. took   : %lf s\n", t1);
+     }
+ #endif
++#endif
+    
+ #ifdef DEBUG
+     if (PAR(cr))
+@@ -1078,7 +1079,7 @@ int gmx_pme_error(int argc,char *argv[])
+     
+     cr = init_par(&argc,&argv);
+     
+-#ifdef GMX_MPI
++#ifdef GMX_LIB_MPI
+     MPI_Barrier(MPI_COMM_WORLD);
+ #endif
+ 
+diff --git a/src/tools/gmx_potential.c b/src/tools/gmx_potential.c
+index c674551..8b3705a 100644
+--- a/src/tools/gmx_potential.c
++++ b/src/tools/gmx_potential.c
+@@ -55,6 +55,11 @@
+ #include "index.h"
+ #include "gmx_ana.h"
+ 
++/* Suppress Cygwin compiler warnings from using newlib version of
++ * ctype.h */
++#ifdef GMX_CYGWIN
++#undef toupper
++#endif
+ 
+ #define EPS0 8.85419E-12
+ #define ELC 1.60219E-19
+diff --git a/src/tools/gmx_rama.c b/src/tools/gmx_rama.c
+index 4ba79d9..4d25a35 100644
+--- a/src/tools/gmx_rama.c
++++ b/src/tools/gmx_rama.c
+@@ -69,7 +69,7 @@ static void plot_rama(FILE *out,t_xrama *xr)
+ int gmx_rama(int argc,char *argv[])
+ {
+   const char *desc[] = {
+-    "[TT]g_rama[tt] selects the Phi/Psi dihedral combinations from your topology file",
++    "[TT]g_rama[tt] selects the [GRK]phi[grk]/[GRK]psi[grk] dihedral combinations from your topology file",
+     "and computes these as a function of time.",
+     "Using simple Unix tools such as [IT]grep[it] you can select out", 
+     "specific residues."
+diff --git a/src/tools/gmx_rdf.c b/src/tools/gmx_rdf.c
+index 117f493..4c0b3a7 100644
+--- a/src/tools/gmx_rdf.c
++++ b/src/tools/gmx_rdf.c
+@@ -630,30 +630,30 @@ int gmx_rdf(int argc,char *argv[])
+     "The normal method is around a (set of) particle(s), the other methods",
+     "are around the center of mass of a set of particles ([TT]-com[tt])",
+     "or to the closest particle in a set ([TT]-surf[tt]).",
+-    "With all methods rdf's can also be calculated around axes parallel",
+-    "to the z-axis with option [TT]-xy[tt].",
++    "With all methods, the RDF can also be calculated around axes parallel",
++    "to the [IT]z[it]-axis with option [TT]-xy[tt].",
+     "With option [TT]-surf[tt] normalization can not be used.[PAR]",
+-    "The option [TT]-rdf[tt] sets the type of rdf to be computed.",
++    "The option [TT]-rdf[tt] sets the type of RDF to be computed.",
+     "Default is for atoms or particles, but one can also select center",
+-    "of mass or geometry of molecules or residues. In all cases only",
++    "of mass or geometry of molecules or residues. In all cases, only",
+     "the atoms in the index groups are taken into account.",
+-    "For molecules and/or the center of mass option a run input file",
++    "For molecules and/or the center of mass option, a run input file",
+     "is required.",
+-    "Other weighting than COM or COG can currently only be achieved",
++    "Weighting other than COM or COG can currently only be achieved",
+     "by providing a run input file with different masses.",
+     "Options [TT]-com[tt] and [TT]-surf[tt] also work in conjunction",
+     "with [TT]-rdf[tt].[PAR]",
+     "If a run input file is supplied ([TT]-s[tt]) and [TT]-rdf[tt] is set",
+     "to [TT]atom[tt], exclusions defined",
+-    "in that file are taken into account when calculating the rdf.",
++    "in that file are taken into account when calculating the RDF.",
+     "The option [TT]-cut[tt] is meant as an alternative way to avoid",
+-    "intramolecular peaks in the rdf plot.",
++    "intramolecular peaks in the RDF plot.",
+     "It is however better to supply a run input file with a higher number of",
+-    "exclusions. For eg. benzene a topology with nrexcl set to 5",
+-    "would eliminate all intramolecular contributions to the rdf.",
++    "exclusions. For e.g. benzene a topology, setting nrexcl to 5",
++    "would eliminate all intramolecular contributions to the RDF.",
+     "Note that all atoms in the selected groups are used, also the ones",
+     "that don't have Lennard-Jones interactions.[PAR]",
+-    "Option [TT]-cn[tt] produces the cumulative number rdf,",
++    "Option [TT]-cn[tt] produces the cumulative number RDF,",
+     "i.e. the average number of particles within a distance r.[PAR]",
+     "To bridge the gap between theory and experiment structure factors can",
+     "be computed (option [TT]-sq[tt]). The algorithm uses FFT, the grid",
+diff --git a/src/tools/gmx_rms.c b/src/tools/gmx_rms.c
+index a363bb4..a848bb9 100644
+--- a/src/tools/gmx_rms.c
++++ b/src/tools/gmx_rms.c
+@@ -95,19 +95,19 @@ int gmx_rms(int argc, char *argv[])
+         *desc[] =
+             {
+                 "[TT]g_rms[tt] compares two structures by computing the root mean square",
+-                "deviation (RMSD), the size-independent 'rho' similarity parameter",
+-                "(rho) or the scaled rho (rhosc), ",
+-                "see Maiorov & Crippen, PROTEINS [BB]22[bb], 273 (1995).",
++                "deviation (RMSD), the size-independent [GRK]rho[grk] similarity parameter",
++                "([TT]rho[tt]) or the scaled [GRK]rho[grk] ([TT]rhosc[tt]), ",
++                "see Maiorov & Crippen, Proteins [BB]22[bb], 273 (1995).",
+                 "This is selected by [TT]-what[tt].[PAR]"
+ 
+-                    "Each structure from a trajectory ([TT]-f[tt]) is compared to a",
++                "Each structure from a trajectory ([TT]-f[tt]) is compared to a",
+                 "reference structure. The reference structure",
+                 "is taken from the structure file ([TT]-s[tt]).[PAR]",
+ 
+                 "With option [TT]-mir[tt] also a comparison with the mirror image of",
+                 "the reference structure is calculated.",
+                 "This is useful as a reference for 'significant' values, see",
+-                "Maiorov & Crippen, PROTEINS [BB]22[bb], 273 (1995).[PAR]",
++                "Maiorov & Crippen, Proteins [BB]22[bb], 273 (1995).[PAR]",
+ 
+                 "Option [TT]-prev[tt] produces the comparison with a previous frame",
+                 "the specified number of frames ago.[PAR]",
+@@ -124,9 +124,9 @@ int gmx_rms(int argc, char *argv[])
+                 "Option [TT]-mw[tt] controls whether mass weighting is done or not.",
+                 "If you select the option (default) and ",
+                 "supply a valid [TT].tpr[tt] file masses will be taken from there, ",
+-                "otherwise the masses will be deduced from the atommass.dat file in",
+-                "the GROMACS library directory. This is fine for proteins but not",
+-                "necessarily for other molecules. A default mass of 12.011 amu (Carbon)",
++                "otherwise the masses will be deduced from the [TT]atommass.dat[tt] file in",
++                "[TT]GMXLIB[tt]. This is fine for proteins, but not",
++                "necessarily for other molecules. A default mass of 12.011 amu (carbon)",
+                 "is assigned to unknown atoms. You can check whether this happend by",
+                 "turning on the [TT]-debug[tt] flag and inspecting the log file.[PAR]",
+ 
+diff --git a/src/tools/gmx_rmsdist.c b/src/tools/gmx_rmsdist.c
+index db20963..93e0d6a 100644
+--- a/src/tools/gmx_rmsdist.c
++++ b/src/tools/gmx_rmsdist.c
+@@ -513,7 +513,7 @@ int gmx_rmsdist (int argc,char *argv[])
+     "which has the advantage that no fit is needed like in standard RMS",
+     "deviation as computed by [TT]g_rms[tt].",
+     "The reference structure is taken from the structure file.",
+-    "The rmsd at time t is calculated as the rms",
++    "The RMSD at time t is calculated as the RMS",
+     "of the differences in distance between atom-pairs in the reference",
+     "structure and the structure at time t.[PAR]",
+     "[TT]g_rmsdist[tt] can also produce matrices of the rms distances, rms distances",
+diff --git a/src/tools/gmx_rotmat.c b/src/tools/gmx_rotmat.c
+index 2adde5d..eea8137 100644
+--- a/src/tools/gmx_rotmat.c
++++ b/src/tools/gmx_rotmat.c
+@@ -193,17 +193,17 @@ int gmx_rotmat(int argc,char *argv[])
+         "determining the orientation of a molecule",
+         "at an interface, possibly on a trajectory produced with",
+         "[TT]trjconv -fit rotxy+transxy[tt] to remove the rotation",
+-        "in the xy-plane.",
++        "in the [IT]x-y[it] plane.",
+         "[PAR]",
+         "Option [TT]-ref[tt] determines a reference structure for fitting,",
+         "instead of using the structure from [TT]-s[tt]. The structure with",
+         "the lowest sum of RMSD's to all other structures is used.",
+         "Since the computational cost of this procedure grows with",
+         "the square of the number of frames, the [TT]-skip[tt] option",
+-        "can be useful. A full fit or only a fit in the x/y plane can",
++        "can be useful. A full fit or only a fit in the [IT]x-y[it] plane can",
+         "be performed.",
+         "[PAR]",
+-        "Option [TT]-fitxy[tt] fits in the x/y plane before determining",
++        "Option [TT]-fitxy[tt] fits in the [IT]x-y[it] plane before determining",
+         "the rotation matrix."
+     };
+     const char *reffit[] = 
+diff --git a/src/tools/gmx_saltbr.c b/src/tools/gmx_saltbr.c
+index 9c5ee3c..84a9247 100644
+--- a/src/tools/gmx_saltbr.c
++++ b/src/tools/gmx_saltbr.c
+@@ -122,12 +122,12 @@ int gmx_saltbr(int argc,char *argv[])
+   const char *desc[] = {
+     "[TT]g_saltbr[tt] plots the distance between all combination of charged groups",
+     "as a function of time. The groups are combined in different ways.",
+-    "A minimum distance can be given, (ie. a cut-off), then groups",
+-    "that are never closer than that distance will not be plotted.[BR]",
++    "A minimum distance can be given (i.e. a cut-off), such that groups",
++    "that are never closer than that distance will not be plotted.[PAR]",
+     "Output will be in a number of fixed filenames, [TT]min-min.xvg[tt], [TT]plus-min.xvg[tt]",
+-    "and [TT]plus-plus.xvg[tt], or files for every individual ion-pair if the [TT]-sep[tt]",
+-    "option is selected. In this case files are named as [TT]sb-ResnameResnr-Atomnr[tt].",
+-    "There may be many such files."
++    "and [TT]plus-plus.xvg[tt], or files for every individual ion pair if the [TT]-sep[tt]",
++    "option is selected. In this case, files are named as [TT]sb-(Resname)(Resnr)-(Atomnr)[tt].",
++    "There may be [BB]many[bb] such files."
+   };
+   static gmx_bool bSep=FALSE;
+   static real truncate=1000.0;
+diff --git a/src/tools/gmx_sas.c b/src/tools/gmx_sas.c
+index ac50bd6..4cd049d 100644
+--- a/src/tools/gmx_sas.c
++++ b/src/tools/gmx_sas.c
+@@ -566,7 +566,7 @@ int gmx_sas(int argc,char *argv[])
+ {
+   const char *desc[] = {
+     "[TT]g_sas[tt] computes hydrophobic, hydrophilic and total solvent accessible surface area.",
+-    "As a side effect the Connolly surface can be generated as well in",
++    "As a side effect, the Connolly surface can be generated as well in",
+     "a [TT].pdb[tt] file where the nodes are represented as atoms and the vertices",
+     "connecting the nearest nodes as CONECT records.",
+     "The program will ask for a group for the surface calculation",
+@@ -575,7 +575,7 @@ int gmx_sas(int argc,char *argv[])
+     "The output group can be the whole or part of the calculation group.",
+     "The average and standard deviation of the area over the trajectory can be plotted",
+     "per residue and atom as well (options [TT]-or[tt] and [TT]-oa[tt]).",
+-    "In combination with the latter option an [TT]itp[tt] file can be",
++    "In combination with the latter option an [TT].itp[tt] file can be",
+     "generated (option [TT]-i[tt])",
+     "which can be used to restrain surface atoms.[PAR]",
+     "By default, periodic boundary conditions are taken into account,",
+@@ -585,7 +585,7 @@ int gmx_sas(int argc,char *argv[])
+     "Please consider whether the normal probe radius is appropriate",
+     "in this case or whether you would rather use e.g. 0. It is good",
+     "to keep in mind that the results for volume and density are very",
+-    "approximate, in e.g. ice Ih one can easily fit water molecules in the",
++    "approximate. For example, in ice Ih, one can easily fit water molecules in the",
+     "pores which would yield a volume that is too low, and surface area and density",
+     "that are both too high."
+   };
+@@ -610,9 +610,9 @@ int gmx_sas(int argc,char *argv[])
+     { "-pbc",     FALSE, etBOOL, {&bPBC},
+       "Take periodicity into account" },
+     { "-prot",    FALSE, etBOOL, {&bSave},
+-      "Output the protein to the connelly [TT].pdb[tt] file too" },
++      "Output the protein to the Connelly [TT].pdb[tt] file too" },
+     { "-dgs",     FALSE, etREAL, {&dgs_default},
+-      "default value for solvation free energy per area (kJ/mol/nm^2)" }
++      "Default value for solvation free energy per area (kJ/mol/nm^2)" }
+   };
+   t_filenm  fnm[] = {
+     { efTRX, "-f",   NULL,       ffREAD },
+diff --git a/src/tools/gmx_sgangle.c b/src/tools/gmx_sgangle.c
+index 47ab299..cde0e64 100644
+--- a/src/tools/gmx_sgangle.c
++++ b/src/tools/gmx_sgangle.c
+@@ -445,7 +445,7 @@ int gmx_sgangle(int argc,char *argv[])
+     "If [TT]-one[tt] is set, only one group should be specified in the index",
+     "file and the angle between this group at time 0 and t will be computed.",
+     "The angles calculated depend on the order in which the atoms are ",
+-    "given. Giving for instance 5 6 will rotate the vector 5-6 with ",
++    "given. Giving, for instance, 5 6 will rotate the vector 5-6 with ",
+     "180 degrees compared to giving 6 5. [PAR]If three atoms are given, ",
+     "the normal on the plane spanned by those three atoms will be",
+     "calculated, using the formula  P1P2 x P1P3.",
+@@ -470,7 +470,7 @@ int gmx_sgangle(int argc,char *argv[])
+     { "-one", FALSE, etBOOL, {&bOne},
+       "Only one group compute angle between vector at time zero and time t"},
+     { "-z", FALSE, etBOOL, {&bZ},
+-        "Use the Z-axis as reference" }
++        "Use the [IT]z[it]-axis as reference" }
+   };
+ #define NPA asize(pa)
+ 
+diff --git a/src/tools/gmx_sham.c b/src/tools/gmx_sham.c
+index 91b1e35..63b8c67 100644
+--- a/src/tools/gmx_sham.c
++++ b/src/tools/gmx_sham.c
+@@ -686,10 +686,10 @@ int gmx_sham(int argc,char *argv[])
+     "make enthalpy (option [TT]-lsh[tt]) and entropy (option [TT]-lss[tt])",
+     "plots. The histograms can be made for any quantities the user supplies.",
+     "A line in the input file may start with a time",
+-    "(see option [TT]-time[tt]) and any number of y values may follow.",
++    "(see option [TT]-time[tt]) and any number of [IT]y[it]-values may follow.",
+     "Multiple sets can also be",
+     "read when they are separated by & (option [TT]-n[tt]),",
+-    "in this case only one y value is read from each line.",
++    "in this case only one [IT]y[it]-value is read from each line.",
+     "All lines starting with # and @ are skipped.",
+     "[PAR]",
+     "Option [TT]-ge[tt] can be used to supply a file with free energies",
+@@ -699,7 +699,7 @@ int gmx_sham(int argc,char *argv[])
+     "[PAR]",
+     "Option [TT]-ene[tt] can be used to supply a file with energies.",
+     "These energies are used as a weighting function in the single",
+-    "histogram analysis method by Kumar et. al. When temperatures",
++    "histogram analysis method by Kumar et al. When temperatures",
+     "are supplied (as a second column in the file), an experimental",
+     "weighting scheme is applied. In addition the vales",
+     "are used for making enthalpy and entropy plots.",
+@@ -709,7 +709,7 @@ int gmx_sham(int argc,char *argv[])
+     "sampled by two particles increases with increasing distance.",
+     "Depending on what one would like to show, one can choose to correct",
+     "the histogram and free-energy for this volume effect.",
+-    "The probability is normalized by r and r^2 for a dimension of 2 and 3",
++    "The probability is normalized by r and r^2 for dimensions of 2 and 3, ",
+     "respectively.",
+     "A value of -1 is used to indicate an angle in degrees between two",
+     "vectors: a sin(angle) normalization will be applied.",
+diff --git a/src/tools/gmx_sorient.c b/src/tools/gmx_sorient.c
+index 53862d6..213eb7f 100644
+--- a/src/tools/gmx_sorient.c
++++ b/src/tools/gmx_sorient.c
+@@ -127,23 +127,23 @@ int gmx_sorient(int argc,char *argv[])
+   const char *desc[] = {
+     "[TT]g_sorient[tt] analyzes solvent orientation around solutes.", 
+     "It calculates two angles between the vector from one or more",
+-    "reference positions to the first atom of each solvent molecule:[BR]",
+-    "theta1: the angle with the vector from the first atom of the solvent",
++    "reference positions to the first atom of each solvent molecule:[PAR]",
++    "[GRK]theta[grk]1: the angle with the vector from the first atom of the solvent",
+     "molecule to the midpoint between atoms 2 and 3.[BR]",
+-    "theta2: the angle with the normal of the solvent plane, defined by the",
+-    "same three atoms, or when the option [TT]-v23[tt] is set",
+-    "the angle with the vector between atoms 2 and 3.[BR]",
++    "[GRK]theta[grk]2: the angle with the normal of the solvent plane, defined by the",
++    "same three atoms, or, when the option [TT]-v23[tt] is set, ",
++    "the angle with the vector between atoms 2 and 3.[PAR]",
+     "The reference can be a set of atoms or",
+     "the center of mass of a set of atoms. The group of solvent atoms should",
+     "consist of 3 atoms per solvent molecule.",
+     "Only solvent molecules between [TT]-rmin[tt] and [TT]-rmax[tt] are",
+     "considered for [TT]-o[tt] and [TT]-no[tt] each frame.[PAR]",
+-    "[TT]-o[tt]: distribtion of cos(theta1) for rmin<=r<=rmax.[PAR]",
+-    "[TT]-no[tt]: distribution of cos(theta2) for rmin<=r<=rmax.[PAR]",
+-    "[TT]-ro[tt]: <cos(theta1)> and <3cos^2(theta2)-1> as a function of the",
++    "[TT]-o[tt]: distribtion of cos([GRK]theta[grk]1) for rmin<=r<=rmax.[PAR]",
++    "[TT]-no[tt]: distribution of cos([GRK]theta[grk]2) for rmin<=r<=rmax.[PAR]",
++    "[TT]-ro[tt]: <cos([GRK]theta[grk]1)> and <3cos^2([GRK]theta[grk]2)-1> as a function of the",
+     "distance.[PAR]",
+     "[TT]-co[tt]: the sum over all solvent molecules within distance r",
+-    "of cos(theta1) and 3cos^2(theta2)-1 as a function of r.[PAR]",
++    "of cos([GRK]theta[grk]1) and 3cos^2([GRK]theta[grk]2)-1 as a function of r.[PAR]",
+     "[TT]-rc[tt]: the distribution of the solvent molecules as a function of r"
+   };
+  
+diff --git a/src/tools/gmx_spatial.c b/src/tools/gmx_spatial.c
+index 9e146fe..1cb9ffb 100644
+--- a/src/tools/gmx_spatial.c
++++ b/src/tools/gmx_spatial.c
+@@ -65,41 +65,41 @@ int gmx_spatial(int argc,char *argv[])
+     "[TT]g_spatial[tt] calculates the spatial distribution function and ",
+     "outputs it in a form that can be read by VMD as Gaussian98 cube format. ",
+     "This was developed from template.c (GROMACS-3.3). ",
+-    "For a system of 32K atoms and a 50ns trajectory, the SDF can be generated ",
++    "For a system of 32,000 atoms and a 50 ns trajectory, the SDF can be generated ",
+     "in about 30 minutes, with most of the time dedicated to the two runs through ",
+     "[TT]trjconv[tt] that are required to center everything properly. ",
+     "This also takes a whole bunch of space (3 copies of the [TT].xtc[tt] file). ",
+     "Still, the pictures are pretty and very informative when the fitted selection is properly made. ",
+-    "3-4 atoms in a widely mobile group like a free amino acid in solution works ",
++    "3-4 atoms in a widely mobile group (like a free amino acid in solution) works ",
+     "well, or select the protein backbone in a stable folded structure to get the SDF ",
+     "of solvent and look at the time-averaged solvation shell. ",
+-    "It is also possible using this program to generate the SDF based on some arbitrarty ",
++    "It is also possible using this program to generate the SDF based on some arbitrary ",
+     "Cartesian coordinate. To do that, simply omit the preliminary [TT]trjconv[tt] steps. \n",
+     "USAGE: \n",
+     "1. Use [TT]make_ndx[tt] to create a group containing the atoms around which you want the SDF \n",
+     "2. [TT]trjconv -s a.tpr -f a.xtc -o b.xtc -center tric -ur compact -pbc none[tt] \n",
+     "3. [TT]trjconv -s a.tpr -f b.xtc -o c.xtc -fit rot+trans[tt] \n",
+     "4. run [TT]g_spatial[tt] on the [TT].xtc[tt] output of step #3. \n",
+-    "5. Load grid.cube into VMD and view as an isosurface. \n",
+-    "*** Systems such as micelles will require [TT]trjconv -pbc cluster[tt] between steps 1 and 2\n",
+-    "WARNINGS: \n",
++    "5. Load [TT]grid.cube[tt] into VMD and view as an isosurface. \n",
++    "[BB]Note[bb] that systems such as micelles will require [TT]trjconv -pbc cluster[tt] between steps 1 and 2\n",
++    "WARNINGS:[BR]",
+     "The SDF will be generated for a cube that contains all bins that have some non-zero occupancy. ",
+     "However, the preparatory [TT]-fit rot+trans[tt] option to [TT]trjconv[tt] implies that your system will be rotating ",
+     "and translating in space (in order that the selected group does not). Therefore the values that are ",
+     "returned will only be valid for some region around your central group/coordinate that has full overlap ",
+     "with system volume throughout the entire translated/rotated system over the course of the trajectory. ",
+     "It is up to the user to ensure that this is the case. \n",
+-    "BUGS: \n",
++    "BUGS:[BR]",
+     "When the allocated memory is not large enough, a segmentation fault may occur. This is usually detected ",
+-    "and the program is halted prior to the fault while displaying a warning message suggesting the use of the [TT]-nab[tt] ",
++    "and the program is halted prior to the fault while displaying a warning message suggesting the use of the [TT]-nab[tt] (Number of Additional Bins)",
+     "option. However, the program does not detect all such events. If you encounter a segmentation fault, run it again ",
+     "with an increased [TT]-nab[tt] value. \n",
+-    "RISKY OPTIONS: \n",
++    "RISKY OPTIONS:[BR]",
+     "To reduce the amount of space and time required, you can output only the coords ",
+     "that are going to be used in the first and subsequent run through [TT]trjconv[tt]. ",
+     "However, be sure to set the [TT]-nab[tt] option to a sufficiently high value since ",
+-    "memory is allocated for cube bins based on the initial coords and the [TT]-nab[tt] ",
+-    "(Number of Additional Bins) option value. \n"
++    "memory is allocated for cube bins based on the initial coordinates and the [TT]-nab[tt] ",
++    "option value. \n"
+   };
+   
+   static gmx_bool bPBC=FALSE;
+diff --git a/src/tools/gmx_spol.c b/src/tools/gmx_spol.c
+index 45ce0fd..dc99082 100644
+--- a/src/tools/gmx_spol.c
++++ b/src/tools/gmx_spol.c
+@@ -156,7 +156,7 @@ int gmx_spol(int argc,char *argv[])
+     "the inner product of the distance vector",
+     "and the dipole of the solvent molecule is determined.",
+     "For solvent molecules with net charge (ions), the net charge of the ion",
+-    "is subtracted evenly at all atoms in the selection of each ion.",
++    "is subtracted evenly from all atoms in the selection of each ion.",
+     "The average of these dipole components is printed.",
+     "The same is done for the polarization, where the average dipole is",
+     "subtracted from the instantaneous dipole. The magnitude of the average",
+diff --git a/src/tools/gmx_tcaf.c b/src/tools/gmx_tcaf.c
+index cbf9586..dee6fab 100644
+--- a/src/tools/gmx_tcaf.c
++++ b/src/tools/gmx_tcaf.c
+@@ -218,34 +218,34 @@ int gmx_tcaf(int argc,char *argv[])
+ {
+   const char *desc[] = {
+     "[TT]g_tcaf[tt] computes tranverse current autocorrelations.",
+-    "These are used to estimate the shear viscosity eta.",
+-    "For details see: Palmer, JCP 49 (1994) pp 359-366.[PAR]",
++    "These are used to estimate the shear viscosity, [GRK]eta[grk].",
++    "For details see: Palmer, Phys. Rev. E 49 (1994) pp 359-366.[PAR]",
+     "Transverse currents are calculated using the",
+-    "k-vectors (1,0,0) and (2,0,0) each also in the y- and z-direction,",
++    "k-vectors (1,0,0) and (2,0,0) each also in the [IT]y[it]- and [IT]z[it]-direction,",
+     "(1,1,0) and (1,-1,0) each also in the 2 other planes (these vectors",
+     "are not independent) and (1,1,1) and the 3 other box diagonals (also",
+     "not independent). For each k-vector the sine and cosine are used, in",
+     "combination with the velocity in 2 perpendicular directions. This gives",
+     "a total of 16*2*2=64 transverse currents. One autocorrelation is",
+-    "calculated fitted for each k-vector, which gives 16 tcaf's. Each of",
+-    "these tcaf's is fitted to f(t) = exp(-v)(cosh(Wv) + 1/W sinh(Wv)),",
+-    "v = -t/(2 tau), W = sqrt(1 - 4 tau eta/rho k^2), which gives 16 tau's",
+-    "and eta's. The fit weights decay with time as exp(-t/wt), the tcaf and",
++    "calculated fitted for each k-vector, which gives 16 TCAF's. Each of",
++    "these TCAF's is fitted to f(t) = exp(-v)(cosh(Wv) + 1/W sinh(Wv)),",
++    "v = -t/(2 [GRK]tau[grk]), W = sqrt(1 - 4 [GRK]tau[grk] [GRK]eta[grk]/[GRK]rho[grk] k^2), which gives 16 values of [GRK]tau[grk]",
++    "and [GRK]eta[grk]. The fit weights decay with time as exp(-t/wt), and the TCAF and",
+     "fit are calculated up to time 5*wt.",
+-    "The eta's should be fitted to 1 - a eta(k) k^2, from which",
++    "The [GRK]eta[grk] values should be fitted to 1 - a [GRK]eta[grk](k) k^2, from which",
+     "one can estimate the shear viscosity at k=0.[PAR]",
+     "When the box is cubic, one can use the option [TT]-oc[tt], which",
+-    "averages the tcaf's over all k-vectors with the same length.",
++    "averages the TCAF's over all k-vectors with the same length.",
+     "This results in more accurate tcaf's.",
+-    "Both the cubic tcaf's and fits are written to [TT]-oc[tt]",
+-    "The cubic eta estimates are also written to [TT]-ov[tt].[PAR]",
+-    "With option [TT]-mol[tt] the transverse current is determined of",
+-    "molecules instead of atoms. In this case the index group should",
++    "Both the cubic TCAF's and fits are written to [TT]-oc[tt]",
++    "The cubic [GRK]eta[grk] estimates are also written to [TT]-ov[tt].[PAR]",
++    "With option [TT]-mol[tt], the transverse current is determined of",
++    "molecules instead of atoms. In this case, the index group should",
+     "consist of molecule numbers instead of atom numbers.[PAR]",
+     "The k-dependent viscosities in the [TT]-ov[tt] file should be",
+-    "fitted to eta(k) = eta0 (1 - a k^2) to obtain the viscosity at",
++    "fitted to [GRK]eta[grk](k) = [GRK]eta[grk]0 (1 - a k^2) to obtain the viscosity at",
+     "infinite wavelength.[PAR]",
+-    "NOTE: make sure you write coordinates and velocities often enough.",
++    "[BB]Note:[bb] make sure you write coordinates and velocities often enough.",
+     "The initial, non-exponential, part of the autocorrelation function",
+     "is very important for obtaining a good fit."
+   };
+diff --git a/src/tools/gmx_trjcat.c b/src/tools/gmx_trjcat.c
+index c06c23c..2ca470d 100644
+--- a/src/tools/gmx_trjcat.c
++++ b/src/tools/gmx_trjcat.c
+@@ -438,7 +438,7 @@ int gmx_trjcat(int argc, char *argv[])
+             { "-dt", FALSE, etTIME,
+                 { &dt }, "Only write frame when t MOD dt = first time (%t)" },
+             { "-prec", FALSE, etINT,
+-                { &prec }, "Precision for .xtc and .gro writing in number of decimal places" },
++                { &prec }, "Precision for [TT].xtc[tt] and [TT].gro[tt] writing in number of decimal places" },
+             { "-vel", FALSE, etBOOL,
+                 { &bVels }, "Read and write velocities if possible" },
+             { "-settime", FALSE, etBOOL,
+@@ -446,11 +446,11 @@ int gmx_trjcat(int argc, char *argv[])
+             { "-sort", FALSE, etBOOL,
+                 { &bSort }, "Sort trajectory files (not frames)" },
+             { "-keeplast", FALSE, etBOOL,
+-                { &bKeepLast }, "keep overlapping frames at end of trajectory" },
++                { &bKeepLast }, "Keep overlapping frames at end of trajectory" },
+             { "-overwrite", FALSE, etBOOL,
+-                { &bOverwrite }, "overwrite overlapping frames during appending" },
++                { &bOverwrite }, "Overwrite overlapping frames during appending" },
+             { "-cat", FALSE, etBOOL,
+-                { &bCat }, "do not discard double time frames" } };
++                { &bCat }, "Do not discard double time frames" } };
+ #define npargs asize(pa)
+     int ftpin, i, frame, frame_out, step = 0, trjout = 0;
+     t_trxstatus *status;
+diff --git a/src/tools/gmx_trjorder.c b/src/tools/gmx_trjorder.c
+index fb4bc02..6c2d7c2 100644
+--- a/src/tools/gmx_trjorder.c
++++ b/src/tools/gmx_trjorder.c
+@@ -99,7 +99,7 @@ int gmx_trjorder(int argc,char *argv[])
+     "with any Gromacs program to analyze the n closest waters.",
+     "[PAR]",
+     "If the output file is a [TT].pdb[tt] file, the distance to the reference target",
+-    "will be stored in the B-factor field in order to color with e.g. rasmol.",
++    "will be stored in the B-factor field in order to color with e.g. Rasmol.",
+     "[PAR]",
+     "With option [TT]-nshell[tt] the number of molecules within a shell",
+     "of radius [TT]-r[tt] around the reference group are printed."
+diff --git a/src/tools/gmx_tune_pme.c b/src/tools/gmx_tune_pme.c
+index e70f5ea..f22d308 100644
+--- a/src/tools/gmx_tune_pme.c
++++ b/src/tools/gmx_tune_pme.c
+@@ -1845,10 +1845,19 @@ static void create_command_line_snippets(
+         /* Skip options not meant for mdrun */        
+         if (!is_main_switch(opt))
+         {
+-            /* Print it to a string buffer, strip away trailing whitespaces that pa_val also returns: */
+-            sprintf(strbuf2, "%s", pa_val(&pa[i],buf,BUFLENGTH));
+-            rtrim(strbuf2);
+-            sprintf(strbuf, "%s %s ", opt, strbuf2);
++            /* Boolean arguments need to be generated in the -[no]argname format */
++            if (pa[i].type == etBOOL)
++            {
++                sprintf(strbuf,"-%s%s ",*pa[i].u.b ? "" : "no",opt+1);
++            }
++            else
++            {
++                /* Print it to a string buffer, strip away trailing whitespaces that pa_val also returns: */
++                sprintf(strbuf2, "%s", pa_val(&pa[i],buf,BUFLENGTH));
++                rtrim(strbuf2);
++                sprintf(strbuf, "%s %s ", opt, strbuf2);
++            }
++
+             /* We need the -np (or -nt) switch in a separate buffer - whether or not it was set! */
+             if (0 == strcmp(opt,np_or_nt))
+             {
+@@ -1997,7 +2006,7 @@ int gmx_tune_pme(int argc,char *argv[])
+             "MPIRUN and MDRUN. If these are not present, 'mpirun' and 'mdrun'",
+             "will be used as defaults. Note that for certain MPI frameworks you",
+             "need to provide a machine- or hostfile. This can also be passed",
+-            "via the MPIRUN variable, e.g.",
++            "via the MPIRUN variable, e.g.[PAR]",
+             "[TT]export MPIRUN=\"/usr/local/mpirun -machinefile hosts\"[tt][PAR]",
+             "Please call [TT]g_tune_pme[tt] with the normal options you would pass to",
+             "[TT]mdrun[tt] and add [TT]-np[tt] for the number of processors to perform the",
+@@ -2006,11 +2015,11 @@ int gmx_tune_pme(int argc,char *argv[])
+             "[TT]g_tune_pme[tt] can test various real space / reciprocal space workloads",
+             "for you. With [TT]-ntpr[tt] you control how many extra [TT].tpr[tt] files will be",
+             "written with enlarged cutoffs and smaller fourier grids respectively.",
+-            "Typically, the first test (No. 0) will be with the settings from the input",
+-            "[TT].tpr[tt] file; the last test (No. [TT]ntpr[tt]) will have cutoffs multiplied",
++            "Typically, the first test (number 0) will be with the settings from the input",
++            "[TT].tpr[tt] file; the last test (number [TT]ntpr[tt]) will have cutoffs multiplied",
+             "by (and at the same time fourier grid dimensions divided by) the scaling",
+-            "factor [TT]-fac[tt] (default 1.2). The remaining [TT].tpr[tt] files will have about equally",
+-            "spaced values inbetween these extremes. Note that you can set [TT]-ntpr[tt] to 1",
++            "factor [TT]-fac[tt] (default 1.2). The remaining [TT].tpr[tt] files will have about ",
++            "equally-spaced values in between these extremes. [BB]Note[bb] that you can set [TT]-ntpr[tt] to 1",
+             "if you just want to find the optimal number of PME-only nodes; in that case",
+             "your input [TT].tpr[tt] file will remain unchanged.[PAR]",
+             "For the benchmark runs, the default of 1000 time steps should suffice for most",
+@@ -2019,11 +2028,11 @@ int gmx_tune_pme(int argc,char *argv[])
+             "are by default reset after 100 steps. For large systems",
+             "(>1M atoms) you may have to set [TT]-resetstep[tt] to a higher value.",
+             "From the 'DD' load imbalance entries in the md.log output file you",
+-            "can tell after how many steps the load is sufficiently balanced.[PAR]"
+-            "Example call: [TT]g_tune_pme -np 64 -s protein.tpr -launch[tt][PAR]",
++            "can tell after how many steps the load is sufficiently balanced. Example call:[PAR]"
++            "[TT]g_tune_pme -np 64 -s protein.tpr -launch[tt][PAR]",
+             "After calling [TT]mdrun[tt] several times, detailed performance information",
+-            "is available in the output file perf.out. ",
+-            "Note that during the benchmarks a couple of temporary files are written",
++            "is available in the output file [TT]perf.out.[tt] ",
++            "[BB]Note[bb] that during the benchmarks, a couple of temporary files are written",
+             "(options [TT]-b[tt]*), these will be automatically deleted after each test.[PAR]",
+             "If you want the simulation to be started automatically with the",
+             "optimized parameters, use the command line option [TT]-launch[tt].[PAR]",
+@@ -2166,9 +2175,9 @@ int gmx_tune_pme(int argc,char *argv[])
+       { "-np",       FALSE, etINT,  {&nnodes},
+         "Number of nodes to run the tests on (must be > 2 for separate PME nodes)" },
+       { "-npstring", FALSE, etENUM, {procstring},
+-        "Specify the number of processors to $MPIRUN using this string"},
++        "Specify the number of processors to [TT]$MPIRUN[tt] using this string"},
+       { "-passall",  FALSE, etBOOL, {&bPassAll},
+-        "HIDDENPut arguments unknown to [TT]mdrun[tt] at the end of the command line. Can e.g. be used for debugging purposes. "},
++        "HIDDENPut arguments unknown to [TT]mdrun[tt] at the end of the command line. Can be used for debugging purposes. "},
+       { "-nt",       FALSE, etINT,  {&nthreads},
+         "Number of threads to run the tests on (turns MPI & mpirun off)"},
+       { "-r",        FALSE, etINT,  {&repeats},
+@@ -2186,15 +2195,15 @@ int gmx_tune_pme(int argc,char *argv[])
+       { "-downfac",  FALSE, etREAL, {&downfac},
+         "Lower limit for rcoulomb scaling factor" },
+       { "-ntpr",     FALSE, etINT,  {&ntprs},
+-        "Number of [TT].tpr[tt] files to benchmark. Create these many files with scaling factors ranging from 1.0 to fac. If < 1, automatically choose the number of [TT].tpr[tt] files to test" },
++        "Number of [TT].tpr[tt] files to benchmark. Create this many files with scaling factors ranging from 1.0 to fac. If < 1, automatically choose the number of [TT].tpr[tt] files to test" },
+       { "-four",     FALSE, etREAL, {&fs},
+         "Use this fourierspacing value instead of the grid found in the [TT].tpr[tt] input file. (Spacing applies to a scaling factor of 1.0 if multiple [TT].tpr[tt] files are written)" },
+       { "-steps",    FALSE, etGMX_LARGE_INT, {&bench_nsteps},
+-        "Take timings for these many steps in the benchmark runs" }, 
++        "Take timings for this many steps in the benchmark runs" }, 
+       { "-resetstep",FALSE, etINT,  {&presteps},
+-        "Let dlb equilibrate these many steps before timings are taken (reset cycle counters after these many steps)" },
++        "Let dlb equilibrate this many steps before timings are taken (reset cycle counters after this many steps)" },
+       { "-simsteps", FALSE, etGMX_LARGE_INT, {&new_sim_nsteps},
+-        "If non-negative, perform these many steps in the real run (overwrite nsteps from [TT].tpr[tt], add [TT].cpt[tt] steps)" }, 
++        "If non-negative, perform this many steps in the real run (overwrites nsteps from [TT].tpr[tt], add [TT].cpt[tt] steps)" }, 
+       { "-launch",   FALSE, etBOOL, {&bLaunch},
+         "Lauch the real simulation after optimization" },
+       /******************/
+@@ -2251,7 +2260,7 @@ int gmx_tune_pme(int argc,char *argv[])
+       { "-rerunvsite", FALSE, etBOOL, {&bRerunVSite},
+         "HIDDENRecalculate virtual site coordinates with [TT]-rerun[tt]" },
+       { "-ionize",    FALSE, etBOOL, {&bIonize},
+-        "Do a simulation including the effect of an X-Ray bombardment on your system" },
++        "Do a simulation including the effect of an X-ray bombardment on your system" },
+       { "-confout",   FALSE, etBOOL, {&bConfout},
+         "HIDDENWrite the last configuration with [TT]-c[tt] and force checkpointing at the last step" },
+       { "-stepout",   FALSE, etINT,  {&nstepout},
+diff --git a/src/tools/gmx_wham.c b/src/tools/gmx_wham.c
+index a9b9ba0..0538bdc 100644
+--- a/src/tools/gmx_wham.c
++++ b/src/tools/gmx_wham.c
+@@ -2549,13 +2549,13 @@ int gmx_wham(int argc,char *argv[])
+         "which may be useful for, e.g. membranes.[PAR]",
+         "AUTOCORRELATIONS[BR]----------------[BR]",
+         "With [TT]-ac[tt], [TT]g_wham[tt] estimates the integrated autocorrelation ",
+-        "time (IACT) tau for each umbrella window and weights the respective ",
+-        "window with 1/[1+2*tau/dt]. The IACTs are written ",
++        "time (IACT) [GRK]tau[grk] for each umbrella window and weights the respective ",
++        "window with 1/[1+2*[GRK]tau[grk]/dt]. The IACTs are written ",
+         "to the file defined with [TT]-oiact[tt]. In verbose mode, all ",
+         "autocorrelation functions (ACFs) are written to [TT]hist_autocorr.xvg[tt]. ",
+         "Because the IACTs can be severely underestimated in case of limited ",
+         "sampling, option [TT]-acsig[tt] allows to smooth the IACTs along the ",
+-        "reaction coordinate with a Gaussian (sigma provided with [TT]-acsig[tt], ",
++        "reaction coordinate with a Gaussian ([GRK]sigma[grk] provided with [TT]-acsig[tt], ",
+         "see output in [TT]iact.xvg[tt]). Note that the IACTs are estimated by simple ",
+         "integration of the ACFs while the ACFs are larger 0.05.",
+         "If you prefer to compute the IACTs by a more sophisticated (but possibly ",
+@@ -2616,7 +2616,7 @@ int gmx_wham(int argc,char *argv[])
+         { "-max", FALSE, etREAL, {&opt.max},
+           "Maximum coordinate in profile"},
+         { "-auto", FALSE, etBOOL, {&opt.bAuto},
+-          "determine min and max automatically"},
++          "Determine min and max automatically"},
+         { "-bins",FALSE, etINT, {&opt.bins},
+           "Number of bins in profile"},
+         { "-temp", FALSE, etREAL, {&opt.Temperature},
+@@ -2624,11 +2624,11 @@ int gmx_wham(int argc,char *argv[])
+         { "-tol", FALSE, etREAL, {&opt.Tolerance},
+           "Tolerance"},
+         { "-v", FALSE, etBOOL, {&opt.verbose},
+-          "verbose mode"},
++          "Verbose mode"},
+         { "-b", FALSE, etREAL, {&opt.tmin}, 
+-          "first time to analyse (ps)"},
++          "First time to analyse (ps)"},
+         { "-e", FALSE, etREAL, {&opt.tmax}, 
+-          "last time to analyse (ps)"},
++          "Last time to analyse (ps)"},
+         { "-dt", FALSE, etREAL, {&opt.dt},
+           "Analyse only every dt ps"},
+         { "-histonly", FALSE, etBOOL, {&opt.bHistOnly},
+@@ -2638,19 +2638,19 @@ int gmx_wham(int argc,char *argv[])
+         { "-log", FALSE, etBOOL, {&opt.bLog},
+           "Calculate the log of the profile before printing"},
+         { "-unit", FALSE,  etENUM, {en_unit},
+-          "energy unit in case of log output" },
++          "Energy unit in case of log output" },
+         { "-zprof0", FALSE, etREAL, {&opt.zProf0},
+           "Define profile to 0.0 at this position (with [TT]-log[tt])"},
+         { "-cycl", FALSE, etBOOL, {&opt.bCycl},
+           "Create cyclic/periodic profile. Assumes min and max are the same point."},
+         { "-sym", FALSE, etBOOL, {&opt.bSym},
+-          "symmetrize profile around z=0"},   
++          "Symmetrize profile around z=0"},   
+         { "-hist-eq", FALSE, etBOOL, {&opt.bHistEq},
+           "HIDDENEnforce equal weight for all histograms. (Non-Weighed-HAM)"},
+         { "-ac", FALSE, etBOOL, {&opt.bCalcTauInt},
+-          "calculate integrated autocorrelation times and use in wham"},
++          "Calculate integrated autocorrelation times and use in wham"},
+         { "-acsig", FALSE, etREAL, {&opt.sigSmoothIact},
+-          "Smooth autocorrelation times along reaction coordinate with Gaussian of this sigma"},
++          "Smooth autocorrelation times along reaction coordinate with Gaussian of this [GRK]sigma[grk]"},
+         { "-ac-trestart", FALSE, etREAL, {&opt.acTrestart},
+           "When computing autocorrelation functions, restart computing every .. (ps)"},
+         { "-acred", FALSE, etBOOL, {&opt.bAllowReduceIact},
+@@ -2659,15 +2659,15 @@ int gmx_wham(int argc,char *argv[])
+         { "-nBootstrap", FALSE,  etINT, {&opt.nBootStrap},
+           "nr of bootstraps to estimate statistical uncertainty (e.g., 200)" },
+         { "-bs-method", FALSE,  etENUM, {en_bsMethod},
+-          "bootstrap method" },
++          "Bootstrap method" },
+         { "-bs-tau", FALSE, etREAL, {&opt.tauBootStrap},
+           "Autocorrelation time (ACT) assumed for all histograms. Use option [TT]-ac[tt] if ACT is unknown."},
+         { "-bs-seed", FALSE, etINT, {&opt.bsSeed},
+-          "seed for bootstrapping. (-1 = use time)"},
++          "Seed for bootstrapping. (-1 = use time)"},
+         { "-histbs-block", FALSE, etINT, {&opt.histBootStrapBlockLength},
+-          "when mixing histograms only mix within blocks of [TT]-histbs-block[tt]."},
++          "When mixing histograms only mix within blocks of [TT]-histbs-block[tt]."},
+         { "-vbs", FALSE, etBOOL, {&opt.bs_verbose},
+-          "verbose bootstrapping. Print the CDFs and a histogram file for each bootstrap."},
++          "Verbose bootstrapping. Print the CDFs and a histogram file for each bootstrap."},
+         { "-stepout", FALSE, etINT, {&opt.stepchange},
+           "HIDDENWrite maximum change every ... (set to 1 with [TT]-v[tt])"},
+         { "-updateContr", FALSE, etINT, {&opt.stepUpdateContrib},
+diff --git a/src/tools/gmx_wheel.c b/src/tools/gmx_wheel.c
+index 580ec52..2a3dbd1 100644
+--- a/src/tools/gmx_wheel.c
++++ b/src/tools/gmx_wheel.c
+@@ -205,7 +205,7 @@ int gmx_wheel(int argc,char *argv[])
+   const char *desc[] = {
+     "[TT]g_wheel[tt] plots a helical wheel representation of your sequence.",
+     "The input sequence is in the [TT].dat[tt] file where the first line contains",
+-    "the number of residues and each consecutive line contains a residue"
++    "the number of residues and each consecutive line contains a residue "
+     "name."
+   };
+   output_env_t oenv;
+diff --git a/src/tools/gmx_xpm2ps.c b/src/tools/gmx_xpm2ps.c
+index 89d803f..fb057f4 100644
+--- a/src/tools/gmx_xpm2ps.c
++++ b/src/tools/gmx_xpm2ps.c
+@@ -1095,17 +1095,17 @@ int gmx_xpm2ps(int argc,char *argv[])
+     "in the correct matrix format.",
+     "Matrix data may be generated by programs such as [TT]do_dssp[tt], [TT]g_rms[tt] or",
+     "[TT]g_mdmat[tt].[PAR]",
+-    "Parameters are set in the [TT]m2p[tt] file optionally supplied with",
+-    "[TT]-di[tt]. Reasonable defaults are provided. Settings for the y-axis",
+-    "default to those for the x-axis. Font names have a defaulting hierarchy:",
++    "Parameters are set in the [TT].m2p[tt] file optionally supplied with",
++    "[TT]-di[tt]. Reasonable defaults are provided. Settings for the [IT]y[it]-axis",
++    "default to those for the [IT]x[it]-axis. Font names have a defaulting hierarchy:",
+     "titlefont -> legendfont; titlefont -> (xfont -> yfont -> ytickfont)",
+     "-> xtickfont, e.g. setting titlefont sets all fonts, setting xfont",
+     "sets yfont, ytickfont and xtickfont.[PAR]",
+-    "When no [TT]m2p[tt] file is supplied, many settings are taken from",
++    "When no [TT].m2p[tt] file is supplied, many settings are taken from",
+     "command line options. The most important option is [TT]-size[tt],",
+     "which sets the size of the whole matrix in postscript units.",
+     "This option can be overridden with the [TT]-bx[tt] and [TT]-by[tt]",
+-    "options (and the corresponding parameters in the [TT]m2p[tt] file),",
++    "options (and the corresponding parameters in the [TT].m2p[tt] file),",
+     "which set the size of a single matrix element.[PAR]",
+     "With [TT]-f2[tt] a second matrix file can be supplied. Both matrix",
+     "files will be read simultaneously and the upper left half of the",
+@@ -1125,7 +1125,7 @@ int gmx_xpm2ps(int argc,char *argv[])
+     "with [TT]-cmin[tt] and [TT]-cmax[tt].[PAR]",
+     "[TT]-title[tt] can be set to [TT]none[tt] to suppress the title, or to",
+     "[TT]ylabel[tt] to show the title in the Y-label position (alongside",
+-    "the Y-axis).[PAR]",
++    "the [IT]y[it]-axis).[PAR]",
+     "With the [TT]-rainbow[tt] option, dull grayscale matrices can be turned",
+     "into attractive color pictures.[PAR]",
+     "Merged or rainbowed matrices can be written to an XPixelMap file with",
+diff --git a/src/tools/interf.h b/src/tools/interf.h
+new file mode 100644
+index 0000000..841dc2b
+--- /dev/null
++++ b/src/tools/interf.h
+@@ -0,0 +1,52 @@
++/*
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.2.0
++ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
++ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
++ * Copyright (c) 2001-2004, The GROMACS development team,
++ * check out http://www.gromacs.org for more information.
++
++ * 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:
++ * Green Red Orange Magenta Azure Cyan Skyblue
++ */
++
++#ifndef _interf_h
++#define _interf_h
++
++#include "typedefs.h"
++
++typedef struct {
++  real Z; /* Interface height-coordinate */
++  real t; /* Interface thickness */
++} t_interf;
++
++static void init_interf(t_interf *surf)
++{
++  surf->Z = 0;
++  surf->t = 0;
++}
++
++#endif
+diff --git a/src/tools/levenmar.c b/src/tools/levenmar.c
+index 8bdb129..b967a40 100644
+--- a/src/tools/levenmar.c
++++ b/src/tools/levenmar.c
+@@ -1,4 +1,5 @@
+ /*
++ * $Id: levenmar.c,v 1.20 2004/01/23 18:11:02 lindahl Exp $
+  * 
+  *                This source code is part of
+  * 
+diff --git a/src/tools/make_edi.c b/src/tools/make_edi.c
+index 617f375..409fb47 100644
+--- a/src/tools/make_edi.c
++++ b/src/tools/make_edi.c
+@@ -5,7 +5,7 @@
+  *                 G   R   O   M   A   C   S
+  *
+  *          GROningen MAchine for Chemical Simulations
+- * 
++ *
+  *                        VERSION 3.2.0
+  *
+  * The make_edi program was generously contributed by Oliver Lange, based
+@@ -15,7 +15,7 @@
+  * 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
+@@ -62,18 +62,25 @@
+ #include "rmpbc.h"
+ #include "txtdump.h"
+ #include "eigio.h"
+-#include "index.h" 
++#include "index.h"
+ 
++/* Suppress Cygwin compiler warnings from using newlib version of
++ * ctype.h */
++#ifdef GMX_CYGWIN
++#undef isdigit
++#endif
+ 
+ typedef struct
+-{ 
++{
+     real        deltaF0;
+     gmx_bool    bHarmonic;
++    gmx_bool    bConstForce;   /* Do constant force flooding instead of
++                                  evaluating a flooding potential             */
+     real        tau;
+     real        deltaF;
+-    real        kT; 
++    real        kT;
+     real        constEfl;
+-    real        alpha2; 
++    real        alpha2;
+ } t_edflood;
+ 
+ 
+@@ -93,7 +100,7 @@ typedef struct edipar
+     int         nini;           /* total Nr of atoms                    */
+     gmx_bool    fitmas;         /* true if trans fit with cm            */
+     gmx_bool    pcamas;         /* true if mass-weighted PCA            */
+-    int         presteps;       /* number of steps to run without any   
++    int         presteps;       /* number of steps to run without any
+                                  *    perturbations ... just monitoring */
+     int         outfrq;         /* freq (in steps) of writing to edo    */
+     int         maxedsteps;     /* max nr of steps per cycle            */
+@@ -141,26 +148,26 @@ int sscan_list(int *list[], const char *str, const char *listname) {
+ 
+    /*enums to define the different lexical stati */
+    enum { sBefore, sNumber, sMinus, sRange, sZero, sSmaller, sError, sSteppedRange };
+-  
++
+    int status=sBefore; /*status of the deterministic automat to scan str   */
+    int number=0;
+    int end_number=0;
+-    
++
+    char *start=NULL; /*holds the string of the number behind a ','*/
+    char *end=NULL; /*holds the string of the number behind a '-' */
+-  
++
+    int nvecs=0; /* counts the number of vectors in the list*/
+ 
+    step=NULL;
+    snew(pos,n+4);
+    startpos=pos;
+    strcpy(pos,str);
+-   pos[n]=',';  
++   pos[n]=',';
+    pos[n+1]='1';
+    pos[n+2]='\0';
+ 
+    *list = NULL;
+-     
++
+    while ((c=*pos)!=0) {
+      switch(status) {
+         /* expect a number */
+@@ -184,22 +191,22 @@ int sscan_list(int *list[], const char *str, const char *listname) {
+              else status=sError; break;
+ 
+         /* have read a '-' -> expect a number */
+-     case sMinus: 
++     case sMinus:
+        if (isdigit(c)) {
+ 	 end=pos;
+ 	 status=sRange; break;
+        } else status=sError; break;
+-       
++
+      case sSteppedRange:
+        if (isdigit(c)) {
+ 	 if (step) {
+-	   status=sError; break; 
++	   status=sError; break;
+ 	 } else
+ 	   step=pos;
+ 	 status=sRange;
+ 	 break;
+        } else status=sError; break;
+-       
++
+         /* have read the number after a minus, expect ',' or ':' */
+         case sRange:
+             if (c==',') {
+@@ -228,7 +235,7 @@ int sscan_list(int *list[], const char *str, const char *listname) {
+ 
+        /* format error occured */
+        case sError:
+-       gmx_fatal(FARGS,"Error in the list of eigenvectors for %s at pos %d with char %c",listname,pos-startpos,*(pos-1)); 
++       gmx_fatal(FARGS,"Error in the list of eigenvectors for %s at pos %d with char %c",listname,pos-startpos,*(pos-1));
+ 
+        /* logical error occured */
+        case sZero:
+@@ -246,7 +253,7 @@ int sscan_list(int *list[], const char *str, const char *listname) {
+    sfree(startpos);
+    return nvecs;
+ } /*sscan_list*/
+-  
++
+ void write_eigvec(FILE* fp, int natoms, int eig_list[], rvec** eigvecs,int nvec, const char *grouptitle,real steps[]) {
+ /* eig_list is a zero-terminated list of indices into the eigvecs array.
+    eigvecs are coordinates of eigenvectors
+@@ -257,18 +264,18 @@ void write_eigvec(FILE* fp, int natoms, int eig_list[], rvec** eigvecs,int nvec,
+   int n=0,i; rvec x;
+   real sum;
+   while (eig_list[n++]);  /*count selected eigenvecs*/
+-  
++
+   fprintf(fp,"# NUMBER OF EIGENVECTORS + %s\n %d\n",grouptitle,n-1);
+-  
++
+   /* write list of eigenvector indicess */
+   for(n=0;eig_list[n];n++) {
+     if (steps)
+-      fprintf(fp,"%8d   %g\n",eig_list[n],steps[n]); 
+-    else 
++      fprintf(fp,"%8d   %g\n",eig_list[n],steps[n]);
++    else
+       fprintf(fp,"%8d   %g\n",eig_list[n],1.0);
+   }
+   n=0;
+-    
++
+   /* dump coordinates of the selected eigenvectors */
+   while (eig_list[n]) {
+     sum=0;
+@@ -277,21 +284,21 @@ void write_eigvec(FILE* fp, int natoms, int eig_list[], rvec** eigvecs,int nvec,
+ 	gmx_fatal(FARGS,"Selected eigenvector %d is higher than maximum number %d of available eigenvectors",eig_list[n],nvec);
+       copy_rvec(eigvecs[eig_list[n]-1][i],x);
+       sum+=norm2(x);
+-      fprintf(fp,"%8.5f %8.5f %8.5f\n",x[XX],x[YY],x[ZZ]);      
+-    }    
++      fprintf(fp,"%8.5f %8.5f %8.5f\n",x[XX],x[YY],x[ZZ]);
++    }
+     n++;
+   }
+ }
+ 
+ 
+ /*enum referring to the different lists of eigenvectors*/
+-enum { evLINFIX, evLINACC, evFLOOD, evRADFIX, evRADACC, evRADCON , evMON,  evEND };
++enum { evLINFIX, evLINACC, evFLOOD, evRADFIX, evRADACC, evRADCON , evMON,  evNr };
+ #define oldMAGIC 666
+-#define MAGIC 669
++#define MAGIC 670
+ 
+ 
+-void write_the_whole_thing(FILE* fp, t_edipar *edpars, rvec** eigvecs, 
+-                           int nvec, int *eig_listen[], real* evStepList[]) 
++void write_the_whole_thing(FILE* fp, t_edipar *edpars, rvec** eigvecs,
++                           int nvec, int *eig_listen[], real* evStepList[])
+ {
+ /* write edi-file */
+ 
+@@ -300,15 +307,16 @@ void write_the_whole_thing(FILE* fp, t_edipar *edpars, rvec** eigvecs,
+         MAGIC,edpars->nini,edpars->fitmas,edpars->pcamas);
+     fprintf(fp,"#OUTFRQ\n %d\n#MAXLEN\n %d\n#SLOPECRIT\n %f\n",
+         edpars->outfrq,edpars->maxedsteps,edpars->slope);
+-    fprintf(fp,"#PRESTEPS\n %d\n#DELTA_F0\n %f\n#INIT_DELTA_F\n %f\n#TAU\n %f\n#EFL_NULL\n %f\n#ALPHA2\n %f\n#KT\n %f\n#HARMONIC\n %d\n",
+-        edpars->presteps,edpars->flood.deltaF0,edpars->flood.deltaF,edpars->flood.tau,edpars->flood.constEfl,edpars->flood.alpha2,edpars->flood.kT,edpars->flood.bHarmonic);
+-    
++    fprintf(fp,"#PRESTEPS\n %d\n#DELTA_F0\n %f\n#INIT_DELTA_F\n %f\n#TAU\n %f\n#EFL_NULL\n %f\n#ALPHA2\n %f\n#KT\n %f\n#HARMONIC\n %d\n#CONST_FORCE_FLOODING\n %d\n",
++        edpars->presteps,edpars->flood.deltaF0,edpars->flood.deltaF,edpars->flood.tau,edpars->flood.constEfl,
++        edpars->flood.alpha2,edpars->flood.kT,edpars->flood.bHarmonic,edpars->flood.bConstForce);
++
+     /* Average and reference positions */
+     write_t_edx(fp,edpars->sref,"NREF, XREF");
+     write_t_edx(fp,edpars->sav,"NAV, XAV");
+ 
+     /*Eigenvectors */
+- 
++
+     write_eigvec(fp, edpars->ned, eig_listen[evMON],eigvecs,nvec,"COMPONENTS GROUP 1",NULL);
+     write_eigvec(fp, edpars->ned, eig_listen[evLINFIX],eigvecs,nvec,"COMPONENTS GROUP 2",evStepList[evLINFIX]);
+     write_eigvec(fp, edpars->ned, eig_listen[evLINACC],eigvecs,nvec,"COMPONENTS GROUP 3",evStepList[evLINACC]);
+@@ -321,9 +329,9 @@ void write_the_whole_thing(FILE* fp, t_edipar *edpars, rvec** eigvecs,
+     /*Target and Origin positions */
+     write_t_edx(fp,edpars->star,"NTARGET, XTARGET");
+     write_t_edx(fp,edpars->sori,"NORIGIN, XORIGIN");
+-} 
++}
+ 
+-int read_conffile(const char *confin,char *title,rvec *x[]) 
++int read_conffile(const char *confin,char *title,rvec *x[])
+ {
+ /* read coordinates out of STX file  */
+   int natoms;
+@@ -342,23 +350,23 @@ int read_conffile(const char *confin,char *title,rvec *x[])
+     snew(*x,natoms);
+     read_stx_conf(confin,title,&confat,*x,NULL,NULL,box);
+     return natoms;
+-}  
++}
+ 
+ 
+-void read_eigenvalues(int vecs[],const char *eigfile, real values[], 
+-                      gmx_bool bHesse, real kT) 
++void read_eigenvalues(int vecs[],const char *eigfile, real values[],
++                      gmx_bool bHesse, real kT)
+ {
+   int  neig,nrow,i;
+   double **eigval;
+-  
++
+   neig = read_xvg(eigfile,&eigval,&nrow);
+-  
++
+   fprintf(stderr,"Read %d eigenvalues\n",neig);
+-  for(i=bHesse ? 6 : 0 ; i<neig; i++) { 
++  for(i=bHesse ? 6 : 0 ; i<neig; i++) {
+     if (eigval[1][i] < -0.001 && bHesse)
+       fprintf(stderr,
+ 	      "WARNING: The Hessian Matrix has negative eigenvalue %f, we set it to zero (no flooding in this direction)\n\n",eigval[1][i]);
+-      
++
+     if (eigval[1][i] < 0)
+       eigval[1][i] = 0;
+   }
+@@ -400,9 +408,9 @@ static real *scan_vecparams(const char *str,const char * par, int nvecs)
+       tcap += d;
+       strcat(f0,"%*s");
+     }
+-  }  
++  }
+   return vec_params;
+-}    
++}
+ 
+ 
+ void init_edx(struct edix *edx) {
+@@ -411,12 +419,12 @@ void init_edx(struct edix *edx) {
+   snew(edx->anrs,1);
+ }
+ 
+-void filter2edx(struct edix *edx,int nindex, atom_id index[],int ngro, 
+-                atom_id igro[],rvec *x,const char* structure) 
++void filter2edx(struct edix *edx,int nindex, atom_id index[],int ngro,
++                atom_id igro[],rvec *x,const char* structure)
+ {
+ /* filter2edx copies coordinates from x to edx which are given in index
+ */
+-  
++
+    int pos,i;
+    int ix=edx->nr;
+    edx->nr+=nindex;
+@@ -433,7 +441,7 @@ void filter2edx(struct edix *edx,int nindex, atom_id index[],int ngro,
+ 
+ void get_structure(t_atoms *atoms,const char *IndexFile,
+                    const char *StructureFile,struct edix *edx,int nfit,
+-                   atom_id ifit[],int natoms, atom_id index[]) 
++                   atom_id ifit[],int natoms, atom_id index[])
+ {
+   atom_id *igro;  /*index corresponding to target or origin structure*/
+   int ngro;
+@@ -441,7 +449,7 @@ void get_structure(t_atoms *atoms,const char *IndexFile,
+   rvec *xtar;
+   char  title[STRLEN];
+   char* grpname;
+-  
++
+ 
+   ntar=read_conffile(StructureFile,title,&xtar);
+   printf("Select an index group of %d elements that corresponds to the atoms in the structure file %s\n",
+@@ -460,7 +468,7 @@ int main(int argc,char *argv[])
+ 
+   static const char *desc[] = {
+       "[TT]make_edi[tt] generates an essential dynamics (ED) sampling input file to be used with [TT]mdrun[tt]",
+-      "based on eigenvectors of a covariance matrix ([TT]g_covar[tt]) or from a", 
++      "based on eigenvectors of a covariance matrix ([TT]g_covar[tt]) or from a",
+       "normal modes anaysis ([TT]g_nmeig[tt]).",
+       "ED sampling can be used to manipulate the position along collective coordinates",
+       "(eigenvectors) of (biological) macromolecules during a simulation. Particularly,",
+@@ -481,10 +489,10 @@ int main(int argc,char *argv[])
+       "J. Biomol. Struct. Dyn. 13 : 741-751 (1996)[BR]",
+       "B.L. de Groot, A.Amadei, R.M. Scheek, N.A.J. van Nuland and H.J.C. Berendsen; ",
+       "An extended sampling of the configurational space of HPr from E. coli",
+-      "PROTEINS: Struct. Funct. Gen. 26: 314-322 (1996)",
++      "Proteins: Struct. Funct. Gen. 26: 314-322 (1996)",
+       "[PAR]You will be prompted for one or more index groups that correspond to the eigenvectors,",
+       "reference structure, target positions, etc.[PAR]",
+-      
++
+       "[TT]-mon[tt]: monitor projections of the coordinates onto selected eigenvectors.[PAR]",
+       "[TT]-linfix[tt]: perform fixed-step linear expansion along selected eigenvectors.[PAR]",
+       "[TT]-linacc[tt]: perform acceptance linear expansion along selected eigenvectors.",
+@@ -492,13 +500,13 @@ int main(int argc,char *argv[])
+       "[TT]-radfix[tt]: perform fixed-step radius expansion along selected eigenvectors.[PAR]",
+       "[TT]-radacc[tt]: perform acceptance radius expansion along selected eigenvectors.",
+       "(steps in the desired direction will be accepted, others will be rejected).",
+-      "Note: by default the starting MD structure will be taken as origin of the first",
++      "[BB]Note:[bb] by default the starting MD structure will be taken as origin of the first",
+       "expansion cycle for radius expansion. If [TT]-ori[tt] is specified, you will be able",
+       "to read in a structure file that defines an external origin.[PAR]",
+       "[TT]-radcon[tt]: perform acceptance radius contraction along selected eigenvectors",
+       "towards a target structure specified with [TT]-tar[tt].[PAR]",
+       "NOTE: each eigenvector can be selected only once. [PAR]",
+-      "[TT]-outfrq[tt]: frequency (in steps) of writing out projections etc. to .edo file[PAR]",
++      "[TT]-outfrq[tt]: frequency (in steps) of writing out projections etc. to [TT].edo[tt] file[PAR]",
+       "[TT]-slope[tt]: minimal slope in acceptance radius expansion. A new expansion",
+       "cycle will be started if the spontaneous increase of the radius (in nm/step)",
+       "is less than the value specified.[PAR]",
+@@ -507,53 +515,54 @@ int main(int argc,char *argv[])
+       "Note on the parallel implementation: since ED sampling is a 'global' thing",
+       "(collective coordinates etc.), at least on the 'protein' side, ED sampling",
+       "is not very parallel-friendly from an implentation point of view. Because",
+-      "parallel ED requires much extra communication, expect the performance to be",
++      "parallel ED requires some extra communication, expect the performance to be",
+       "lower as in a free MD simulation, especially on a large number of nodes. [PAR]",
+       "All output of [TT]mdrun[tt] (specify with [TT]-eo[tt]) is written to a .edo file. In the output",
+       "file, per OUTFRQ step the following information is present: [PAR]",
+-      "* the step number[BR]",
+-      "* the number of the ED dataset. (Note that you can impose multiple ED constraints in",
+-      "a single simulation - on different molecules e.g. - if several .edi files were concatenated",
+-      "first. The constraints are applied in the order they appear in the .edi file.) [BR]",
+-      "* RMSD (for atoms involved in fitting prior to calculating the ED constraints)[BR]",
++      "[TT]*[tt] the step number[BR]",
++      "[TT]*[tt] the number of the ED dataset. ([BB]Note[bb] that you can impose multiple ED constraints in",
++      "a single simulation (on different molecules) if several [TT].edi[tt] files were concatenated",
++      "first. The constraints are applied in the order they appear in the [TT].edi[tt] file.) [BR]",
++      "[TT]*[tt] RMSD (for atoms involved in fitting prior to calculating the ED constraints)[BR]",
+       "* projections of the positions onto selected eigenvectors[BR]",
+       "[PAR][PAR]",
+       "FLOODING:[PAR]",
+-      "with -flood you can specify which eigenvectors are used to compute a flooding potential,",
++      "with [TT]-flood[tt], you can specify which eigenvectors are used to compute a flooding potential,",
+       "which will lead to extra forces expelling the structure out of the region described",
+       "by the covariance matrix. If you switch -restrain the potential is inverted and the structure",
+       "is kept in that region.",
+       "[PAR]",
+-      "The origin is normally the average structure stored in the eigvec.trr file.",
+-      "It can be changed with -ori to an arbitrary position in configurational space.",
+-      "With -tau, -deltaF0 and -Eflnull you control the flooding behaviour.",
++      "The origin is normally the average structure stored in the [TT]eigvec.trr[tt] file.",
++      "It can be changed with [TT]-ori[tt] to an arbitrary position in configurational space.",
++      "With [TT]-tau[tt], [TT]-deltaF0[tt], and [TT]-Eflnull[tt] you control the flooding behaviour.",
+       "Efl is the flooding strength, it is updated according to the rule of adaptive flooding.",
+-      "Tau is the time constant of adaptive flooding, high tau means slow adaption (i.e. growth). ",
++      "Tau is the time constant of adaptive flooding, high [GRK]tau[grk] means slow adaption (i.e. growth). ",
+       "DeltaF0 is the flooding strength you want to reach after tau ps of simulation.",
+-      "To use constant Efl set -tau to zero.",
++      "To use constant Efl set [TT]-tau[tt] to zero.",
+       "[PAR]",
+-      "-alpha is a fudge parameter to control the width of the flooding potential. A value of 2 has been found",
++      "[TT]-alpha[tt] is a fudge parameter to control the width of the flooding potential. A value of 2 has been found",
+       "to give good results for most standard cases in flooding of proteins.",
+-      "Alpha basically accounts for incomplete sampling, if you sampled further the width of the ensemble would",
+-      "increase, this is mimicked by alpha>1.",
+-      "For restraining alpha<1 can give you smaller width in the restraining potential.",
++      "[GRK]alpha[grk] basically accounts for incomplete sampling, if you sampled further the width of the ensemble would",
++      "increase, this is mimicked by [GRK]alpha[grk] > 1.",
++      "For restraining, [GRK]alpha[grk] < 1 can give you smaller width in the restraining potential.",
+       "[PAR]",
+       "RESTART and FLOODING:",
+       "If you want to restart a crashed flooding simulation please find the values deltaF and Efl in",
+-      "the output file and manually put them into the .edi file under DELTA_F0 and EFL_NULL."
++      "the output file and manually put them into the [TT].edi[tt] file under DELTA_F0 and EFL_NULL."
+   };
+-    
++
+     /* Save all the params in this struct and then save it in an edi file.
+     * ignoring fields nmass,massnrs,mass,tmass,nfit,fitnrs,edo
+     */
+-    static t_edipar edi_params;     
+-    
+-    enum  { evSTEPEND = evRADFIX + 1}; 
+-    static const char* evSelections[evEND]= {NULL,NULL,NULL,NULL,NULL,NULL};
+-    static const char* evOptions[evEND] = {"-linfix","-linacc","-flood","-radfix","-radacc","-radcon","-mon"};
+-    static const char* evParams[evSTEPEND] ={NULL,NULL};
+-    static const char* evStepOptions[evSTEPEND] = {"-linstep","-accdir","-not_used","-radstep"};
+-    static real* evStepList[evSTEPEND];
++    static t_edipar edi_params;
++
++    enum  { evStepNr = evRADFIX + 1};
++    static const char* evSelections[evNr]= {NULL,NULL,NULL,NULL,NULL,NULL};
++    static const char* evOptions[evNr] = {"-linfix","-linacc","-flood","-radfix","-radacc","-radcon","-mon"};
++    static const char* evParams[evStepNr] ={NULL,NULL};
++    static const char* evStepOptions[evStepNr] = {"-linstep","-accdir","-not_used","-radstep"};
++    static const char* ConstForceStr;
++    static real* evStepList[evStepNr];
+     static real  radfix=0.0;
+     static real deltaF0=150;
+     static real deltaF=0;
+@@ -561,7 +570,7 @@ int main(int argc,char *argv[])
+     static real constEfl=0.0;
+     static real alpha=1;
+     static int eqSteps=0;
+-    static int* listen[evEND];
++    static int* listen[evNr];
+     static real T=300.0;
+     const real kB = 2.5 / 300.0; /* k_boltzmann in MD units */
+     static gmx_bool bRestrain = FALSE;
+@@ -574,49 +583,53 @@ int main(int argc,char *argv[])
+         "Indices of eigenvectors for fixed increment linear sampling" },
+     { "-linacc", FALSE, etSTR, {&evSelections[1]},
+         "Indices of eigenvectors for acceptance linear sampling" },
+-    { "-flood",  FALSE, etSTR, {&evSelections[2]},
+-        "Indices of eigenvectors for flooding"},
+     { "-radfix", FALSE, etSTR, {&evSelections[3]},
+         "Indices of eigenvectors for fixed increment radius expansion" },
+     { "-radacc", FALSE, etSTR, {&evSelections[4]},
+         "Indices of eigenvectors for acceptance radius expansion" },
+     { "-radcon", FALSE, etSTR, {&evSelections[5]},
+         "Indices of eigenvectors for acceptance radius contraction" },
++    { "-flood",  FALSE, etSTR, {&evSelections[2]},
++        "Indices of eigenvectors for flooding"},
+     { "-outfrq", FALSE, etINT, {&edi_params.outfrq},
+         "Freqency (in steps) of writing output in [TT].edo[tt] file" },
+     { "-slope", FALSE, etREAL, { &edi_params.slope},
+         "Minimal slope in acceptance radius expansion"},
++    { "-linstep", FALSE, etSTR, {&evParams[0]},
++        "Stepsizes (nm/step) for fixed increment linear sampling (put in quotes! \"1.0 2.3 5.1 -3.1\")"},
++    { "-accdir", FALSE, etSTR, {&evParams[1]},
++        "Directions for acceptance linear sampling - only sign counts! (put in quotes! \"-1 +1 -1.1\")"},
++    { "-radstep", FALSE, etREAL, {&radfix},
++        "Stepsize (nm/step) for fixed increment radius expansion"},
+     { "-maxedsteps", FALSE, etINT, {&edi_params.maxedsteps},
+-        "Max nr of steps per cycle" },
++        "Maximum number of steps per cycle" },
++    { "-eqsteps", FALSE, etINT, {&eqSteps},
++        "Number of steps to run without any perturbations "},
+     { "-deltaF0", FALSE,etREAL, {&deltaF0},
+-        "Target destabilization energy  - used for flooding"},
++        "Target destabilization energy for flooding"},
+     { "-deltaF", FALSE, etREAL, {&deltaF},
+-        "Start deltaF with this parameter - default 0, i.e. nonzero values only needed for restart"},
+-    { "-tau", FALSE, etREAL, {&tau}, 
++        "Start deltaF with this parameter - default 0, nonzero values only needed for restart"},
++    { "-tau", FALSE, etREAL, {&tau},
+         "Coupling constant for adaption of flooding strength according to deltaF0, 0 = infinity i.e. constant flooding strength"},
+-    { "-eqsteps", FALSE, etINT, {&eqSteps},
+-        "Number of steps to run without any perturbations "},
+     { "-Eflnull", FALSE, etREAL, {&constEfl},
+-        "This is the starting value of the flooding strength. The flooding strength is updated according to the adaptive flooding scheme. To use a constant flooding strength use [TT]-tau[tt] 0. "},
++        "The starting value of the flooding strength. The flooding strength is updated "
++        "according to the adaptive flooding scheme. For a constant flooding strength use [TT]-tau[tt] 0. "},
+     { "-T", FALSE, etREAL, {&T},
+         "T is temperature, the value is needed if you want to do flooding "},
+     { "-alpha",FALSE,etREAL,{&alpha},
+         "Scale width of gaussian flooding potential with alpha^2 "},
+-    { "-linstep", FALSE, etSTR, {&evParams[0]},
+-      "Stepsizes (nm/step) for fixed increment linear sampling (put in quotes! \"1.0 2.3 5.1 -3.1\")"},
+-    { "-accdir", FALSE, etSTR, {&evParams[1]},
+-      "Directions for acceptance linear sampling - only sign counts! (put in quotes! \"-1 +1 -1.1\")"},
+-    { "-radstep", FALSE, etREAL, {&radfix},
+-        "Stepsize (nm/step) for fixed increment radius expansion"},
+     { "-restrain",FALSE, etBOOL, {&bRestrain},
+         "Use the flooding potential with inverted sign -> effects as quasiharmonic restraining potential"},
+     { "-hessian",FALSE, etBOOL, {&bHesse},
+         "The eigenvectors and eigenvalues are from a Hessian matrix"},
+-    { "-harmonic",FALSE, etBOOL, {&bHarmonic}, 
++    { "-harmonic",FALSE, etBOOL, {&bHarmonic},
+         "The eigenvalues are interpreted as spring constant"},
++    { "-constF", FALSE, etSTR, {&ConstForceStr},
++        "Constant force flooding: manually set the forces for the eigenvectors selected with -flood "
++        "(put in quotes! \"1.0 2.3 5.1 -3.1\"). No other flooding parameters are needed when specifying the forces directly."}
+     };
+ #define NPA asize(pa)
+-    
++
+     rvec       *xref1;
+     int        nvec1,*eignr1=NULL;
+     rvec       *xav1,**eigvec1=NULL;
+@@ -630,14 +643,14 @@ int main(int argc,char *argv[])
+     int ev_class; /* parameter _class i.e. evMON, evRADFIX etc. */
+     int nvecs;
+     real *eigval1=NULL; /* in V3.3 this is parameter of read_eigenvectors */
+-    
++
+     const char *EdiFile;
+     const char *TargetFile;
+     const char *OriginFile;
+     const char *EigvecFile;
+-   
++
+     output_env_t oenv;
+-    
++
+     /*to read topology file*/
+     t_topology top;
+     int        ePBC;
+@@ -645,10 +658,10 @@ int main(int argc,char *argv[])
+     matrix     topbox;
+     rvec       *xtop;
+     gmx_bool bTop, bFit1;
+-    
++
+     t_filenm fnm[] = {
+     { efTRN, "-f",    "eigenvec",    ffREAD  },
+-    { efXVG, "-eig",  "eigenval",    ffOPTRD }, 
++    { efXVG, "-eig",  "eigenval",    ffOPTRD },
+     { efTPS, NULL,    NULL,          ffREAD },
+     { efNDX, NULL,    NULL,  ffOPTRD },
+     { efSTX, "-tar", "target", ffOPTRD},
+@@ -660,64 +673,69 @@ int main(int argc,char *argv[])
+     CopyRight(stderr,argv[0]);
+     parse_common_args(&argc,argv, 0 ,
+                       NFILE,fnm,NPA,pa,asize(desc),desc,0,NULL,&oenv);
+-    
++
+     indexfile=ftp2fn_null(efNDX,NFILE,fnm);
+     EdiFile=ftp2fn(efEDI,NFILE,fnm);
+     TargetFile      = opt2fn_null("-tar",NFILE,fnm);
+     OriginFile      = opt2fn_null("-ori",NFILE,fnm);
+-    
+-    
+-    for (ev_class=0; ev_class<evEND; ++ev_class) {
++
++
++    for (ev_class=0; ev_class<evNr; ++ev_class) {
+         if (opt2parg_bSet(evOptions[ev_class],NPA,pa)) {
+             /*get list of eigenvectors*/
+             nvecs=sscan_list(&(listen[ev_class]),opt2parg_str(evOptions[ev_class],NPA,pa),evOptions[ev_class]);
+-            if (ev_class<evSTEPEND-2) {
++            if (ev_class<evStepNr-2) {
+                 /*if apropriate get list of stepsizes for these eigenvectors*/
+-                if (opt2parg_bSet(evStepOptions[ev_class],NPA,pa)) 
++                if (opt2parg_bSet(evStepOptions[ev_class],NPA,pa))
+                     evStepList[ev_class]=
+                         scan_vecparams(opt2parg_str(evStepOptions[ev_class],NPA,pa),evStepOptions[ev_class],nvecs);
+                 else { /*if list is not given fill with zeros */
+                     snew(evStepList[ev_class],nvecs);
+-                    for (i=0; i<nvecs; i++) 
++                    for (i=0; i<nvecs; i++)
+                         evStepList[ev_class][i]=0.0;
+                 }
+             } else if (ev_class == evRADFIX && opt2parg_bSet(evStepOptions[ev_class],NPA,pa)) {
+                 snew(evStepList[ev_class],nvecs);
+                 for (i=0; i<nvecs; i++)
+                     evStepList[ev_class][i]=radfix;
+-                
+             } else if (ev_class == evFLOOD) {
+                 snew(evStepList[ev_class],nvecs);
++
++                /* Are we doing constant force flooding? In that case, we read in
++                 * the fproj values from the command line */
++                if (opt2parg_bSet("-constF", NPA, pa))
++                {
++                    evStepList[ev_class] = scan_vecparams(opt2parg_str("-constF",NPA,pa),"-constF",nvecs);
++                }
+             } else {}; /*to avoid ambiguity   */
+         } else { /* if there are no eigenvectors for this option set list to zero */
+             listen[ev_class]=NULL;
+             snew(listen[ev_class],1);
+             listen[ev_class][0]=0;
+-        };
+-    };
+-    
++        }
++    }
++
+     /* print the interpreted list of eigenvectors - to give some feedback*/
+-    for (ev_class=0; ev_class<evEND; ++ev_class) {
++    for (ev_class=0; ev_class<evNr; ++ev_class) {
+         printf("Eigenvector list %7s consists of the indices: ",evOptions[ev_class]);
+         i=0;
+         while(listen[ev_class][i])
+             printf("%d ",listen[ev_class][i++]);
+         printf("\n");
+     }
+-    
+-    EigvecFile=NULL; 
+-    EigvecFile=opt2fn("-f",NFILE,fnm); 
+-    
+-    
++
++    EigvecFile=NULL;
++    EigvecFile=opt2fn("-f",NFILE,fnm);
++
+     /*read eigenvectors from eigvec.trr*/
+     read_eigenvectors(EigvecFile,&natoms,&bFit1,
+                       &xref1,&edi_params.fitmas,&xav1,&edi_params.pcamas,&nvec1,&eignr1,&eigvec1,&eigval1);
+-	   
++
+     bTop=read_tps_conf(ftp2fn(efTPS,NFILE,fnm),
+                        title,&top,&ePBC,&xtop,NULL,topbox,0);
+     atoms=&top.atoms;
+-    
+-    
++
++
+     printf("\nSelect an index group of %d elements that corresponds to the eigenvectors\n",natoms);
+     get_index(atoms,indexfile,1,&i,&index,&grpname); /*if indexfile != NULL parameter 'atoms' is ignored */
+     if (i!=natoms) {
+@@ -725,8 +743,8 @@ int main(int argc,char *argv[])
+                   i,natoms);
+     }
+     printf("\n");
+-    
+-    
++
++
+     if (xref1==NULL)
+     {
+         if (bFit1)
+@@ -752,39 +770,49 @@ int main(int argc,char *argv[])
+         ifit=index;
+     }
+ 
+-    /* if -flood read eigenvalues and store them in evSteplist[evFLOOD] */
+-    if (listen[evFLOOD][0]!=0)
+-        read_eigenvalues(listen[evFLOOD],opt2fn("-eig",NFILE,fnm),evStepList[evFLOOD],bHesse,kB*T);
+- 
+-  /*number of eigenvectors*/
+-  edi_params.ned=natoms;
+-  edi_params.flood.tau=tau;
+-  edi_params.flood.deltaF0=deltaF0;
+-  edi_params.flood.deltaF=deltaF;
+-  edi_params.presteps=eqSteps;
+-  edi_params.flood.kT=kB*T;
+-  edi_params.flood.bHarmonic=bHarmonic;
+-  if (bRestrain)
+-  {
+-      /* Trick: invert sign of Efl and alpha2 then this will give the same sign in the exponential and inverted sign outside */
+-      edi_params.flood.constEfl=-constEfl;
+-      edi_params.flood.alpha2=-sqr(alpha);
+-  }
+-  else
+-  {
+-      edi_params.flood.constEfl=constEfl;
+-      edi_params.flood.alpha2=sqr(alpha);
+-  }
+-  
++    if (opt2parg_bSet("-constF", NPA, pa))
++    {
++        /* Constant force flooding is special: Most of the normal flooding
++         * options are not needed. */
++        edi_params.flood.bConstForce = TRUE;
++    }
++    else
++    {
++        /* For normal flooding read eigenvalues and store them in evSteplist[evFLOOD] */
++
++        if ( listen[evFLOOD][0]!=0)
++            read_eigenvalues(listen[evFLOOD],opt2fn("-eig",NFILE,fnm),evStepList[evFLOOD],bHesse,kB*T);
++
++        edi_params.flood.tau=tau;
++        edi_params.flood.deltaF0=deltaF0;
++        edi_params.flood.deltaF=deltaF;
++        edi_params.presteps=eqSteps;
++        edi_params.flood.kT=kB*T;
++        edi_params.flood.bHarmonic=bHarmonic;
++        if (bRestrain)
++        {
++            /* Trick: invert sign of Efl and alpha2 then this will give the same sign in the exponential and inverted sign outside */
++            edi_params.flood.constEfl=-constEfl;
++            edi_params.flood.alpha2=-sqr(alpha);
++        }
++        else
++        {
++            edi_params.flood.constEfl=constEfl;
++            edi_params.flood.alpha2=sqr(alpha);
++        }
++    }
++
++    edi_params.ned=natoms;
++
+   /*number of system atoms  */
+   edi_params.nini=atoms->nr;
+ 
+- 
++
+   /*store reference and average structure in edi_params*/
+   make_t_edx(&edi_params.sref,nfit,xref1,ifit);
+   make_t_edx(&edi_params.sav,natoms,xav1,index);
+ 
+-                                                         
++
+   /* Store target positions in edi_params */
+   if (opt2bSet("-tar",NFILE,fnm))
+   {
+diff --git a/src/tools/make_ndx.c b/src/tools/make_ndx.c
+index 308eb09..1e80df2 100644
+--- a/src/tools/make_ndx.c
++++ b/src/tools/make_ndx.c
+@@ -1184,7 +1184,7 @@ int main(int argc,char *argv[])
+     "All these programs can generate default index groups. You ONLY",
+     "have to use [TT]make_ndx[tt] when you need SPECIAL index groups.",
+     "There is a default index group for the whole system, 9 default", 
+-    "index groups are generated for proteins, a default index group",
++    "index groups for proteins, and a default index group",
+     "is generated for every other residue name.[PAR]",
+     "When no index file is supplied, also [TT]make_ndx[tt] will generate the",
+     "default groups.",
+diff --git a/src/tools/powerspect.c b/src/tools/powerspect.c
+new file mode 100644
+index 0000000..3366e48
+--- /dev/null
++++ b/src/tools/powerspect.c
+@@ -0,0 +1,136 @@
++/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*-
++ * $Id: densorder.c,v 0.9
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.0
++ * 
++ * Copyright (c) 1991-2001
++ * BIOSON Research Institute, Dept. of Biophysical Chemistry
++ * 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.
++ * 
++ * Do check out http://www.gromacs.org , or mail us at gromacs at gromacs.org .
++ * 
++ * And Hey:
++ * Gyas ROwers Mature At Cryogenic Speed
++ */
++
++#ifdef HAVE_CONFIG_H
++#include <config.h>
++#endif
++#include <smalloc.h>
++#include <gmx_fft.h>
++#include <gmx_fatal.h>
++#include <futil.h>
++#include "interf.h"
++#include "powerspect.h"
++
++void addtoavgenergy(t_complex *list, real *result, int size, int tsteps){
++  int i;
++	for (i=0;i<size;i++){
++		result[i]+=cabs2(list[i])/tsteps;
++	}
++
++} 
++
++ 
++void powerspectavg(real ***intftab, int tsteps, int xbins, int ybins, char **outfiles){
++  /*Fourier plans and output;*/
++  gmx_fft_t  fftp;
++ t_complex *ftspect1; /* Spatial FFT of interface for each time frame and interface ftint[time,xycoord][0], ftintf[time,xycoord][1] for interface 1 and 2 				respectively */
++  t_complex *ftspect2;
++  real *pspectavg1; /*power -spectrum 1st interface*/
++  real *pspectavg2; /* -------------- 2nd interface*/
++  real *temp;
++  FILE *datfile1,*datfile2; /*data-files with interface data*/
++  int n; /*time index*/
++  int fy=ybins/2+1; /* number of (symmetric) fourier y elements; */
++  int rfl=xbins*fy; /*length of real - DFT == Symmetric 2D matrix*/
++  int status;
++ 
++/*Prepare data structures for FFT, with time averaging of power spectrum*/
++if ( (status=gmx_fft_init_2d_real(&fftp,xbins,ybins,GMX_FFT_FLAG_NONE) )!=0)
++  {
++        free(fftp);
++        gmx_fatal(status,__FILE__,__LINE__,"Error allocating FFT");
++    }
++
++/*Initialize arrays*/
++snew(ftspect1,rfl);
++snew(ftspect2,rfl);
++snew(temp,rfl);
++snew(pspectavg1,rfl);
++snew(pspectavg2,rfl);
++
++/*Fouriertransform directly (no normalization or anything)*/
++/*NB! Check carefully indexes here*/
++
++	for (n=0;n<tsteps;n++){
++		gmx_fft_2d_real(fftp,GMX_FFT_REAL_TO_COMPLEX,intftab[0][n],ftspect1);
++		gmx_fft_2d_real(fftp,GMX_FFT_REAL_TO_COMPLEX,intftab[1][n],ftspect2);
++		
++		/*Add to average for interface 1 here*/
++		addtoavgenergy(ftspect1,pspectavg1,rfl,tsteps);
++		/*Add to average for interface 2 here*/
++		addtoavgenergy(ftspect2,pspectavg2,rfl,tsteps);
++	}
++	/*Print out average energy-spectrum to outfiles[0] and outfiles[1];*/
++
++datfile1 = ffopen(outfiles[0],"w");
++datfile2 = ffopen(outfiles[1],"w");
++
++/*Filling dat files with spectral data*/
++fprintf(datfile1,"%s\n","kx\t ky\t\tPower(kx,ky)");
++fprintf(datfile2,"%s\n","kx\t ky\t\tPower(kx,ky)");
++        for(n=0;n<rfl;n++){
++		fprintf(datfile1,"%d\t%d\t %8.6f\n",(n / fy),(n % fy),pspectavg1[n]);
++		fprintf(datfile2,"%d\t%d\t %8.6f\n",(n /fy),(n % fy),pspectavg2[n]);
++	}  
++ffclose(datfile1); 
++ffclose(datfile2);
++
++free(ftspect1);
++free(ftspect2);
++
++}
++
++void powerspectavg_intf(t_interf ***if1, t_interf ***if2, int t, int xb, int yb, char **fnms)
++{
++	real ***surf;
++
++	int xy=xb*yb;
++	int i,n;
++	
++	snew(surf,2);
++	snew(surf[0],t);
++	snew(surf[1],t);
++	for (n=0;n<t;n++){
++		snew(surf[0][n],xy);
++		snew(surf[1][n],xy);
++		for(i=0;i<xy;i++){
++			surf[0][n][i]=if1[n][i]->Z;
++			surf[1][n][i]=if2[n][i]->Z;
++		}
++	}
++        powerspectavg(surf, t,xb,yb,fnms);
++}
++	
+diff --git a/src/tools/powerspect.h b/src/tools/powerspect.h
+new file mode 100644
+index 0000000..62d1108
+--- /dev/null
++++ b/src/tools/powerspect.h
+@@ -0,0 +1,48 @@
++/*
++ * 
++ *                This source code is part of
++ * 
++ *                 G   R   O   M   A   C   S
++ * 
++ *          GROningen MAchine for Chemical Simulations
++ * 
++ *                        VERSION 3.2.0
++ * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others.
++ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
++ * Copyright (c) 2001-2004, The GROMACS development team,
++ * check out http://www.gromacs.org for more information.
++
++ * 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:
++ * Green Red Orange Magenta Azure Cyan Skyblue
++ */
++
++#ifndef _powerspect_h
++#define _powerspect_h
++
++#include "typedefs.h"
++#include "interf.h"
++
++extern void powerspectavg(real ***interface, int t, int xbins, int ybins, 
++			  char **outfiles);
++			  
++extern void powerspectavg_intf(t_interf ***if1,t_interf ***if2,int t, 
++			       int xbins, int ybins, char **outfiles);
++
++#endif

Propchange: unstable/gromacs/debian/patches/30_git_release-4.5-patches.dpatch
------------------------------------------------------------------------------
    svn:executable = *




More information about the Debichem-commits mailing list