ls1-MarDyn
ls1-MarDyn molecular dynamics code
Virial2DProfile.h
1//
2// Created by Heier on 07/29/2020.
3//
4
5#ifndef MARDYN_VIRIAL2D_H
6#define MARDYN_VIRIAL2D_H
7
8#include "ProfileBase.h"
9#include "plugins/SpatialProfile.h"
10
11
12class DensityProfile;
13class DOFProfile;
14class KineticProfile;
15
16
17class Virial2DProfile final : public ProfileBase {
18public:
19 Virial2DProfile(DensityProfile* densProf, DOFProfile * dofProf, KineticProfile * kinProf) :
20 _densityProfile(densProf), _dofProfile(dofProf), _kineticProfile(kinProf), _local3dProfile(), _global3dProfile() {
21 }
22
23 ~~Virial2DProfile() final = default;
24
25
26 void record(Molecule& mol, unsigned long uID) final {
27 for (unsigned short d = 0; d < 3; d++) {
28 _local3dProfile[uID][d] += mol.Vi(d);
29 }
30 }
31
32 void collectAppend(DomainDecompBase* domainDecomp, unsigned long uID) final {
33 for (unsigned short d = 0; d < 3; d++) {
34 domainDecomp->collCommAppendDouble(_local3dProfile[uID][d]);
35 }
36 }
37
38 void collectRetrieve(DomainDecompBase* domainDecomp, unsigned long uID) final {
39 for (unsigned short d = 0; d < 3; d++) {
40 _global3dProfile[uID][d] = domainDecomp->collCommGetDouble();
41 }
42 }
43
44
45 void output(string prefix, long unsigned accumulatedDatasets) final;
46
47 void reset(unsigned long uID) final {
48 for (unsigned d = 0; d < 3; d++) {
49 _local3dProfile[uID][d] = 0.0;
50 _global3dProfile[uID][d] = 0.0;
51 }
52 }
53
54 int comms() final { return 3; }
55
56private:
57 DensityProfile* _densityProfile;
58 DOFProfile* _dofProfile;
59 KineticProfile* _kineticProfile;
60
61 // Local 3D Profile
62 std::map<unsigned, std::array<double, 3>> _local3dProfile;
63 // Global 3D Profile
64 std::map<unsigned, std::array<double, 3>> _global3dProfile;
65
66 // Only needed because its abstract, all output handled by output()
67 void writeDataEntry(unsigned long uID, ofstream& outfile) const final;
68
69};
70
71
72#endif //MARDYN_VIRIAL_H
Records (NO OUTPUT) the DOF of molecules per bin specified by Sampling grid in KartesianProfile.
Definition: DOFProfile.h:15
Outputs the number density of molecules per bin specified by Sampling grid in KartesianProfile.
Definition: DensityProfile.h:14
handle boundary region and multiple processes
Definition: DomainDecompBase.h:51
FullMolecule modeled as LJ sphere with point polarities.
Definition: FullMolecule.h:18
Records (NO OUTPUT) the 2xKinetic Profile of molecules per bin specified by Sampling grid in Kartesia...
Definition: KineticProfile.h:14
Base class for all Profile outputs used by KartesianProfile.
Definition: ProfileBase.h:34
Definition: Virial2DProfile.h:17
void record(Molecule &mol, unsigned long uID) final
The recording step defines what kind of data needs to be recorded for a single molecule with a corres...
Definition: Virial2DProfile.h:26
void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final
Get global values after AllReduceSum per bin. Write to e.g. _globalProfile.
Definition: Virial2DProfile.h:38
int comms() final
1D profiles like a number density profile should return 1 here. 3D profiles that have 3 entries per b...
Definition: Virial2DProfile.h:54
void output(string prefix, long unsigned accumulatedDatasets) final
Whatever is necessary to output for this profile.
Definition: Virial2DProfile.cpp:11
void reset(unsigned long uID) final
Used to reset all array contents for a specific uID in order to start the next recording timeframe.
Definition: Virial2DProfile.h:47
void collectAppend(DomainDecompBase *domainDecomp, unsigned long uID) final
Append all necessary communication per bin to the DomainDecomposition. Append from e....
Definition: Virial2DProfile.h:32