MaMiCo
1.2
Toggle main menu visibility
Loading...
Searching...
No Matches
coupling
cell-mappings
ComputeTemperatureMapping.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_COMPUTETEMPERATUREMAPPING_H_
6
#define _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_COMPUTETEMPERATUREMAPPING_H_
7
8
#include "coupling/interface/MDSolverInterface.h"
9
#include "coupling/interface/Molecule.h"
10
#include <iostream>
11
12
namespace
coupling
{
13
namespace
cellmappings {
14
template
<
class
LinkedCell,
unsigned
int
dim>
class
ComputeTemperatureMapping
;
15
}
16
}
// namespace coupling
17
25
template
<
class
LinkedCell,
unsigned
int
dim>
class
coupling::cellmappings::ComputeTemperatureMapping
{
26
public
:
31
ComputeTemperatureMapping
(
const
tarch::la::Vector<dim, double>
& meanVelocity,
32
coupling::interface::MDSolverInterface<LinkedCell, dim>
*
const
mdSolverInterface)
33
: _mdSolverInterface(mdSolverInterface), _meanVelocity(meanVelocity), _temperature(0.0), _particleCounter(0) {}
34
36
~ComputeTemperatureMapping
() {}
37
41
void
beginCellIteration
() {
42
_temperature = 0.0;
43
_particleCounter = 0;
44
}
45
49
void
endCellIteration
() {
50
_temperature = _temperature * _mdSolverInterface->getMoleculeMass();
51
if
(_particleCounter != 0) {
52
_temperature = _temperature / (dim * _mdSolverInterface->getKB() * _particleCounter);
53
}
54
}
55
60
void
handleCell
(LinkedCell& cell) {
61
coupling::interface::MoleculeIterator<LinkedCell, dim>
* it = _mdSolverInterface->getMoleculeIterator(cell);
62
it->
begin
();
63
while
(it->
continueIteration
()) {
64
const
coupling::interface::Molecule<dim>
& wrapper(it->
getConst
());
65
_temperature += tarch::la::dot((wrapper.
getVelocity
() - _meanVelocity), (wrapper.
getVelocity
() - _meanVelocity));
66
_particleCounter++;
67
68
it->
next
();
69
}
70
delete
it;
71
}
72
76
double
getTemperature
()
const
{
return
_temperature; }
77
78
private
:
79
coupling::interface::MDSolverInterface<LinkedCell, dim>
*
const
_mdSolverInterface;
80
const
tarch::la::Vector<dim, double>
_meanVelocity;
81
double
_temperature;
82
unsigned
int
_particleCounter;
83
};
84
#endif
// _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_COMPUTETEMPERATUREMAPPING_H_
coupling::cellmappings::ComputeTemperatureMapping
This class computes the temperature in a certain (coupling) cell.
Definition
ComputeTemperatureMapping.h:25
coupling::cellmappings::ComputeTemperatureMapping::~ComputeTemperatureMapping
~ComputeTemperatureMapping()
Definition
ComputeTemperatureMapping.h:36
coupling::cellmappings::ComputeTemperatureMapping::beginCellIteration
void beginCellIteration()
Definition
ComputeTemperatureMapping.h:41
coupling::cellmappings::ComputeTemperatureMapping::endCellIteration
void endCellIteration()
Definition
ComputeTemperatureMapping.h:49
coupling::cellmappings::ComputeTemperatureMapping::getTemperature
double getTemperature() const
Definition
ComputeTemperatureMapping.h:76
coupling::cellmappings::ComputeTemperatureMapping::ComputeTemperatureMapping
ComputeTemperatureMapping(const tarch::la::Vector< dim, double > &meanVelocity, coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface)
Definition
ComputeTemperatureMapping.h:31
coupling::cellmappings::ComputeTemperatureMapping::handleCell
void handleCell(LinkedCell &cell)
Definition
ComputeTemperatureMapping.h:60
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
tarch::la::Vector
Definition
Vector.h:25
coupling
everything necessary for coupling operations, is defined in here
Definition
AdditiveMomentumInsertion.h:15
Generated by
1.17.0