Line data Source code
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_DATASTRUCTURES_MOLECULE_H_
6 : #define _MOLECULARDYNAMICS_COUPLING_DATASTRUCTURES_MOLECULE_H_
7 :
8 : #include "coupling/interface/Molecule.h"
9 : #include "tarch/la/Vector.h"
10 :
11 : namespace coupling {
12 : namespace datastructures {
13 : template <unsigned int dim> class Molecule;
14 : }
15 : } // namespace coupling
16 :
17 : /**
18 : * @brief molecule representation for coupling component. Dericed from the
19 : *class coupling::interface::Molecule
20 : * @tparam dim Number of dimensions; it can be 1, 2 or 3
21 : * @author Philipp Neumann
22 : */
23 :
24 : template <unsigned int dim> class coupling::datastructures::Molecule : public coupling::interface::Molecule<dim> {
25 : public:
26 : /** Constructor: initialises the molecule;
27 : * @param position
28 : * @param velocity
29 : * @param force
30 : * @param potentialEnergy
31 : */
32 0 : Molecule(const tarch::la::Vector<dim, double>& position, const tarch::la::Vector<dim, double>& velocity, const tarch::la::Vector<dim, double>& force,
33 : const double& potentialEnergy)
34 0 : : coupling::interface::Molecule<dim>(), _position(position), _velocity(velocity), _force(force), _potentialEnergy(potentialEnergy) {}
35 0 : Molecule()
36 0 : : coupling::interface::Molecule<dim>(), _position(tarch::la::Vector<dim, double>(0.0)), _velocity(tarch::la::Vector<dim, double>(0.0)),
37 0 : _force(tarch::la::Vector<dim, double>(0.0)), _potentialEnergy(0.0) {}
38 :
39 : /** Destructor */
40 0 : virtual ~Molecule() {}
41 :
42 : /** returns the velocity of the molecule
43 : * @return _velocity Velocity*/
44 0 : tarch::la::Vector<dim, double> getVelocity() const { return _velocity; }
45 : /** sets the velocity of the molecule
46 : * @param velocity Velocity*/
47 0 : void setVelocity(const tarch::la::Vector<dim, double>& velocity) { _velocity = velocity; }
48 :
49 : /** returns the velocity of the molecule
50 : * @return _position Position*/
51 0 : tarch::la::Vector<dim, double> getPosition() const { return _position; }
52 : /** sets the velocity of the molecule
53 : * @param position Position*/
54 0 : void setPosition(const tarch::la::Vector<dim, double>& position) { _position = position; }
55 :
56 : /** sets the force acting on this molecule. This function is called in the
57 : * USHER scheme so far only if the force of a newly created molecule should be
58 : * set
59 : * @param force Force
60 : * @todo Philipp When the force should be set? when not? you need to
61 : * implement this function.
62 : */
63 0 : void setForce(const tarch::la::Vector<dim, double>& force) { _force = force; }
64 : /** returns the force of the molecule
65 : * @return _force Force*/
66 0 : tarch::la::Vector<dim, double> getForce() const { return _force; }
67 :
68 : /** returns potential energy of the molecule
69 : * @return _potentialEnergy Potential energy of the molecule */
70 0 : double getPotentialEnergy() const { return _potentialEnergy; }
71 : /** sets potential energy of the molecule
72 : * @param _potentialEnergy Potential energy of the molecule */
73 0 : void setPotentialEnergy(const double& potentialEnergy) { _potentialEnergy = potentialEnergy; }
74 :
75 : private:
76 : /** Position of the molecule */
77 : tarch::la::Vector<dim, double> _position;
78 : /** Velocity vector of the molecule */
79 : tarch::la::Vector<dim, double> _velocity;
80 : /** Force vector of the molecule */
81 : tarch::la::Vector<dim, double> _force;
82 : /** Potential energy of the molecule */
83 : double _potentialEnergy;
84 : };
85 :
86 : #endif // _MOLECULARDYNAMICS_COUPLING_DATASTRUCTURES_MOLECULE_H_
|