#include "TwoCellsInteractionHitrateGeneratorTest.h"#include <array>#include <cmath>#include <set>#include <vector>#include "autopas/utils/ExceptionHandler.h"#include "generators/src/PseudoContainer.h"#include "generators/src/TwoCellsInteractionHitrateGenerator.h"#include "molecularDynamicsLibrary/MoleculeLJ.h"
Typedefs | |
| using | MoleculeType = mdLib::MoleculeLJ |
| Particle type used across all tests. | |
| using | CellType = std::vector< MoleculeType > |
| Container type for a single cell's particles. | |
Functions | |
| double | dist3D (const MoleculeType &a, const MoleculeType &b) |
| Computes the Euclidean distance between two particles. | |
| void | fill (CellType &v1, CellType &v2, std::size_t n, double hitrate, unsigned int seed=42) |
| Fills two cells with n particles at the requested hitrate using the module-level box definitions. | |
| TEST_F (TwoCellsInteractionHitrateGeneratorTest, testParticleCount) | |
| Both cells receive exactly n particles for every (n, hitrate) combination. | |
| TEST_F (TwoCellsInteractionHitrateGeneratorTest, testPositionsInBounds) | |
| Every particle lies strictly within its own cell's bounding box. | |
| TEST_F (TwoCellsInteractionHitrateGeneratorTest, testInteractionCountHitrateZero) | |
| With hitrate=0 every particle is in the far zone: no cross-cell pair is within cutoff. | |
| TEST_F (TwoCellsInteractionHitrateGeneratorTest, testPairedParticlesInRange) | |
| At least k cross-cell pairs are within cutoff after filling. | |
| TEST_F (TwoCellsInteractionHitrateGeneratorTest, testFarParticlesOutOfRange) | |
| Far particles are out of range of every particle in the other cell. | |
| TEST_F (TwoCellsInteractionHitrateGeneratorTest, testUniqueIDs) | |
| No two particles across both cells share an ID. | |
| TEST_F (TwoCellsInteractionHitrateGeneratorTest, testDeterminism) | |
| The same seed produces identical particle positions across two independent calls. | |
| TEST_F (TwoCellsInteractionHitrateGeneratorTest, testPreconditionNonAdjacentCells) | |
| Non-adjacent cells (gap between boxMax1[0] and boxMin2[0]) must throw. | |
| TEST_F (TwoCellsInteractionHitrateGeneratorTest, testPreconditionHitrateOutOfRange) | |
| Hitrate outside [0, 1] must throw. | |
| TEST_F (TwoCellsInteractionHitrateGeneratorTest, testPreconditionCellTooNarrow) | |
| A cell whose x-width does not exceed 1.2 * kCutoff violates the factor set in the Generator, so it is too narrow and should throw. | |
Variables | |
| constexpr double | kCutoff = 3.0 |
| Cutoff radius used across all tests. | |
| constexpr double | kCellSize = 8.0 |
| Each cell has dimensions kCellSize x kCellSize x kCellSize. | |
| const std::array< double, 3 > | kBoxMin1 = {0., 0., 0.} |
| Lower corner of the Bounding box of cell 1. | |
| const std::array< double, 3 > | kBoxMax1 = {kCellSize, kCellSize, kCellSize} |
| Upper corner of cell 1's bounding box. | |
| const std::array< double, 3 > | kBoxMin2 = {kCellSize, 0., 0.} |
| Lower corner of the Bounding box of cell 2. | |
| const std::array< double, 3 > | kBoxMax2 = {2. * kCellSize, kCellSize, kCellSize} |
| Upper corner of cell 2's bounding box. | |
| double dist3D | ( | const MoleculeType & | a, |
| const MoleculeType & | b | ||
| ) |
Computes the Euclidean distance between two particles.
| a | First particle. |
| b | Second particle. |
Fills two cells with n particles at the requested hitrate using the module-level box definitions.
| v1 | Target vector for cell 1 particles. |
| v2 | Target vector for cell 2 particles. |
| n | Number of particles per cell. |
| hitrate | Fraction of particle pairs that are within cutoff distance. |
| seed | RNG seed for deterministic placement. |
| TEST_F | ( | TwoCellsInteractionHitrateGeneratorTest | , |
| testFarParticlesOutOfRange | |||
| ) |
Far particles are out of range of every particle in the other cell.
A cell1 particle is "far" if its x-coordinate is more than kCutoff below kBoxMax1[0] (the shared face). A cell2 particle is "far" if its x-coordinate is more than kCutoff above kBoxMin2[0].
| TEST_F | ( | TwoCellsInteractionHitrateGeneratorTest | , |
| testPairedParticlesInRange | |||
| ) |
At least k cross-cell pairs are within cutoff after filling.
Particles are shuffled so we count all in-range pairs rather than checking by index.
| const std::array<double, 3> kBoxMin1 = {0., 0., 0.} |
Lower corner of the Bounding box of cell 1.
Bounding box occupies [0, kCellSize] in all dimensions.
| const std::array<double, 3> kBoxMin2 = {kCellSize, 0., 0.} |
Lower corner of the Bounding box of cell 2.
The Bounding box is adjacent to cell 1, occupies [kCellSize, 2*kCellSize] in x.