make_random Initialize particles randomly
read_snapshot Initialize from a snapshot


MPCD system initialization

Commands to initialize the MPCD system data. Currently, random initialization and snapshot initialization (see are supported. Random initialization is useful for large systems where a snapshot is impractical. Snapshot initialization is useful when you require fine control over the particle properties and initial configuration.

hoomd.mpcd.init.make_random(N, kT, seed)

Initialize particles randomly

  • N (int) – Total number of MPCD particles
  • kT (float) – Temperature of MPCD particles (in energy units)
  • seed (int) – Random seed for initialization

Initialized MPCD system data (

MPCD particles are randomly initialized into the simulation box. An MPCD system can be randomly initialized only after the HOOMD system is first initialized (see hoomd.init). The system can only be initialized one time. The total number of particles N is evenly divided between all domains. Random positions are then drawn uniformly within the (local) box. Particle velocities are drawn from a Maxwell-Boltzmann distribution consistent with temperature kT. All MPCD particles are given unit mass and type A.


mpcd.init.make_random(N=1250000000, kT=1.0, seed=42)


Random number generation is performed using C++11 mt19937 seeded by seed plus the rank number in MPI simulations. This random number generator is separate from other generators used in MPCD, so seed can be reasonably recycled elsewhere.


Initialize from a snapshot

Parameters:snapshot ( – MPCD system data snapshot
Returns:Initialized MPCD system data (

An MPCD system can be initialized from a snapshot after the HOOMD system is first initialized (see hoomd.init). The system can only be initialized one time. If no type is specified in the snapshot, a default type A will be assigned to the MPCD particles.


snap =
snap.particles.position[:] = L * np.random.random((10,3))


It is expected that the snapshot has the same box size as the HOOMD system. By default, this is how a new snapshot is initialized. If the HOOMD system is resized after the MPCD snapshot is created and before initialization from the MPCD snapshot, an error will be raised if the MPCD snapshot is not properly resized.