DCD

class hoomd.write.DCD(trigger, filename, filter=hoomd.filter.All(), overwrite=False, unwrap_full=False, unwrap_rigid=False, angle_z=False)

Bases: Writer

Writes simulation trajectories in the DCD format.

Parameters:
  • trigger (hoomd.trigger.Periodic) – Select the timesteps to write.

  • filename (str) – File name to write.

  • filter (hoomd.filter.filter_like) – Select the particles to write. Defaults to hoomd.filter.All.

  • overwrite (bool) – When False, (the default) an existing DCD file will be appended to. When True, an existing DCD file filename will be overwritten.

  • unwrap_full (bool) – When False, (the default) particle coordinates are always written inside the simulation box. When True, particles will be unwrapped into their current box image before writing to the DCD file.

  • unwrap_rigid (bool) – When False, (the default) individual particles are written inside the simulation box which breaks up rigid bodies near box boundaries. When True, particles belonging to the same rigid body will be unwrapped so that the body is continuous. The center of mass of the body remains in the simulation box, but some particles may be written just outside it. unwrap_rigid is ignored when unwrap_full is True.

  • angle_z (bool) – When True, the particle orientation angle is written to the z component (only useful for 2D simulations)

DCD writes the simulation trajectory to the specified file in the DCD file format. DCD stores only particle positions and the box parameters, in length units, and is limited to simulations where the number of particles is fixed.

Warning

When you use DCD to append to an existing DCD file:

  • The period must be the same or the time data in the file will not be consistent.

  • DCD will not write out data at time steps that already are present in the DCD file.

Example:

dcd = hoomd.write.DCD(
    trigger=hoomd.trigger.Periodic(1_000_000),
    filename=dcd_filename,
)
simulation.operations.writers.append(dcd)

Members inherited from AutotunedObject:

property kernel_parameters

Kernel parameters. Read more...

property is_tuning_complete

Check if kernel parameter tuning is complete. Read more...

tune_kernel_parameters()

Start tuning kernel parameters. Read more...


Members inherited from Integrator:

trigger

The trigger to activate this operation. Read more...


Members defined in DCD:

filename

File name to write (read only).

Example:

filename = dcd.filename
Type:

str

filter

Select the particles to write (read only).

Example:

filter_ = dcd.filter
Type:

hoomd.filter.filter_like

overwrite

When False, an existing DCD file will be appended to. When True, an existing DCD file filename will be overwritten (read only).

Example:

overwrite = dcd.overwrite
Type:

bool

unwrap_full

When False, particle coordinates are always written inside the simulation box. When True, particles will be unwrapped into their current box image before writing to the DCD file.

Example:

dcd.unwrap_full = True
Type:

bool

unwrap_rigid

When False, individual particles are written inside the simulation box which breaks up rigid bodies near box boundaries. When True, particles belonging to the same rigid body will be unwrapped so that the body is continuous. The center of mass of the body remains in the simulation box, but some particles may be written just outside it. unwrap_rigid is ignored when unwrap_full is True.

Example:

dcd.unwrap_rigid = True
Type:

bool

angle_z

When True, the particle orientation angle is written to the z component.

Example:

dcd.angle_z = True
Type:

bool