hoomd.variant.linear_interp Linearly interpolated variant.


Specify values that vary over time.

This package contains various commands for creating quantities that can vary smoothly over the course of a simulation. For example, set the temperature in a NVT simulation to slowly heat or cool the system over a long simulation.

class hoomd.variant.linear_interp(points, zero='now')

Linearly interpolated variant.

  • points (list) – Set points in the linear interpolation (see below)
  • zero (int) – Specify absolute time step number location for 0 in points. Use ‘now’ to indicate the current step.

hoomd.variant.linear_interp creates a time-varying quantity where the value at each time step is determined by linear interpolation between a given set of points.

At time steps before the initial point, the value is identical to the value at the first given point. At time steps after the final point, the value is identical to the value at the last given point. All points between are determined by linear interpolation.

Time steps given to hoomd.variant.linear_interp are relative to the current step of the simulation, and starts counting from 0 at the time of creation. Set zero to control the relative starting point.

points is a list of (time step, set value) tuples. For example, to specify a series of points that goes from 10 at time step 0 to 20 at time step 100 and then back down to 5 at time step 200:

points = [(0, 10), (100, 20), (200, 5)]

Any number of points can be specified in any order. However, listing them monotonically increasing in time will result in a much more human readable set of values.


L = variant.linear_interp(points = [(0, 10), (100, 20), (200, 5)])
V = variant.linear_interp(points = [(0, 10), (1e6, 20)], zero=80000)
integrate.nvt(group=all, tau = 0.5,
    T = variant.linear_interp(points = [(0, 1.0), (1e5, 2.0)])