From fd43bc146114a15140d573f01a34375fcc87c0f1 Mon Sep 17 00:00:00 2001 From: Artem Zhmurov Date: Fri, 26 Jul 2019 11:17:34 +0200 Subject: [PATCH] Change the file structure in constraints tests To avoid the confusion with the private implementation (PImpl) classes, _impl suffix is abandoned, the constraining instances are now called runners. The class that stores all the data structures is now in separate file. Change-Id: Ibbff52da578db5e0b001b5802b44e0917f46f70b --- src/gromacs/mdlib/tests/CMakeLists.txt | 5 +- src/gromacs/mdlib/tests/constr.cpp | 253 ++------------------ src/gromacs/mdlib/tests/constrtestdata.cpp | 257 +++++++++++++++++++++ .../tests/{constr_impl.h => constrtestdata.h} | 34 +-- .../{constr_impl.cpp => constrtestrunners.cpp} | 3 +- .../tests/{constr_impl.cu => constrtestrunners.cu} | 6 +- src/gromacs/mdlib/tests/constrtestrunners.h | 74 ++++++ 7 files changed, 354 insertions(+), 278 deletions(-) create mode 100644 src/gromacs/mdlib/tests/constrtestdata.cpp rename src/gromacs/mdlib/tests/{constr_impl.h => constrtestdata.h} (90%) rename src/gromacs/mdlib/tests/{constr_impl.cpp => constrtestrunners.cpp} (99%) rename src/gromacs/mdlib/tests/{constr_impl.cu => constrtestrunners.cu} (96%) create mode 100644 src/gromacs/mdlib/tests/constrtestrunners.h diff --git a/src/gromacs/mdlib/tests/CMakeLists.txt b/src/gromacs/mdlib/tests/CMakeLists.txt index 15ad0b1a1a..6a1ec6a62f 100644 --- a/src/gromacs/mdlib/tests/CMakeLists.txt +++ b/src/gromacs/mdlib/tests/CMakeLists.txt @@ -33,12 +33,13 @@ # the research papers on the package. Check out http://www.gromacs.org. file(GLOB MDLIB_TEST_SOURCES - constr_impl.cpp + constrtestrunners.cpp + constrtestdata.cpp ) if (GMX_USE_CUDA) file(GLOB MDLIB_TEST_CUDA_SOURCES - constr_impl.cu + constrtestrunners.cu settle_runners.cu ) endif() diff --git a/src/gromacs/mdlib/tests/constr.cpp b/src/gromacs/mdlib/tests/constr.cpp index 4d74583aec..1d6c85affd 100644 --- a/src/gromacs/mdlib/tests/constr.cpp +++ b/src/gromacs/mdlib/tests/constr.cpp @@ -44,254 +44,31 @@ * \author Artem Zhmurov * \ingroup module_mdlib */ - #include "gmxpre.h" -#include "gromacs/mdlib/constr.h" - #include "config.h" #include -#include - -#include #include #include #include -#include "gromacs/fileio/gmxfio.h" -#include "gromacs/gmxlib/nrnb.h" -#include "gromacs/math/paddedvector.h" #include "gromacs/math/vec.h" #include "gromacs/math/vectypes.h" -#include "gromacs/mdlib/lincs.h" -#include "gromacs/mdlib/shake.h" -#include "gromacs/mdrunutility/multisim.h" -#include "gromacs/mdtypes/commrec.h" -#include "gromacs/mdtypes/inputrec.h" -#include "gromacs/mdtypes/mdatom.h" #include "gromacs/pbcutil/pbc.h" -#include "gromacs/topology/block.h" -#include "gromacs/topology/idef.h" -#include "gromacs/topology/ifunc.h" -#include "gromacs/topology/topology.h" -#include "gromacs/utility/smalloc.h" #include "gromacs/utility/stringutil.h" -#include "gromacs/utility/unique_cptr.h" -#include "testutils/refdata.h" #include "testutils/testasserts.h" -#include "constr_impl.h" +#include "constrtestdata.h" +#include "constrtestrunners.h" namespace gmx { namespace test { - -ConstraintsTestData::ConstraintsTestData(const std::string &title, - int numAtoms, std::vector masses, - std::vector constraints, std::vector constraintsR0, - bool computeVirial, tensor virialScaledRef, - bool compute_dHdLambda, float dHdLambdaRef, - real initialTime, real timestep, - const std::vector &x, const std::vector &xPrime, const std::vector &v, - real shakeTolerance, gmx_bool shakeUseSOR, - int lincsNumIterations, int lincsExpansionOrder, real lincsWarnAngle) -{ - // This is to trick Gerrit - { - { - title_ = title; // Human-friendly name of the system - numAtoms_ = numAtoms; // Number of atoms - - // Masses of atoms - masses_ = masses; - invmass_.resize(numAtoms); // Vector of inverse masses - - for (int i = 0; i < numAtoms; i++) - { - invmass_[i] = 1.0/masses.at(i); - } - - // Saving constraints to check if they are satisfied after algorithm was applied - constraints_ = constraints; // Constraints indices (in type-i-j format) - constraintsR0_ = constraintsR0; // Equilibrium distances for each type of constraint - - invdt_ = 1.0/timestep; // Inverse timestep - - // Communication record - cr_.nnodes = 1; - cr_.dd = nullptr; - - // Multisim data - ms_.sim = 0; - ms_.nsim = 1; - - // Input record - data that usually comes from configuration file (.mdp) - ir_.efep = 0; - ir_.init_t = initialTime; - ir_.delta_t = timestep; - ir_.eI = 0; - - // MD atoms data - md_.nMassPerturbed = 0; - md_.lambda = 0.0; - md_.invmass = invmass_.data(); - md_.nr = numAtoms; - md_.homenr = numAtoms; - - // Virial evaluation - computeVirial_ = computeVirial; - if (computeVirial) - { - for (int i = 0; i < DIM; i++) - { - for (int j = 0; j < DIM; j++) - { - virialScaled_[i][j] = 0; - virialScaledRef_[i][j] = virialScaledRef[i][j]; - } - } - } - - - // Free energy evaluation - compute_dHdLambda_ = compute_dHdLambda; - dHdLambda_ = 0; - if (compute_dHdLambda_) - { - ir_.efep = efepYES; - dHdLambdaRef_ = dHdLambdaRef; - } - else - { - ir_.efep = efepNO; - dHdLambdaRef_ = 0; - } - - // Constraints and their parameters (local topology) - for (int i = 0; i < F_NRE; i++) - { - idef_.il[i].nr = 0; - } - idef_.il[F_CONSTR].nr = constraints.size(); - - snew(idef_.il[F_CONSTR].iatoms, constraints.size()); - int maxType = 0; - for (unsigned i = 0; i < constraints.size(); i++) - { - if (i % 3 == 0) - { - if (maxType < constraints.at(i)) - { - maxType = constraints.at(i); - } - } - idef_.il[F_CONSTR].iatoms[i] = constraints.at(i); - } - snew(idef_.iparams, maxType + 1); - for (unsigned i = 0; i < constraints.size()/3; i++) - { - idef_.iparams[constraints.at(3*i)].constr.dA = constraintsR0.at(constraints.at(3*i)); - idef_.iparams[constraints.at(3*i)].constr.dB = constraintsR0.at(constraints.at(3*i)); - } - - // Constraints and their parameters (global topology) - InteractionList interactionList; - interactionList.iatoms.resize(constraints.size()); - for (unsigned i = 0; i < constraints.size(); i++) - { - interactionList.iatoms.at(i) = constraints.at(i); - } - InteractionList interactionListEmpty; - interactionListEmpty.iatoms.resize(0); - - gmx_moltype_t molType; - molType.atoms.nr = numAtoms; - molType.ilist.at(F_CONSTR) = interactionList; - molType.ilist.at(F_CONSTRNC) = interactionListEmpty; - mtop_.moltype.push_back(molType); - - gmx_molblock_t molBlock; - molBlock.type = 0; - molBlock.nmol = 1; - mtop_.molblock.push_back(molBlock); - - mtop_.natoms = numAtoms; - mtop_.ffparams.iparams.resize(maxType + 1); - for (int i = 0; i <= maxType; i++) - { - mtop_.ffparams.iparams.at(i) = idef_.iparams[i]; - } - mtop_.bIntermolecularInteractions = false; - - // Coordinates and velocities - x_.resizeWithPadding(numAtoms); - xPrime_.resizeWithPadding(numAtoms); - xPrime0_.resizeWithPadding(numAtoms); - xPrime2_.resizeWithPadding(numAtoms); - - v_.resizeWithPadding(numAtoms); - v0_.resizeWithPadding(numAtoms); - - std::copy(x.begin(), x.end(), x_.begin()); - std::copy(xPrime.begin(), xPrime.end(), xPrime_.begin()); - std::copy(xPrime.begin(), xPrime.end(), xPrime0_.begin()); - std::copy(xPrime.begin(), xPrime.end(), xPrime2_.begin()); - - std::copy(v.begin(), v.end(), v_.begin()); - std::copy(v.begin(), v.end(), v0_.begin()); - - // SHAKE-specific parameters - ir_.shake_tol = shakeTolerance; - ir_.bShakeSOR = shakeUseSOR; - - // LINCS-specific parameters - ir_.nLincsIter = lincsNumIterations; - ir_.nProjOrder = lincsExpansionOrder; - ir_.LincsWarnAngle = lincsWarnAngle; - } - } -} - -/*! \brief - * Reset the data structure so it can be reused. - * - * Set the coordinates and velocities back to their values before - * constraining. The scaled virial tensor and dHdLambda are zeroed. - * - */ -void ConstraintsTestData::reset() -{ - xPrime_ = xPrime0_; - xPrime2_ = xPrime0_; - v_ = v0_; - - if (computeVirial_) - { - for (int i = 0; i < DIM; i++) - { - for (int j = 0; j < DIM; j++) - { - virialScaled_[i][j] = 0; - } - } - } - dHdLambda_ = 0; -} - -/*! \brief - * Cleaning up the memory. - */ -ConstraintsTestData::~ConstraintsTestData() -{ - sfree(idef_.il[F_CONSTR].iatoms); - sfree(idef_.iparams); -} - namespace { @@ -304,19 +81,19 @@ namespace */ typedef std::tuple ConstraintsTestParameters; -//! Names of all availible algorithms -std::vector algorithmsNames; +//! Names of all availible runners +std::vector runnersNames; -//! Method that fills and returns algorithmNames to the test macros. -std::vector getAlgorithmsNames() +//! Method that fills and returns runnersNames to the test macros. +std::vector getRunnersNames() { - algorithmsNames.emplace_back("SHAKE"); - algorithmsNames.emplace_back("LINCS"); + runnersNames.emplace_back("SHAKE"); + runnersNames.emplace_back("LINCS"); if (GMX_GPU == GMX_GPU_CUDA && canComputeOnGpu()) { - algorithmsNames.emplace_back("LINCS_CUDA"); + runnersNames.emplace_back("LINCS_CUDA"); } - return algorithmsNames; + return runnersNames; } /*! \brief Test fixture for constraints. @@ -886,12 +663,12 @@ TEST_P(ConstraintsTest, TriangleOfConstraints){ lincsNIter, lincslincsExpansionOrder, lincsWarnAngle); std::string pbcName; - std::string algorithmName; - std::tie(pbcName, algorithmName) = GetParam(); - t_pbc pbc = pbcs_.at(pbcName); + std::string runnerName; + std::tie(pbcName, runnerName) = GetParam(); + t_pbc pbc = pbcs_.at(pbcName); // Apply constraints - algorithms_.at(algorithmName)(testData.get(), pbc); + algorithms_.at(runnerName)(testData.get(), pbc); checkConstrainsLength(absoluteTolerance(0.0002), *testData, pbc); checkConstrainsDirection(*testData, pbc); @@ -905,7 +682,7 @@ TEST_P(ConstraintsTest, TriangleOfConstraints){ INSTANTIATE_TEST_CASE_P(WithParameters, ConstraintsTest, ::testing::Combine(::testing::Values("PBCNone", "PBCXYZ"), - ::testing::ValuesIn(getAlgorithmsNames()))); + ::testing::ValuesIn(getRunnersNames()))); } // namespace } // namespace test diff --git a/src/gromacs/mdlib/tests/constrtestdata.cpp b/src/gromacs/mdlib/tests/constrtestdata.cpp new file mode 100644 index 0000000000..46c72d26a1 --- /dev/null +++ b/src/gromacs/mdlib/tests/constrtestdata.cpp @@ -0,0 +1,257 @@ +/* + * This file is part of the GROMACS molecular simulation package. + * + * Copyright (c) 2018,2019, 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. + * + * GROMACS is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * GROMACS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with GROMACS; if not, see + * http://www.gnu.org/licenses, or write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * If you want to redistribute modifications to GROMACS, please + * consider that scientific software is very special. Version + * control is crucial - bugs must be traceable. We will be happy to + * consider code for inclusion in the official distribution, but + * derived work must not be called official GROMACS. Details are found + * in the README & COPYING files - if they are missing, get the + * official version at http://www.gromacs.org. + * + * To help us fund GROMACS development, we humbly ask that you cite + * the research papers on the package. Check out http://www.gromacs.org. + */ +/*! \internal \file + * \brief SHAKE and LINCS tests. + * + * \todo Better tests for virial are needed. + * \todo Tests for bigger systems to test threads synchronization, + * reduction, etc. on the GPU. + * \todo Tests for algorithms for derivatives. + * \todo Free-energy perturbation tests + * + * \author Artem Zhmurov + * \ingroup module_mdlib + */ + +#include "gmxpre.h" + +#include "constrtestdata.h" + +#include "gromacs/utility/smalloc.h" +#include "gromacs/utility/stringutil.h" + +namespace gmx +{ +namespace test +{ + +ConstraintsTestData::ConstraintsTestData(const std::string &title, + int numAtoms, std::vector masses, + std::vector constraints, std::vector constraintsR0, + bool computeVirial, tensor virialScaledRef, + bool compute_dHdLambda, float dHdLambdaRef, + real initialTime, real timestep, + const std::vector &x, const std::vector &xPrime, const std::vector &v, + real shakeTolerance, gmx_bool shakeUseSOR, + int lincsNumIterations, int lincsExpansionOrder, real lincsWarnAngle) +{ + title_ = title; // Human-friendly name of the system + numAtoms_ = numAtoms; // Number of atoms + + // Masses of atoms + masses_ = masses; + invmass_.resize(numAtoms); // Vector of inverse masses + + for (int i = 0; i < numAtoms; i++) + { + invmass_[i] = 1.0/masses.at(i); + } + + // Saving constraints to check if they are satisfied after algorithm was applied + constraints_ = constraints; // Constraints indices (in type-i-j format) + constraintsR0_ = constraintsR0; // Equilibrium distances for each type of constraint + + invdt_ = 1.0/timestep; // Inverse timestep + + // Communication record + cr_.nnodes = 1; + cr_.dd = nullptr; + + // Multisim data + ms_.sim = 0; + ms_.nsim = 1; + + // Input record - data that usually comes from configuration file (.mdp) + ir_.efep = 0; + ir_.init_t = initialTime; + ir_.delta_t = timestep; + ir_.eI = 0; + + // MD atoms data + md_.nMassPerturbed = 0; + md_.lambda = 0.0; + md_.invmass = invmass_.data(); + md_.nr = numAtoms; + md_.homenr = numAtoms; + + // Virial evaluation + computeVirial_ = computeVirial; + if (computeVirial) + { + for (int i = 0; i < DIM; i++) + { + for (int j = 0; j < DIM; j++) + { + virialScaled_[i][j] = 0; + virialScaledRef_[i][j] = virialScaledRef[i][j]; + } + } + } + + + // Free energy evaluation + compute_dHdLambda_ = compute_dHdLambda; + dHdLambda_ = 0; + if (compute_dHdLambda_) + { + ir_.efep = efepYES; + dHdLambdaRef_ = dHdLambdaRef; + } + else + { + ir_.efep = efepNO; + dHdLambdaRef_ = 0; + } + + // Constraints and their parameters (local topology) + for (int i = 0; i < F_NRE; i++) + { + idef_.il[i].nr = 0; + } + idef_.il[F_CONSTR].nr = constraints.size(); + + snew(idef_.il[F_CONSTR].iatoms, constraints.size()); + int maxType = 0; + for (unsigned i = 0; i < constraints.size(); i++) + { + if (i % 3 == 0) + { + if (maxType < constraints.at(i)) + { + maxType = constraints.at(i); + } + } + idef_.il[F_CONSTR].iatoms[i] = constraints.at(i); + } + snew(idef_.iparams, maxType + 1); + for (unsigned i = 0; i < constraints.size()/3; i++) + { + idef_.iparams[constraints.at(3*i)].constr.dA = constraintsR0.at(constraints.at(3*i)); + idef_.iparams[constraints.at(3*i)].constr.dB = constraintsR0.at(constraints.at(3*i)); + } + + // Constraints and their parameters (global topology) + InteractionList interactionList; + interactionList.iatoms.resize(constraints.size()); + for (unsigned i = 0; i < constraints.size(); i++) + { + interactionList.iatoms.at(i) = constraints.at(i); + } + InteractionList interactionListEmpty; + interactionListEmpty.iatoms.resize(0); + + gmx_moltype_t molType; + molType.atoms.nr = numAtoms; + molType.ilist.at(F_CONSTR) = interactionList; + molType.ilist.at(F_CONSTRNC) = interactionListEmpty; + mtop_.moltype.push_back(molType); + + gmx_molblock_t molBlock; + molBlock.type = 0; + molBlock.nmol = 1; + mtop_.molblock.push_back(molBlock); + + mtop_.natoms = numAtoms; + mtop_.ffparams.iparams.resize(maxType + 1); + for (int i = 0; i <= maxType; i++) + { + mtop_.ffparams.iparams.at(i) = idef_.iparams[i]; + } + mtop_.bIntermolecularInteractions = false; + + // Coordinates and velocities + x_.resizeWithPadding(numAtoms); + xPrime_.resizeWithPadding(numAtoms); + xPrime0_.resizeWithPadding(numAtoms); + xPrime2_.resizeWithPadding(numAtoms); + + v_.resizeWithPadding(numAtoms); + v0_.resizeWithPadding(numAtoms); + + std::copy(x.begin(), x.end(), x_.begin()); + std::copy(xPrime.begin(), xPrime.end(), xPrime_.begin()); + std::copy(xPrime.begin(), xPrime.end(), xPrime0_.begin()); + std::copy(xPrime.begin(), xPrime.end(), xPrime2_.begin()); + + std::copy(v.begin(), v.end(), v_.begin()); + std::copy(v.begin(), v.end(), v0_.begin()); + + // SHAKE-specific parameters + ir_.shake_tol = shakeTolerance; + ir_.bShakeSOR = shakeUseSOR; + + // LINCS-specific parameters + ir_.nLincsIter = lincsNumIterations; + ir_.nProjOrder = lincsExpansionOrder; + ir_.LincsWarnAngle = lincsWarnAngle; +} + +/*! \brief + * Reset the data structure so it can be reused. + * + * Set the coordinates and velocities back to their values before + * constraining. The scaled virial tensor and dHdLambda are zeroed. + * + */ +void ConstraintsTestData::reset() +{ + xPrime_ = xPrime0_; + xPrime2_ = xPrime0_; + v_ = v0_; + + if (computeVirial_) + { + for (int i = 0; i < DIM; i++) + { + for (int j = 0; j < DIM; j++) + { + virialScaled_[i][j] = 0; + } + } + } + dHdLambda_ = 0; +} + +/*! \brief + * Cleaning up the memory. + */ +ConstraintsTestData::~ConstraintsTestData() +{ + sfree(idef_.il[F_CONSTR].iatoms); + sfree(idef_.iparams); +} + +} // namespace test +} // namespace gmx diff --git a/src/gromacs/mdlib/tests/constr_impl.h b/src/gromacs/mdlib/tests/constrtestdata.h similarity index 90% rename from src/gromacs/mdlib/tests/constr_impl.h rename to src/gromacs/mdlib/tests/constrtestdata.h index 8755914968..8375d6bbc5 100644 --- a/src/gromacs/mdlib/tests/constr_impl.h +++ b/src/gromacs/mdlib/tests/constrtestdata.h @@ -43,27 +43,16 @@ * \ingroup module_mdlib */ -#ifndef GMX_MDLIB_TESTS_CONSTR_IMPL_H -#define GMX_MDLIB_TESTS_CONSTR_IMPL_H +#ifndef GMX_MDLIB_TESTS_CONSTRTESTDATA_H +#define GMX_MDLIB_TESTS_CONSTRTESTDATA_H -#include "gmxpre.h" - -#include - -#include - -#include -#include #include -#include "gromacs/fileio/gmxfio.h" #include "gromacs/gmxlib/nrnb.h" -#include "gromacs/gmxlib/nonbonded/nonbonded.h" #include "gromacs/gpu_utils/gpu_testutils.h" #include "gromacs/math/paddedvector.h" #include "gromacs/math/vec.h" #include "gromacs/math/vectypes.h" -#include "gromacs/mdlib/constr.h" #include "gromacs/mdlib/gmx_omp_nthreads.h" #include "gromacs/mdlib/lincs.h" #include "gromacs/mdlib/shake.h" @@ -72,13 +61,9 @@ #include "gromacs/mdtypes/inputrec.h" #include "gromacs/mdtypes/mdatom.h" #include "gromacs/pbcutil/pbc.h" -#include "gromacs/topology/block.h" #include "gromacs/topology/idef.h" #include "gromacs/topology/ifunc.h" #include "gromacs/topology/topology.h" -#include "gromacs/utility/smalloc.h" -#include "gromacs/utility/stringutil.h" -#include "gromacs/utility/unique_cptr.h" namespace gmx { @@ -218,20 +203,7 @@ class ConstraintsTestData ~ConstraintsTestData(); }; -/*! \brief Apply SHAKE constraints to the test data. - */ -void applyShake(ConstraintsTestData *testData, t_pbc pbc); -/*! \brief Apply LINCS constraints to the test data. - */ -void applyLincs(ConstraintsTestData *testData, t_pbc pbc); -/*! \brief Apply CUDA version of LINCS constraints to the test data. - * - * All the data is copied to the GPU device, then LINCS is applied and - * the resulting coordinates are copied back. - */ -void applyLincsCuda(ConstraintsTestData *testData, t_pbc pbc); - } // namespace test } // namespace gmx -#endif // GMX_MDLIB_TESTS_CONSTR_IMPL_H +#endif // GMX_MDLIB_TESTS_CONSTRTESTDATA_H diff --git a/src/gromacs/mdlib/tests/constr_impl.cpp b/src/gromacs/mdlib/tests/constrtestrunners.cpp similarity index 99% rename from src/gromacs/mdlib/tests/constr_impl.cpp rename to src/gromacs/mdlib/tests/constrtestrunners.cpp index 452fbd71e1..dff35e7870 100644 --- a/src/gromacs/mdlib/tests/constr_impl.cpp +++ b/src/gromacs/mdlib/tests/constrtestrunners.cpp @@ -44,7 +44,7 @@ #include "gmxpre.h" -#include "constr_impl.h" +#include "constrtestrunners.h" #include "config.h" @@ -53,7 +53,6 @@ #include #include -#include #include #include diff --git a/src/gromacs/mdlib/tests/constr_impl.cu b/src/gromacs/mdlib/tests/constrtestrunners.cu similarity index 96% rename from src/gromacs/mdlib/tests/constr_impl.cu rename to src/gromacs/mdlib/tests/constrtestrunners.cu index 45027bdbb8..88143aadfa 100644 --- a/src/gromacs/mdlib/tests/constr_impl.cu +++ b/src/gromacs/mdlib/tests/constrtestrunners.cu @@ -42,21 +42,17 @@ */ #include "gmxpre.h" -#include "constr_impl.h" +#include "constrtestrunners.h" #include #include #include -#include #include #include "gromacs/gpu_utils/devicebuffer.cuh" #include "gromacs/gpu_utils/gpu_utils.h" -#include "gromacs/math/vec.h" -#include "gromacs/math/vectypes.h" -#include "gromacs/mdlib/constr.h" #include "gromacs/mdlib/lincs_cuda.cuh" #include "gromacs/pbcutil/pbc.h" #include "gromacs/utility/unique_cptr.h" diff --git a/src/gromacs/mdlib/tests/constrtestrunners.h b/src/gromacs/mdlib/tests/constrtestrunners.h new file mode 100644 index 0000000000..45a27abbaf --- /dev/null +++ b/src/gromacs/mdlib/tests/constrtestrunners.h @@ -0,0 +1,74 @@ +/* + * This file is part of the GROMACS molecular simulation package. + * + * Copyright (c) 2018,2019, 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. + * + * GROMACS is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation; either version 2.1 + * of the License, or (at your option) any later version. + * + * GROMACS is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with GROMACS; if not, see + * http://www.gnu.org/licenses, or write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * If you want to redistribute modifications to GROMACS, please + * consider that scientific software is very special. Version + * control is crucial - bugs must be traceable. We will be happy to + * consider code for inclusion in the official distribution, but + * derived work must not be called official GROMACS. Details are found + * in the README & COPYING files - if they are missing, get the + * official version at http://www.gromacs.org. + * + * To help us fund GROMACS development, we humbly ask that you cite + * the research papers on the package. Check out http://www.gromacs.org. + */ +/*! \internal \file + * \brief SHAKE and LINCS tests header. + * + * Contains description and constructor for the test data accumulating object, + * declares CPU- and GPU-based functions used to apply SHAKE or LINCS on the + * test data. + * + * \author Artem Zhmurov + * \ingroup module_mdlib + */ + +#ifndef GMX_MDLIB_TESTS_CONSTRTESTRUNNERS_H +#define GMX_MDLIB_TESTS_CONSTRTESTRUNNERS_H + +#include "constrtestdata.h" + +struct t_pbc; + +namespace gmx +{ +namespace test +{ + +/*! \brief Apply SHAKE constraints to the test data. + */ +void applyShake(ConstraintsTestData *testData, t_pbc pbc); +/*! \brief Apply LINCS constraints to the test data. + */ +void applyLincs(ConstraintsTestData *testData, t_pbc pbc); +/*! \brief Apply CUDA version of LINCS constraints to the test data. + * + * All the data is copied to the GPU device, then LINCS is applied and + * the resulting coordinates are copied back. + */ +void applyLincsCuda(ConstraintsTestData *testData, t_pbc pbc); + +} // namespace test +} // namespace gmx + +#endif // GMX_MDLIB_TESTS_CONSTRTESTRUNNERS_H -- 2.11.4.GIT