DumpH5MD - IO object

This module provides a writer for H5MD file format.

espressopp.io.DumpH5MD(system, integrator, filename, group_name, *args)
Parameters:
  • system (espressopp.System) – The system object.
  • integrator (espressopp.integrator.MDIntegrator) – System integrator.
  • filename (str) – The file name.
  • group_name (str) – The name of particle group.
  • is_adress (bool) – If positive then store position of AdResS particles
  • author (str) – The name of author of this file
  • email (str) – The e-mail address to the author.
  • chunk_size (int) –
  • static_box (bool) – box size written as time-independent variable
  • is_single_prec (bool) – Store float values with single precision (default: False)
  • store_position – Saves postions of particles
  • store_species – Saves types of particles.
  • store_state – Saves states of particles.
  • store_velocity – Saves velocities of particles.
  • store_force – Saves forces of particles
  • store_charge – Saves charges of particles
  • store_lambda – Saves lambdas (AdResS) of particles
  • store_res_id – Saves residues id of particles.
  • store_mass – Saves masses of particles
Return type:

The DumpH5MD writer.

Example

>>> traj_file = espressopp.io.DumpH5MD(
        system, integrator, output_file,
        group_name='atoms',
        static_box=False,
        author='xxx',
        email='xxx@xxx',
        store_species=True,
        store_velocity=True,
        store_state=True,
        store_lambda=True)
>>> for s in range(steps):
        integrator.run(int_steps)
        traj_file.dump(s*int_steps, s*int_steps*integrator.dt)

Important note. Within the current approach, this extension is not compatible with ExtAnalyze module. Therefore, this code does not work:

>>> ext_analyze = espressopp.integrator.ExtAnalyze(traj_file, 10)
>>> integrator.addExtension(ext_analyze)
>>> integrator.run(2000)

Sorting file

The content of the /particles/{}/ is not sorted with respect to the particle id. This is because of the way how the data are stored by multiple cores simultaneously.

If the flag do_sort is True then during the close method, the data will be sorted.