Molecular Dynamics Simulation  1.0
GlobalDownwardsGravity.cpp
Go to the documentation of this file.
2 
4 
5 std::array<double, 3UL> GlobalDownwardsGravity::calculateForce(Particle& p) const { return {0.0, -p.getM() * g, 0.0}; }
6 
7 GlobalDownwardsGravity::operator std::string() const { return "GlobalDownwardsGravity: g=" + std::to_string(g); }
8 
void setGravitationalAcceleration(double g)
Sets the gravitational acceleration.
std::array< double, 3UL > calculateForce(Particle &p) const override
Calculates the downwards gravity force on a particle using the given gravitational acceleration.
GlobalDownwardsGravity(double g)
Constructor for the GlobalDownwardsGravity class.
Class to represent a particle.
Definition: Particle.h:26
double getM() const
Gets the mass of the particle.
Definition: Particle.h:177
std::string to_string(const Container &container, const std::string &delimiter=", ", const std::array< std::string, 2 > &surround={"[", "]"})
Definition: ArrayUtils.h:97