Molecular Dynamics  v0.4
Project for the Practical hosted by the Scientific Computing Chair
LinkedCells.h
Go to the documentation of this file.
1 //
2 // Created by daniel on 22.05.24.
3 //
4 #pragma once
5 
6 #include "../Model.h"
7 #include "../../particleRepresentation/container/linkedCellsContainer/LinkedCellsContainer.h"
9 
18 class LinkedCells final : public Model {
19 private:
21  bool pull;
23  std::array<double, 3> pullingForce{};
25  std::unique_ptr<Force> forceBetweenDirectNeighborsInMembrane;
27 
35  std::vector<std::pair<Side, enumsStructs::BoundaryCondition> > boundarySettings;
36 
40  void processBoundaryForces();
41 
46  void processHaloCells();
47 
51  void pullMarkedParticles();
52 
56  void updateForcesMembrane();
57 
58 public:
73  LinkedCells(Force &force, double deltaT, std::array<double, 3> domainSize, double rCutOff,
75  std::array<double, 3> g = {}, MembraneParameters membraneParameters = MembraneParameters{},
78 
84  void step(int iteration) override;
85 
91  void updateForcesOptimized();
92 
96  void initializeForces() override;
97 
98  //The following methods are only needed for parallelization.
99 
100 #ifdef _OPENMP
104  void updateForcesParallelReduction();
105 
109  void updateForcesParallelSkipping();
110 
114  void updateForcesParallelLinear();
115 
119  void updateVelocitiesParallel();
120 
124  void updatePositionsParallel();
125 
129  void processBoundaryForcesParallel();
130 
136  void initializeReductionVectors(int maxNumThreads);
137 #endif
138 };
outputFormat
Supported output formats.
Definition: FileHandler.h:31
Interface representing the force that the source exerts on the target.
Definition: Force.h:14
Container to store the particles for simulation using the linked cells algorithm.
Definition: LinkedCellsContainer.h:22
Model that implements the linked cell algorithm.
Definition: LinkedCells.h:18
void processHaloCells()
Process all particles which have left the domain at the end of a simulation step according to the spe...
Definition: LinkedCells.cpp:109
enumsStructs::ParallelizationStrategy parallelizationStrategy
Definition: LinkedCells.h:26
LinkedCells(Force &force, double deltaT, std::array< double, 3 > domainSize, double rCutOff, FileHandler::outputFormat outputFormat, BoundarySet boundaryConditions, bool gravityOn, std::array< double, 3 > g={}, MembraneParameters membraneParameters=MembraneParameters{}, enumsStructs::ParallelizationStrategy parallelizationStrategy=enumsStructs::ParallelizationStrategy::none)
Contruct a new Linked Cells model.
Definition: LinkedCells.cpp:9
std::array< double, 3 > pullingForce
Definition: LinkedCells.h:23
std::unique_ptr< Force > forceBetweenDirectNeighborsInMembrane
Definition: LinkedCells.h:25
LinkedCellsContainer particles
Definition: LinkedCells.h:31
void initializeForces() override
Calculate forces at the beginning of the simulation that the old force is not 0.
Definition: LinkedCells.cpp:233
void updateForcesOptimized()
Implements the optimization we presented as our second idea. At the moment this is dead code,...
Definition: LinkedCells.cpp:219
std::unique_ptr< Force > forceBetweenDiagonalNeighborsInMembrane
Definition: LinkedCells.h:24
void processBoundaryForces()
Apply forces to all particles in boundary cells according to the specified boundary conditions.
Definition: LinkedCells.cpp:79
void pullMarkedParticles()
Apply to all particles that are marked a constant force.
Definition: LinkedCells.cpp:132
int pullingActiveUntil
Definition: LinkedCells.h:22
bool membraneSetting
Definition: LinkedCells.h:20
void step(int iteration) override
Perform one time step in the linked cells model.
Definition: LinkedCells.cpp:171
bool pull
Definition: LinkedCells.h:21
std::vector< std::pair< Side, enumsStructs::BoundaryCondition > > boundarySettings
Definition: LinkedCells.h:35
void updateForcesMembrane()
Calculate forces between particles in a membrane structure.
Definition: LinkedCells.cpp:140
Abstract base class for any model for molecule simulation.
Definition: Model.h:17
FileHandler::outputFormat outputFormat
Definition: Model.h:25
std::array< double, 3 > g
Definition: Model.h:32
bool gravityOn
Definition: Model.h:31
double deltaT
Definition: Model.h:30
Enumeration class corresponding to the force schema type.
Definition: ConfigurationFile.h:6026
Class corresponding to the rCutOff schema type.
Definition: ConfigurationFile.h:6444
ParallelizationStrategy
Definition: enumsStructs.h:51
Definition: enumsStructs.h:38
Definition: enumsStructs.h:151