ls1-MarDyn
ls1-MarDyn molecular dynamics code
EnsembleBase.h
1#pragma once
2
3#include "molecules/Component.h"
4
5#include <string>
6#include <vector>
7#include <map>
8
9#include "DomainBase.h"
10#include "molecules/MoleculeForwardDeclaration.h"
11
13
14class MixingRuleBase;
15
17
19
20class CellProcessor;
21
22class Domain;
23
25enum GlobalVariable {
26 NUM_PARTICLES = 1 << 0,
27 ENERGY = 1 << 1,
28 VOLUME = 1 << 2,
29 CHEMICAL_POTENTIAL = 1 << 3,
30 TEMPERATURE = 1 << 4,
31 PRESSURE = 1 << 5
32};
33
34enum Type {
35 undefined,
36 NVT,
37 muVT
38};
39
40class XMLfileUnits;
41
47class Ensemble {
48public:
49 Ensemble() :
50 _domain(nullptr) {
51 }
52
53 virtual ~~Ensemble();
54
55 virtual void readXML(XMLfileUnits& xmlconfig);
56
58 virtual unsigned long N() = 0;
59
61 virtual double V() = 0;
62
64 virtual double E() = 0;
65
67 virtual double mu() = 0;
68
70 virtual double p() = 0;
71
73 virtual double T() = 0;
74
77 virtual void updateGlobalVariable(ParticleContainer* particleContainer, GlobalVariable variable) = 0;
78
79 DomainBase*& domain() { return _domain; }
80
81 Component* getComponent(int cid) {
82 mardyn_assert(cid < static_cast<int>(_components.size()));
83 return &_components.at(cid);
84 }
85
86 Component* getComponent(std::string name) { return getComponent(_componentnamesToIds[name]); }
87
88 std::vector<Component>* getComponents() { return &_components; }
89
90 void addComponent(Component& component) { _components.push_back(component); }
91
94
96 int getType() { return _type; }
97
99 virtual std::list<ChemicalPotential>* getLmu() { return nullptr; }
100
102 virtual void initConfigXML(ParticleContainer* moleculeContainer) {};
103
105 virtual void prepare_start() {};
106
108 virtual void
109 beforeEventNewTimestep(ParticleContainer* moleculeContainer, DomainDecompBase* domainDecomposition,
110 unsigned long simstep) {};
111
113 virtual void
114 afterForces(ParticleContainer* moleculeContainer, DomainDecompBase* domainDecomposition,
115 CellProcessor* cellProcessor,
116 unsigned long simstep) {};
117
119 virtual void beforeThermostat(unsigned long simstep, unsigned long initStatistics) {};
120
122 virtual void storeSample(Molecule* m, uint32_t componentid) {};
123
124protected:
125
126
127 std::vector<Component> _components;
128 std::map<std::string, int> _componentnamesToIds;
129 std::vector<MixingRuleBase*> _mixingrules;
130 DomainBase* _domain;
131 Type _type = undefined;
132
133 /* EnsembleBase has a DomainBase pointer _domain, however this is not compatible
134 * with the needed Domain* for the ChemicalPotential/radial function
135 * and for whatever reason, Domain does not inherit from DomainBase.
136 */
137 Domain* _simulationDomain;
138};
Definition: CellProcessor.h:29
Definition: ChemicalPotential.h:16
Class implementing molecules as rigid rotators consisting out of different interaction sites (LJcente...
Definition: Component.h:14
Definition: DomainBase.h:7
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
Base class for ensembles.
Definition: EnsembleBase.h:47
virtual void updateGlobalVariable(ParticleContainer *particleContainer, GlobalVariable variable)=0
Calculate global variables.
virtual void beforeThermostat(unsigned long simstep, unsigned long initStatistics)
Definition: EnsembleBase.h:119
virtual void prepare_start()
Definition: EnsembleBase.h:105
virtual double V()=0
Returns the global volume of the ensemble.
virtual void beforeEventNewTimestep(ParticleContainer *moleculeContainer, DomainDecompBase *domainDecomposition, unsigned long simstep)
Definition: EnsembleBase.h:109
virtual void initConfigXML(ParticleContainer *moleculeContainer)
Definition: EnsembleBase.h:102
virtual double p()=0
Returns the global presure of the ensemble.
virtual unsigned long N()=0
Returns the global number of Molecules of the ensemble.
void setComponentLookUpIDs()
prepare the _compIDs used by the Vectorized*CellProcessors
Definition: EnsembleBase.cpp:91
virtual void storeSample(Molecule *m, uint32_t componentid)
Definition: EnsembleBase.h:122
virtual std::list< ChemicalPotential > * getLmu()
Definition: EnsembleBase.h:99
virtual double T()=0
Returns the global Temperature of the ensemble.
int getType()
Definition: EnsembleBase.h:96
virtual void afterForces(ParticleContainer *moleculeContainer, DomainDecompBase *domainDecomposition, CellProcessor *cellProcessor, unsigned long simstep)
Definition: EnsembleBase.h:114
virtual double mu()=0
Returns the global chemical potential of the ensemble.
virtual double E()=0
Returns the global energy of the ensemble.
FullMolecule modeled as LJ sphere with point polarities.
Definition: FullMolecule.h:18
Definition: MixingRuleBase.h:8
This Interface is used to get access to particles and pairs of particles.
Definition: ParticleContainer.h:69
XML file with unit attributes abstraction.
Definition: xmlfileUnits.h:25
::xsd::cxx::tree::name< char, token > name
C++ type corresponding to the Name XML Schema built-in type.
Definition: vtk-punstructured.h:288
::xsd::cxx::tree::string< char, simple_type > string
C++ type corresponding to the string XML Schema built-in type.
Definition: vtk-punstructured.h:270