Burst

class hoomd.write.Burst(trigger, filename, filter=hoomd.filter.All(), mode='ab', dynamic=None, logger=None, max_burst_size=-1, write_at_start=False)

Bases: GSD

Write the last \(N\) stored frames in the GSD format.

When triggered, Burst adds a frame (up the last \(N\) frames) in a buffer. Call dump to write the frames to the file. When the the next frame would result in \(N + 1\) frames being stored, the oldest frame is removed and the new frame is added.

Parameters:
  • trigger (hoomd.trigger.trigger_like) – Select the timesteps to store in the buffer.

  • filename (str) – File name to write.

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

  • mode (str) – The file open mode. Defaults to 'ab'.

  • dynamic (list[str]) – Field names and/or field categores to save in all frames. Defaults to ['property'].

  • logger (hoomd.logging.Logger) – Provide log quantities to write. Defaults to None.

  • max_burst_size (int) – The maximum number of frames to store before between writes. -1 represents no limit. Defaults to -1.

  • write_at_start (bool) – When True and the file does not exist or has 0 frames: write one frame with the current state of the system when hoomd.Simulation.run is called. Defaults to False.

  • clear_whole_buffer_after_dump (bool) – When True the buffer is emptied after calling dump each time. When False, dump removes frames from the buffer until the end index. Defaults to True.

Warning

Burst errors when attempting to create a file or writing to one with zero frames when write_at_start is False.

Note

When analyzing files created by Burst, generally the first frame is not associated with the call to Burst.dump.

Example:

burst = hoomd.write.Burst(
    trigger=hoomd.trigger.Periodic(1_000),
    filename=burst_filename,
    max_burst_size=100,
    write_at_start=True,
)
simulation.operations.writers.append(burst)

See also

The base class hoomd.write.GSD


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 Burst:

max_burst_size

The maximum number of frames to store before between writes. -1 represents no limit.

Example:

burst.max_burst_size = 200
Type:

int

write_at_start

When True and the file does not exist or has 0 frames: write one frame with the current state of the system when hoomd.Simulation.run is called (read only).

Example:

write_at_start = burst.write_at_start
Type:

bool

clear_whole_buffer_after_dump

When True the buffer is emptied after calling dump each time. When False, dump removes frames from the buffer until the end index.

Example:

burst.clear_buffer_after_dump = False
Type:

bool

__len__()

Get the current length of the internal frame buffer.

Example:

buffered_frames = len(burst)
dump(start=0, end=-1)

Write stored frames in range to the file and empties the buffer.

This method alllows for custom writing of frames at user specified conditions.

Parameters:
  • start (int) – The first frame to write. Defaults to 0.

  • end (int) – The last frame to write. Defaults to -1 (last frame).

Example:

burst.dump()