31 std::array<double, 3>
x{};
36 std::array<double, 3>
v{};
41 std::array<double, 3>
f{};
78 mutable std::mutex mutex_f;
94 Particle(std::array<double, 3> x_arg, std::array<double, 3> v_arg,
double m_arg,
int type = 0,
double epsilon_arg = 1.0,
97 Particle(std::array<double, 3> x_arg, std::array<double, 3> v_arg, std::array<double, 3> f_arg, std::array<double, 3> old_f_arg,
109 inline void setX(
const std::array<double, 3>&
x) { this->x =
x; }
116 inline void setV(
const std::array<double, 3>&
v) { this->v =
v; }
123 inline void setF(
const std::array<double, 3>&
f) { this->f =
f; }
129 inline void addF(
const std::array<double, 3>& force) {
131 std::lock_guard lock(mutex_f);
140 inline void subF(
const std::array<double, 3>& force) {
142 std::lock_guard lock(mutex_f);
152 inline void setOldF(
const std::array<double, 3>& oldF) {
old_f = oldF; }
157 [[nodiscard]]
inline const std::array<double, 3>&
getX()
const {
return x; }
162 [[nodiscard]]
inline const std::array<double, 3>&
getV()
const {
return v; }
167 [[nodiscard]]
inline const std::array<double, 3>&
getF()
const {
return f; }
172 [[nodiscard]]
inline const std::array<double, 3>&
getOldF()
const {
return old_f; }
177 [[nodiscard]]
inline double getM()
const {
return m; }
222 [[nodiscard]] std::string
toString()
const;
LockState
Enum class to define the lockstate of particles. Locked particles are not allowed to move.
std::ostream & operator<<(std::ostream &stream, Particle &p)
Class to represent a particle.
void setF(const std::array< double, 3 > &f)
Sets the force of the particle.
std::array< double, 3 > x
Position of the particle.
double epsilon
Lennard-Jones potential parameter epsilon.
std::array< double, 3 > v
Velocity of the particle.
double getSigma() const
Gets the Lennard-Jones potential parameter sigma.
const std::array< double, 3 > & getV() const
Gets the velocity of the particle.
Particle(const Particle &other)
int type
Type of the particle. Use it for whatever you want (e.g. to separate molecules belonging to different...
std::string toString() const
bool isLocked() const
Gets whether the particle is locked in space.
bool operator==(Particle &other)
Particle & operator=(const Particle &other)
void subF(const std::array< double, 3 > &force)
Subtracts a force from the particle.
void addConnectedParticle(long ptr_diff, double l_0, double k)
Adds a connected particle.
std::array< double, 3 > f
Force effective on this particle.
int getType() const
Gets the type of the particle.
const std::array< double, 3 > & getX() const
Gets the position of the particle.
std::array< double, 3 > old_f
Force which was effective on this particle.
void addF(const std::array< double, 3 > &force)
Adds a force to the particle.
void setOldF(const std::array< double, 3 > &oldF)
Sets the old force of the particle.
double getM() const
Gets the mass of the particle.
double sigma
Lennard-Jones potential parameter sigma.
void setX(const std::array< double, 3 > &x)
Sets the position of the particle.
void setV(const std::array< double, 3 > &v)
Sets the velocity of the particle.
LockState lock_state
Wheter the particle is loccked in space.
double getEpsilon() const
Gets the Lennard-Jones potential parameter epsilon.
const std::array< double, 3 > & getF() const
Gets the total force of the particle.
void setLocked(LockState new_lock_state)
Set wheter the particle is locked in space.
const std::array< double, 3 > & getOldF() const
Gets the old total force of the particle.
const std::vector< std::tuple< long, double, double > > & getConnectedParticles() const
Gets the list of connected particles.
double m
Mass of this particle.
std::vector< std::tuple< long, double, double > > connected_particles
List of connected particles.