ls1-MarDyn
ls1-MarDyn molecular dynamics code
AutoPasContainer.h
Go to the documentation of this file.
1
7#pragma once
8
9#include "ParticleContainer.h"
10
11#include <autopas/AutoPas.h>
12#include <autopas/molecularDynamics/autopasmd.h>
13
18public:
19 AutoPasContainer(double cutoff);
20
21 ~~AutoPasContainer() override {
22#ifdef ENABLE_MPI
23 _logFile.close();
24#endif
25 };
26
60 void readXML(XMLfileUnits &xmlconfig) override;
61
62 bool rebuild(double bBoxMin[3], double bBoxMax[3]) override;
63
64 void update() override;
65
66 bool addParticle(Molecule &particle, bool inBoxCheckedAlready = false, bool checkWhetherDuplicate = false,
67 const bool &rebuildCaches = false) override;
68
69 bool addHaloParticle(Molecule &particle, bool inBoxCheckedAlready = false, bool checkWhetherDuplicate = false,
70 const bool &rebuildCaches = false) override;
71
72 void addParticles(std::vector<Molecule> &particles, bool checkWhetherDuplicate = false) override;
73
74 void traverseCells(CellProcessor &cellProcessor) override;
75
76 void traverseNonInnermostCells(CellProcessor &cellProcessor) override;
77
78 void traversePartialInnermostCells(CellProcessor &cellProcessor, unsigned int stage, int stageCount) override;
79
80 ParticleIterator iterator(ParticleIterator::Type t) override;
81
82 RegionParticleIterator regionIterator(const double startCorner[3], const double endCorner[3],
83 ParticleIterator::Type t) override;
84
85 unsigned long getNumberOfParticles() override;
86
87 void clear() override;
88
89 void deleteOuterParticles() override;
90
91 double get_halo_L(int index) const override;
92
93 double getCutoff() const override;
94
95 double getSkin() const override;
96
97 void deleteMolecule(ParticleIterator &moleculeIter, const bool &rebuildCaches) override;
98
99 double getEnergy(ParticlePairsHandler *particlePairsHandler, Molecule *m1, CellProcessor &cellProcessor) override;
100
101 void updateInnerMoleculeCaches() override;
102
104
105 void updateMoleculeCaches() override;
106
107 std::variant<ParticleIterator, SingleCellIterator<ParticleCell>> getMoleculeAtPosition(const double pos[3]) override;
108
109 unsigned long initCubicGrid(std::array<unsigned long, 3> numMoleculesPerDimension,
110 std::array<double, 3> simBoxLength, size_t seed_offset) override;
111
112 double *getCellLength() override;
113
114 double *getHaloSize() override;
115
116 // from MemoryProfilable
117 size_t getTotalSize() override { return 0; }
118
119 void printSubInfo(int offset) override {}
120
121 std::string getName() override { return "AutoPasContainer"; }
122
123 void setCutoff(double cutoff) override { _cutoff = cutoff; }
124
125 std::vector<Molecule> getInvalidParticles() override {
126 return std::move(_invalidParticles);
127 }
128
129 bool isInvalidParticleReturner() override { return true; }
130
132private:
137 template <bool shifting>
138 void traverseTemplateHelper();
139
146 template <typename F>
147 std::pair<double,double> iterateWithFunctor(F&& functor);
148
149 double _cutoff{0.};
150 double _verletSkin;
151 double _relativeOptimumRange;
152 double _relativeBlacklistRange;
153 unsigned int _verletRebuildFrequency;
154 unsigned int _verletClusterSize;
155 unsigned int _tuningFrequency;
156 unsigned int _tuningSamples;
157 unsigned int _maxEvidence;
158 unsigned int _maxTuningPhasesWithoutTest;
159 unsigned int _evidenceForPrediction;
160 autopas::AutoPas<Molecule> _autopasContainer;
161 bool _autopasContainerIsInitialized{false};
162
163 std::set<autopas::TraversalOption> _traversalChoices;
164 std::set<autopas::ContainerOption> _containerChoices;
165 autopas::SelectorStrategyOption _selectorStrategy;
166 autopas::TuningStrategyOption _tuningStrategyOption;
167 autopas::ExtrapolationMethodOption _extrapolationMethod;
168 autopas::AcquisitionFunctionOption _tuningAcquisitionFunction;
169 std::set<autopas::DataLayoutOption> _dataLayoutChoices;
170 std::set<autopas::Newton3Option> _newton3Choices;
171 autopas::Logger::LogLevel _logLevel{autopas::Logger::LogLevel::info};
172
173 std::vector<Molecule> _invalidParticles;
174 bool _useAVXFunctor{true};
175
176 ParticlePropertiesLibrary<double, size_t> _particlePropertiesLibrary;
177
178#ifdef ENABLE_MPI
179 std::ofstream _logFile;
180#endif
181};
Definition: AutoPasContainer.h:17
void updateBoundaryAndHaloMoleculeCaches() override
Update the caches of the molecules, that lie in the boundary or halo cells. The caches of boundary an...
Definition: AutoPasContainer.cpp:445
void setCutoff(double cutoff) override
Definition: AutoPasContainer.h:123
void updateMoleculeCaches() override
Update the caches of the molecules.
Definition: AutoPasContainer.cpp:449
bool rebuild(double bBoxMin[3], double bBoxMax[3]) override
rebuild the datastructure
Definition: AutoPasContainer.cpp:146
bool addHaloParticle(Molecule &particle, bool inBoxCheckedAlready=false, bool checkWhetherDuplicate=false, const bool &rebuildCaches=false) override
add a single Molecule to the ParticleContainer, ensures that it is added in the halo.
Definition: AutoPasContainer.cpp:260
void updateInnerMoleculeCaches() override
Update the caches of the molecules, that lie in inner cells. The caches of boundary and halo cells is...
Definition: AutoPasContainer.cpp:441
double * getHaloSize() override
Definition: AutoPasContainer.cpp:473
unsigned long getNumberOfParticles() override
Definition: AutoPasContainer.cpp:405
double get_halo_L(int index) const override
returns the width of the halo stripe (for the given dimension index)
Definition: AutoPasContainer.cpp:426
bool addParticle(Molecule &particle, bool inBoxCheckedAlready=false, bool checkWhetherDuplicate=false, const bool &rebuildCaches=false) override
add a single Molecule to the ParticleContainer.
Definition: AutoPasContainer.cpp:250
void deleteOuterParticles() override
delete all Particles which are not within the bounding box
Definition: AutoPasContainer.cpp:416
void readXML(XMLfileUnits &xmlconfig) override
Definition: AutoPasContainer.cpp:88
std::string getConfigurationAsString() override
Definition: AutoPasContainer.cpp:499
std::variant< ParticleIterator, SingleCellIterator< ParticleCell > > getMoleculeAtPosition(const double pos[3]) override
Gets a molecule by its position.
Definition: AutoPasContainer.cpp:453
void addParticles(std::vector< Molecule > &particles, bool checkWhetherDuplicate=false) override
adds a whole vector of particles
Definition: AutoPasContainer.cpp:266
void clear() override
Delete all molecules in container.
Definition: AutoPasContainer.cpp:414
void traverseCells(CellProcessor &cellProcessor) override
traverse pairs which are close to each other
Definition: AutoPasContainer.cpp:348
void update() override
do necessary updates resulting from changed particle positions
Definition: AutoPasContainer.cpp:238
Definition: CellProcessor.h:29
FullMolecule modeled as LJ sphere with point polarities.
Definition: FullMolecule.h:18
This Interface is used to get access to particles and pairs of particles.
Definition: ParticleContainer.h:69
Definition: ParticleIterator.h:50
interface for defining the action performed when processing a pair
Definition: ParticlePairsHandler.h:38
Definition: RegionParticleIterator.h:33
XML file with unit attributes abstraction.
Definition: xmlfileUnits.h:25
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-punstructured.h:270
Definition: FakedOptFFT.h:23