Particles and Clusters

class Particle(object)

The particle is the most basic physical object we provide. All other physical objects either extend the base Particle, or are collections of particles such as the Cluster

static items()

Returns a list of all of the instances of this type.

position

vector3 – gets / sets the global position of the particle

velocity

vector3 – returns the velocity of the particle, read-only

force

vector3 – returns the net force that acts on this particle

charge

number – gets the total charge of the particle.

mass
radius
name
name2
dynamics

number – one of the Integrator Constants that specifies the time evolution of this particle. Particles can be either intertial particles that obey Newtonian dynamics, \(F=ma\) or overdamped dynamics, \(F \propto mv\).

age
style

Style – gets / sets the style of an object. When we create a new particle instance, it’s style points to the style attribute of the particle’s type, so that if we change something in the particle type, this changes every instance of that type. For more details, see the Style section.

frozen

Get / sets the frozen attribute. Frozen particles are fixed in place, and will not move if any force acts on them.

id
type_id
flags
become(type)

Dynamically changes the type of an object. We can change the type of a Particle derived object to anyther pre-existing Particle derived type. What this means is that if we have an object of say type A, we can change it to another type, say B, and and all of the forces and processes that acted on objects of type A stip and the forces and processes defined for type B now take over. See section Changing Type for more details.

Parameters:type – (Type)
split()

Splits a single particle into two, for more details, see section Splitting and Cleavage. The particle version of split is fairly simple, however the Cluster.split() offers many more options.

fission()

synonym for split()

destroy()

Destroys the particle, and removes it form inventory. The present object is handle that now references an empty particle. Calling any method after destroy will result in an error.

spherical([origin])

Calculates the particle’s coordinates in spherical coordinates (\([\rho, \theta, \phi]\)), where \(\rho\) is the distance from the origin, \(\theta\) is the azimuthal polar angle ranging from \([0,2 \pi]\), and \(phi\) is the declination from vertical, ranging from \([0,\pi]\)

Parameters:origin ([x,y,z]) – a vector of the origin to use for spherical coordinate calculations, optional, if not given, uses the center of the simulation domain as the origin.
virial([distance])

Computes the virial tensor, see Pressure and Virial Tensors.

Parameters:distance – (number (,optional)) distance from the center of this particle to include the other particles to use for the virial calculation.
Return type:3x3 matrix
neighbors([distance][, types])

Gets a list of all the other particles that are near the current one. By default, we list all the nearest particles that interact with the current one via forces.

Parameters:
  • distance – (number (,optional)) - An optional search distance, if specified will get all objects within the given distance. Defaults to the global simulation cutoff distance.
  • types – (tuple, (,optional)) – If specified, can provide a tuple of types to include in the neighbor search. If types are provides, this method will return all non-cluster particles within a certain distance. Defaults to all types.

For example, to search for all objects of type A and B a distance of 1 unit away from a particle p, we would:

>>> nbrs = p.neighbors(distance=1, types=(A, B))
>>> print(len(nbrs))
class Cluster(Particle)

A Cluster is a collection of particles.

split([axis][, random][, normal][, point])

Splits the cluster into two clusters, where the first one is the original cluster and the new one is a new ‘daughter’ cluster.

split is discussed in detail in Splitting and Cleavage

Parameters:
  • axis – (length 3 vector (,optional)) - orientation axis for a split. If the ‘axis’ argument is given, the ‘split’ method chooses a random plane co-linear with this vector and uses this as the cleavage plane.
  • random – (Boolean (,optional)) - ‘split’ chooses a random cleavage plane coincident with the center of mass of the cluster.
  • normal – (length 3 vector (,optional)) - a normal direction for the cleavage plane.
  • point – (length 3 vector (,optional)) - if given, uses this point to determine the point-normal form for the clevage plane.
virial()

Computes the Virial Tensor for the particles in this cluster.

radius_of_gyration()

Computes the Radius of Gyration for the particles in this cluster.

center_of_mass()

Computes the Center of Mass for the particles in this cluster.

center_of_geometry()

Computes the Center of Geometry for the particles in this cluster.

moment_of_inertia()

Computes the Moment of Inertia for the particles in this cluster.

centroid()

Convenience synonym for center_of_geometry

inertia()

Convenience synonym for moment_of_inertia