ls1-MarDyn
ls1-MarDyn molecular dynamics code
KineticProfile.h
1//
2// Created by Kruegener on 10/22/2018.
3//
4
5#ifndef MARDYN_KINETICPROFILE_H
6#define MARDYN_KINETICPROFILE_H
7
8#include "ProfileBase.h"
9#include "plugins/SpatialProfile.h"
10
14class KineticProfile final : public ProfileBase {
15public:
16 ~~KineticProfile() final = default;
17 void record(Molecule &mol, unsigned long uID) final {
18 double mv2 = 0.0;
19 double Iw2 = 0.0;
20 mol.calculate_mv2_Iw2(mv2, Iw2);
21 _localProfile[uID] += mv2 + Iw2;
22 }
23 void collectAppend(DomainDecompBase *domainDecomp, unsigned long uID) final {
24 domainDecomp->collCommAppendDouble(_localProfile[uID]);
25 }
26 void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final {
27 _globalProfile[uID] = domainDecomp->collCommGetDouble();
28 }
29 void output(string prefix, long unsigned accumulatedDatasets) final;
30 void reset(unsigned long uID) final {
31 _localProfile[uID] = 0.0;
32 _globalProfile[uID] = 0.0;
33 }
34 int comms() final {return 1;}
35
36 double getGlobalKineticEnergy(unsigned long uid) const {
37 return _globalProfile.at(uid);
38 }
39
40private:
41 // Local 1D Profile
42 std::map<unsigned, double> _localProfile;
43 // Global 1D Profile
44 std::map<unsigned, double> _globalProfile;
45
46 void writeDataEntry(unsigned long uID, ofstream &outfile) const final;
47
48};
49
50
51#endif //MARDYN_KINETICPROFILE_H
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
void collectRetrieve(DomainDecompBase *domainDecomp, unsigned long uID) final
Get global values after AllReduceSum per bin. Write to e.g. _globalProfile.
Definition: KineticProfile.h:26
void output(string prefix, long unsigned accumulatedDatasets) final
Whatever is necessary to output for this profile.
Definition: KineticProfile.cpp:7
int comms() final
1D profiles like a number density profile should return 1 here. 3D profiles that have 3 entries per b...
Definition: KineticProfile.h:34
void collectAppend(DomainDecompBase *domainDecomp, unsigned long uID) final
Append all necessary communication per bin to the DomainDecomposition. Append from e....
Definition: KineticProfile.h:23
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: KineticProfile.h:17
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: KineticProfile.h:30
Base class for all Profile outputs used by KartesianProfile.
Definition: ProfileBase.h:34