LCOV - code coverage report
Current view: top level - simplemd - Molecule.h (source / functions) Coverage Total Hit
Test: coverage.info Lines: 57.1 % 14 8
Test Date: 2026-08-21 15:14:06 Functions: 100.0 % 2 2

            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_MOLECULE_H_
       6              : #define _MOLECULARDYNAMICS_MOLECULE_H_
       7              : 
       8              : #include "simplemd/MolecularDynamicsDefinitions.h"
       9              : #include "simplemd/MolecularProperties.h"
      10              : #include "tarch/la/Vector.h"
      11              : 
      12              : namespace simplemd {
      13              : class Molecule;
      14              : }
      15              : 
      16              : /** describes a single molecule
      17              :  *  @author Philipp Neumann
      18              :  */
      19              : class simplemd::Molecule {
      20              : public:
      21              :   /** initialise position and velocity of molecule */
      22         1338 :   KOKKOS_FUNCTION Molecule(const tarch::la::Vector<MD_DIM, double>& position, const tarch::la::Vector<MD_DIM, double>& velocity)
      23         5352 :       : _position(position), _velocity(velocity), _force(0.0), _forceOld(0.0), _potentialEnergy(0.0), _id(0), _isFixed(false) {}
      24              :   /** empty constructor */
      25    487959024 :   KOKKOS_FUNCTION Molecule() : _position(0.0), _velocity(0.0), _force(0.0), _forceOld(0.0), _potentialEnergy(0.0), _id(0), _isFixed(false) {}
      26         1318 :   KOKKOS_FUNCTION ~Molecule() {}
      27              : 
      28              :   /** fix position of particle. */
      29              :   KOKKOS_FUNCTION void fix() {
      30              :     _isFixed = true;
      31              :     _velocity = tarch::la::Vector<MD_DIM, double>(0.0);
      32              :   }
      33              : 
      34              :   /** check if particle is fixed */
      35              :   KOKKOS_FUNCTION const bool& isFixed() const { return _isFixed; }
      36              : 
      37              :   /** get/set ID */
      38              :   KOKKOS_FUNCTION const unsigned int& getID() const { return _id; }
      39            0 :   void setID(const unsigned int& id) { _id = id; }
      40              : 
      41              :   /** get/ set position */
      42         3240 :   KOKKOS_FUNCTION tarch::la::Vector<MD_DIM, double>& getPosition() { return _position; }
      43            0 :   KOKKOS_FUNCTION const tarch::la::Vector<MD_DIM, double>& getConstPosition() const { return _position; }
      44            0 :   void setPosition(const tarch::la::Vector<MD_DIM, double>& position) { _position = position; }
      45              : 
      46              :   /** get/ set velocity */
      47              :   tarch::la::Vector<MD_DIM, double>& getVelocity() { return _velocity; }
      48            0 :   KOKKOS_FUNCTION const tarch::la::Vector<MD_DIM, double>& getConstVelocity() const { return _velocity; }
      49     10628820 :   void setVelocity(const tarch::la::Vector<MD_DIM, double>& velocity) { _velocity = velocity; }
      50              : 
      51              :   /** get/ set force */
      52        16500 :   KOKKOS_FUNCTION tarch::la::Vector<MD_DIM, double>& getForce() { return _force; }
      53            0 :   KOKKOS_FUNCTION const tarch::la::Vector<MD_DIM, double>& getConstForce() const { return _force; }
      54     10628820 :   void setForce(const tarch::la::Vector<MD_DIM, double>& force) { _force = force; }
      55              : 
      56              :   /** get/ set force of last timestep */
      57              :   tarch::la::Vector<MD_DIM, double>& getForceOld() { return _forceOld; }
      58              :   const tarch::la::Vector<MD_DIM, double>& getConstForceOld() const { return _forceOld; }
      59              :   void setForceOld(const tarch::la::Vector<MD_DIM, double>& force) { _forceOld = force; }
      60              : 
      61              :   KOKKOS_FUNCTION double& getPotentialEnergy() { return _potentialEnergy; }
      62              :   KOKKOS_FUNCTION const double& getConstPotentialEnergy() const { return _potentialEnergy; }
      63            0 :   KOKKOS_FUNCTION void setPotentialEnergy(const double& potentialEnergy) { _potentialEnergy = potentialEnergy; }
      64              : 
      65              : private:
      66              :   tarch::la::Vector<MD_DIM, double> _position;
      67              :   tarch::la::Vector<MD_DIM, double> _velocity;
      68              :   tarch::la::Vector<MD_DIM, double> _force;
      69              :   tarch::la::Vector<MD_DIM, double> _forceOld;
      70              :   double _potentialEnergy;
      71              :   unsigned int _id;
      72              :   bool _isFixed;
      73              : };
      74              : 
      75              : #endif
        

Generated by: LCOV version 2.0-1