This deformation energy is the difference between the energy of the equilibrium structure and a distorted structure. Calculate this is very easy, the difficult part is to set the correct distortion. Eg:
You have a cubic structure, with lattice parameter optimized a=b=c = 3.56, and then you calculate the energy of this structure, let's say it's -12.4 eV. If you change your lattice parameter to 3.7, and calculate the energy again, it would not be -12.4 eV. So you can calculate this energy difference, but the difficult part is to know what exactly is the "name" of this distortion. Also, this is not the only possible distortion.
Do you want only to calculate this deformation, or do you want to achieve the calculation of elastic constants, or something else?