mpcd.init¶
Overview
make_random |
Initialize particles randomly |
read_snapshot |
Initialize from a snapshot |
Details
MPCD system initialization
Commands to initialize the MPCD system data. Currently, random initialization
and snapshot initialization (see hoomd.mpcd.data
) 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
Parameters: Returns: Initialized MPCD system data (
hoomd.mpcd.data.system
)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.Examples:
mpcd.init.make_random(N=1250000000, kT=1.0, seed=42)
Notes
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.
-
hoomd.mpcd.init.
read_snapshot
(snapshot)¶ Initialize from a snapshot
Parameters: snapshot ( hoomd.mpcd.data.snapshot
) – MPCD system data snapshotReturns: Initialized MPCD system data ( hoomd.mpcd.data.system
)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.Examples:
snap = mpcd.data.make_snapshot(N=10) snap.particles.position[:] = L * np.random.random((10,3)) mpcd.init.read_snapshot(snap)
Notes
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.