# deprecated.dump¶

Overview

 deprecated.dump.pos Writes simulation snapshots in the POS format deprecated.dump.xml Writes simulation snapshots in the HOOMD XML format.

Details

Deprecated trajectory file writers.

class hoomd.deprecated.dump.pos(filename, period=None, unwrap_rigid=False, phase=0, addInfo=None)

Writes simulation snapshots in the POS format

Parameters: filename (str) – File name to write period (int) – (optional) Number of time steps between file dumps 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. phase (int) – When -1, start on the current time step. When >= 0, execute on steps where (step + phase) % period == 0. addInfo (callable) – A user-defined python function that returns a string of additional information when it is called. This information will be printed in the pos file beneath the shape definitions. The information returned by addInfo may dynamically change over the course of the simulation; addInfo is a function of the simulation timestep only.

Deprecated since version 2.0.

The file is opened on initialization and a new frame is appended every a period steps.

Warning

pos is not restart compatible. It always overwrites the file on initialization.

Examples:

dump.pos(filename="dump.pos", period=1000)
pos = dump.pos(filename="particles.pos", period=1e5)

disable()

Disable the analyzer.

Examples:

my_analyzer.disable()


Executing the disable command will remove the analyzer from the system. Any hoomd.run() command executed after disabling an analyzer will not use that analyzer during the simulation. A disabled analyzer can be re-enabled with enable().

enable()

Enables the analyzer

Examples:

my_analyzer.enable()

restore_state()

Resore the state information from the file used to initialize the simulations

set_def(typ, shape)

Set a pos def string for a given type

Parameters: typ (str) – Type name to set shape def shape (str) – Shape def string to set
set_period(period)

Changes the period between analyzer executions

Parameters: period (int) – New period to set (in time steps)

Examples:

analyzer.set_period(100)
analyzer.set_period(1)


While the simulation is running (hoomd.run(), the action of each analyzer is executed every period time steps. Changing the period does not change the phase set when the analyzer was first created.

class hoomd.deprecated.dump.xml(group, filename='dump', period=None, time_step=None, phase=0, restart=False, **params)

Writes simulation snapshots in the HOOMD XML format.

Parameters: group (hoomd.group) – Group of particles to dump filename (str) – (optional) Base of the file name period (int) – (optional) Number of time steps between file dumps params – (optional) Any number of parameters that set_params() accepts time_step (int) – (optional) Time step to write into the file (overrides the current simulation step). time_step is ignored for periodic updates phase (int) – When -1, start on the current time step. When >= 0, execute on steps where &(step + phase) % period == 0*. restart (bool) – When True, write only filename and don’t save previous states.

Deprecated since version 2.0: GSD is the new default file format for HOOMD-blue. It can store everything that an XML file can in an efficient binary format that is easy to access. See hoomd.dump.gsd.

Every period time steps, a new file will be created. The state of the particles in group at that time step is written to the file in the HOOMD XML format. All values are written in native HOOMD-blue units, see Units for more information.

If you only need to store a subset of the system, you can save file size and time spent analyzing data by specifying a group to write out. xml will write out all of the particles in group in ascending tag order. When the group is not hoomd.group.all(), xml will not write the topology fields (bond, angle, dihedral, improper, constraint).

Examples:

deprecated.dump.xml(group=group.all(), filename="atoms.dump", period=1000)
xml = deprecated.dump.xml(group=group.all(), filename="particles", period=1e5)
xml = deprecated.dump.xml(group=group.all(), filename="test.xml", vis=True)
xml = deprecated.dump.xml(group=group.all(), filename="restart.xml", all=True, restart=True, period=10000, phase=0);
xml = deprecated.dump.xml(group=group.type('A'), filename="A", period=1e3)


If period is set and restart is False, a new file will be created every period steps. The time step at which the file is created is added to the file name in a fixed width format to allow files to easily be read in order. I.e. the write at time step 0 with filename="particles" produces the file particles.0000000000.xml.

If period is set and restart is True, xml will write a temporary file and then move it to filename. This stores only the most recent state of the simulation in the written file. It is useful for writing jobs that are restartable - see Restartable jobs. Note that this causes high metadata traffic on lustre filesystems and may cause your account to be blocked at some supercomputer centers. Use hoomd.dump.gsd for efficient restart files.

By default, only particle positions are output to the dump files. This can be changed with set_params(), or by specifying the options in the xml command.

If period is not specified, then no periodic updates will occur. Instead, the file filename is written immediately. time_step is passed on to write()

disable()

Disable the analyzer.

Examples:

my_analyzer.disable()


Executing the disable command will remove the analyzer from the system. Any hoomd.run() command executed after disabling an analyzer will not use that analyzer during the simulation. A disabled analyzer can be re-enabled with enable().

enable()

Enables the analyzer

Examples:

my_analyzer.enable()

restore_state()

Resore the state information from the file used to initialize the simulations

set_params(all=None, vis=None, position=None, image=None, velocity=None, mass=None, diameter=None, type=None, body=None, bond=None, angle=None, dihedral=None, improper=None, constraint=None, acceleration=None, charge=None, orientation=None, angmom=None, inertia=None, vizsigma=None)

Change xml write parameters.

Parameters: all (bool) – (if True) Enables the output of all optional parameters below vis (bool) – (if True) Enables options commonly used for visualization. - Specifically, vis=True sets position, mass, diameter, type, body, bond, angle, dihedral, improper, charge position (bool) – (if set) Set to True/False to enable/disable the output of particle positions in the xml file image (bool) – (if set) Set to True/False to enable/disable the output of particle images in the xml file velocity (bool) – (if set) Set to True/False to enable/disable the output of particle velocities in the xml file mass (bool) – (if set) Set to True/False to enable/disable the output of particle masses in the xml file diameter (bool) – (if set) Set to True/False to enable/disable the output of particle diameters in the xml file type (bool) – (if set) Set to True/False to enable/disable the output of particle types in the xml file body (bool) – (if set) Set to True/False to enable/disable the output of the particle bodies in the xml file bond (bool) – (if set) Set to True/False to enable/disable the output of bonds in the xml file angle (bool) – (if set) Set to True/False to enable/disable the output of angles in the xml file dihedral (bool) – (if set) Set to True/False to enable/disable the output of dihedrals in the xml file improper (bool) – (if set) Set to True/False to enable/disable the output of impropers in the xml file constraint (bool) – (if set) Set to True/False to enable/disable the output of constraints in the xml file acceleration (bool) – (if set) Set to True/False to enable/disable the output of particle accelerations in the xml charge (bool) – (if set) Set to True/False to enable/disable the output of particle charge in the xml orientation (bool) – (if set) Set to True/False to enable/disable the output of particle orientations in the xml file angmom (bool) – (if set) Set to True/False to enable/disable the output of particle angular momenta in the xml file inertia (bool) – (if set) Set to True/False to enable/disable the output of particle moments of inertia in the xml file vizsigma (bool) – (if set) Set to a floating point value to include as vizsigma in the xml file

Examples:

xml.set_params(type=False)
xml.set_params(position=False, type=False, velocity=True)
xml.set_params(type=True, position=True)
xml.set_params(bond=True)
xml.set_params(all=True)


Attention

The simulation topology (bond, angle, dihedral, improper, constraint) cannot be output when the group for xml is not hoomd.group.all. An error will be raised.

set_period(period)

Changes the period between analyzer executions

Parameters: period (int) – New period to set (in time steps)

Examples:

analyzer.set_period(100)
analyzer.set_period(1)


While the simulation is running (hoomd.run(), the action of each analyzer is executed every period time steps. Changing the period does not change the phase set when the analyzer was first created.

write(filename, time_step=None)

Write a file at the current time step.

Parameters: filename (str) – File name to write to time_step (int) – (if set) Time step value to write out to the file

The periodic file writes can be temporarily overridden and a file with any file name written at the current time step.

When time_step is None, the current system time step is written to the file. When specified, time_step overrides this value.

Examples:

xml.write(filename="start.xml")
xml.write(filename="start.xml", time_step=0)

write_restart()

Write a restart file at the current time step.

This only works when dump.xml() is in restart mode. write_restart() writes out a restart file at the current time step. Put it at the end of a script to ensure that the system state is written out before exiting.