  We describe a self-contained procedure to evaluate the free energy of liquid
and solid phases of an alloy system. The free energy of a single-element solid
phase is calculated with thermodynamic integration using the Einstein crystal
as the reference system. Then, free energy difference between the solid and
liquid phases is calculated by Gibbs-Duhem integration. The central part of our
method is the construction of a reversible alchemical path connecting a pure
liquid and a liquid alloy to calculate the mixing enthalpy and entropy. We have
applied the method to calculate the free energy of solid and liquid phases in
the Al-Sm system. The driving force for fcc-Al nucleation in Al-Sm liquid and
the melting curve for fcc-Al and Al3Sm are also calculated.
