xml Class Reference
Detailed Description
Writes simulation snapshots in the HOOMD XML format.Every period time steps, a new file will be created. The state of the particles at that time step is written to the file in the HOOMD XML format.
- See also:
- XML File Format
Public Member Functions | |
| def | __init__ |
| Initialize the hoomd_xml writer. | |
| def | set_params |
| Change xml write parameters. | |
| def | write |
| Write a file at the current time step. | |
| def | disable |
| Disables the analyzer. | |
| def | enable |
| Enables the analyzer. | |
| def | set_period |
| Changes the period between analyzer executions. | |
Member Function Documentation
| def __init__ | ( | self, | ||
filename = "dump", |
||||
period = None | ||||
| ) |
Initialize the hoomd_xml writer.
- Parameters:
-
filename (optional) Base of the file name period (optional) Number of time steps between file dumps
dump.xml(filename="atoms.dump", period=1000) xml = dump.xml(filename="particles", period=1e5) xml = dump.xml()
If period is set, 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
By default, only particle positions are output to the dump files. This can be changed with set_params().
If period is not specified, then no periodic updates will occur. Instead, the write() command must be executed to write an output file.
period can be a function: see Variable period specification for details
| def disable | ( | self | ) | [inherited] |
Disables the analyzer.
Examples:
analyzer.disable()
Executing the disable command will remove the analyzer from the system. Any run() command executed after disabling an analyzer will not use that analyzer during the simulation. A disabled analyzer can be re-enabled with enable()
To use this command, you must have saved the analyzer in a variable, as shown in this example:
analyzer = analyzer.some_analyzer()
# ... later in the script
analyzer.disable()
| def enable | ( | self | ) | [inherited] |
Enables the analyzer.
Examples:
analyzer.enable()
See disable() for a detailed description.
| def set_params | ( | self, | ||
all = None, |
||||
position = None, |
||||
image = None, |
||||
velocity = None, |
||||
mass = None, |
||||
diameter = None, |
||||
type = None, |
||||
wall = None, |
||||
bond = None | ||||
| ) |
Change xml write parameters.
- Parameters:
-
all (if true) Enables the output of all optional parameters below position (if set) Set to True/False to enable/disable the output of particle positions in the xml file image (if set) Set to True/False to enable/disable the output of particle images in the xml file velocity (if set) Set to True/False to enable/disable the output of particle velocities in the xml file mass (if set) Set to True/False to enable/disable the output of particle masses in the xml file diameter (if set) Set to True/False to enable/disable the output of particle diameters in the xml file type (if set) Set to True/False to enable/disable the output of particle types in the xml file wall (if set) Set to True/False to enable/disable the output of walls in the xml file bond (if set) Set to True/False to enable/disable the output of bonds in the xml file
xml = dump.xml(filename="particles", period=1e5)
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(position=True, wall=True) xml.set_params(bond=True) xml.set_params(all=True)
| def set_period | ( | self, | ||
| period | ||||
| ) | [inherited] |
Changes the period between analyzer executions.
- Parameters:
-
period New period to set
analyzer.set_period(100) analyzer.set_period(1)
While the simulation is running, the action of each analyzer is executed every period time steps.
To use this command, you must have saved the analyzer in a variable, as shown in this example:
analyzer = analyze.some_analyzer()
# ... later in the script
analyzer.set_period(10)
| def write | ( | self, | ||
| filename | ||||
| ) |
Write a file at the current time step.
- Parameters:
-
filename File name to write to
Executing write() requires that the dump was saved in a variable when it was specified.
xml = dump.xml()
Examples:
xml.write(filename="start.xml")
Generated on Tue Mar 24 17:40:34 2009 for HOOMD by
1.5.7.1


