Merge branch 'origin/release-2020' into merge-2020-into-2021
authorPaul Bauer <paul.bauer.q@gmail.com>
Tue, 24 Nov 2020 13:38:39 +0000 (14:38 +0100)
committerPaul Bauer <paul.bauer.q@gmail.com>
Tue, 24 Nov 2020 14:15:08 +0000 (15:15 +0100)
Resolved Conflicts:
admin/containers/scripted_gmx_docker_builds.py
docs/conf.cmakein.py
docs/dev-manual/change-management.rst
docs/dev-manual/contribute.rst
docs/dev-manual/releng/index.rst
docs/dev-manual/tools.rst
docs/install-guide/index.rst
docs/reference-manual/preface.rst
docs/release-notes/index.rst
scripts/GMXRC.bash.cmakein
src/gromacs/gmxana/gmx_covar.cpp
src/gromacs/gmxana/gmx_do_dssp.cpp
src/gromacs/gmxana/gmx_h2order.cpp
src/gromacs/gmxana/nsfactor.cpp
src/gromacs/hardware/detecthardware.cpp
src/gromacs/mdlib/coupling.cpp
src/gromacs/mdrun/md.cpp
src/gromacs/mdtypes/state.h
src/gromacs/trajectoryanalysis/modules/pairdist.cpp
src/gromacs/utility/basedefinitions.h

27 files changed:
admin/containers/scripted_gmx_docker_builds.py
docs/conf.cmakein.py
docs/dev-manual/contribute.rst
docs/dev-manual/releng/index.rst
docs/dev-manual/reportstyle.rst
docs/dev-manual/tools.rst
docs/how-to/index.rst
docs/install-guide/index.rst
docs/reference-manual/preface.rst
docs/release-notes/2016/major/bugs-fixed.rst
docs/release-notes/2020/2020.5.rst
docs/release-notes/index.rst
docs/user-guide/getting-started.rst
src/gromacs/domdec/partition.cpp
src/gromacs/gmxana/gmx_covar.cpp
src/gromacs/gmxana/gmx_do_dssp.cpp
src/gromacs/gmxana/gmx_h2order.cpp
src/gromacs/gmxana/nsfactor.cpp
src/gromacs/hardware/detecthardware.cpp
src/gromacs/hardware/prepare_detection.cpp
src/gromacs/mdlib/coupling.cpp
src/gromacs/mdlib/mdebin_bar.cpp
src/gromacs/mdtypes/state.h
src/gromacs/trajectoryanalysis/modules/pairdist.cpp
src/gromacs/trajectoryanalysis/tests/pairdist.cpp
src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_CoordinateSelectionIsNotOverwritten.xml [new file with mode: 0644]
src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_CoordinateSelectionIsNotOverwrittenWithExplicitGroup.xml [new file with mode: 0644]

index 5464a7f17c5b62a9ac3519cb5c66e5cd1a4af9a8..1b820805bdce2683f03e6fb535d1705fa76a237e 100755 (executable)
@@ -199,14 +199,12 @@ def get_llvm_packages(args) -> typing.Iterable[str]:
     else:
         return []
 
-
 def get_opencl_packages(args) -> typing.Iterable[str]:
     if (args.doxygen is None) and (args.oneapi is None):
         return _opencl_extra_packages
     else:
         return []
 
-
 def get_compiler(args, compiler_build_stage: hpccm.Stage = None) -> bb_base:
     # Compiler
     if args.icc is not None:
index 5ca284b39426b725831f8f9851511c45b05ef6f6..c5993c6a09e4f8f864fd7c47c93499f2c61fd25c 100644 (file)
@@ -223,16 +223,11 @@ rst_epilog += """
 .. _MKL: https://software.intel.com/en-us/intel-mkl
 .. _VMD: http://www.ks.uiuc.edu/Research/vmd/
 .. _PyMOL: http://www.pymol.org
-.. _continuous integration server used by GROMACS: http://jenkins.gromacs.org
-.. _Jenkins: http://jenkins-ci.org
 .. _webpage: http://www.gromacs.org
 .. _ftp site: ftp://ftp.gromacs.org/pub/gromacs/
 .. _tutorials: http://www.gromacs.org/Documentation/Tutorials
 .. _issue tracker: https://gitlab.com/gromacs/gromacs/-/issues/
-.. _issues: https://gitlab.com/gromacs/gromacs/-/issues/
 .. _gitlab: https://gitlab.com/gromacs/gromacs/
-.. _redmine: http://redmine.gromacs.org
-.. _gerrit: http://gerrit.gromacs.org
 .. _download: ../download.html
 .. |thisyear| replace:: {thisyear_string}
 """.format(gmx_version_string=gmx_version_string, regressiontest_version=regressiontest_version, thisyear_string=thisyear_string)
index 22db6df9f58f0e51a7aa78316cf2282281891be5..dfc8862a531117e5b1bce8f00ae4cc6eecc791af 100644 (file)
@@ -40,7 +40,8 @@ please make sure that you have checked all the points on this list:
   widespread adoption of the method.
 
 * *Advance discussion*: Please communicate with the other developers,
-  e.g.  on the `developer mailing list`_ mailing list, or `issue tracker`_ to let them know of the general
+  e.g.  on the `developer mailing list`_ mailing list, or
+  `issue tracker`_ to let them know of the general
   nature of your plans. This will prevent duplicate or wasted
   effort. It is also a good idea to search those resources as well as
   the literature and WWW for other projects that may be relevant.
index 74272b9ab7414af2538cf3ebf7d88a1b9bd243a2..5b9ccdade4d23b1b6c83e7810dc6d10cbbfeaf53 100644 (file)
@@ -3,23 +3,25 @@
 
 .. _releng-workflow-release:
 
-Release engineering with Gitlab
+Release engineering with GitLab
 ===============================
 
 .. toctree::
    :hidden:
 
-We are currently switching our build and testing system to use Gitlab
-CI pipelines run on GitLab Runner. This section is going to be extended
-with individual build information as it comes available. For now we are
-using a combination of building with the previous system on Jenkins
-and post-submit verification on Gitlab.
+We are currently switching our build and testing system to use GitLab
+and the integrated CI system, with information for the general system found
+in the official `GitLab documentation <https://docs.gitlab.com/ee/ci/yaml/>`_.
+The new configuration for the builds and tests can be found in the file
+``.gitlab-ci.yml``, with the templates for configuring is found in the files in the
+``admin/ci-templates/`` directory. This section is going to be extended
+with individual build information as it comes available.
 
 .. seealso:: :doc:`../infrastructure`
 
 .. _releng-triggering-builds:
 
-Triggering builds on Gitlab
+Triggering builds on GitLab
 ---------------------------
 
 Pipelines can be triggered through the web interface, with different
index 93e58492fe599fd6a66100fd257da1a7315b9ede..07f11f72041a82fbfd9e5182bc66d9cb6f6f0818 100644 (file)
@@ -34,8 +34,8 @@ does not result in any warnings or errors in itself. If your example generates e
 not be considered as *real*, or at the minimum it will be much harder to analyse to find the actual issue.
 
 
-If your inputs are sensitive, then it is possible to create private `issues`_ so that the
-developer team can have access to solve the problem, while preventing widespread
+If your inputs are sensitive, then it is possible to create private `issues <issue tracker>`_
+so that the developer team can have access to solve the problem, while preventing widespread
 visibility on the internet.
 
 
index fd90412c285334743a55380d9308631d3bc7deae..c6f7d6f3c58a00f734453ab0dc8fb536a0d0c2c0 100644 (file)
@@ -29,7 +29,7 @@ Several tools have their own individual pages and are listed below.
 Change management
 -----------------
 
-|Gromacs| change management is supported by the following tools.
+|Gromacs| change management uses git and `GitLab`_ for code uploading and testing as well as issues tracking.
 (For change submission guidelines, refer to :doc:`contribute`.)
 
 git
index 4ac7ee77ed72cb01f1a1109446cba2386d9428e8..18b284953c85316605a002896f908f7195294bf7 100644 (file)
@@ -5,7 +5,7 @@ Short How-To guides
 .. highlight:: bash
 
 A number of short guides are presented here to help users getting started with simulations.
-More detailed tutorials are available for example at the http://www.mdtutorials.com/.
+Useful third-party tutorials provided by Justin Lemkul are found here http://www.mdtutorials.com/.
 
 .. toctree::
    :maxdepth: 2
index 69daf6f2266f975e25dcd2fa8f090c9a4a2b4272..02c05b950e655234e7e942d34af48afad55b5c5c 100644 (file)
@@ -1317,8 +1317,8 @@ and
 a beta version of oneAPI containing Intel's compiler.
 For this testing, we use Ubuntu 18.04 or 20.04 operating system.
 Other compiler, library, and OS versions are tested less frequently.
-For details, you can
-have a look at the `continuous integration server used by GROMACS`_,
+For details, you can have a look at the
+`continuous integration server used by GROMACS <gitlab>`_,
 which uses GitLab runner on a local k8s x86 cluster with NVIDIA and
 AMD GPU support.
 
index 1fc4bcc6e126d92086585ef35f95670c46f27c9c..b675c224318eed4524e32606d0cb1038dc1f8a60 100644 (file)
@@ -39,7 +39,7 @@ Comments on form and content are welcome, please send them to one of
 the mailing lists (see our `webpage`_ or this section on
 how to :ref:`contribute <gmx-contribute>`), or open an issue
 on our `issue tracker`_. Corrections can also be made in the |Gromacs| git
-source repository and uploaded to the |Gromacs| `gerrit`_.
+source repository and uploaded to the |Gromacs| `GitLab`_.
 
 We release an updated version of the manual whenever
 we release a new version of the software, so in general 
index d79603c6708459dc16da65e7cecbc1d851ca7399..62108c17874a3bd41a767f8c22c534deca2fb44f 100644 (file)
@@ -160,7 +160,7 @@ These document fixes for issues that were identified as having been
 introduced into the release-2016 branch since it diverged from
 release-5-1. These will not appear in the final release notes, because
 no formal release is thought to have had the problem. Of course, the
-tracked `issues`_ remain available should further discussion arise.
+tracked `issues <issue tracker>`_ remain available should further discussion arise.
 
 Fixed bug in v-rescale thermostat & replica exchange
 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
index e0a021f48a56d8404df647efa0f630525cdffb37..761dee81f16e51ae6447afd0a90e218f78b5ae24 100644 (file)
@@ -16,9 +16,57 @@ in the :ref:`release-notes`.
 Fixes where mdrun could behave incorrectly
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
+Fix mdrun writing zero dH/dlambda and foreign lambda energies before checkpointing
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+With free-energy runs with separate-dhdl-file=no and nstdhdl not a multiple of
+nstenergy, mdrun would write zeros for dH/dlambda and foreign energies to
+the energy file for steps between the last energy frame and the checkpoint.
+This would lead to errors in free-energy estimates which could go unnoticed
+as values only deviate for a few steps.
+
+:issue:`3763`
+
+Fixed bugs with COM pulling and domain decompostion with weight or >32 ranks
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+When using COM pulling and domain decomposition, the results would be
+incorrect when using relative weights per atom or when using more than
+32 DD MPI ranks. This would usually lead to crashes or obviously wrong
+results.
+
+:issue:`3750`
+
+Fixed conserved energy for MTTK
+"""""""""""""""""""""""""""""""
+
+When using `pcoupl=MTTK` and `tcoupl=nose-hoover`, the calculated conserved
+energy was incorrect due to two errors dating back to GROMACS 4.6 and 2018,
+respectively. As a result, all reported conserved energies using this
+combination of temperature and pressure coupling algorithms in any GROMACS
+version since GROMACS 4.6 are likely to be wrong. Note that these errors did
+not impact the dynamics, as the conserved energy is only reported, but never
+used in calculations. Also note that this bug only affects this exact
+combination of temperature / pressure coupling algorithms.
+
+:issue:`3796`
+
+
 Fixes for ``gmx`` tools
 ^^^^^^^^^^^^^^^^^^^^^^^
 
+Improve CHARMM support in gmx do_dssp
+"""""""""""""""""""""""""""""""""""""
+
+:issue:`3568`
+
+Fix non-funtioning gmx h2order -d option
+""""""""""""""""""""""""""""""""""""""""
+
+The gmx h2order tool would always take the normal along the z-axis.
+
+:issue:`3820`
+
 Fixes that affect portability
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
index dfb12c7e5a2ae8c581cdd8be8d075811cf75af58..6b41402eb98eb2ad7f5b0c7f8c9bd22fc1d504f0 100644 (file)
@@ -18,7 +18,7 @@ the 2021 release series, as appropriate. Around the time the 2022
 release is made, the 2020 series will no longer be maintained.
 
 Where issue numbers are reported in these release notes, more details
-can be found at https://gitlab.com/gromacs/gromacs/-/issues at that issue number.
+can be found on the `issue tracker`_ at that issue number.
 
 |Gromacs| 2021 series
 ---------------------
@@ -41,7 +41,6 @@ Major release
    2021/major/portability
    2021/major/miscellaneous
 
-
 |Gromacs| 2020 series
 ---------------------
 
index f7b0ce167a030b814d749038b623799dd0e2413d..02214fba67dbb2d160c064b533e811bdc17a40f0 100644 (file)
@@ -156,11 +156,9 @@ checkpoint file (:ref:`cpt` file).
 
 Tutorial material
 -----------------
-There are `several tutorials`_ available that cover aspects of using |Gromacs|.
+There are several third-party `tutorials`_ available that cover aspects of using |Gromacs|.
 Further information can also be found in the :doc:`How to <../how-to/index>` section.
 
-.. _several tutorials: http://www.mdtutorials.com/gmx/ 
-
 Background reading
 ------------------
 *   Berendsen, H.J.C., Postma, J.P.M., van Gunsteren, W.F., Hermans, J. (1981)
index d1488c855dec91163532b7ddfe33e0a8130c05bb..b295040db745d94abe1231988ed7041458fc4360 100644 (file)
@@ -3152,18 +3152,19 @@ void dd_partition_system(FILE*                     fplog,
                                 mdatoms->sigmaB, dd_pme_maxshift_x(dd), dd_pme_maxshift_y(dd));
     }
 
-    if (ir->bPull)
-    {
-        /* Update the local pull groups */
-        dd_make_local_pull_groups(cr, pull_work);
-    }
-
     if (dd->atomSets != nullptr)
     {
         /* Update the local atom sets */
         dd->atomSets->setIndicesInDomainDecomposition(*(dd->ga2la));
     }
 
+    // The pull group construction can need the atom sets updated above
+    if (ir->bPull)
+    {
+        /* Update the local pull groups */
+        dd_make_local_pull_groups(cr, pull_work);
+    }
+
     /* Update the local atoms to be communicated via the IMD protocol if bIMD is TRUE. */
     imdSession->dd_make_local_IMD_atoms(dd);
 
index 5fa50372bf70a467c0642d32076df33cc5b1f655..559c1f96372f7686f65fc3fe7ccc00bb92586c9a 100644 (file)
 #include "gromacs/pbcutil/rmpbc.h"
 #include "gromacs/topology/index.h"
 #include "gromacs/topology/topology.h"
+#include "gromacs/utility/arrayref.h"
 #include "gromacs/utility/arraysize.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/futil.h"
 #include "gromacs/utility/smalloc.h"
 #include "gromacs/utility/sysinfo.h"
 
+
+namespace gmx
+{
+
+namespace
+{
+
+/*! \brief Throw an error if any element in index exceeds a given number.
+ *
+ * \param[in] indices to be acessed
+ * \param[in] largestOkayIndex to be accessed
+ * \param[in] indexUsagePurpose to be more explicit in the error message
+ *
+ * \throws RangeError if largestOkayIndex is larger than any element in indices
+ *
+ */
+void throwErrorIfIndexOutOfBounds(ArrayRef<const int> indices,
+                                  const int           largestOkayIndex,
+                                  const std::string&  indexUsagePurpose)
+{
+    // do nothing if index is empty
+    if (indices.ssize() == 0)
+    {
+        return;
+    }
+    const int largestIndex = *std::max_element(indices.begin(), indices.end());
+    if (largestIndex < largestOkayIndex)
+    {
+        GMX_THROW(RangeError("The provided structure file only contains "
+                             + std::to_string(largestOkayIndex) + " coordinates, but coordinate index "
+                             + std::to_string(largestIndex) + " was requested for " + indexUsagePurpose
+                             + ". Make sure to update structure files "
+                               "and index files if you store only a part of your system."));
+    }
+};
+
+} // namespace
+
+} // namespace gmx
+
 int gmx_covar(int argc, char* argv[])
 {
     const char* desc[] = {
@@ -172,6 +214,8 @@ int gmx_covar(int argc, char* argv[])
     {
         printf("\nChoose a group for the least squares fit\n");
         get_index(atoms, ndxfile, 1, &nfit, &ifit, &fitname);
+        // Make sure that we never attempt to access a coordinate out of range
+        gmx::throwErrorIfIndexOutOfBounds({ ifit, ifit + nfit }, atoms->nr, "fitting");
         if (nfit < 3)
         {
             gmx_fatal(FARGS, "Need >= 3 points to fit!\n");
@@ -183,6 +227,7 @@ int gmx_covar(int argc, char* argv[])
     }
     printf("\nChoose a group for the covariance analysis\n");
     get_index(atoms, ndxfile, 1, &natoms, &index, &ananame);
+    gmx::throwErrorIfIndexOutOfBounds({ index, index + natoms }, atoms->nr, "analysis");
 
     bDiffMass1 = FALSE;
     if (bFit)
@@ -261,9 +306,14 @@ int gmx_covar(int argc, char* argv[])
     nat      = read_first_x(oenv, &status, trxfile, &t, &xread, box);
     if (nat != atoms->nr)
     {
-        fprintf(stderr, "\nWARNING: number of atoms in tpx (%d) and trajectory (%d) do not match\n",
+        fprintf(stderr,
+                "\nWARNING: number of atoms in structure file (%d) and trajectory (%d) do not "
+                "match\n",
                 natoms, nat);
     }
+    gmx::throwErrorIfIndexOutOfBounds({ ifit, ifit + nfit }, nat, "fitting");
+    gmx::throwErrorIfIndexOutOfBounds({ index, index + natoms }, nat, "analysis");
+
     do
     {
         nframes0++;
index b1c9aa11c52be1727d7ac054babecdc8d1235ff0..1cfcde6f3876650d12fe9f2c2f8951bbd8cacf8f 100644 (file)
@@ -259,17 +259,14 @@ static gmx_bool* bPhobics(t_atoms* atoms)
 
 static void check_oo(t_atoms* atoms)
 {
-    char* OOO;
+    char* OOO = gmx_strdup("O");
 
-    int i;
-
-    OOO = gmx_strdup("O");
-
-    for (i = 0; (i < atoms->nr); i++)
+    for (int i = 0; (i < atoms->nr); i++)
     {
         if ((std::strcmp(*(atoms->atomname[i]), "OXT") == 0)
             || (std::strcmp(*(atoms->atomname[i]), "O1") == 0)
-            || (std::strcmp(*(atoms->atomname[i]), "OC1") == 0))
+            || (std::strcmp(*(atoms->atomname[i]), "OC1") == 0)
+            || (std::strcmp(*(atoms->atomname[i]), "OT1") == 0))
         {
             *atoms->atomname[i] = OOO;
         }
index 1e52fe0b491ac09cc4d5024cae6931318e39455b..509801a57292a95c46647a7da56057469c0ffa9d 100644 (file)
@@ -259,6 +259,15 @@ static void h2order_plot(rvec dipole[], real order[], const char* afile, int nsl
     xvgrclose(ord);
 }
 
+enum
+{
+    axisSEL,
+    axisZ,
+    axisY,
+    axisX,
+    axisNR
+};
+
 int gmx_h2order(int argc, char* argv[])
 {
     const char* desc[] = {
@@ -271,13 +280,13 @@ int gmx_h2order(int argc, char* argv[])
         "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."
     };
-    static int         axis    = 2; /* normal to memb. default z  */
-    static const char* axtitle = "Z";
-    static int         nslices = 0; /* nr of slices defined       */
-    t_pargs            pa[]    = { { "-d",
+    static const char* axisOption[axisNR + 1] = { nullptr, "Z", "Y", "X", nullptr };
+    static int         nslices                = 0; /* nr of slices defined       */
+    // The struct that will hold the parsed user input
+    t_pargs     pa[]   = { { "-d",
                        FALSE,
-                       etSTR,
-                       { &axtitle },
+                       etENUM,
+                       { axisOption },
                        "Take the normal on the membrane in direction X, Y or Z." },
                      { "-sl",
                        FALSE,
@@ -285,7 +294,7 @@ int gmx_h2order(int argc, char* argv[])
                        { &nslices },
                        "Calculate order parameter as function of boxlength, dividing the box"
                        " in this number of slices." } };
-    const char*        bugs[]  = {
+    const char* bugs[] = {
         "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, "
@@ -316,11 +325,25 @@ int gmx_h2order(int argc, char* argv[])
 
 #define NFILE asize(fnm)
 
+    // Parse the user input in argv into pa
     if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME, NFILE, fnm, asize(pa), pa,
                            asize(desc), desc, asize(bugs), bugs, &oenv))
     {
         return 0;
     }
+
+    // Process the axis option chosen by the user to set the
+    // axis used for the computation. The useful choice is an
+    // axis normal to the membrane. Default is z-axis.
+    int axis = ZZ;
+    switch (nenum(axisOption))
+    {
+        case axisX: axis = XX; break;
+        case axisY: axis = YY; break;
+        case axisZ: axis = ZZ; break;
+        default: axis = ZZ;
+    }
+
     bMicel = opt2bSet("-nm", NFILE, fnm);
 
     top = read_top(ftp2fn(efTPR, NFILE, fnm), &pbcType); /* read topology file */
index 0f8171fecc99275171f154943dd7ea446ec90a02..e56b568d756502b9ce707536d2b2b89d6a50ff6a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2012,2013,2014,2015,2016, The GROMACS development team.
  * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
index 54e2eefb3e7ff4d7d55e1079800d4d776114acf1..d808249678abdb704be7cdbb13562ce846b41ae7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
+ * Copyright (c) 2012,2013,2014,2015,2016, The GROMACS development team.
  * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
index 885afdc3b2ae64c0c2dad6461f4cbc795ddc057b..853192f52a70c810c54d8f5ee6ab502fedc727b1 100644 (file)
@@ -78,8 +78,8 @@ namespace gmx
  *  declared noexcept, but at least icc 19.1 and 21-beta08 with the
  *  libstdc++-7.5 has difficulty implementing a std::vector of
  *  std::thread started with this function when declared noexcept. It
- *  is not clear whether the problem is the compiler or the standard
- *  library. Fortunately, this function is not performance sensitive,
+ *  is a known compiler bug that should be fixed after 19.1.
+ *  Fortunately, this function is not performance sensitive,
  *  and only runs on platforms other than x86 and POWER (ie ARM),
  *  so the possible overhead introduced by omitting noexcept is not
  *  important.
index 43ef9d2459be5a85aa439296a3edd83fc2ae9a00..e56bcada93ffee70985837cd004719c09761a05a 100644 (file)
@@ -1770,7 +1770,7 @@ static real energyNoseHoover(const t_inputrec* ir, const t_state* state, const t
 
         if (nd > 0.0)
         {
-            if (inputrecNvtTrotter(ir))
+            if (inputrecNvtTrotter(ir) || inputrecNptTrotter(ir))
             {
                 /* contribution from the thermal momenta of the NH chain */
                 for (int j = 0; j < nh; j++)
@@ -1821,7 +1821,7 @@ static real energyPressureMTTK(const t_inputrec* ir, const t_state* state, const
             double iQinv = MassQ->QPinv[i * nh + j];
             if (iQinv > 0)
             {
-                energy += 0.5 * gmx::square(state->nhpres_vxi[i * nh + j] / iQinv);
+                energy += 0.5 * gmx::square(state->nhpres_vxi[i * nh + j]) / iQinv;
                 /* contribution from the thermal variable of the NH chain */
                 energy += state->nhpres_xi[i * nh + j] * kT;
             }
index 394c225ddeb819aa704156142ed1c2f76e1a8d2d..bed78d90c1699df9169929577556099483e8e246 100644 (file)
@@ -730,7 +730,7 @@ void mde_delta_h_coll_update_energyhistory(const t_mde_delta_h_coll* dhc, energy
     {
         std::vector<real>& dh = deltaH->dh[i];
         dh.resize(dhc->dh[i].ndh);
-        std::copy(dh.begin(), dh.end(), dhc->dh[i].dh);
+        std::copy(dhc->dh[i].dh, dhc->dh[i].dh + dhc->dh[i].ndh, dh.begin());
     }
     deltaH->start_time   = dhc->start_time;
     deltaH->start_lambda = dhc->start_lambda;
index 9b2db3b779d1c17592746a333d58f396dfc13693..e38f3f7dbc7941fb8c283b75a18ee71251dffff0 100644 (file)
@@ -234,8 +234,8 @@ public:
     // All things public
     int natoms; //!< Number of atoms, local + non-local; this is the size of \p x, \p v and \p cg_p, when used
     int ngtc;          //!< The number of temperature coupling groups
-    int nnhpres;       //!< The NH-chain length for the MTTK barostat
-    int nhchainlength; //!< The NH-chain length for temperature coupling
+    int nnhpres;       //!< The number of NH-chains for the MTTK barostat (always 1 or 0)
+    int nhchainlength; //!< The NH-chain length for temperature coupling and MTTK barostat
     int flags; //!< Set of bit-flags telling which entries are present, see enum at the top of the file
     int                      fep_state;      //!< indicates which of the alchemical states we are in
     std::array<real, efptNR> lambda;         //!< Free-energy lambda vector
index f1d470779a7d743d5a5f15617fbb7bba056cbf71..e5e27165d34119a584ffb699dbc9576e492b467a 100644 (file)
@@ -254,13 +254,18 @@ void PairDistance::initOptions(IOptionsContainer* options, TrajectoryAnalysisSet
 int initSelectionGroups(Selection* sel, const gmx_mtop_t* top, GroupType type)
 {
     e_index_t indexType = INDEX_UNKNOWN;
-    switch (type)
+    // If the selection type is INDEX_UNKNOWN (e.g. a position not associated
+    // with a set of particles), don't overwrite the selection type.
+    if (sel->type() != INDEX_UNKNOWN)
     {
-        case GroupType::All: indexType = INDEX_ALL; break;
-        case GroupType::Residue: indexType = INDEX_RES; break;
-        case GroupType::Molecule: indexType = INDEX_MOL; break;
-        case GroupType::None: indexType = INDEX_ATOM; break;
-        case GroupType::Count: GMX_THROW(InternalError("Invalid GroupType"));
+        switch (type)
+        {
+            case GroupType::All: indexType = INDEX_ALL; break;
+            case GroupType::Residue: indexType = INDEX_RES; break;
+            case GroupType::Molecule: indexType = INDEX_MOL; break;
+            case GroupType::None: indexType = INDEX_ATOM; break;
+            case GroupType::Count: GMX_THROW(InternalError("Invalid GroupType"));
+        }
     }
     return sel->initOriginalIdsToGroup(top, indexType);
 }
index 27a1cd4c2b8e565fe84662587661fe4ca07a9d21..d259ad1224482e14285eb33ef6721ef5506cb99d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -152,4 +152,22 @@ TEST_F(PairDistanceModuleTest, ComputesGroupedMaxDistanceWithCutoff)
     runTest(CommandLine(cmdline));
 }
 
+TEST_F(PairDistanceModuleTest, CoordinateSelectionIsNotOverwritten)
+{
+    const char* const cmdline[] = { "pairdist", "-ref", "[0.0, 1.5, 2.9]", "-sel", "resindex 3",
+                                    "-type",    "max" };
+    setTopology("simple.gro");
+    setOutputFile("-o", ".xvg", NoTextMatch());
+    runTest(CommandLine(cmdline));
+}
+
+TEST_F(PairDistanceModuleTest, CoordinateSelectionIsNotOverwrittenWithExplicitGroup)
+{
+    const char* const cmdline[] = { "pairdist", "-ref", "[0.0, 1.5, 2.9]", "-sel", "resindex 3",
+                                    "-type",    "max",  "-refgrouping",    "res" };
+    setTopology("simple.gro");
+    setOutputFile("-o", ".xvg", NoTextMatch());
+    runTest(CommandLine(cmdline));
+}
+
 } // namespace
diff --git a/src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_CoordinateSelectionIsNotOverwritten.xml b/src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_CoordinateSelectionIsNotOverwritten.xml
new file mode 100644 (file)
index 0000000..48416ed
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+  <String Name="CommandLine">pairdist -ref '[0.0, 1.5, 2.9]' -sel 'resindex 3' -type max</String>
+  <OutputData Name="Data">
+    <AnalysisData Name="dist">
+      <DataFrame Name="Frame0">
+        <Real Name="X">0</Real>
+        <DataValues>
+          <Int Name="Count">1</Int>
+          <DataValue>
+            <Real Name="Value">4.3197222132910351</Real>
+          </DataValue>
+        </DataValues>
+      </DataFrame>
+    </AnalysisData>
+  </OutputData>
+  <OutputFiles Name="Files">
+    <File Name="-o"></File>
+  </OutputFiles>
+</ReferenceData>
diff --git a/src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_CoordinateSelectionIsNotOverwrittenWithExplicitGroup.xml b/src/gromacs/trajectoryanalysis/tests/refdata/PairDistanceModuleTest_CoordinateSelectionIsNotOverwrittenWithExplicitGroup.xml
new file mode 100644 (file)
index 0000000..844acad
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="referencedata.xsl"?>
+<ReferenceData>
+  <String Name="CommandLine">pairdist -ref '[0.0, 1.5, 2.9]' -sel 'resindex 3' -type max -refgrouping res</String>
+  <OutputData Name="Data">
+    <AnalysisData Name="dist">
+      <DataFrame Name="Frame0">
+        <Real Name="X">0</Real>
+        <DataValues>
+          <Int Name="Count">1</Int>
+          <DataValue>
+            <Real Name="Value">4.3197222132910351</Real>
+          </DataValue>
+        </DataValues>
+      </DataFrame>
+    </AnalysisData>
+  </OutputData>
+  <OutputFiles Name="Files">
+    <File Name="-o"></File>
+  </OutputFiles>
+</ReferenceData>