Computing values of interest

To compute physical values from a simulation, we can use algorithms represented by subtypes of Compute and associate these algorithms to a simulation.

Users don’t usualy need to use these compute algorithms directly, as the output algorithms (see Exporting values of interest) set the needed computations by themself.

Computed values can have various usages: they may be used in outputs, or in controls. The data is shared between algorithms using the Universe.data field. This field is a dictionnary associating symbols and any kind of value.

This page of documentation presents the implemented computations. Each computation can be associated with a specific simulation using the push! function.

push!(simulation, compute)

Adds a compute algorithm to the simulation list. If the algorithm is already present, a warning is issued. Usage example:

sim = Simulation(:md, 1.0) # Create a simulation

# Do not forget the parentheses to instanciate the computation
push!(sim, MyCompute())

propagate!(sim, universe, 5000)

# You can access the last computed value in the sim.data dictionnary
universe.data[:my_compute]

You can also call directly any instance of MyCompute:

universe = Universe() # Create an universe
# ...

compute = MyCompute() # Instanciate the compute
value = compute(universe) # Compute the value

The following paragraphs sums up the implemented computations, giving for each algorithm the return value (for direct calling), and the associated keys in Universe.data.

Volume

type VolumeCompute

Computes the volume of the current unit cell.

Key: :volume

Return value: The current cell volume

Pressure

type PressureCompute

TODO

Key:

Return value: