# Example 01: Calculation of free energy#

In this example, a simple calculation of the Helmholtz free energy \(F(NVT)\) is illustrated. We use a Fe BCC structure at 100K.

The EAM potential that will be used: Meyer, R, and P Entel. “Martensite-austenite transition and phonon dispersion curves of Fe1−xNix studied by molecular-dynamics simulations.” Phys. Rev. B 57, 5140.

The reference data is from: Freitas, Rodrigo, Mark Asta, and Maurice de Koning. “Nonequilibrium Free-Energy Calculation of Solids Using LAMMPS.” Computational Materials Science 112 (February 2016): 333–41.

## Solid free energy#

The input file for calculation of solid BCC Fe at 100 K is provided in the folder. A detailed description of the input file is available here. The calculation can be started from the terminal using:

```
calphy -i input.yaml
```

This should give a message:

```
Total number of 1 calculations found
```

`calphy`

is running in the background executing the calculation. A new folder called `fe-bcc-solid-100-0`

, and files called `fe-bcc-100-solid-0.sub.err`

and `fe-bcc-solid-100-0.sub.out`

will also be created.

After the calculation is over, the results are available in the `report.yaml`

file. The file is shown below:

```
average:
density: 0.08337660890608233
spring_constant: '3.28'
vol_atom: 11.99414235031551
input:
concentration: '1.0'
element: Fe
lattice: BCC
pressure: 0.0
temperature: 100
results:
error: 0.0
free_energy: -4.263489224907735
pv: 0.0
reference_system: 0.014873819531664851
unit: eV/atom
work: -4.278363044439399
```

The calculated free energy is \(-4.2635\) eV/atom, the value reported in the publication is \(-4.2631147(1)\) eV/atom. The calculated value can be further improved by increasing the system size, and by increasing the switching time.