2#ifndef PARTICLEPAIRS2POTFORCEADAPTER_H_
3#define PARTICLEPAIRS2POTFORCEADAPTER_H_
5#include "molecules/potforce.h"
6#include "particleContainer/handlerInterfaces/ParticlePairsHandler.h"
24 _domain(domain), _virial(0.0), _upot6LJ(0.0), _upotXpoles(0.0), _myRF(0.0) {
27 const int numThreads = mardyn_get_max_threads();
28 Log::global_log->info() <<
"ParticlePairs2PotForceAdapter: allocate data for " << numThreads <<
" threads." << std::endl;
29 _threadData.resize(numThreads);
35 const int myid = mardyn_get_thread_num();
36 _threadData[myid] = myown;
46 const int myid = mardyn_get_thread_num();
47 delete _threadData[myid];
66 const int myid = mardyn_get_thread_num();
68 _threadData[myid]->clear();
77 double glob_virial = 0.0;
78 double glob_upot6LJ = 0.0;
79 double glob_upotXpoles = 0.0;
80 double glob_myRF = 0.0;
83 #pragma omp parallel reduction(+:glob_virial, glob_upot6LJ, glob_upotXpoles, glob_myRF)
86 const int myid = mardyn_get_thread_num();
87 glob_virial += _threadData[myid]->_virial;
88 glob_upot6LJ += _threadData[myid]->_upot6LJ;
89 glob_upotXpoles += _threadData[myid]->_upotXpoles;
90 glob_myRF += _threadData[myid]->_myRF;
93 _virial = glob_virial;
94 _upot6LJ = glob_upot6LJ;
95 _upotXpoles = glob_upotXpoles;
98 _domain.
setLocalUpot(_upot6LJ / 6. + _upotXpoles + _myRF);
103 PP2PFAThreadData() : _virial(0.0), _upot6LJ(0.0), _upotXpoles(0.0), _myRF(0.0), _comp2Param(0) {}
106 if(_comp2Param != 0) {
113 if (_comp2Param != 0) {
133 std::vector<PP2PFAThreadData *> _threadData;
151 const int tid = mardyn_get_thread_num();
154 ParaStrm& params = (* my_threadData._comp2Param)(molecule1.componentid(), molecule2.componentid());
159 double dummy1, dummy2, dummy3, dummy4[3], Virial3[3];
161 case MOLECULE_MOLECULE :
163 PotForce(molecule1, molecule2, params, distanceVector, my_threadData._upot6LJ, my_threadData._upotXpoles, my_threadData._myRF, Virial3, calculateLJ );
164 my_threadData._virial += 2*(Virial3[0]+Virial3[1]+Virial3[2]);
165 return my_threadData._upot6LJ + my_threadData._upotXpoles;
166 case MOLECULE_HALOMOLECULE :
168 PotForce(molecule1, molecule2, params, distanceVector, dummy1, dummy2, dummy3, dummy4, calculateLJ);
170 case MOLECULE_MOLECULE_FLUID :
175 FluidPot(molecule1, molecule2, params, distanceVector, dummy1, dummy2, dummy3, calculateLJ);
176 return dummy1 / 6.0 + dummy2 + dummy3;
Definition: Comp2Param.h:15
This class is used to read in the phasespace and to handle macroscopic values.
Definition: Domain.h:47
void setLocalVirial(double Virial)
set the virial of the local process
Definition: Domain.cpp:113
void setLocalUpot(double Upot)
set the potential of the local process
Definition: Domain.cpp:109
Comp2Param & getComp2Params()
get the parameter streams
Definition: Domain.cpp:147
FullMolecule modeled as LJ sphere with point polarities.
Definition: FullMolecule.h:18
Definition: ParaStrm.h:21
void reset_read()
reset reading "pointer" to the beginning of the stream
Definition: ParaStrm.h:51
calculate pair forces and collect macroscopic values
Definition: ParticlePairs2PotForceAdapter.h:20
double processPair(Molecule &molecule1, Molecule &molecule2, double distanceVector[3], PairType pairType, double dd, bool calculateLJ=true)
Definition: ParticlePairs2PotForceAdapter.h:150
void init()
initialize macroscopic values
Definition: ParticlePairs2PotForceAdapter.h:56
void finish()
calculate macroscopic values
Definition: ParticlePairs2PotForceAdapter.h:76
~ParticlePairs2PotForceAdapter()
Destructor.
Definition: ParticlePairs2PotForceAdapter.h:41
ParticlePairs2PotForceAdapter(Domain &domain)
Constructor.
Definition: ParticlePairs2PotForceAdapter.h:23
interface for defining the action performed when processing a pair
Definition: ParticlePairsHandler.h:38
static void exit(int exitcode)
Terminate simulation with given exit code.
Definition: Simulation.cpp:155
Definition: ParticlePairs2PotForceAdapter.h:102