# Displacement vectors

This modifier calculates the displacement vectors of particles from two different configurations of the simulated system.

The input particle set, to which the modifier has been applied, is considered the current (or deformed) configuration of the system. The reference (or initial) particle coordinates are loaded from a separate input file by the modifier.

The modifier calculates the displacement vector of each particle by subtracting its position in the reference configuration from the particle's position in the current configuration. The calculated vectors are stored in the `Displacement` particle property and can optionally be visualized as arrows. Alternatively, one can use the Color coding modifier to visualize the displacement magnitudes through a color scheme.

Use the "Reference: External data source" panel to pick the file containing the initial particle positions. Note that this reference file should contain the same set of particles as the input configuration seen by the modifier. That implies that you should not delete particles before applying the Displacement vectors modifier. The modifier should typically be placed at the beginning of the processing pipeline.

To calculate the displacement vector of a particle, the modifier has to find the corresponding particle in the supplied reference configuration. If the particles have unique IDs assigned to them, the modifier will use this information to map particles from the current configuration to the reference configuration. If no particle IDs are available, the modifier assumes that particles have the same ordering in both configurations.

The vectors computed by the modifier are stored in the `Displacement` particle property. This property is associated with a vector display object, which allows rendering the displacement vectors as arrows. By default, the display object is disabled. You have to enable it in the pipeline editor first to show the arrows in the viewports.

The visual appearance of the vectors computed by this modifier is controlled through the attached vector display object.

## Parameters

Eliminate homogeneous cell deformation

  This option lets the modifier first rescale the current simulation cell including all particle coordinates to match the cell shape in the reference configuration before calculating the displacement vectors. This effectively eliminates any macroscopic, homogeneous deformation of the simulation cell, and the calculated vectors will reflect only the internal, microscopic displacements of particles.

Assume unwrapped coordinates

  This only affects the treatment of simulation cells with periodic boundary conditions. If activated, the particle coordinates in the reference and the current configuration are taken as is. If this option is not checked, the minimum image convention is used to deal with particles that have crossed a periodic boundary.

Fixed reference configuration

  If this option is active, the selected animation frame from the reference simulation sequence is used as a fixed reference to calculate the displacement vectors. This is the default mode.

Relative to current frame

  If this option is active, then a changing reference configuration is used to calculate the displacement vectors. This allows computing incremental displacement vectors (similar to discrete velocity vectors). The frame offset controls the distance between reference and current frame and can be negative or positive. If it is negative, then the reference frame precedes the current frame in the simulation sequence. Note that the displacement vectors will not be computed for simulation frames for which the resulting reference frame is negative or out of range.