/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2020, by the GROMACS development team, led by
+ * Copyright (c) 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.
#include <gtest/gtest.h>
#include "gromacs/topology/exclusionblocks.h"
+#include "gromacs/utility/listoflists.h"
#include "nblib/exception.h"
#include "nblib/particletype.h"
+#include "nblib/sequencing.hpp"
#include "nblib/tests/testsystems.h"
#include "nblib/topology.h"
+#include "nblib/topologyhelpers.h"
+#include "nblib/particlesequencer.h"
namespace nblib
{
TEST(NBlibTest, TopologyHasExclusions)
{
- WaterTopologyBuilder waters;
- Topology watersTopology = waters.buildTopology(2);
- const gmx::ListOfLists<int>& testExclusions = watersTopology.getGmxExclusions();
+ WaterTopologyBuilder waters;
+ Topology watersTopology = waters.buildTopology(2);
+ ExclusionLists<int> exclusionLists = watersTopology.exclusionLists();
+ const gmx::ListOfLists<int> testExclusions(std::move(exclusionLists.ListRanges),
+ std::move(exclusionLists.ListElements));
const std::vector<std::vector<int>>& refExclusions = { { 0, 1, 2 }, { 0, 1, 2 }, { 0, 1, 2 },
{ 3, 4, 5 }, { 3, 4, 5 }, { 3, 4, 5 } };
std::vector<std::tuple<Molecule, int>> molecules{ std::make_tuple(water, 2),
std::make_tuple(methanol, 1) };
- detail::ParticleSequencer particleSequencer;
+ ParticleSequencer particleSequencer;
particleSequencer.build(molecules);
auto pairs = detail::sequenceIDs<HarmonicBondType>(molecules, particleSequencer);
std::vector<std::tuple<Molecule, int>> molecules{ std::make_tuple(water, 2),
std::make_tuple(methanol, 1) };
- detail::ParticleSequencer particleSequencer;
+ ParticleSequencer particleSequencer;
particleSequencer.build(molecules);
auto pairs = detail::sequenceIDs<HarmonicBondType>(molecules, particleSequencer);
Molecule water = WaterMoleculeBuilder{}.waterMolecule();
Molecule methanol = MethanolMoleculeBuilder{}.methanolMolecule();
- CubicBondType testBond(1., 1., 1.);
- DefaultAngle testAngle(Degrees(1), 1);
+ CubicBondType testBond(1., 1., 1.);
+ HarmonicAngleType testAngle(Degrees(1), 1);
water.addInteraction(ParticleName("H1"), ParticleName("H2"), testBond);
water.addInteraction(ParticleName("H1"), ParticleName("Oxygen"), ParticleName("H2"), testAngle);
auto interactionData = topology.getInteractionData();
auto& harmonicBonds = pickType<HarmonicBondType>(interactionData);
auto& cubicBonds = pickType<CubicBondType>(interactionData);
- auto& angleInteractions = pickType<DefaultAngle>(interactionData);
+ auto& angleInteractions = pickType<HarmonicAngleType>(interactionData);
HarmonicBondType ohBond(1., 1.);
HarmonicBondType ohBondMethanol(1.01, 1.02);
EXPECT_EQ(cubicBondsReference, cubicBonds.parameters);
EXPECT_EQ(cubicIndicesReference, cubicBonds.indices);
- DefaultAngle methanolAngle(Degrees(108.52), 397.5);
- std::vector<DefaultAngle> angleReference{ testAngle, methanolAngle };
- std::vector<InteractionIndex<DefaultAngle>> angleIndicesReference{
+ HarmonicAngleType methanolAngle(Degrees(108.52), 397.5);
+ std::vector<HarmonicAngleType> angleReference{ testAngle, methanolAngle };
+ std::vector<InteractionIndex<HarmonicAngleType>> angleIndicesReference{
{ std::min(H1, H2), Ow, std::max(H1, H2), 0 }, { std::min(MeH1, MeO1), Me1, std::max(MeO1, MeH1), 1 }
};
EXPECT_EQ(angleReference, angleInteractions.parameters);
reference.push_back(localBlock);
reference.push_back(localBlock);
- std::vector<gmx::ExclusionBlock> probe = detail::toGmxExclusionBlock(testInput);
+ std::vector<gmx::ExclusionBlock> probe = toGmxExclusionBlock(testInput);
ASSERT_EQ(reference.size(), probe.size());
for (size_t i = 0; i < reference.size(); ++i)