Molecular Dynamics  v0.4
Project for the Practical hosted by the Scientific Computing Chair
Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
Particle Class Reference

#include <Particle.h>

Collaboration diagram for Particle:
Collaboration graph

Public Member Functions

 Particle (int type=0)
 
 Particle (const Particle &other)
 
 Particle (std::array< double, 3 > x_arg, std::array< double, 3 > v_arg, double m_arg, int type=0, double epsilon_arg=5, double sigma_arg=1)
 
void resetForce ()
 Set force to oldForce and set force to 0. More...
 
double calculateEKin () const
 Calculate the current kinetic energy of the particle. More...
 
double calculateEKinFlow (std::array< double, 3 > &avgVelocity) const
 Calculate the current kinetic energy of the particle within a flow simulation. More...
 
void addDirectNeighbor (int idToAdd)
 
void addDiagonalNeighbor (int idToAdd)
 
bool isDirectNeighbor (Particle &neighbor)
 Check, if particle neighbor is a direct neighbor of this particle. More...
 
bool isDiagonalNeighbor (Particle &neighbor)
 Check, if particle neighbor is a diagonal neighbor of this particle. More...
 
virtual ~Particle ()
 
const std::array< double, 3 > & getX () const
 
const std::array< double, 3 > & getV () const
 
const std::array< double, 3 > & getF () const
 
const std::array< double, 3 > & getOldF () const
 
double getM () const
 
int getType () const
 
double getEpsilon () const
 
double getSigma () const
 
int getId () const
 
bool isMarked () const
 
std::vector< int > & getDirectNeighbors ()
 
std::vector< int > & getDiagonalNeighbors ()
 
bool isFixed () const
 
void setOldF (const std::array< double, 3 > &oldF)
 
void setF (const std::array< double, 3 > &f)
 
void setX (const std::array< double, 3 > &x)
 
void setV (const std::array< double, 3 > &v)
 
void setType (int type)
 
void setMarked (bool status)
 
void setFixed (bool status)
 
bool operator== (Particle &other) const
 
std::string toString () const
 

Static Public Member Functions

static void resetID ()
 Reset Id for testing purposes. More...
 

Private Attributes

std::array< double, 3 > x {}
 
std::array< double, 3 > v {}
 
std::array< double, 3 > f {}
 
std::array< double, 3 > old_f {}
 
double m {}
 
int type
 
double epsilon
 
double sigma
 
bool marked
 
int id
 
std::vector< int > directNeighbors
 
std::vector< int > diagonalNeighbors
 
bool fixed
 
std::vector< bool > forceMarker
 
std::vector< std::array< double, 3 > > forceAccumulator
 

Static Private Attributes

static int nextId = 1
 

Constructor & Destructor Documentation

◆ Particle() [1/3]

Particle::Particle ( int  type = 0)
explicit
Here is the call graph for this function:

◆ Particle() [2/3]

Particle::Particle ( const Particle other)
Here is the call graph for this function:

◆ Particle() [3/3]

Particle::Particle ( std::array< double, 3 >  x_arg,
std::array< double, 3 >  v_arg,
double  m_arg,
int  type = 0,
double  epsilon_arg = 5,
double  sigma_arg = 1 
)

◆ ~Particle()

Particle::~Particle ( )
virtual

Member Function Documentation

◆ addDiagonalNeighbor()

void Particle::addDiagonalNeighbor ( int  idToAdd)

Make particle p a diagonal neighbor of this particle.

Parameters
idToAddNew diagonal neighbor of this particle.
Here is the caller graph for this function:

◆ addDirectNeighbor()

void Particle::addDirectNeighbor ( int  idToAdd)

Make particle p a direct neighbor of this particle.

Parameters
idToAddNew direct neighbor of this particle.
Here is the caller graph for this function:

◆ calculateEKin()

double Particle::calculateEKin ( ) const

Calculate the current kinetic energy of the particle.

Returns
kinetic energy of the particle.
Here is the caller graph for this function:

◆ calculateEKinFlow()

double Particle::calculateEKinFlow ( std::array< double, 3 > &  avgVelocity) const

Calculate the current kinetic energy of the particle within a flow simulation.

Parameters
avgVelocityAverage velocity of the particles within the system.
Returns
kinetic energy of the particle.

◆ getDiagonalNeighbors()

std::vector< int > & Particle::getDiagonalNeighbors ( )

◆ getDirectNeighbors()

std::vector< int > & Particle::getDirectNeighbors ( )

◆ getEpsilon()

double Particle::getEpsilon ( ) const
Here is the caller graph for this function:

◆ getF()

const std::array< double, 3 > & Particle::getF ( ) const
Here is the caller graph for this function:

◆ getId()

int Particle::getId ( ) const
Here is the caller graph for this function:

◆ getM()

double Particle::getM ( ) const
Here is the caller graph for this function:

◆ getOldF()

const std::array< double, 3 > & Particle::getOldF ( ) const
Here is the caller graph for this function:

◆ getSigma()

double Particle::getSigma ( ) const
Here is the caller graph for this function:

◆ getType()

int Particle::getType ( ) const
Here is the caller graph for this function:

◆ getV()

const std::array< double, 3 > & Particle::getV ( ) const
Here is the caller graph for this function:

◆ getX()

const std::array< double, 3 > & Particle::getX ( ) const
Here is the caller graph for this function:

◆ isDiagonalNeighbor()

bool Particle::isDiagonalNeighbor ( Particle neighbor)

Check, if particle neighbor is a diagonal neighbor of this particle.

Parameters
neighborParticle to check.
Returns
True, if the specified particle is a diagonal neighbor. False otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isDirectNeighbor()

bool Particle::isDirectNeighbor ( Particle neighbor)

Check, if particle neighbor is a direct neighbor of this particle.

Parameters
neighborParticle to check.
Returns
True, if the specified particle is a direct neighbor. False otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ isFixed()

bool Particle::isFixed ( ) const
Here is the caller graph for this function:

◆ isMarked()

bool Particle::isMarked ( ) const
Here is the caller graph for this function:

◆ operator==()

bool Particle::operator== ( Particle other) const

◆ resetForce()

void Particle::resetForce ( )

Set force to oldForce and set force to 0.

Here is the caller graph for this function:

◆ resetID()

void Particle::resetID ( )
static

Reset Id for testing purposes.

◆ setF()

void Particle::setF ( const std::array< double, 3 > &  f)
Here is the caller graph for this function:

◆ setFixed()

void Particle::setFixed ( bool  status)
Here is the caller graph for this function:

◆ setMarked()

void Particle::setMarked ( bool  status)
Here is the caller graph for this function:

◆ setOldF()

void Particle::setOldF ( const std::array< double, 3 > &  oldF)

◆ setType()

void Particle::setType ( int  type)
Here is the caller graph for this function:

◆ setV()

void Particle::setV ( const std::array< double, 3 > &  v)
Here is the caller graph for this function:

◆ setX()

void Particle::setX ( const std::array< double, 3 > &  x)

◆ toString()

std::string Particle::toString ( ) const
Here is the caller graph for this function:

Member Data Documentation

◆ diagonalNeighbors

std::vector<int> Particle::diagonalNeighbors
private

Diagonal neighbors within a membrane.

◆ directNeighbors

std::vector<int> Particle::directNeighbors
private

Direct neighbors within a membrane.

◆ epsilon

double Particle::epsilon
private

Lennard-Jones-Parameter epsilon.

◆ f

std::array<double, 3> Particle::f {}
private

Force effective on this particle.

◆ fixed

bool Particle::fixed
private

Fixed particles belong to a wall. Needed for study nanofluidics.

◆ forceAccumulator

std::vector<std::array<double,3> > Particle::forceAccumulator
private

Each thread has its own value to accumulate the forces it has calculated.

◆ forceMarker

std::vector<bool> Particle::forceMarker
private

Mark, which forces of the reduction vector are unequal to 0.

◆ id

int Particle::id
private

Id to set neighbor relationships between particles.

◆ m

double Particle::m {}
private

Mass of this particle.

◆ marked

bool Particle::marked
private

Mark particles to which a special force should be applied.

◆ nextId

int Particle::nextId = 1
staticprivate

Id of the particle that is created next.

◆ old_f

std::array<double, 3> Particle::old_f {}
private

Force which was effective on this particle.

◆ sigma

double Particle::sigma
private

Lennard-Jones-Parameter sigma.

◆ type

int Particle::type
private

Type of the particle. Use it for whatever you want (e.g. to separate molecules belonging to different bodies, matters, and so on).

◆ v

std::array<double, 3> Particle::v {}
private

Velocity of the particle.

◆ x

std::array<double, 3> Particle::x {}
private

Position of the particle.


The documentation for this class was generated from the following files: