Gromacs  2025.0-dev-20241011-013a99c
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Functions | Variables
#include "gmxpre.h"
#include "gromacs/listed_forces/bonded.h"
#include <cmath>
#include <cstdint>
#include <algorithm>
#include <iterator>
#include <limits>
#include <memory>
#include <ostream>
#include <string>
#include <tuple>
#include <unordered_map>
#include <vector>
#include <gtest/gtest.h>
#include "gromacs/listed_forces/listed_forces.h"
#include "gromacs/math/paddedvector.h"
#include "gromacs/math/units.h"
#include "gromacs/math/vec.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/mdtypes/mdatom.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/topology/idef.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/enumerationhelpers.h"
#include "gromacs/utility/real.h"
#include "gromacs/utility/strconvert.h"
#include "gromacs/utility/stringstream.h"
#include "gromacs/utility/textwriter.h"
#include "testutils/refdata.h"
#include "testutils/testasserts.h"
+ Include dependency graph for bonded.cpp:

Description

Implements test of bonded force routines.

Todo:
We should re-work this. For example, a harmonic bond has so few computations that force components should be accurate to a small and computed relative error.
Author
David van der Spoel david.nosp@m..van.nosp@m.dersp.nosp@m.oel@.nosp@m.icm.u.nosp@m.u.se

Classes

struct  gmx::test::anonymous_namespace{bonded.cpp}::OutputQuantities
 Output from bonded kernels. More...
 
struct  gmx::test::anonymous_namespace{bonded.cpp}::iListInput
 Input structure for listed forces tests. More...
 

Functions

void gmx::test::anonymous_namespace{bonded.cpp}::checkOutput (TestReferenceChecker *checker, const OutputQuantities &output, const BondedKernelFlavor bondedKernelFlavor)
 Utility to check the output from bonded tests. More...
 
std::ostream & gmx::test::anonymous_namespace{bonded.cpp}::operator<< (std::ostream &out, const iListInput &input)
 Prints the interaction and parameters to a stream.
 
void gmx::test::anonymous_namespace{bonded.cpp}::fillIatoms (int ftype, std::vector< t_iatom > *iatoms)
 Utility to fill iatoms struct. More...
 
static void gmx::PrintTo (const RVec &value, std::ostream *os)
 Print an RVec to os.
 
static void gmx::PrintTo (const PaddedVector< RVec > &vector, std::ostream *os)
 Print a padded vector of RVec to os.
 

Variables

constexpr int gmx::test::anonymous_namespace{bonded.cpp}::c_numAtoms = 4
 Number of atoms used in these tests.
 
std::vector< iListInput > gmx::test::anonymous_namespace{bonded.cpp}::c_InputBonds
 Function types for testing bonds. Add new terms at the end. More...
 
const real gmx::test::anonymous_namespace{bonded.cpp}::cQuarticAngles [5] = { 1.1, 2.3, 4.6, 7.8, 9.2 }
 Constants for Quartic Angles.
 
std::vector< iListInput > gmx::test::anonymous_namespace{bonded.cpp}::c_InputAngles
 Function types for testing angles. Add new terms at the end. More...
 
const real gmx::test::anonymous_namespace{bonded.cpp}::rbcA [NR_RBDIHS] = { -5.35, 13.6, 8.4, -16.7, 0.3, 12.4 }
 Constants for Ryckaert-Bellemans A.
 
const real gmx::test::anonymous_namespace{bonded.cpp}::rbcB [NR_RBDIHS] = { -6.35, 12.6, 8.1, -10.7, 0.9, 15.4 }
 Constants for Ryckaert-Bellemans B.
 
const real gmx::test::anonymous_namespace{bonded.cpp}::rbc [NR_RBDIHS] = { -7.35, 13.6, 8.4, -16.7, 1.3, 12.4 }
 Constants for Ryckaert-Bellemans without FEP.
 
std::vector< iListInput > gmx::test::anonymous_namespace{bonded.cpp}::c_InputDihs
 Function types for testing dihedrals. Add new terms at the end. More...
 
std::vector< iListInput > gmx::test::anonymous_namespace{bonded.cpp}::c_InputPols
 Function types for testing polarization. Add new terms at the end. More...
 
std::vector< iListInput > gmx::test::anonymous_namespace{bonded.cpp}::c_InputRestraints
 Function types for testing polarization. Add new terms at the end. More...
 
std::vector< iListInput > gmx::test::anonymous_namespace{bonded.cpp}::c_InputBondsZeroLength
 Function types for testing bond with zero length, has zero reference length to make physical sense. More...
 
std::vector< iListInput > gmx::test::anonymous_namespace{bonded.cpp}::c_InputAnglesZeroAngle
 Function types for testing angles with zero angle, has zero reference angle to make physical sense. More...
 
std::vector< PaddedVector< RVec > > gmx::test::anonymous_namespace{bonded.cpp}::c_coordinatesForTests
 Coordinates for testing. More...
 
std::vector< PaddedVector< RVec > > gmx::test::anonymous_namespace{bonded.cpp}::c_coordinatesForTestsZeroBondLength
 Coordinates for testing bonds with zero length. More...
 
std::vector< PaddedVector< RVec > > gmx::test::anonymous_namespace{bonded.cpp}::c_coordinatesForTestsZeroAngle
 Coordinates for testing bonds with zero length. More...
 
std::vector< PbcTypegmx::test::anonymous_namespace{bonded.cpp}::c_pbcForTests = { PbcType::No, PbcType::XY, PbcType::Xyz }
 PBC values for testing.