OpenMPCD
Public Member Functions | Public Attributes | List of all members
MPCDAnalysis.ParticleCollection.ParticleCollection Class Reference

Public Member Functions

def __init__ (self)
 
def setPositionsAndVelocities (self, positions, velocities)
 
def setUniformMass (self, mass)
 
def isEmpty (self)
 
def getParticleCount (self)
 
def getPositions (self)
 
def getPosition (self, index)
 
def getVelocities (self)
 
def getVelocity (self, index)
 
def getMass (self, index)
 
def getMomentum (self, index)
 
def getCenterOfMass (self)
 
def getCenterOfPositions (self)
 
def getCenterOfMassVelocity (self)
 
def rotateAroundNormalizedAxis (self, axis, angle)
 
def shiftToCenterOfMassFrame (self)
 
def getGyrationTensor (self)
 
def getMomentOfInertiaTensor (self)
 
def getTotalAngularMomentumVector (self)
 
def getRotationFrequencyVector (self)
 
def getGyrationTensorPrincipalMoments (self)
 
def getGyrationTensorEigensystem (self)
 
def getRadiusOfGyrationSquared (self)
 
def getRadiusOfGyration (self)
 
def getAsphericity (self)
 
def getAcylindricity (self)
 
def getRelativeShapeAnisotropy (self)
 
def getOrientationAngle (self, axis)
 
def getOrientationAngles (self, axis)
 
def __eq__ (self, rhs)
 
def __ne__ (self, rhs)
 

Public Attributes

 positions
 
 velocities
 
 uniformMass
 
 gyrationTensor
 

Detailed Description

Represents the state of a collection of particles.

Definition at line 11 of file ParticleCollection.py.

Constructor & Destructor Documentation

◆ __init__()

def MPCDAnalysis.ParticleCollection.ParticleCollection.__init__ (   self)
    Constructs an empty particle collection.

Definition at line 17 of file ParticleCollection.py.

Member Function Documentation

◆ __eq__()

def MPCDAnalysis.ParticleCollection.ParticleCollection.__eq__ (   self,
  rhs 
)
    The equality operator.

    Returns whether this instance stores the same particles (i.e. their
    count, positions, velocities, and masses) as the given `rhs` instance.

    Having set a different uniform mass in two instances makes them not
    equal, even if there are no particles.

    @param[in] rhs The right-hand-side instance to compare to.

    @return Returns whether the two instances are equal, or `NotImplemented`
            if the two instances are not of the same type.

Definition at line 668 of file ParticleCollection.py.

◆ __ne__()

def MPCDAnalysis.ParticleCollection.ParticleCollection.__ne__ (   self,
  rhs 
)
    The inequality operator.

    @param[in] rhs The right-hand-side instance to compare to.

    @return Returns `NotImplemented` if the two instances are not of the
            same type, and `not self == rhs` otherwise.

Definition at line 697 of file ParticleCollection.py.

◆ getAcylindricity()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getAcylindricity (   self)
    Returns the acylindricity \f$ c \f$, i.e.
    \f[
        \lambda_y^2 - \lambda_x^2
    \f]
    where \f$ \lambda_x^2 \f$ is the smallest eigenvalue of the gyration
    tensor, \f$ \lambda_z^2 \f$ is the largest eigenvalue, and
    \f$ \lambda_y^2 \f$ is the one in between.

Definition at line 573 of file ParticleCollection.py.

◆ getAsphericity()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getAsphericity (   self)
    Returns the asphericity \f$ b \f$, i.e.
    \f[
        \lambda_z^2 - \frac{1}{2} \left( \lambda_x^2 + \lambda_y^2 \right)
    \f]
    where \f$ \lambda_z^2 \f$ is the largest eigenvalue of the gyration
    tensor, and \f$ \lambda_x^2 \f$ and \f$ \lambda_y^2 \f$ are the two
    smallest eigenvalues.

Definition at line 557 of file ParticleCollection.py.

◆ getCenterOfMass()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getCenterOfMass (   self)
    Returns the center of mass of the particles, as an instance of
    `Vector3DReal`.

    @throw RuntimeError
           Throws if `isEmpty()`.
    @throw RuntimeError
           Throws if the mass has not been specified for all particles.

Definition at line 251 of file ParticleCollection.py.

◆ getCenterOfMassVelocity()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getCenterOfMassVelocity (   self)
    Returns the velocity of the center of mass, as an instance of
    `Vector3DReal`.

    @throw RuntimeError
           Throws if `isEmpty()`.
    @throw RuntimeError
           Throws if the mass has not been specified for all particles.

Definition at line 299 of file ParticleCollection.py.

◆ getCenterOfPositions()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getCenterOfPositions (   self)
    Returns the unweighted average of all particle positions, as an instance
    of `Vector3DReal`.

    @throw RuntimeError
           Throws if `isEmpty()`.

Definition at line 276 of file ParticleCollection.py.

◆ getGyrationTensor()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getGyrationTensor (   self)
    Returns the gyration tensor \f$ S \f$.

    The returned object is a \f$ 3 \times 3 \f$ symmetric matrix of type
    `numpy.ndarray`.
    Given \f$ N \f$ particles with positions \f$ \vec{r}^{(i)} \f$ (in any
    Cartesian coordinate frame), the \f$ \left( m, n \right) \f$-component
    of the gyration tensor is defined by
    \f[
        S_{mn}
        =
        \frac{ 1 }{ 2 N^2 }
        \sum_{i = 1}^N
        \sum_{j = 1}^N
        \left( \vec{r}^{(i)}_m - \vec{r}^{(j)}_m \right)
        \left( \vec{r}^{(i)}_n - \vec{r}^{(j)}_n \right)
    \f]

    @throw ValueError
           Throws if there are no particles in this instance.

Definition at line 392 of file ParticleCollection.py.

◆ getGyrationTensorEigensystem()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getGyrationTensorEigensystem (   self)
    Returns the eigenvalues and eigenvectors of the gyration tensor (as
    returned by `getGyrationTensor`).

    The returned object is a list, with each element being a list of first
    the eigenvalue, and second the associated eigenvector. The tuples are
    sorted by the value of the eigenvalue, smallest first.

    The eigenvalues are real and of type `numpy.float64`, and the
    eigenvectors are of type `numpy.ndarray` with three entries of type
    `numpy.float64`.

Definition at line 509 of file ParticleCollection.py.

◆ getGyrationTensorPrincipalMoments()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getGyrationTensorPrincipalMoments (   self)
    Returns the eigenvalues \f$ \lambda_x^2 \f$, \f$ \lambda_y^2 \f$, and
    \f$ \lambda_z^2 \f$ of the gyration tensor (as returned by
    `getGyrationTensor`). The eigenvalues are arranged such that
    \f$ \lambda_x^2 \le \lambda_y^2 \le \lambda_y^z \f$.

    The eigenvalues are real and of type `numpy.float64`, and returned as
    the elements of a list.

Definition at line 483 of file ParticleCollection.py.

◆ getMass()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getMass (   self,
  index 
)
    Returns the mass of the particle with the given `index` as a `float`.

    @throw IndexError
           Throws if `index` is negative or `index >= getParticleCount()`.
    @throw RuntimeError
           Throws if no mass has been specified for the given particle.
    @throw TypeError
           Throws if `index` is not an `int`.

    @param[in] index
               The index of the particle to query, in the range of
               `[0, getParticleCount() - 1]`.

Definition at line 206 of file ParticleCollection.py.

◆ getMomentum()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getMomentum (   self,
  index 
)
    Returns the momentum of the particle with the given `index`, as an
    instance of `Vector3DReal`

    @throw IndexError
           Throws if `index` is negative or `index >= getParticleCount()`.
    @throw RuntimeError
           Throws if no mass has been specified for the given particle.
    @throw TypeError
           Throws if `index` is not an `int`.

    @param[in] index
               The index of the particle to query, in the range of
               `[0, getParticleCount() - 1]`.

Definition at line 236 of file ParticleCollection.py.

◆ getOrientationAngle()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getOrientationAngle (   self,
  axis 
)
    Returns the angle between the given `axis` and the eigenvector of the
    gyration tensor that corresponds to the largest eigenvalue.

Definition at line 601 of file ParticleCollection.py.

◆ getOrientationAngles()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getOrientationAngles (   self,
  axis 
)
    Returns the angle between the given `axis` and the eigenvectors of the
    gyration tensor. The returned value is a list, sorted by increasing
    eigenvalues, of pairs of eigenvalue and corresponding angle.

Definition at line 616 of file ParticleCollection.py.

◆ getParticleCount()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getParticleCount (   self)
    Returns the number of particles in this collection.

Definition at line 112 of file ParticleCollection.py.

◆ getPosition()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getPosition (   self,
  index 
)
    Returns the position of the particle with the given `index`, as an
    instance of `Vector3DReal`.

    @throw IndexError
           Throws if `index` is negative or `index >= getParticleCount()`.
    @throw TypeError
           Throws if `index` is not an `int`.

    @param[in] index
               The index of the particle to query, in the range of
               `[0, getParticleCount() - 1]`.

Definition at line 143 of file ParticleCollection.py.

◆ getPositions()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getPositions (   self)
    Returns a reference to the internal list of position vectors.

    @warning
    It is assumed that the returned reference will not be manipulated!

Definition at line 124 of file ParticleCollection.py.

◆ getRadiusOfGyration()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getRadiusOfGyration (   self)
    Returns the radius of gyration \f$ R_g \f$, i.e. the square root of the
    result of `getRadiusOfGyrationSquared`.

Definition at line 543 of file ParticleCollection.py.

◆ getRadiusOfGyrationSquared()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getRadiusOfGyrationSquared (   self)
    Returns the sum of the eigenvalues of the gyration tensor, as returned
    by `getGyrationTensorPrincipalMoments`

Definition at line 532 of file ParticleCollection.py.

◆ getRelativeShapeAnisotropy()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getRelativeShapeAnisotropy (   self)
    Returns the relative shape anisotropy \f$ \kappa^2 \f$, i.e.
    \f[
        \frac{ b^2 + \frac{3}{4} c^2 }{ R_g^4 }
    \f]
    where \f$ b \f$ is the asphericity, \f$ c \f$ is the acylindricity, and
    \f$ R_g \f$ is the radius of gyration.

Definition at line 588 of file ParticleCollection.py.

◆ getVelocities()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getVelocities (   self)
    Returns a reference to the internal list of velocity vectors.

    @warning
    It is assumed that the returned reference will not be manipulated!

Definition at line 161 of file ParticleCollection.py.

◆ getVelocity()

def MPCDAnalysis.ParticleCollection.ParticleCollection.getVelocity (   self,
  index 
)
    Returns the velocity of the particle with the given `index`, as an
    instance of `Vector3DReal`

    @throw IndexError
           Throws if `index` is negative or `index >= getParticleCount()`.
    @throw TypeError
           Throws if `index` is not an `int`.

    @param[in] index
               The index of the particle to query, in the range of
               `[0, getParticleCount() - 1]`.

Definition at line 180 of file ParticleCollection.py.

◆ isEmpty()

def MPCDAnalysis.ParticleCollection.ParticleCollection.isEmpty (   self)
    Returns whether this collection contains any particles.

Definition at line 103 of file ParticleCollection.py.

◆ rotateAroundNormalizedAxis()

def MPCDAnalysis.ParticleCollection.ParticleCollection.rotateAroundNormalizedAxis (   self,
  axis,
  angle 
)
    Rotates all position and velocity vectors around the given `axis` for
    the given `angle`.

    @throw TypeError
           Throws if one of the arguments is of the wrong type.
    @throw ValueError
           Throws if `axis` is not a unit-length vector.

    @param[in] axis
               The axis to rotate around, which must have unit length.
    @param[in] angle
               The angle to rotate, in radians, as an instance of `float`.

Definition at line 331 of file ParticleCollection.py.

◆ setPositionsAndVelocities()

def MPCDAnalysis.ParticleCollection.ParticleCollection.setPositionsAndVelocities (   self,
  positions,
  velocities 
)
    Sets the particle positions and velocities.

    The given arguments will be copied into an instance-internal store.

    @throw TypeError
           Throws if the arguments do not have the types specified in their
           documentation.
    @throw ValueError
           Throws if the `positions` and `velocities` lists do not have
           equal length.

    @param[in] positions
               A list of `Vector3DReal` instances, describing the particle
               positions.
    @param[in] velocities
               A list of `Vector3DReal` instances, describing the particle
               velocities.

Definition at line 46 of file ParticleCollection.py.

◆ setUniformMass()

def MPCDAnalysis.ParticleCollection.ParticleCollection.setUniformMass (   self,
  mass 
)
    Sets a uniform mass for all particles, including currently stored ones
    and ones that may be added or altered later.

    @throw TypeError
           Throws if `mass` is neither `int` nor `float`.
    @throw ValueError
           Throws if `mass` is smaller than `0`.

    @param[in] mass
               The particle mass, which must be a non-negative `int` or
               `float`.

Definition at line 88 of file ParticleCollection.py.

◆ shiftToCenterOfMassFrame()

def MPCDAnalysis.ParticleCollection.ParticleCollection.shiftToCenterOfMassFrame (   self)
    Transforms the positions and velocities into the center of mass frame.

Definition at line 356 of file ParticleCollection.py.


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