Universe
- mechanica.Universe
Global universe instance.
- class mechanica.MxUniverse
The universe is a top level singleton object, and is automatically initialized when the simulator loads. The universe is a representation of the physical universe that we are simulating, and is the repository for all physical object representations.
All properties and methods on the universe are static, and you never actually instantiate a universe.
Universe has a variety of properties such as boundary conditions, and stores all the physical objects such as particles, bonds, potentials, etc.
- property temperature
Universe temperature
- property time
Current time
- property dt
Time step
- property boundary_conditions
Boundary conditions
- property kinetic_energy
Universe kinetic energy
- property center: MxVector3f
Universe center point
- property num_types: int
Number of particle types
- property cutoff: float
Global interaction cutoff distance
- static origin() MxVector3f
Gets the origin of the universe
- Return type
- Returns
MxVector3f
- static dim() MxVector3f
Gets the dimensions of the universe
- Return type
- Returns
MxVector3f
- property name
- static virial(origin: MxVector3f = None, radius: float * = None, types: std::vector< MxParticleType *, std::allocator< MxParticleType * > > * = None) MxMatrix3f *
Computes the virial tensor for the either the entire simulation domain, or a specific local virial tensor at a location and radius. Optionally can accept a list of particle types to restrict the virial calculation for specify types.
- Parameters
origin (
MxVector3f) – An optional length-3 array for the origin. Defaults to the center of the simulation domain if not given.radius (float) – An optional number specifying the size of the region to compute the virial tensor for. Defaults to the entire simulation domain.
types (std::vector< MxParticleType *,std::allocator< MxParticleType * > >) – An optional list of
Particletypes to include in the calculation. Defaults to every particle type.
- Return type
- Returns
MxMatrix3f*
- static step(until: double const & = 0, dt: double const & = 0) HRESULT
Performs a single time step
dtof the universe if no arguments are given. Optionally runs untiluntil, and can use a different timestep ofdt.- Parameters
until (float) – runs the timestep for this length of time, optional.
dt (float) – overrides the existing time step, and uses this value for time stepping; currently not supported.
- Return type
int
- Returns
HRESULT
- static stop() HRESULT
Stops the universe time evolution. This essentially freezes the universe, everything remains the same, except time no longer moves forward.
- Return type
int
- Returns
HRESULT
- static start() HRESULT
Starts the universe time evolution, and advanced the universe forward by timesteps in
dt. All methods to build and manipulate universe objects are valid whether the universe time evolution is running or stopped.- Return type
int
- Returns
HRESULT
- static particles() MxParticleList *
Gets all particles in the universe
- Return type
- Returns
MxParticleList*
- static grid(shape: MxVector3i) std::vector< std::vector< std::vector< MxParticleList *,std::allocator< MxParticleList * > >,std::allocator< std::vector< MxParticleList *,std::allocator< MxParticleList * > > > >,std::allocator< std::vector< std::vector< MxParticleList *,std::allocator< MxParticleList * > >,std::allocator< std::vector< MxParticleList *,std::allocator< MxParticleList * > > > > > >
Gets a three-dimesional array of particle lists, of all the particles in the system.
- Parameters
shape (
MxVector3i) – shape of grid- Return type
std::vector< std::vector< std::vector< MxParticleList *,std::allocator< MxParticleList * > >,std::allocator< std::vector< MxParticleList *,std::allocator< MxParticleList * > > > >,std::allocator< std::vector< std::vector< MxParticleList *,std::allocator< MxParticleList * > >,std::allocator< std::vector< MxParticleList *,std::allocator< MxParticleList * > > > > > >
- Returns
std::vector<std::vector<std::vector<MxParticleList*> > >
- static bonds() std::vector< MxBondHandle *,std::allocator< MxBondHandle * > > *
Get all bonds in the universe
- Return type
std::vector< MxBondHandle *,std::allocator< MxBondHandle * > >
- Returns
std::vector<MxBondHandle*>*