Enable grompp to read virtual_site1
authorPascal Merz <pascal.merz@me.com>
Tue, 26 Jan 2021 15:53:54 +0000 (15:53 +0000)
committerPaul Bauer <paul.bauer.q@gmail.com>
Tue, 26 Jan 2021 15:53:54 +0000 (15:53 +0000)
In !306, a virtual site with one constructing atom was introduced.
grompp was, however, not updated to understand the new topology entry.
This updates the topology format in grompp and the manual. It also adds
a missing example for virtual site type 2fd to the manual.

Found while investigating #3866, but not directly connected.

docs/reference-manual/topologies/particle-type.rst
docs/reference-manual/topologies/topology-file-formats.rst
src/gromacs/gmxpreprocess/topdirs.cpp
src/gromacs/gmxpreprocess/topdirs.h
src/gromacs/gmxpreprocess/topio.cpp
src/gromacs/topology/idef.cpp

index 686c72c2bc9bc10f80ec87abd7774ec4aab2301d..31b89594bec647672f64417134819d062e37cadc 100644 (file)
@@ -77,7 +77,15 @@ while it is still supported internally in the code, the old 4fd type
 should not be used in new input files. The different types are explained
 in sec. :ref:`virtualsites`.
 
-Parameters for type 2 should look like this:
+Parameters for type 1 should look like this:
+
+::
+
+    [ virtual_sites1 ]
+    ; Site  from        funct
+    5       1           1
+
+for type 2 like this:
 
 ::
 
@@ -85,6 +93,14 @@ Parameters for type 2 should look like this:
     ; Site  from        funct  a
     5       1     2     1      0.7439756
 
+for type 2fd like this:
+
+::
+
+    [ virtual_sites2 ]
+    ; Site  from        funct  d
+    5       1     2     2      -0.105
+
 for type 3 like this:
 
 ::
index 49401c24056670984a04563776cd82baa1c468f4..0ea97bb28a7a7d2757e0d8a9bf599b86c893952c 100644 (file)
@@ -251,6 +251,8 @@ interactions can be converted to constraints by :ref:`grompp <gmx grompp>`.
             +------------------------------------+----------------------------+------------+-----------+-------------------------------------------------------------------------+------------+
             | SETTLE                             | ``settles``                | 1          | 1         | |DOH|, |DHH| (nm)                                                       |            | 
             +------------------------------------+----------------------------+------------+-----------+-------------------------------------------------------------------------+------------+
+            | 1-body virtual site                | ``virtual_sites1``         | 2          | 0         |                                                                         |            |
+            +------------------------------------+----------------------------+------------+-----------+-------------------------------------------------------------------------+------------+
             | 2-body virtual site                | ``virtual_sites2``         | 3          | 1         | |AO| ()                                                                 |            | 
             +------------------------------------+----------------------------+------------+-----------+-------------------------------------------------------------------------+------------+
             | 2-body virtual site (fd)           | ``virtual_sites2``         | 3          | 2         | |DO| (nm)                                                               |            | 
index a6139cf3c95b9e4827334caae6d35d2679677b2f..36c27ceb647fe620ae0f536b2984db8cfdc67aaa 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
  * Copyright (c) 2013,2014,2015,2017,2018 by the GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, 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.
@@ -56,12 +56,12 @@ static gmx::EnumerationArray<Directive, const char*> directive_names = {
       "dihedraltypes", "nonbond_params", "implicit_genborn_params", "implicit_surface_params",
       "cmaptypes",
       /* All the directives above can not appear after moleculetype */
-      "moleculetype", "atoms", "virtual_sites2", "virtual_sites3", "virtual_sites4",
-      "virtual_sitesn", "bonds", "exclusions", "pairs", "pairs_nb", "angles", "dihedrals",
-      "constraints", "settles", "polarization", "water_polarization", "thole_polarization",
-      "system", "molecules", "position_restraints", "angle_restraints", "angle_restraints_z",
-      "distance_restraints", "orientation_restraints", "dihedral_restraints", "cmap",
-      "intermolecular_interactions", "maxdirs", "invalid", "none" }
+      "moleculetype", "atoms", "virtual_sites1", "virtual_sites2", "virtual_sites3",
+      "virtual_sites4", "virtual_sitesn", "bonds", "exclusions", "pairs", "pairs_nb", "angles",
+      "dihedrals", "constraints", "settles", "polarization", "water_polarization",
+      "thole_polarization", "system", "molecules", "position_restraints", "angle_restraints",
+      "angle_restraints_z", "distance_restraints", "orientation_restraints", "dihedral_restraints",
+      "cmap", "intermolecular_interactions", "maxdirs", "invalid", "none" }
 };
 
 int ifunc_index(Directive d, int type)
@@ -142,6 +142,15 @@ int ifunc_index(Directive d, int type)
             {
                 return F_BHAM;
             }
+        case Directive::d_vsites1:
+            if (type == 1)
+            {
+                return F_VSITE1;
+            }
+            else
+            {
+                gmx_fatal(FARGS, "Invalid vsites1 type %d", type);
+            }
         case Directive::d_vsites2:
             switch (type)
             {
@@ -278,6 +287,7 @@ void DS_Init(DirStack** DS)
         set_nec(&(necessary[Directive::d_cmaptypes]), Directive::d_atomtypes, Directive::d_none);
         set_nec(&(necessary[Directive::d_moleculetype]), Directive::d_atomtypes, Directive::d_none);
         set_nec(&(necessary[Directive::d_atoms]), Directive::d_moleculetype, Directive::d_none);
+        set_nec(&(necessary[Directive::d_vsites1]), Directive::d_atoms, Directive::d_none);
         set_nec(&(necessary[Directive::d_vsites2]), Directive::d_atoms, Directive::d_none);
         set_nec(&(necessary[Directive::d_vsites3]), Directive::d_atoms, Directive::d_none);
         set_nec(&(necessary[Directive::d_vsites4]), Directive::d_atoms, Directive::d_none);
index 075d989f6b62235c2e31dd20ddf9333af97db8eb..202cd23b11ef3d5b2ff5526f54c7c28294b6fec2 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2019,2021, 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.
@@ -54,6 +54,7 @@ enum class Directive : int
     d_cmaptypes,
     d_moleculetype,
     d_atoms,
+    d_vsites1,
     d_vsites2,
     d_vsites3,
     d_vsites4,
index 316656d7a63ea08b7e2c5c6718bdc327247f8e5b..7c7343a7018df5fc023e34d340a0f94761d61bad 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
  * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
- * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020,2021, 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.
@@ -748,6 +748,7 @@ static char** read_topol(const char*                           infile,
                                       pline, FALSE, FALSE, 1.0, bZero, &bWarn_copy_A_B, wi);
                             break;
 
+                        case Directive::d_vsites1:
                         case Directive::d_vsites2:
                         case Directive::d_vsites3:
                         case Directive::d_vsites4:
index a82e6e5754bbb112fe7d8f2fab1953dd5827c9df..03b0989476701c49570f54ca635d677a96bccceb 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
  * Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, 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.
@@ -272,6 +272,7 @@ void printInteractionParameters(gmx::TextWriter* writer, t_functype ftype, const
         case F_SETTLE:
             writer->writeLineFormatted("doh=%15.8e, dhh=%15.8e", iparams.settle.doh, iparams.settle.dhh);
             break;
+        case F_VSITE1: writer->ensureEmptyLine(); break;
         case F_VSITE2: writer->writeLineFormatted("a=%15.8e", iparams.vsite.a); break;
         case F_VSITE3:
         case F_VSITE3FD: