MaMiCo
1.2
Toggle main menu visibility
Loading...
Searching...
No Matches
coupling
cell-mappings
SetTemperatureMapping.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_SETTEMPERATUREMAPPING_H_
6
#define _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_SETTEMPERATUREMAPPING_H_
7
8
#include "coupling/interface/MDSolverInterface.h"
9
#include "coupling/interface/Molecule.h"
10
#include <cmath>
11
#include <iostream>
12
13
namespace
coupling
{
14
namespace
cellmappings {
15
template
<
class
LinkedCell,
unsigned
int
dim>
class
SetTemperatureMapping
;
16
}
17
}
// namespace coupling
18
25
template
<
class
LinkedCell,
unsigned
int
dim>
class
coupling::cellmappings::SetTemperatureMapping
{
26
public
:
34
SetTemperatureMapping
(
const
double
& oldTemperature,
const
double
& newTemperature,
const
tarch::la::Vector<dim, double>
& meanVelocity,
35
coupling::interface::MDSolverInterface<LinkedCell, dim>
*
const
mdSolverInterface)
36
: _mdSolverInterface(mdSolverInterface), _factor(
getScalingFactor
(oldTemperature, newTemperature)), _meanVelocity(meanVelocity) {}
37
39
~SetTemperatureMapping
() {}
40
43
void
beginCellIteration
() {}
44
47
void
endCellIteration
() {}
48
53
void
handleCell
(LinkedCell& cell) {
54
coupling::interface::MoleculeIterator<LinkedCell, dim>
* it = _mdSolverInterface->getMoleculeIterator(cell);
55
it->
begin
();
56
while
(it->
continueIteration
()) {
57
coupling::interface::Molecule<dim>
& wrapper(it->
get
());
58
tarch::la::Vector<dim, double>
velocity = wrapper.
getVelocity
();
59
// scale velocity
60
velocity = _meanVelocity + _factor * (velocity - _meanVelocity);
61
wrapper.
setVelocity
(velocity);
62
it->
next
();
63
}
64
delete
it;
65
}
66
67
private
:
75
double
getScalingFactor
(
const
double
& oldTemperature,
const
double
& newTemperature)
const
{
76
77
if
(oldTemperature != 0.0) {
78
return
sqrt(newTemperature / oldTemperature);
79
}
else
{
80
return
1.0;
81
}
82
}
83
84
coupling::interface::MDSolverInterface<LinkedCell, dim>
*
const
_mdSolverInterface;
85
const
double
_factor;
86
const
tarch::la::Vector<dim, double>
_meanVelocity;
87
};
88
#endif
// _MOLECULARDYNAMICS_COUPLING_CELLMAPPINGS_SETTEMPERATUREMAPPING_H_
coupling::cellmappings::SetTemperatureMapping
This class sets a certain temperature over several linked cells.
Definition
SetTemperatureMapping.h:25
coupling::cellmappings::SetTemperatureMapping::endCellIteration
void endCellIteration()
Definition
SetTemperatureMapping.h:47
coupling::cellmappings::SetTemperatureMapping::getScalingFactor
double getScalingFactor(const double &oldTemperature, const double &newTemperature) const
Definition
SetTemperatureMapping.h:75
coupling::cellmappings::SetTemperatureMapping::handleCell
void handleCell(LinkedCell &cell)
Definition
SetTemperatureMapping.h:53
coupling::cellmappings::SetTemperatureMapping::beginCellIteration
void beginCellIteration()
Definition
SetTemperatureMapping.h:43
coupling::cellmappings::SetTemperatureMapping::SetTemperatureMapping
SetTemperatureMapping(const double &oldTemperature, const double &newTemperature, const tarch::la::Vector< dim, double > &meanVelocity, coupling::interface::MDSolverInterface< LinkedCell, dim > *const mdSolverInterface)
Definition
SetTemperatureMapping.h:34
coupling::cellmappings::SetTemperatureMapping::~SetTemperatureMapping
~SetTemperatureMapping()
Definition
SetTemperatureMapping.h:39
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::get
virtual coupling::interface::Molecule< dim > & get()=0
coupling::interface::Molecule
interface to access a single molecule in the MD simulation.
Definition
Molecule.h:23
coupling::interface::Molecule::setVelocity
virtual void setVelocity(const tarch::la::Vector< dim, double > &velocity)=0
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