espressomd.io.writer package

Submodules

espressomd.io.writer.h5md module

class espressomd.io.writer.h5md.H5md(**kwargs)[source]

Bases: ScriptInterfaceHelper

H5md file object.

Note

Bonds will be written to the file if they exist. The pypresso script will be written in the metadata.

Parameters:
  • file_path (str or pathlib.Path) – Path to the trajectory file, or an existing file to append data to (it must have the same specifications).

  • unit_system (UnitSystem, optional) – Physical units for the data.

  • fields (set or str, optional) – List of fields to write to the trajectory file. Defaults to 'all'. See valid_fields() for the list of valid fields. This list defines the H5MD specifications. If the file in file_path already exists but has different specifications, an exception is raised.

  • chunk_size (int) – The chunk size for hdf5 write operations. Must be greater than 0.

get_params()

Get the parameters from the script interface.

file_path

Path to the trajectory file.

Type:

str

script_path

Path to the pypresso script, or empty string for interactive sessions.

Type:

str

fields

List of fields to write to the trajectory file.

Type:

list

mass_unit
Type:

str

length_unit
Type:

str

time_unit
Type:

str

force_unit
Type:

str

velocity_unit
Type:

str

charge_unit
Type:

str

chunk_size
Type:

int

close(**kwargs)

Close the H5md file and flush both the data and superblock.

default_params()[source]
flush(**kwargs)

Call the H5md flush method. Only the dataset buffers will be flushed. The file superblock, which contains the datasets and metadata address space information (End of Allocation, EOA), won’t be flushed. Only the H5md close method can flush the superblock. A file that was manually flushed via this method but not properly closed might have a stale EOA and thus be unreadable. This can happen when a simulation receives a termination signal and doesn’t have time to release all file handles.

required_keys()[source]
valid_fields(**kwargs)

Get the list of valid fields.

valid_keys()[source]
write(**kwargs)

Call the H5md write method.

class espressomd.io.writer.h5md.UnitSystem(**kwargs)[source]

Bases: object

Data class for writing H5MD trajectories with physical units. There are four settable units: ‘mass’, ‘length’, ‘time’, ‘charge’. Units should be written as strings following the specifications defined here, e.g. UnitSystem(time='ps', mass='u', length='nm', charge='e').

espressomd.io.writer.vtf module

espressomd.io.writer.vtf.vtf_pid_map(system, types='all')[source]

Generates a VTF particle index map to ESPResSo id. This fills the gap for particle ID’s as required by VMD.

Parameters:
Returns:

A dictionary where the values are the VTF indices and the keys are the ESPresSo particle id.

Return type:

dict

espressomd.io.writer.vtf.writevcf(system, fp, types='all')[source]

writes a VCF (VTF Coordinate Format) to a file. This can be used to write a timestep to a VTF file.

Parameters:
  • system (espressomd.system.System)

  • types (str) – Specifies the particle types. The string ‘all’ will write all particles

  • fp (file) – File pointer to write to.

espressomd.io.writer.vtf.writevsf(system, fp, types='all')[source]

writes a VST (VTF Structure Format) to a file. This can be used to write the header of a VTF file.

Parameters:
  • system (espressomd.system.System)

  • types (str) – Specifies the particle types. The string ‘all’ will write all particles

  • fp (file) – File pointer to write to.

Module contents