### Syntax

`parOut = sw_fstat(state, parIn, T, E, M, nExt)`

### Description

`parOut = sw_fstat(state, parIn, T, E, M, nExt)`

calculates statistical
properties of different physical variables over several sampled state.
The function is called by spinw.anneal.

### Input Arguments

`state`

- Defines the task of the function.
`1`

Initialize the parOut structure.`2`

Store the parameters of the physical state.`3`

Calculate physical properties from the variable statistics.

`parIn`

- Same as
`parOut`

. `T`

- Temperature of the system, row vector with number of elements.
`E`

- Energy of the system, row vector with number of elements.
`M`

- Magnetic moment of every atom in a matrix with dimensions of .
`nExt`

- Size of the magnetic supercell, column vector of 3 integers.
`kB`

- Boltzmann constant, units of temperature.

### Output Arguments

`parOut`

- Output parameter structure with the following fields:
`nStat`

The number of evaluated states.`M`

averaged over all magnetic moment stored in a matrix with dimensions of .`M2`

averaged over all magnetic moment stored in a matrix with dimensions of .`E`

summed over all magnetic moment.`E2`

summed over all magnetic moment.

- For the final execution, the following parameters are calculated:
`parOut`

- Array of struct with number of elements:
`avgM`

Average components of the magnetisation over runs, matrix with dimensions of .`stdM`

Standard deviation of the mgnetisation components over runs, matrix with dimensions of .`avgE`

Average system energy per spin over runs, scalar.`stdE`

Standard deviation of the system energy per spin over runs, scalar.`T`

Final temperature of the sample.`Cp`

Heat capacity of the sample: .`Chi`

Magnetic susceptibility of the sample: .