# Example 02: Phase transformation in Fe#

In this example, we will make use of the temperature sweep algorithm in calphy to calculate the transformation temperature for BCC to FCC transition in Fe.

The input file is provided in the folder. The calculation can be started from the terminal using:

calphy -i input.yaml


In the input file, the calculations block is as shown below:

- mode: ts
temperature: [100, 1400]
pressure: 
lattice: [BCC]
repeat: [5, 5, 5]
reference_phase: [solid]
n_iterations: 1
pair_style: eam
pair_coeff: "* * ../potentials/Fe.eam"
n_equilibration_steps: 10000
n_switching_steps: 25000
- mode: ts
temperature: [100, 1400]
pressure: 
lattice: [FCC]
repeat: [5, 5, 5]
reference_phase: [solid]
n_iterations: 1
lattice_constant: [6.00]
pair_style: eam
pair_coeff: "* * ../potentials/Fe.eam"
n_equilibration_steps: 10000
n_switching_steps: 25000


The mode is listed as ts, which stands for temperature sweep. The sweep starts from the first value in the temperature option, which is 100 K. The free energy is integrated until 1400 K, which is the second value listed. Furthermore, there are also two calculation blocks. You can see that the lattice mentioned is different; one set is for BCC structure, while the other is FCC.

Once the calculation is over, there will a file called temperature_sweep.dat in each of the folders. This file indicates the variation of free energy with the temperature. We can read in the files and calculate the transition temperature as follows:

:

import numpy as np
import matplotlib.pyplot as plt

:

bt, bfe, bferr = np.loadtxt("ts-BCC-100-0/temperature_sweep.dat", unpack=True)
ft, ffe, fferr = np.loadtxt("ts-FCC-100-0/temperature_sweep.dat", unpack=True)

args = np.argsort(np.abs(bfe-ffe))
print(bt[args], "K")

508.07011498303046 K

:

plt.plot(bt, bfe, color="#E53935", label="bcc")
plt.plot(ft, ffe, color="#0097A7", label="fcc")
plt.xlabel("Temperature (K)", fontsize=12)
plt.ylabel("F (ev/atom)", fontsize=12)
plt.legend()
plt.savefig("fe_transition.png", dpi=300, bbox_inches="tight") [ ]: