|
MolSim
|
Particle class modeling a particle's position, velocity, force, mass and type. More...
#include <Particle.h>
Public Member Functions | |
| Particle (int type=0) | |
| Construct a new Particle object by optionally passing its type. Prevents implicit conversions. | |
| Particle (const Particle &other) | |
| Construct a new Particle object using another Particle's data. | |
| Particle (const std::array< double, 3 > &x, const std::array< double, 3 > &v, double m, int type=TYPE_DEFAULT, double eps=EPSILON_DEFAULT, double sigma=SIGMA_DEFAULT, double k=K_DEFAULT, double r_0=R0_DEFAULT, double fzup=FZUP_DEFAULT) | |
| Construct a new Particle object using explicit values for each new data field. | |
| Particle (const std::array< double, 3 > &x, const std::array< double, 3 > &v, const std::array< double, 3 > &f, const std::array< double, 3 > &old_f, double m, int type, double eps, double sigma, double k, double r_0, double fzup, int cellIndex) | |
| Construct a new Particle object using explicit values for every data field. | |
| virtual | ~Particle () |
| Destroys the Particle object. | |
| std::array< double, 3 > & | getX () |
| Gets the position \( x \) of this particle. | |
| std::array< double, 3 > & | getV () |
| Gets the velocity \( v \) of this particle. | |
| std::array< double, 3 > & | getF () |
| Gets the force \( F \) effective on this particle. | |
| std::array< double, 3 > & | getOldF () |
| Gets the force \( F_\text{old} \) previously effective on this particle. | |
| std::vector< std::reference_wrapper< Particle > > & | getDirectNeighbours () |
| Gets the direct neighbours of this particle. | |
| const std::vector< std::reference_wrapper< Particle > > & | getDirectNeighbours () const |
| Gets the direct neighbours of this particle (const). | |
| std::vector< std::reference_wrapper< Particle > > & | getDiagonalNeighbours () |
| Gets the diagonal neighbours of this particle. | |
| const std::vector< std::reference_wrapper< Particle > > & | getDiagonalNeighbours () const |
| Gets the diagonal neighbours of this particle (const). | |
| const std::array< double, 3 > & | getX () const |
| Gets the position \( x \) of this particle (const). | |
| const std::array< double, 3 > & | getV () const |
| Gets the velocity \( v \) of this particle (const). | |
| const std::array< double, 3 > & | getThermalMotion () const |
| Gets the thermal motion \( \hat v \) of this particle (const). | |
| const std::array< double, 3 > & | getF () const |
| Gets the force \( F \) effective on this particle (const). | |
| const std::array< double, 3 > & | getOldF () const |
| Gets the force \( F_\text{old} \) previously effective on this particle (const). | |
| double | getM () const |
| Gets the mass \( m \) of the particle. | |
| int | getType () const |
| Gets the type of the particle. | |
| double | getEpsilon () const |
| Gets the Lennard-Jones parameter \( \epsilon \) of the particle. | |
| double | getSigma () const |
| Gets the Lennard-Jones parameter \( \sigma \) of the particle. | |
| double | getK () const |
| Gets the stiffness constant \( k \). | |
| double | getR0 () const |
| Gets the average bond length of a molecule pair \( r_0 \). | |
| double | getFZUP () const |
| Gets the constant upward force \( F_{Z-UP} \). | |
| int | getCellIndex () const |
| Get the index of the particle in a CellContainer. | |
| bool | isActive () const |
| Checks if the particle is currently active. | |
| int | getId () const |
| Get the ID of this particle. | |
| omp_lock_t & | getLock () |
| Get a reference to the Lock object. | |
| void | setX (const std::array< double, 3 > &new_x) |
| Sets the new position \( x \) of the particle to a given value. | |
| void | setV (const std::array< double, 3 > &new_v) |
| Sets the new velocity \( v \) of the particle to a given value. | |
| void | setDirectNeighbours (const std::vector< std::reference_wrapper< Particle > > &neighbours) |
| Sets the direct neighbours of the particle. | |
| void | setDiagonalNeighbours (const std::vector< std::reference_wrapper< Particle > > &neighbours) |
| Sets the diagonal neighbours of the particle. | |
| void | setThermalMotion (const std::array< double, 3 > &new_thermal_motion) |
| Sets the new thermal motion \( \hat v \) of the particle to a given value. | |
| void | setF (const std::array< double, 3 > &new_f) |
| Sets the new force effective on the particle \( F \) to a given value. | |
| void | setOldF (const std::array< double, 3 > &new_old_f) |
| Sets the new previously effective force on the particle \( F_\text{old} \) to a given value. | |
| void | setFToZero () |
| Resets the force of the particle \( F \) to 0,0,0. | |
| void | setM (double new_m) |
| Sets the new mass \( m \) of the particle to a given value. | |
| void | setType (double new_type) |
| Sets the new type of the particle to a given value. | |
| void | setEpsilon (double new_eps) |
| Sets the new Lennard-Jones parameter \( \epsilon \) of the particle to a given value. | |
| void | setSigma (double new_sigma) |
| Sets the new Lennard-Jones parameter \( \sigma \) of the particle to a given value. | |
| void | setK (double new_k) |
| Sets the new stiffness constant \( k \) to a given value. | |
| void | setFZUP (double new_fzup) |
| Sets the new upward force \( F_{Z-UP} \) to a given value. | |
| void | setR0 (double new_r_0) |
| Sets the new average bond length \( r_0 \) to a given value. | |
| void | setCellIndex (int new_index) |
| Sets the new index in a CellContainer. | |
| void | markInactive () |
| Sets the Particle's active status to "inactive". | |
| std::string | toString () const |
| Returns a string representation of this particle. | |
| bool | operator== (const Particle &other) const |
| Overload of the equality operator for Particle objects. | |
| bool | operator!= (const Particle &other) const |
| Overload of the inequality operator for Particle objects. | |
Private Attributes | |
| std::array< double, 3 > | x |
| Position \( x \) of the particle. | |
| std::array< double, 3 > | v |
| Velocity \( v \) of the particle. | |
| std::array< double, 3 > | thermal_motion |
| Thermal motion \( \hat v \) of the particle. | |
| std::array< double, 3 > | f |
| Force \( F \) effective on this particle. | |
| std::array< double, 3 > | old_f |
| Force \( F_\text{old} \) which was effective on this particle. | |
| std::vector< std::reference_wrapper< Particle > > | direct_neighbours |
| Direct (up-down, left-right) neighbours of the particle (for membranes). | |
| std::vector< std::reference_wrapper< Particle > > | diagonal_neighbours |
| Diagonal neighbours of the particle (for membranes). | |
| double | m |
| Mass \( m \) of this particle. | |
| int | type |
| Type of the particle. 1 if wall, 0 otherwise. | |
| double | epsilon |
| Depth \( \epsilon \) of the potential well. Lennard-Jones parameter. | |
| double | sigma |
| Distance \( \sigma \) where the Lennard-Jones potential reaches zero. Lennard-Jones parameter. | |
| double | k |
| The stiffness constant \( k \) for membrane simulations. | |
| double | r_0 |
| The average bond length \( r_0 \) for membrane simulations. | |
| double | fzup |
| The constant upward force \( F_{Z-UP} \) for membrane simulations. | |
| int | cellIndex |
| The cell index of the particle, to be used with the linked cell method. | |
| omp_lock_t | lock |
| A mutual exclusion lock, used alongside parallelization. | |
| bool | active {true} |
| The status of the particle. | |
| int | id |
| A unique ID for this particle. Currently only used for debug purposes. | |
Particle class modeling a particle's position, velocity, force, mass and type.
|
explicit |
| Particle::Particle | ( | const Particle & | other | ) |
| Particle::Particle | ( | const std::array< double, 3 > & | x, |
| const std::array< double, 3 > & | v, | ||
| double | m, | ||
| int | type = TYPE_DEFAULT, |
||
| double | eps = EPSILON_DEFAULT, |
||
| double | sigma = SIGMA_DEFAULT, |
||
| double | k = K_DEFAULT, |
||
| double | r_0 = R0_DEFAULT, |
||
| double | fzup = FZUP_DEFAULT |
||
| ) |
Construct a new Particle object using explicit values for each new data field.
Given that the current simulations make use of the particle mass as the divisor in some formulas, the mass may not be negative or 0.
| x | A reference to the array containing data for the position \( x \). |
| v | A reference to the array containing data for the velocity \( v \). |
| m | The mass \( m \) of the particle. |
| type | The type of the particle. (optional) |
| eps | The Lennard-Jones parameter \( \epsilon \) of the particle. (optional) |
| sigma | The Lennard-Jones parameter \( \sigma \) of the particle. (optional) |
| k | The stiffness constant \( k \), used for membrane simulations. (optional) |
| r_0 | The average bond length \( r_0 \), used for membrane simulations. (optional) |
| fzup | The constant upward force \( F_{Z-UP} \), used for membrane simulations. (optional) |
| Particle::Particle | ( | const std::array< double, 3 > & | x, |
| const std::array< double, 3 > & | v, | ||
| const std::array< double, 3 > & | f, | ||
| const std::array< double, 3 > & | old_f, | ||
| double | m, | ||
| int | type, | ||
| double | eps, | ||
| double | sigma, | ||
| double | k, | ||
| double | r_0, | ||
| double | fzup, | ||
| int | cellIndex | ||
| ) |
Construct a new Particle object using explicit values for every data field.
There are no default parameters here; every value must be initialized.
| x | A reference to the array containing data for the position \( x \). |
| v | A reference to the array containing data for the velocity \( v \). |
| f | A reference to the array containing data for the force \( F \) effective on this particle. |
| old_f | A reference to the array containing data for the old force \( F \) effective on this particle. |
| m | The mass \( m \) of the particle. |
| type | The type of the particle. |
| eps | The Lennard-Jones parameter \( \epsilon \) of the particle. |
| sigma | The Lennard-Jones parameter \( \sigma \) of the particle. |
| k | The stiffness constant \( k \), used for membrane simulations. |
| r_0 | The average bond length \( r_0 \), used for membrane simulations. |
| fzup | The constant upward force \( F_{Z-UP} \), used for membrane simulations. |
| cellIndex | The index of this particle inside a cell. For use with the linked cell method. |
|
virtual |
Destroys the Particle object.
|
inline |
Get the index of the particle in a CellContainer.
For use with the linked cell method.
|
inline |
Gets the diagonal neighbours of this particle.
|
inline |
Gets the diagonal neighbours of this particle (const).
|
inline |
Gets the direct neighbours of this particle.
|
inline |
Gets the direct neighbours of this particle (const).
|
inline |
Gets the Lennard-Jones parameter \( \epsilon \) of the particle.
|
inline |
Gets the force \( F \) effective on this particle.
|
inline |
Gets the force \( F \) effective on this particle (const).
|
inline |
Gets the constant upward force \( F_{Z-UP} \).
|
inline |
Get the ID of this particle.
Currently only used for debugging purposes.
|
inline |
Gets the stiffness constant \( k \).
|
inline |
Get a reference to the Lock object.
|
inline |
Gets the mass \( m \) of the particle.
|
inline |
Gets the force \( F_\text{old} \) previously effective on this particle.
|
inline |
Gets the force \( F_\text{old} \) previously effective on this particle (const).
|
inline |
Gets the average bond length of a molecule pair \( r_0 \).
|
inline |
Gets the Lennard-Jones parameter \( \sigma \) of the particle.
|
inline |
Gets the thermal motion \( \hat v \) of this particle (const).
|
inline |
Gets the type of the particle.
|
inline |
Gets the velocity \( v \) of this particle.
|
inline |
Gets the velocity \( v \) of this particle (const).
|
inline |
Gets the position \( x \) of this particle.
|
inline |
Gets the position \( x \) of this particle (const).
|
inline |
Checks if the particle is currently active.
| void Particle::markInactive | ( | ) |
Sets the Particle's active status to "inactive".
| bool Particle::operator!= | ( | const Particle & | other | ) | const |
| bool Particle::operator== | ( | const Particle & | other | ) | const |
| void Particle::setCellIndex | ( | int | new_index | ) |
Sets the new index in a CellContainer.
For use with the linked cell method.
| new_index | The new index in a grid of cells. |
| void Particle::setDiagonalNeighbours | ( | const std::vector< std::reference_wrapper< Particle > > & | neighbours | ) |
Sets the diagonal neighbours of the particle.
| neighbours | A reference to the vector of references to the neighbours. |
| void Particle::setDirectNeighbours | ( | const std::vector< std::reference_wrapper< Particle > > & | neighbours | ) |
Sets the direct neighbours of the particle.
| neighbours | A reference to the vector of references to the neighbours. |
| void Particle::setEpsilon | ( | double | new_eps | ) |
Sets the new Lennard-Jones parameter \( \epsilon \) of the particle to a given value.
| new_eps | The new Lennard-Jones parameter \( \epsilon \) of this particle. |
| void Particle::setF | ( | const std::array< double, 3 > & | new_f | ) |
Sets the new force effective on the particle \( F \) to a given value.
| new_f | A reference to the array containing the new force effective on this particle. |
| void Particle::setFToZero | ( | ) |
Resets the force of the particle \( F \) to 0,0,0.
| void Particle::setFZUP | ( | double | new_fzup | ) |
Sets the new upward force \( F_{Z-UP} \) to a given value.
| new_fzup | The new upward force \( F_{Z-UP} \). |
| void Particle::setK | ( | double | new_k | ) |
Sets the new stiffness constant \( k \) to a given value.
| new_k | The new stiffness constant \( k \). |
| void Particle::setM | ( | double | new_m | ) |
Sets the new mass \( m \) of the particle to a given value.
Given that the current simulations make use of the particle mass as the divisor in some formulas, the mass may not be negative or 0.
| new_m | The new mass of this particle. |
| void Particle::setOldF | ( | const std::array< double, 3 > & | new_old_f | ) |
Sets the new previously effective force on the particle \( F_\text{old} \) to a given value.
| new_old_f | A reference to the array containing the new previously effective force on this particle. |
| void Particle::setR0 | ( | double | new_r_0 | ) |
Sets the new average bond length \( r_0 \) to a given value.
| new_r_0 | The new average bond length \( r_0 \). |
| void Particle::setSigma | ( | double | new_sigma | ) |
Sets the new Lennard-Jones parameter \( \sigma \) of the particle to a given value.
| new_sigma | The new Lennard-Jones parameter \( \sigma \) of this particle. |
| void Particle::setThermalMotion | ( | const std::array< double, 3 > & | new_thermal_motion | ) |
Sets the new thermal motion \( \hat v \) of the particle to a given value.
| new_thermal_motion | A reference to the array containing the new thermal motion of this particle. |
| void Particle::setType | ( | double | new_type | ) |
Sets the new type of the particle to a given value.
| new_type | The new type of this particle. |
| void Particle::setV | ( | const std::array< double, 3 > & | new_v | ) |
Sets the new velocity \( v \) of the particle to a given value.
| new_v | A reference to the array containing the new velocity of this particle. |
| void Particle::setX | ( | const std::array< double, 3 > & | new_x | ) |
Sets the new position \( x \) of the particle to a given value.
| new_x | A reference to the array containing the new position of this particle. |
| std::string Particle::toString | ( | ) | const |
Returns a string representation of this particle.
|
private |
The status of the particle.
If the particle is marked "active", it will be considered in the time integration calculation. Otherwise, it is ignored.
|
private |
The cell index of the particle, to be used with the linked cell method.
|
private |
Diagonal neighbours of the particle (for membranes).
|
private |
Direct (up-down, left-right) neighbours of the particle (for membranes).
|
private |
Depth \( \epsilon \) of the potential well. Lennard-Jones parameter.
|
private |
Force \( F \) effective on this particle.
|
private |
The constant upward force \( F_{Z-UP} \) for membrane simulations.
|
private |
A unique ID for this particle. Currently only used for debug purposes.
|
private |
The stiffness constant \( k \) for membrane simulations.
|
private |
A mutual exclusion lock, used alongside parallelization.
|
private |
Mass \( m \) of this particle.
|
private |
Force \( F_\text{old} \) which was effective on this particle.
|
private |
The average bond length \( r_0 \) for membrane simulations.
|
private |
Distance \( \sigma \) where the Lennard-Jones potential reaches zero. Lennard-Jones parameter.
|
private |
Thermal motion \( \hat v \) of the particle.
|
private |
Type of the particle. 1 if wall, 0 otherwise.
|
private |
Velocity \( v \) of the particle.
|
private |
Position \( x \) of the particle.