Effective configurational and spin Hamiltonians are commonly used to study magnetic and structural thermodynamics. For some purposes, such as the description of phase transitions in substitutional alloys, they can be routinely constructed by high-throughput first-principles calculations. As an illustration of this standard approach, I will describe the calculation of the phase diagrams of Gd-doped EuO and EuS using the cluster expansion technique . Many problems, however, require physical insight for the selection of the relevant degrees of freedom and for an adequate representation of their interactions. The main focus of this talk will be on such problems, including the structural phase transitions at the Cr2O3 (0001) surface and the magnetic thermodynamics of the parent compounds of ferropnictide superconductors .
 J. M. An et al., Phys. Rev. B 83, 064105 (2011).
 A. L. Wysocki, K. D. Belashchenko, and V. P. Antropov, Nature Phys. 7, 485 (2011).