From 13cadb39d075e24ce34630193f77252f526e6965 Mon Sep 17 00:00:00 2001 From: Pascal Merz Date: Tue, 26 Jan 2021 15:53:54 +0000 Subject: [PATCH] Enable grompp to read virtual_site1 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. --- .../topologies/particle-type.rst | 18 +++++++++++++- .../topologies/topology-file-formats.rst | 2 ++ src/gromacs/gmxpreprocess/topdirs.cpp | 24 +++++++++++++------ src/gromacs/gmxpreprocess/topdirs.h | 3 ++- src/gromacs/gmxpreprocess/topio.cpp | 3 ++- src/gromacs/topology/idef.cpp | 3 ++- 6 files changed, 42 insertions(+), 11 deletions(-) diff --git a/docs/reference-manual/topologies/particle-type.rst b/docs/reference-manual/topologies/particle-type.rst index 686c72c2bc..31b89594be 100644 --- a/docs/reference-manual/topologies/particle-type.rst +++ b/docs/reference-manual/topologies/particle-type.rst @@ -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: :: diff --git a/docs/reference-manual/topologies/topology-file-formats.rst b/docs/reference-manual/topologies/topology-file-formats.rst index 49401c2405..0ea97bb28a 100644 --- a/docs/reference-manual/topologies/topology-file-formats.rst +++ b/docs/reference-manual/topologies/topology-file-formats.rst @@ -251,6 +251,8 @@ interactions can be converted to constraints by :ref:`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) | | diff --git a/src/gromacs/gmxpreprocess/topdirs.cpp b/src/gromacs/gmxpreprocess/topdirs.cpp index a6139cf3c9..36c27ceb64 100644 --- a/src/gromacs/gmxpreprocess/topdirs.cpp +++ b/src/gromacs/gmxpreprocess/topdirs.cpp @@ -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_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); diff --git a/src/gromacs/gmxpreprocess/topdirs.h b/src/gromacs/gmxpreprocess/topdirs.h index 075d989f6b..202cd23b11 100644 --- a/src/gromacs/gmxpreprocess/topdirs.h +++ b/src/gromacs/gmxpreprocess/topdirs.h @@ -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, diff --git a/src/gromacs/gmxpreprocess/topio.cpp b/src/gromacs/gmxpreprocess/topio.cpp index 316656d7a6..7c7343a701 100644 --- a/src/gromacs/gmxpreprocess/topio.cpp +++ b/src/gromacs/gmxpreprocess/topio.cpp @@ -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: diff --git a/src/gromacs/topology/idef.cpp b/src/gromacs/topology/idef.cpp index a82e6e5754..03b0989476 100644 --- a/src/gromacs/topology/idef.cpp +++ b/src/gromacs/topology/idef.cpp @@ -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: -- 2.22.0