deprecated.analyze¶
Overview
deprecated.analyze.msd |
Mean-squared displacement. |
Details
Deprecated analyzers.
-
class
hoomd.deprecated.analyze.
msd
(filename, groups, period, header_prefix='', r0_file=None, overwrite=False, phase=0)¶ Mean-squared displacement.
Parameters: - filename (str) – File to write the data to.
- groups (list) – List of groups to calculate the MSDs of.
- period (int) – Quantities are logged every period time steps.
- header_prefix (str) – (optional) Specify a string to print before the header.
- r0_file (str) – hoomd_xml file specifying the positions (and images) to use for \(\vec{r}_0\).
- overwrite (bool) – set to True to overwrite the file filename if it exists.
- phase (int) – When -1, start on the current time step. When >= 0, execute on steps where (step + phase) % period == 0.
Deprecated since version 2.0: analyze.msd will be replaced by a more general system capable of window averaging in a future release.
msd
can be given any number of groups of particles. Every period time steps, it calculates the mean squared displacement of each group (referenced to the particle positions at the time step the command is issued at) and prints the calculated values out to a file.The mean squared displacement (MSD) for each group is calculated as:
\[\langle |\vec{r} - \vec{r}_0|^2 \rangle\]and values are correspondingly written in units of distance squared.
The file format is the same convenient delimited format used by :py:class`hoomd.analyze.log`.
msd
is capable of appending to an existing msd file (the default setting) for use in restarting in long jobs. To generate a correct msd that does not reset to 0 at the start of each run, save the initial state of the system in a hoomd_xml file, including position and image data at a minimum. In the continuation job, specify this file in the r0_file argument to analyze.msd.Examples:
msd = analyze.msd(filename='msd.log', groups=[group1, group2], period=100) analyze.msd(groups=[group1, group2, group3], period=1000, filename='msd.log', header_prefix='#') analyze.msd(filename='msd.log', groups=[group1], period=10, header_prefix='Log of group1 msd, run 5\n')
A group variable (groupN above) can be created by any number of group creation functions. See group for a list.
By default, columns in the file are separated by tabs, suitable for importing as a tab-delimited spreadsheet. The delimiter can be changed to any string using
set_params()
.The header_prefix can be used in a number of ways. It specifies a simple string that will be printed before the header line of the output file. One handy way to use this is to specify header_prefix=’#’ so that
gnuplot
will ignore the header line automatically. Another use-case would be to specify a descriptive line containing details of the current run. Examples of each of these cases are given above.If r0_file is left at the default of None, then the current state of the system at the execution of the analyze.msd command is used to initialize \(\vec{r}_0\).
-
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 withenable()
.
-
restore_state
()¶ Restore the state information from the file used to initialize the simulations
-
set_params
(delimiter=None)¶ Change the parameters of the msd analysis
Parameters: delimiter (str) – New delimiter between columns in the output file (if specified). Examples:
msd.set_params(delimiter=',');
-
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.