Accumulator¶
This module accumulates values (e.g., the pressure) over the course of the simulation and returns statistical measures (e.g., sum, mean, and variance).
- class halmd.observables.utility.accumulator(args)¶
Construct accumulator module.
- Parameters:
args – keyword arguments
args.acquire – callable that returns a number
args.every (number) – interval for aquiring the value
args.start (number) – start step for aquiring the value (default:
halmd.mdsim.clock.step
)args.desc (string) – profiling description
args.aux_enable (table) – sequence of
halmd.mdsim.particle
instances (optional)
The parameter
aux_enable
is useful ifacquire()
depends on one of the auxiliary force variables, seehalmd.mdsim.particle.aux_enable()
for details. In sampling steps of the accumulator, eachparticle
instance listed inaux_enable
is notified to update the auxiliary variables before the integration step. Thereby, redundant force calculations can be avoided.- sample()¶
Sample next value by calling
args.acquire
.
- sum()¶
Sum of accumulated values. Calculated as
mean × count
.
- mean()¶
Mean of accumulated values.
- error_of_mean()¶
Standard error of mean of accumulated values.
- variance()¶
Variance of accumulated values.
- count()¶
Number of samples accumulated.
- reset()¶
Reset the accumulator.
- disconnect()¶
Disconnect accumulator from core.
- desc¶
Profiler description.
- writer(file, args)¶
Write statistical measures to a file.
- Parameters:
args (table) – keyword arguments
args.file – instance of file writer
args.location (string table) – location within file
args.every (number) – sampling interval
args.reset (boolean) – Reset accumulator after writing if true (disabled by default).
- Returns:
instance of group writer
The argument
location
specifies a path in a structured file format like H5MD given as a table of strings, for example{"observables", "averaged_pressure"}
.