MaMiCo
1.2
Toggle main menu visibility
Loading...
Searching...
No Matches
coupling
cell-mappings
ComputeKineticEnergyMapping.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_COMPUTEKINETICENERGYMAPPING_H_
6
#define _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_COMPUTEKINETICENERGYMAPPING_H_
7
8
#include "coupling/interface/MDSolverInterface.h"
9
#include "coupling/interface/Molecule.h"
10
#include <iostream>
11
#include <list>
12
13
namespace
coupling
{
14
namespace
cellmappings {
15
template
<
class
LinkedCell,
unsigned
int
dim>
class
ComputeKineticEnergyMapping
;
16
}
17
}
// namespace coupling
18
25
template
<
class
LinkedCell,
unsigned
int
dim>
class
coupling::cellmappings::ComputeKineticEnergyMapping
{
26
public
:
30
ComputeKineticEnergyMapping
(
coupling::interface::MDSolverInterface<LinkedCell, dim>
*
const
mdSolverInterface)
31
: _mdSolverInterface(mdSolverInterface), _kineticEnergy(0.0) {}
32
34
~ComputeKineticEnergyMapping
() {}
35
38
void
beginCellIteration
() { _kineticEnergy = 0.0; }
39
43
void
endCellIteration
() { _kineticEnergy = 0.5 * _mdSolverInterface->getMoleculeMass() * _kineticEnergy; }
44
48
void
handleCell
(LinkedCell& cell) {
49
50
coupling::interface::MoleculeIterator<LinkedCell, dim>
* it = _mdSolverInterface->getMoleculeIterator(cell);
51
it->
begin
();
52
while
(it->
continueIteration
()) {
53
const
coupling::interface::Molecule<dim>
& wrapper(it->
getConst
());
54
_kineticEnergy += tarch::la::dot(wrapper.
getVelocity
(), wrapper.
getVelocity
());
55
56
it->
next
();
57
}
58
delete
it;
59
}
60
64
double
getKineticEnergy
()
const
{
return
_kineticEnergy; }
65
66
private
:
67
coupling::interface::MDSolverInterface<LinkedCell, dim>
*
const
_mdSolverInterface;
68
double
_kineticEnergy;
69
};
70
#endif
// _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_COMPUTEKINETICENERGYMAPPING_H_
coupling::cellmappings::ComputeKineticEnergyMapping
This class computes the kinetic energy. inside a linked cell.
Definition
ComputeKineticEnergyMapping.h:25
coupling::cellmappings::ComputeKineticEnergyMapping::handleCell
void handleCell(LinkedCell &cell)
Definition
ComputeKineticEnergyMapping.h:48
coupling::cellmappings::ComputeKineticEnergyMapping::endCellIteration
void endCellIteration()
Definition
ComputeKineticEnergyMapping.h:43
coupling::cellmappings::ComputeKineticEnergyMapping::ComputeKineticEnergyMapping
ComputeKineticEnergyMapping(coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface)
Definition
ComputeKineticEnergyMapping.h:30
coupling::cellmappings::ComputeKineticEnergyMapping::~ComputeKineticEnergyMapping
~ComputeKineticEnergyMapping()
Definition
ComputeKineticEnergyMapping.h:34
coupling::cellmappings::ComputeKineticEnergyMapping::beginCellIteration
void beginCellIteration()
Definition
ComputeKineticEnergyMapping.h:38
coupling::cellmappings::ComputeKineticEnergyMapping::getKineticEnergy
double getKineticEnergy() const
Definition
ComputeKineticEnergyMapping.h:64
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::getVelocity
virtual tarch::la::Vector< dim, double > getVelocity() const =0
coupling
everything necessary for coupling operations, is defined in here
Definition
AdditiveMomentumInsertion.h:15
Generated by
1.17.0