ls1-MarDyn
ls1-MarDyn molecular dynamics code
Permittivity.h
1/*
2 * Permittivity.h
3 *
4 * Created on: November 2019
5 * Author: Joshua Marx
6 */
7
8 // DESCRIPTION: Samples the relative permittivity of Stockmayer fluids in the NVT ensemble
9 // Important: Permittivity may take a long time to converge, i.e. a few million steps with ~1000 particles. Reducing number of slabs for the thermostat can drastically improve results!
10
11#ifndef SRC_PLUGINS_PERMITTIVITY_H_
12#define SRC_PLUGINS_PERMITTIVITY_H_
13
14#include "Domain.h"
15#include "parallel/DomainDecompBase.h"
16#include "particleContainer/ParticleContainer.h"
17#include "plugins/PluginBase.h"
18
19class Permittivity: public PluginBase {
20public:
21
22 void init(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) override;
23 void readXML(XMLfileUnits& xmlconfig) override;
24 void record(ParticleContainer* particleContainer);
25 void endStep(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain,
26 unsigned long simstep) override;
27 void reset();
28 void collect(DomainDecompBase* domainDecomp);
29 void writeRunningAverage(unsigned long indexM, double tempMX, double tempMY, double tempMZ, double tempMSquared);
30 void output(Domain* domain, unsigned long timestep);
31 void finish(ParticleContainer* particleContainer, DomainDecompBase* domainDecomp, Domain* domain) override{};
32 std::string getPluginName() override { return std::string("Permittivity"); }
33 static PluginBase* createInstance() { return new Permittivity();}
34
35
36
37private:
38 bool _readStartingStep; // Auxiliary bool variable to read the current time step during the first iteration of endStep
39 unsigned long _writeFrequency; // Write frequency for all profiles -> Length of recording frame before output
40 unsigned long _initStatistics; // Timesteps to skip at start of the simulation
41 unsigned long _recordingTimesteps; // Record every Nth timestep during recording frame
42 unsigned long _accumulatedSteps; // Number of steps in a block
43 unsigned long _runningAverageSteps; // Timesteps for running average output
44 unsigned long _totalNumTimeSteps; // Total number of time steps
45 unsigned long _startingStep; // current time step at the start of simulation
46 unsigned long _numParticlesLocal; // Counts number of particles considered for each block locally
47 unsigned long _RAVCounter;
48 unsigned _numOutputs; // Number of output values to be written
49 unsigned _numComponents; // Number of components
50 unsigned _currentOutputNum; // Number of current block
51 std::map<unsigned,double> _myAbs; // Dipole moment of component
52 std::map<unsigned,unsigned long> _numParticles; // Counts number of particles considered for each block globally
53 std::map<unsigned,double> _outputSquaredM; // Total average squared dipole moment for each block
54 std::map<unsigned, std::map<unsigned, double>> _outputM; // Total average dipole moment for each block
55 std::map<unsigned long, std::map<unsigned long, double >> _localM; // Total dipole moment local
56 std::map<unsigned long, std::map<unsigned long, double >> _globalM; // Total dipole moment global
57 std::array<double, 3> simBoxSize;
58 double _totalAverageM[3]; // Total dipole moment averaged over whole production run
59 double _totalAverageSquaredM; // Total squared dipole moment averaged over whole production run
60 double _MRAV[3]; // Running average for M
61 double _MSquaredRAV; // Running average for <M2>
62 double _permRAV; // Running average for permittivity (without consideration of <M>2
63 double _V; // Box volume
64 double _T; // Target temperature
65 std::ofstream _ravStream;
66 std::string _outputPrefix;
67};
68
69#endif /*SRC_PLUGINS_PERMITTIVITY_H_*/
handle boundary region and multiple processes
Definition: DomainDecompBase.h:51
This class is used to read in the phasespace and to handle macroscopic values.
Definition: Domain.h:47
This Interface is used to get access to particles and pairs of particles.
Definition: ParticleContainer.h:69
Definition: Permittivity.h:19
void finish(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override
Method finish will be called at the end of the simulation.
Definition: Permittivity.h:31
void readXML(XMLfileUnits &xmlconfig) override
Method readXML will be called once for each plugin section in the input file.
Definition: Permittivity.cpp:12
std::string getPluginName() override
return the name of the plugin
Definition: Permittivity.h:32
void init(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain) override
Method init will be called at the begin of the simulation.
Definition: Permittivity.cpp:21
void endStep(ParticleContainer *particleContainer, DomainDecompBase *domainDecomp, Domain *domain, unsigned long simstep) override
Method endStep will be called at the end of each time step.
Definition: Permittivity.cpp:206
The PluginBase class provides the interface for any kind of output/plugin classes - called "(output) ...
Definition: PluginBase.h:47
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