First-Principles Study Of Lattice Dynamics In Crystals