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