Merge branch release-5-0 into release-5-1
authorMark Abraham <mark.j.abraham@gmail.com>
Sat, 8 Aug 2015 13:56:03 +0000 (15:56 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Sat, 8 Aug 2015 13:57:19 +0000 (15:57 +0200)
No conflicts

Change-Id: I551220310b529542d4cc3635815101cf53b325ec

1  2 
docs/manual/topology.tex
src/gromacs/gmxlib/copyrite.cpp

diff --combined docs/manual/topology.tex
index 2f5b1020151f853263b490da15ae1ffae422774b,693ee7bb8908de77541b4978bd75b34fe00de7d0..7a0e6ed388eab55d2a404a7b798e17d0a2001d78
@@@ -409,41 -409,6 +409,41 @@@ want to include parameters for new ato
  them in {\tt atomtypes.atp} as well.
  
  
 +\section{Molecule definition\index{molecule definition}}
 +
 +\subsection{Moleculetype entries}
 +An organizational structure that usually corresponds to molecules is
 +the {\tt [ moleculetype ]} entry. This entry serves two main purposes. One is
 +to give structure to the topology file(s), usually corresponding to real
 +molecules. This makes the topology easier to read and writing it less labor
 +intensive. A second purpose is computational efficiency. The system definition
 +that is kept in memory is proportional in size of the {\tt moleculetype}
 +definitions. If a molecule is present in 100000 copies, this saves a factor
 +of 100000 in memory, which means the system usually fits in cache, which
 +can improve performance tremendously. Interactions that correspond to chemical
 +bonds, that generate exclusions, can only be defined between atoms within
 +a {\tt moleculetype}. It is allowed to have multiple molecules which are
 +not covalently bonded in one {\tt moleculetype} definition. Molecules can
 +be made infinitely long by connecting to themselves over periodic boundaries.
 +When such periodic molecules are present, an option in the {\tt mdp} file
 +needs to be set to tell {\gromacs} not to attempt to make molecules
 +that are broken over periodic boundaries whole again.
 +
 +\subsection{Intermolecular interactions\index{intermolecular interaction}}
 +In some cases, one would like atoms in different molecules to also interact
 +with other interactions than the usual non-bonded interactions. This is often
 +the case in binding studies. When the molecules are covalently bound, e.g.
 +a ligand binding covalently to a protein, they are effectively one molecule
 +and they should be defined in one {\tt [ moleculetype ]} entry. Note that
 +{\tt pdb2gmx} has an option to put two or more molecules in one
 +{\tt [ moleculetype ]} entry. When molecules are not covalently bound,
 +it is much more convenient to use separate {\tt moleculetype} definitions
 +and specify the intermolecular interactions in the
 +{\tt [ intermolecular\_interactions] } section. In this section, which is
 +placed at the end of the topology (see \tabref{topfile1}), normal bonded
 +interactions can be specified using global atom indices. The only restrictions
 +are that no interactions can be used that generates exclusions and no
 +constraints can be used.
  
  \subsection{Intramolecular pair interactions\index{intramolecular pair interaction}}
  \label{subsec:pairinteractions}
@@@ -512,35 -477,7 +512,35 @@@ Energies for types 1 and 2 are written 
  in separate ``LJ-14'' and ``Coulomb-14'' entries per energy group pair.
  Energies for {\tt [~pairs_nb~]} are added to the ``LJ-(SR)'' and ``Coulomb-(SR)'' terms.
  
 -\subsection{Implicit solvation parameters\index{implicit solvation parameters}}
 +
 +\subsection{Exclusions}
 +\label{sec:excl}
 +The \normindex{exclusions} for non-bonded interactions are generated by {\tt
 +grompp} for neighboring atoms up to a certain number of bonds away, as
 +defined in the {\tt [~moleculetype~]} section in the topology file
 +(see \ssecref{topfile}). Particles are considered bonded when they are
 +connected by ``chemical'' bonds ({\tt [~bonds~]} types 1 to 5, 7 or 8)
 +or constraints ({\tt [~constraints~]} type 1).
 +Type 5 {\tt [~bonds~]} can be used to create a \normindex{connection}
 +between two atoms without creating an interaction.
 +There is a \normindex{harmonic interaction}
 +({\tt [~bonds~]} type 6) that does not connect the atoms by a chemical bond.
 +There is also a second constraint type ({\tt [~constraints~]} type 2)
 +that fixes the distance, but does not connect
 +the atoms by a chemical bond.
 +For a complete list of all these interactions, see \tabref{topfile2}.
 +
 +Extra exclusions within a molecule can be added manually
 +in a {\tt [~exclusions~]} section. Each line should start with one
 +atom index, followed by one or more atom indices. All non-bonded
 +interactions between the first atom and the other atoms will be excluded.
 +
 +When all non-bonded interactions within or between groups of atoms need
 +to be excluded, is it more convenient and much more efficient to use
 +energy monitor group exclusions (see \secref{groupconcept}).
 +
 +
 +\section{Implicit solvation parameters\index{implicit solvation parameters}}
  Starting with {\gromacs} 4.5, implicit solvent is supported. A section in the
  topology has been introduced to list those parameters:
  
@@@ -571,6 -508,33 +571,6 @@@ as proposed by Hawkins {\em et al.}~\ci
  basis.
  
  
 -
 -\section{Exclusions}
 -\label{sec:excl}
 -The \normindex{exclusions} for non-bonded interactions are generated by {\tt
 -grompp} for neighboring atoms up to a certain number of bonds away, as
 -defined in the {\tt [~moleculetype~]} section in the topology file
 -(see \ssecref{topfile}). Particles are considered bonded when they are
 -connected by ``chemical'' bonds ({\tt [~bonds~]} types 1 to 5, 7 or 8)
 -or constraints ({\tt [~constraints~]} type 1).
 -Type 5 {\tt [~bonds~]} can be used to create a \normindex{connection}
 -between two atoms without creating an interaction.
 -There is a \normindex{harmonic interaction}
 -({\tt [~bonds~]} type 6) that does not connect the atoms by a chemical bond.
 -There is also a second constraint type ({\tt [~constraints~]} type 2)
 -that fixes the distance, but does not connect
 -the atoms by a chemical bond.
 -For a complete list of all these interactions, see \tabref{topfile2}.
 -
 -Extra exclusions within a molecule can be added manually
 -in a {\tt [~exclusions~]} section. Each line should start with one
 -atom index, followed by one or more atom indices. All non-bonded
 -interactions between the first atom and the other atoms will be excluded.
 -
 -When all non-bonded interactions within or between groups of atoms need
 -to be excluded, is it more convenient and much more efficient to use
 -energy monitor group exclusions (see \secref{groupconcept}).
 -
  \section{Constraint algorithms\index{constraint algorithms}}
  \label{sec:constraints}
  Constraints are defined in the {\tt [~constraints~]} section.
@@@ -1205,17 -1169,10 +1205,17 @@@ in \tabref{topfile2}} \
  {\em mandatory} & {\tts molecules}    & & &   \multicolumn{2}{l|}{molecule name; number of molecules} \\
  \dline
  \multicolumn{6}{c}{~} \\
 +\multicolumn{6}{c}{\bf \large Inter-molecular interactions} \\
 +\dline
 +{\em optional}  & \multicolumn{4}{l}{\tts intermolecular_interactions}        & \\
 +\hline
 +\multicolumn{6}{|c|}{one or more bonded interactions as described in \tabref{topfile2}, with two or more atoms,} \\
 +\multicolumn{6}{|c|}{no interactions that generate exclusions, no constraints, use global atom numbers} \\
 +\dline
 +\multicolumn{6}{c}{~} \\
  \multicolumn{6}{l}{`\# at' is the required number of atom type indices for this directive} \\
  \multicolumn{6}{l}{`f. tp' is the value used to select this function type} \\
 -\multicolumn{6}{l}{`F. E.' indicates which of the parameters for this interaction can be} \\
 -\multicolumn{6}{l}{\phantom{`F. E.'} interpolated during free energy calculations} \\
 +\multicolumn{6}{l}{`F. E.' indicates which of the parameters can be interpolated in free energy calculations} \\
  \multicolumn{6}{l}{~$^{(cr)}$ the combination rule determines the type of LJ parameters, see~\ssecref{nbpar}}\\
  \multicolumn{6}{l}{~$^{(*)}$ for {\tts dihedraltypes} one can specify 4 atoms or the inner (outer for improper) 2 atoms}\\
  \multicolumn{6}{l}{~$^{(nrexcl)}$ exclude neighbors $n_{ex}$ bonds away for non-bonded interactions}\\
@@@ -1245,7 -1202,7 +1245,7 @@@ Name of interaction              & Topo
  % The footnotetext fields only work inside the body, and not from a
  % column with ``p'' formatting'!
  bond                               & {\tts bonds}\fnm{4},\fnm{5}    & 2     & 1     & $b_0$ (nm); $k_b$ (\kJmolnm{-2})                      & all        & \ssecref{harmonicbond}
 -\label{tab:topfile2} \footnotetext[1]{The required number of atom indices for this directive}\footnotetext[2]{The index to use to select this function type}\footnotetext[3]{Indicates which of the parameters for this interaction can be interpolated during free energy calculations}\footnotetext[4]{This interaction type will be used by {{\tts grompp}} for generating exclusions}\footnotetext[5]{This interaction type can be converted to constraints by {{\tts grompp}}}\footnotetext[7]{The combination rule determines the type of LJ parameters, see~\ssecref{nbpar}}\footnotetext[6]{No connection, and so no exclusions, are generated for this interaction}
 +\label{tab:topfile2} \footnotetext[1]{The required number of atom indices for this directive}\footnotetext[2]{The index to use to select this function type}\footnotetext[3]{Indicates which of the parameters can be interpolated in free energy calculations}\footnotetext[4]{This interaction type will be used by {{\tts grompp}} for generating exclusions}\footnotetext[5]{This interaction type can be converted to constraints by {{\tts grompp}}}\footnotetext[7]{The combination rule determines the type of LJ parameters, see~\ssecref{nbpar}}\footnotetext[6]{No connection, and so no exclusions, are generated for this interaction}
  \\
  G96 bond                           & {\tts bonds}\fnm{4},\fnm{5}    & 2     & 2     & $b_0$ (nm); $k_b$ (\kJmolnm{-4})                      & all        & \ssecref{G96bond} \\
  Morse                              & {\tts bonds}\fnm{4},\fnm{5}    & 2     & 3     & $b_0$ (nm); $D$ (\kJmol); $\beta$ (nm$^{-1}$)         & all        & \ssecref{Morsebond} \\
@@@ -1274,8 -1231,8 +1274,8 @@@ periodic improper dihedral         & {\
  Fourier dihedral                   & {\tts dihedrals}               & 4     & 5     & $C_1$, $C_2$, $C_3$, $C_4$ (\kJmol)                   & all        & \ssecref{Fourierdihedral} \\
  tabulated dihedral                 & {\tts dihedrals}               & 4     & 8     & table number ($\geq 0$); $k$ (\kJmol)                 & $k$        & \ssecref{tabulatedinteraction} \\
  proper dihedral (multiple)         & {\tts dihedrals}               & 4     & 9     & $\phi_s$ (deg); $k_\phi$ (\kJmol); multiplicity       & $\phi,k$   & \ssecref{properdihedral} \\
- restricted dihedral                & {\tts dihedrals}               & 4     & 11    & $\phi_0$ (deg); $k_\phi$ (\kJmol)                    &            & \ssecref{ReT} \\
- combined bending-torsion potential & {\tts dihedrals}               & 4     & 10    & $a_0$, $a_1$, $a_2$, $a_3$, $a_4$ (\kJmol)       &            & \ssecref{CBT} \\
+ restricted dihedral                & {\tts dihedrals}               & 4     & 10    & $\phi_0$ (deg); $k_\phi$ (\kJmol)                    &            & \ssecref{ReT} \\
+ combined bending-torsion potential & {\tts dihedrals}               & 4     & 11    & $a_0$, $a_1$, $a_2$, $a_3$, $a_4$ (\kJmol)       &            & \ssecref{CBT} \\
  exclusions                         & {\tts exclusions}              & 1     &       & one or more atom indices                              &            & \tsecref{excl} \\
  constraint                         & {\tts constraints}\fnm{4}      & 2     & 1     & $b_0$ (nm)                                            & all        & \sssecref{constraints},\tsecref{constraints} \\
  constraint\fnm{6}                  & {\tts constraints}             & 2     & 2     & $b_0$ (nm)                                            & all        & \sssecref{constraints},\tsecref{constraints},\tsecref{excl} \\
index 726edde72b4568bc45318d14b5cd54a24ac41485,fc2df6efd1cf6299627016a69d30f636268cda18..eec004128d0020526f3a0ba81b1169e90ab1309f
   * To help us fund GROMACS development, we humbly ask that you cite
   * the research papers on the package. Check out http://www.gromacs.org.
   */
 -#include "copyrite.h"
 +#include "gmxpre.h"
 +
 +#include "gromacs/legacyheaders/copyrite.h"
  
 -#ifdef HAVE_CONFIG_H
  #include "config.h"
 -#endif
  
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
  #include <time.h>
  
 +#include <algorithm>
 +
  #ifdef HAVE_LIBMKL
  #include <mkl.h>
  #endif
 -
  #ifdef HAVE_EXTRAE
 - #include "extrae_user_events.h"
 +#include <extrae_user_events.h>
  #endif
 -
  #include <boost/version.hpp>
  
  /* This file is completely threadsafe - keep it that way! */
  
 -#include "gromacs/legacyheaders/macros.h"
 -#include "gromacs/legacyheaders/vec.h"
 -
 +#include "buildinfo.h"
  #include "gromacs/fft/fft.h"
 -#include "gromacs/fileio/futil.h"
  #include "gromacs/fileio/strdb.h"
 +#include "gromacs/legacyheaders/macros.h"
 +#include "gromacs/math/vec.h"
  #include "gromacs/random/random.h"
  #include "gromacs/utility/baseversion.h"
  #include "gromacs/utility/cstringutil.h"
  #include "gromacs/utility/exceptions.h"
 +#include "gromacs/utility/futil.h"
  #include "gromacs/utility/gmxassert.h"
  #include "gromacs/utility/programcontext.h"
  #include "gromacs/utility/smalloc.h"
 -
 -#include "buildinfo.h"
 +#include "gromacs/utility/stringutil.h"
  
  static gmx_bool be_cool(void)
  {
@@@ -162,17 -163,6 +162,17 @@@ void cool_quote(char *retstring, int re
      sfree(tmpstr);
  }
  
 +static int centeringOffset(int width, int length)
 +{
 +    return std::max(width - length, 0) / 2;
 +}
 +
 +static void printCentered(FILE *fp, int width, const char *text)
 +{
 +    const int offset = centeringOffset(width, std::strlen(text));
 +    fprintf(fp, "%*s%s", offset, "", text);
 +}
 +
  static void printCopyright(FILE *fp)
  {
      static const char * const Contributors[] = {
          "Sebastian Fritsch",
          "Gerrit Groenhof",
          "Christoph Junghans",
 +        "Anca Hamuraru",
 +        "Vincent Hindriksen",
 +        "Dimitrios Karkoulis",
          "Peter Kasson",
          "Carsten Kutzner",
          "Per Larsson",
          "Michael Shirts",
          "Alfons Sijbers",
          "Peter Tieleman",
 +        "Teemu Virolainen",
          "Christian Wennberg",
          "Maarten Wolf"
      };
      static const char * const CopyrightText[] = {
          "Copyright (c) 1991-2000, University of Groningen, The Netherlands.",
 -        "Copyright (c) 2001-2014, The GROMACS development team at",
 +        "Copyright (c) 2001-2015, The GROMACS development team at",
          "Uppsala University, Stockholm University and",
          "the Royal Institute of Technology, Sweden.",
          "check out http://www.gromacs.org for more information."
  #define NLICENSE (int)asize(LicenseText)
  #endif
  
 -    fprintf(fp, "GROMACS is written by:\n");
 +    printCentered(fp, 78, "GROMACS is written by:");
 +    fprintf(fp, "\n");
      for (int i = 0; i < NCONTRIBUTORS; )
      {
          for (int j = 0; j < 4 && i < NCONTRIBUTORS; ++j, ++i)
          {
 -            fprintf(fp, "%-18s ", Contributors[i]);
 +            const int width = 18;
 +            char      buf[30];
 +            const int offset = centeringOffset(width, strlen(Contributors[i]));
 +            GMX_RELEASE_ASSERT(strlen(Contributors[i]) + offset < asize(buf),
 +                               "Formatting buffer is not long enough");
 +            std::fill(buf, buf+width, ' ');
 +            std::strcpy(buf+offset, Contributors[i]);
 +            fprintf(fp, " %-*s", width, buf);
          }
          fprintf(fp, "\n");
      }
 -    fprintf(fp, "and the project leaders:\n");
 -    fprintf(fp, "Mark Abraham, Berk Hess, Erik Lindahl, and David van der Spoel\n");
 +    printCentered(fp, 78, "and the project leaders:");
      fprintf(fp, "\n");
 +    printCentered(fp, 78, "Mark Abraham, Berk Hess, Erik Lindahl, and David van der Spoel");
 +    fprintf(fp, "\n\n");
      for (int i = 0; i < NCR; ++i)
      {
          fprintf(fp, "%s\n", CopyrightText[i]);
@@@ -410,11 -387,6 +410,11 @@@ void please_cite(FILE *fp, const char *
            "Thermodynamics of liquids: standard molar entropies and heat capacities of common solvents from 2PT molecular dynamics",
            "Phys. Chem. Chem. Phys.",
            13, 2011, "169-181" },
 +        { "Caleman2008a",
 +          "C. Caleman and D. van der Spoel",
 +          "Picosecond Melting of Ice by an Infrared Laser Pulse: A Simulation Study",
 +          "Angew. Chem. Int. Ed",
 +          47, 2008, "1417-1420" },
          { "Caleman2011b",
            "C. Caleman and P. J. van Maaren and M. Hong and J. S. Hub and L. T. da Costa and D. van der Spoel",
            "Force Field Benchmark of Organic Liquids: Density, Enthalpy of Vaporization, Heat Capacities, Surface Tension, Isothermal Compressibility, Volumetric Expansion Coefficient, and Dielectric Constant",
            "S. Páll, M. J. Abraham, C. Kutzner, B. Hess, E. Lindahl",
            "Tackling Exascale Software Challenges in Molecular Dynamics Simulations with GROMACS",
            "In S. Markidis & E. Laure (Eds.), Solving Software Challenges for Exascale",
-           8759, 2015, "327" }
+           8759, 2015, "3-27" }
      };
  #define NSTR (int)asize(citedb)
  
@@@ -682,11 -654,11 +682,11 @@@ const char *Program(void
  }
  
  
 -extern void gmx_print_version_info_gpu(FILE *fp);
 +extern void gmx_print_version_info_cuda_gpu(FILE *fp);
  
  static void gmx_print_version_info(FILE *fp)
  {
 -    fprintf(fp, "Gromacs version:    %s\n", gmx_version());
 +    fprintf(fp, "GROMACS version:    %s\n", gmx_version());
      const char *const git_hash = gmx_version_git_full_hash();
      if (git_hash[0] != '\0')
      {
      fprintf(fp, "MPI library:        none\n");
  #endif
  #ifdef GMX_OPENMP
 -    fprintf(fp, "OpenMP support:     enabled\n");
 +    fprintf(fp, "OpenMP support:     enabled (GMX_OPENMP_MAX_THREADS = %d)\n", GMX_OPENMP_MAX_THREADS);
  #else
      fprintf(fp, "OpenMP support:     disabled\n");
  #endif
      fprintf(fp, "GPU support:        enabled\n");
  #else
      fprintf(fp, "GPU support:        disabled\n");
 +#endif
 +#if defined(GMX_GPU) && defined(GMX_USE_OPENCL)
 +    fprintf(fp, "OpenCL support:     enabled\n");
 +#else
 +    fprintf(fp, "OpenCL support:     disabled\n");
  #endif
      /* A preprocessor trick to avoid duplicating logic from vec.h */
  #define gmx_stringify2(x) #x
  #define gmx_stringify(x) gmx_stringify2(x)
      fprintf(fp, "invsqrt routine:    %s\n", gmx_stringify(gmx_invsqrt(x)));
 -#ifndef __MIC__
      fprintf(fp, "SIMD instructions:  %s\n", GMX_SIMD_STRING);
 -#else
 -    fprintf(fp, "SIMD instructions:  %s\n", "Intel MIC");
 -#endif
 -
      fprintf(fp, "FFT library:        %s\n", gmx_fft_get_version_info());
  #ifdef HAVE_RDTSCP
      fprintf(fp, "RDTSCP usage:       enabled\n");
      fprintf(fp, "Boost version:      %d.%d.%d%s\n", BOOST_VERSION / 100000,
              BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100,
              bExternalBoost ? " (external)" : " (internal)");
 -#ifdef GMX_GPU
 -    gmx_print_version_info_gpu(fp);
 +#if defined(GMX_GPU)
 +#ifdef GMX_USE_OPENCL
 +    fprintf(fp, "OpenCL include dir: %s\n", OPENCL_INCLUDE_DIR);
 +    fprintf(fp, "OpenCL library:     %s\n", OPENCL_LIBRARY);
 +    fprintf(fp, "OpenCL version:     %s\n", OPENCL_VERSION_STRING);
 +#else
 +    gmx_print_version_info_cuda_gpu(fp);
 +#endif
  #endif
  }
  
@@@ -838,42 -804,38 +838,42 @@@ void printBinaryInformation(FIL
      {
          fprintf(fp, "%sCreated by:%s\n", prefix, suffix);
      }
 +    // TODO: It would be nice to know here whether we are really running a
 +    // Gromacs binary or some other binary that is calling Gromacs; we
 +    // could then print "%s is part of GROMACS" or some alternative text.
 +    std::string title
 +        = formatString(":-) GROMACS - %s, %s%s (-:", name, gmx_version(), precisionString);
 +    const int   indent
 +        = centeringOffset(78 - strlen(prefix) - strlen(suffix), title.length()) + 1;
 +    fprintf(fp, "%s%*c%s%s\n", prefix, indent, ' ', title.c_str(), suffix);
 +    fprintf(fp, "%s%s\n", prefix, suffix);
      if (settings.bCopyright_)
      {
          GMX_RELEASE_ASSERT(prefix[0] == '\0' && suffix[0] == '\0',
                             "Prefix/suffix not supported with copyright");
 +        printCopyright(fp);
 +        fprintf(fp, "\n");
          // This line is printed again after the copyright notice to make it
          // appear together with all the other information, so that it is not
          // necessary to read stuff above the copyright notice.
          // The line above the copyright notice puts the copyright notice is
          // context, though.
 -        // TODO: It would be nice to know here whether we are really running a
 -        // Gromacs binary or some other binary that is calling Gromacs; we
 -        // could then print "%s is part of GROMACS" or some alternative text.
 -        fprintf(fp, "%sGROMACS:    %s, %s%s%s\n", prefix, name,
 +        fprintf(fp, "%sGROMACS:      %s, %s%s%s\n", prefix, name,
                  gmx_version(), precisionString, suffix);
 -        fprintf(fp, "\n");
 -        printCopyright(fp);
 -        fprintf(fp, "\n");
      }
 -    fprintf(fp, "%sGROMACS:      %s, %s%s%s\n", prefix, name,
 -            gmx_version(), precisionString, suffix);
      const char *const binaryPath = programContext.fullBinaryPath();
 -    if (binaryPath != NULL && binaryPath[0] != '\0')
 +    if (!gmx::isNullOrEmpty(binaryPath))
      {
          fprintf(fp, "%sExecutable:   %s%s\n", prefix, binaryPath, suffix);
      }
 -    const char *const libraryPath = programContext.defaultLibraryDataPath();
 -    if (libraryPath != NULL && libraryPath[0] != '\0')
 +    const gmx::InstallationPrefixInfo installPrefix = programContext.installationPrefix();
 +    if (!gmx::isNullOrEmpty(installPrefix.path))
      {
 -        fprintf(fp, "%sLibrary dir:  %s%s\n", prefix, libraryPath, suffix);
 +        fprintf(fp, "%sData prefix:  %s%s%s\n", prefix, installPrefix.path,
 +                installPrefix.bSourceLayout ? " (source tree)" : "", suffix);
      }
      const char *const commandLine = programContext.commandLine();
 -    if (commandLine != NULL && commandLine[0] != '\0')
 +    if (!gmx::isNullOrEmpty(commandLine))
      {
          fprintf(fp, "%sCommand line:%s\n%s  %s%s\n",
                  prefix, suffix, prefix, commandLine, suffix);