Computing values of interest¶
To compute physical values from a simulation, we can use algorithms represented
by subtypes of Basecompute
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 MolecularDynamic.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
add_compute
function.
-
add_compute
(::MolecularDynamic, ::BaseCompute) This function registers a computation for a given simulation. Example usage:
sim = MolecularDynamic() # Create a simulation # ... # Do not forget the parentheses to instanciate the computation add_compute(sim, MyCompute()) run!(sim, 10) # You can access the last computed value in the sim.data dictionnary sim.data[:my_compute]
You can also call directly any instance of MyCompute
:
sim = MolecularDynamic() # Create a simulation
# ...
compute = MyCompute() # Instanciate the compute
value = compute(sim) # 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
MolecularDynamic.data
.