ParticleList and ParticleTypeList
- mechanica.ParticleList
alias of
mechanica.mechanica.MxParticleList
- class mechanica.MxParticleList(*args)
A special list with convenience methods for working with sets of particles.
- property virial
Virial tensor of particles in list
- property radius_of_gyration
Radius of gyration of particles in list
- property center_of_mass
Center of mass of particles in list
- property centroid
Centroid of particles in list
- property moment_of_inertia
Moment of inertia of particles in list
- property positions
Position of each particle in list
- property velocities
Velocity of each particle in list
- property forces
Net forces acting on each particle in list
- __len__() int
- __getitem__(i: int)
- insert(*args) uint16_t
Inserts the given particle into the list, returns the index of the item.
- Parameters
particle (
MxParticleHandle) – particle to insert- Return type
int
- Returns
uint16_t
- remove(id: int32_t) uint16_t
looks for the item with the given id and deletes it form the list
- Parameters
id (int) – id to remove
- Return type
int
- Returns
uint16_t
- extend(other: MxParticleList) void
inserts the contents of another list
- Parameters
other (
MxParticleList) – another list
- item(i: int32_t const &) MxParticleHandle *
looks for the item at the given index and returns it if found, otherwise returns NULL
- Parameters
i (int) – index of lookup
- Return type
- Returns
MxParticleHandle*
- static all() MxParticleList *
returns an instance populated with all current particles
- Return type
- Returns
MxParticleList*
- sphericalPositions(origin: MxVector3f = None) std::vector< MxVector3f,std::allocator< MxVector3f > >
Get the spherical coordinates of each particle
- Parameters
origin (
MxVector3f) – optional origin of coordinates; default is center of universe- Return type
std::vector< MxVector3f,std::allocator< MxVector3f > >
- Returns
std::vector<MxVector3f>
- toString() std::string
Get a JSON string representation
- Return type
string
- Returns
std::string
- static fromString(str: std::string const &) MxParticleList *
Create from a JSON string representation
- Parameters
str (string) –
- Return type
- Returns
MxParticleList*
- __reduce__()
Helper for pickle.
- mechanica.ParticleTypeList
- class mechanica.MxParticleTypeList(*args)
A special list with convenience methods for working with sets of particle types.
- property virial
Virial tensor of particles corresponding to all types in list
- property radius_of_gyration
Radius of gyration of particles corresponding to all types in list
- property center_of_mass
Center of mass of particles corresponding to all types in list
- property centroid
Centroid of particles corresponding to all types in list
- property moment_of_inertia
Moment of inertia of particles corresponding to all types in list
- property positions
Position of each particle corresponding to all types in list
- property velocities
Velocity of each particle corresponding to all types in list
- property forces
Total net force acting on each particle corresponding to all types in list
- __len__() int
- __getitem__(i: int)
- insert(*args) uint16_t
Inserts the given particle type into the list, returns the index of the item.
- Parameters
ptype (
MxParticleType) –- Return type
int
- Returns
uint16_t
- remove(id: int32_t) uint16_t
looks for the item with the given id and deletes it form the list
- Parameters
id (int) – id to remove
- Return type
int
- Returns
uint16_t
- extend(other: MxParticleTypeList) void
inserts the contents of another list
- Parameters
other (
MxParticleTypeList) – another list
- item(i: int32_t const &) MxParticleType *
looks for the item at the given index and returns it if found, otherwise returns NULL
- Parameters
i (int) – index of lookup
- Return type
- Returns
MxParticleType*
- static all() MxParticleTypeList *
returns an instance populated with all current particle types
- Return type
- Returns
MxParticleTypeList*
- sphericalPositions(origin: MxVector3f = None) std::vector< MxVector3f,std::allocator< MxVector3f > >
Get the spherical coordinates of each particle
- Parameters
origin (
MxVector3f) – optional origin of coordinates; default is center of universe- Return type
std::vector< MxVector3f,std::allocator< MxVector3f > >
- Returns
std::vector<MxVector3f>
- toString() std::string
Get a JSON string representation
- Return type
string
- Returns
std::string
- static fromString(str: std::string const &) MxParticleTypeList *
Create from a JSON string representation
- Parameters
str (string) –
- Return type
- Returns
MxParticleTypeList*
- __reduce__()
Helper for pickle.