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

MxVector3f

Returns

MxVector3f

static dim() MxVector3f

Gets the dimensions of the universe

Return type

MxVector3f

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 Particle types to include in the calculation. Defaults to every particle type.

Return type

MxMatrix3f

Returns

MxMatrix3f*

static step(until: double const & = 0, dt: double const & = 0) HRESULT

Performs a single time step dt of the universe if no arguments are given. Optionally runs until until, and can use a different timestep of dt.

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

MxParticleList

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*>*

static angles() std::vector< MxAngleHandle *,std::allocator< MxAngleHandle * > > *

Get all angles in the universe

Return type

std::vector< MxAngleHandle *,std::allocator< MxAngleHandle * > >

Returns

std::vector<MxAngleHandle*>*

static dihedrals() std::vector< MxDihedralHandle *,std::allocator< MxDihedralHandle * > > *

Get all dihedrals in the universe

Return type

std::vector< MxDihedralHandle *,std::allocator< MxDihedralHandle * > >

Returns

std::vector<MxDihedral*>*