HDF5Log

class hoomd.write.HDF5Log(trigger, filename, logger, mode='a')

Write loggable simulation data to HDF5 files.

This class stores resizable scalar and array data in the HDF5 file format.

Note

This class requires that h5py be installed.

Important

The HDF5 file can be used for other data storage; however, the “hoomd-data” key is reserved for use by this class. An exception will be thrown if this requirement is not met.

Warning

This class cannot handle string, strings, or object loggables.

Parameters:
  • trigger (hoomd.trigger.trigger_like) – The trigger to determine when to write to the HDF5 file.

  • filename (str) – The filename of the HDF5 file to write to.

  • logger (hoomd.logging.Logger) – The logger instance to use for querying log data.

  • mode (str, optional) – The mode to open the file in. Available values are “w”, “x” and “w-”, “a”, and “r+”. Defaults to “a”. See the h5py documentation for more details).

Example:

logger = hoomd.logging.Logger(hoomd.write.HDF5Log.accepted_categories)
hdf5_log = hoomd.write.HDF5Log(
    trigger=hoomd.trigger.Periodic(10_000),
    filename=hdf5_filename,
    logger=logger,
)
simulation.operations.writers.append(hdf5_log)

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

accepted_categories

The enum value for all accepted categories for HDF5Log instances which is all categories other than “string”, “strings”, and “object” (see hoomd.logging.LoggerCategories).

Example:

accepted_categories = hoomd.write.HDF5Log.accepted_categories
Type:

hoomd.logging.LoggerCategories

filename

The filename of the HDF5 file written to (read only).

Example:

filename = hdf5_log.filename
Type:

str

logger

The logger instance used for querying log data (read only).

Example:

logger = hdf5_log.logger
Type:

hoomd.logging.Logger

mode

The mode the file was opened in (read only).

Example:

mode = hdf5_log.mode
Type:

str

flush()

Write out all data currently buffered in memory.

Examples:

Flush one writer:

hdf5_writer.flush()

Flush all write buffers:

for writer in simulation.operations.writers:
    if hasattr(writer, "flush"):
        writer.flush()