MaMiCo
1.2
Toggle main menu visibility
Loading...
Searching...
No Matches
coupling
cell-mappings
ComputeMeanPotentialEnergyMapping.h
1
// Copyright (C) 2015 Technische Universitaet Muenchen
2
// This file is part of the Mamico project. For conditions of distribution
3
// and use, please see the copyright notice in Mamico's main folder, or at
4
// www5.in.tum.de/mamico
5
#ifndef _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_COMPUTEMEANPOTENTIALENERGYMAPPING_H_
6
#define _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_COMPUTEMEANPOTENTIALENERGYMAPPING_H_
7
8
#include "coupling/BoundaryForceController.h"
9
#include "coupling/interface/MDSolverInterface.h"
10
#include "coupling/interface/Molecule.h"
11
#include <iostream>
12
13
namespace
coupling
{
14
namespace
cellmappings {
15
template
<
class
LinkedCell,
unsigned
int
dim>
class
ComputeMeanPotentialEnergyMapping
;
16
}
17
}
// namespace coupling
18
26
template
<
class
LinkedCell,
unsigned
int
dim>
class
coupling::cellmappings::ComputeMeanPotentialEnergyMapping
{
27
public
:
32
ComputeMeanPotentialEnergyMapping
(
coupling::interface::MDSolverInterface<LinkedCell, dim>
*
const
mdSolverInterface,
33
const
coupling::BoundaryForceController<LinkedCell, dim>
& boundaryForceController)
34
: _mdSolverInterface(mdSolverInterface), _meanPotentialEnergy(0.0), _particleCounter(0), _boundaryForceController(boundaryForceController) {}
35
37
~ComputeMeanPotentialEnergyMapping
() {}
38
42
void
beginCellIteration
() {
43
_meanPotentialEnergy = 0.0;
44
_particleCounter = 0;
45
}
46
51
void
endCellIteration
() {
52
if
(_particleCounter != 0) {
53
_meanPotentialEnergy = _meanPotentialEnergy / _particleCounter;
54
}
55
}
56
61
void
handleCell
(LinkedCell& cell) {
62
coupling::interface::MoleculeIterator<LinkedCell, dim>
* it = _mdSolverInterface->getMoleculeIterator(cell);
63
it->
begin
();
64
while
(it->
continueIteration
()) {
65
const
coupling::interface::Molecule<dim>
& wrapper(it->
getConst
());
66
_meanPotentialEnergy += wrapper.
getPotentialEnergy
();
67
_meanPotentialEnergy += _boundaryForceController.getPotentialEnergy(wrapper.
getPosition
());
68
_particleCounter++;
69
70
it->
next
();
71
}
72
delete
it;
73
}
74
78
double
getPotentialEnergy
()
const
{
return
_meanPotentialEnergy; }
79
80
private
:
81
coupling::interface::MDSolverInterface<LinkedCell, dim>
*
const
_mdSolverInterface;
82
double
_meanPotentialEnergy;
83
unsigned
int
_particleCounter;
84
const
coupling::BoundaryForceController<LinkedCell, dim>
& _boundaryForceController;
85
};
86
#endif
// _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_COMPUTEMEANPOTENTIALENERGYMAPPING_H_
coupling::BoundaryForceController
controller for forces acting at open MD boundaries
Definition
BoundaryForceController.h:25
coupling::cellmappings::ComputeMeanPotentialEnergyMapping
This class computes the mean potential energy over this coupling cell.
Definition
ComputeMeanPotentialEnergyMapping.h:26
coupling::cellmappings::ComputeMeanPotentialEnergyMapping::getPotentialEnergy
double getPotentialEnergy() const
Definition
ComputeMeanPotentialEnergyMapping.h:78
coupling::cellmappings::ComputeMeanPotentialEnergyMapping::~ComputeMeanPotentialEnergyMapping
~ComputeMeanPotentialEnergyMapping()
Definition
ComputeMeanPotentialEnergyMapping.h:37
coupling::cellmappings::ComputeMeanPotentialEnergyMapping::beginCellIteration
void beginCellIteration()
Definition
ComputeMeanPotentialEnergyMapping.h:42
coupling::cellmappings::ComputeMeanPotentialEnergyMapping::handleCell
void handleCell(LinkedCell &cell)
Definition
ComputeMeanPotentialEnergyMapping.h:61
coupling::cellmappings::ComputeMeanPotentialEnergyMapping::endCellIteration
void endCellIteration()
Definition
ComputeMeanPotentialEnergyMapping.h:51
coupling::cellmappings::ComputeMeanPotentialEnergyMapping::ComputeMeanPotentialEnergyMapping
ComputeMeanPotentialEnergyMapping(coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface, const coupling::BoundaryForceController< LinkedCell, dim > &boundaryForceController)
Definition
ComputeMeanPotentialEnergyMapping.h:32
coupling::interface::MDSolverInterface
interface to the MD simulation
Definition
MDSolverInterface.h:25
coupling::interface::MoleculeIterator
some iterator scheme for traversing the molecules within a linked cell.
Definition
MoleculeIterator.h:24
coupling::interface::MoleculeIterator::continueIteration
virtual bool continueIteration() const =0
coupling::interface::MoleculeIterator::next
virtual void next()=0
coupling::interface::MoleculeIterator::begin
virtual void begin()=0
coupling::interface::MoleculeIterator::getConst
virtual const coupling::interface::Molecule< dim > & getConst()=0
coupling::interface::Molecule
interface to access a single molecule in the MD simulation.
Definition
Molecule.h:23
coupling::interface::Molecule::getPotentialEnergy
virtual double getPotentialEnergy() const =0
coupling::interface::Molecule::getPosition
virtual tarch::la::Vector< dim, double > getPosition() const =0
coupling
everything necessary for coupling operations, is defined in here
Definition
AdditiveMomentumInsertion.h:15
Generated by
1.17.0