Gromacs  2025-dev-20241003-bd59e46
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs
virtualsites.cpp File Reference
#include "gmxpre.h"
#include "config.h"
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <array>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include "gromacs/math/vectypes.h"
#include "gromacs/topology/idef.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/topology/topology.h"
#include "gromacs/trajectory/trajectoryframe.h"
#include "gromacs/trajectoryanalysis/topologyinformation.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/real.h"
#include "gromacs/utility/strconvert.h"
#include "gromacs/utility/stringutil.h"
#include "testutils/mpitest.h"
#include "testutils/simulationdatabase.h"
#include "testutils/testasserts.h"
#include "testutils/testmatchers.h"
#include "testutils/trajectoryreader.h"
#include "moduletest.h"
#include "simulatorcomparison.h"
+ Include dependency graph for virtualsites.cpp:

Description

Sanity checks for virtual sites.

The tests in this file test the virtual site implementation in two ways. 1) An artificial test system containing all virtual site types is run end-to-end. The virtual sites are recalculated using a reference implementation, and compared to the trajectory values. This ensures that no relevant (real or virtual) coordinates were changed between virtual site computation, and that the mdrun implementation agrees with the reference implementation. The latter has the advantage to be written closer to the analytical expressions, hence easier to check by eye. Unlike the mdrun implementation, it can also be unit- tested (see 2)). Since this is an end-to-end test, it also ensures that virtual sites can be processed by grompp and run by mdrun. 2) The reference implementation is tested to have corresponding positions and velocities. This is achieved by comparing virtual site positions calculated from propagated real positions to virtual site positions calculated by propagating virtual sites using the virtual velocities.

Note, this only ensures that the position and velocity implementation match, not that they are actually correct. Some regression test systems include virtual sites, so there is some testing that no bugs are introduced. It would be good to have unit tests, though. This can either be achieved by refactoring the mdrun implementation, or adding them to the reference implementation here. See also #3911.

Author
Pascal Merz pasca.nosp@m.l.me.nosp@m.rz@me.nosp@m..com

Classes

struct  gmx::test::anonymous_namespace{virtualsites.cpp}::VirtualSiteTest::VirtualSite
 Holds parameters of virtual site and allows calculation. More...
 

Typedefs

using gmx::test::anonymous_namespace{virtualsites.cpp}::VirtualSiteTestParams = std::tuple< std::string, std::string, std::string >