The process of melting a crystalline solid can be
reversed if the liquid is cooled. The change from the liquid state
to the solid state is called freezing. As the liquid cools, it loses
thermal energy. As a result, its particles slow down and come
closer together. Attractive forces begin to trap particles and the
crystals of a solid begin to form.
"The total kinetic energy of all the particles in a sample of
matter is called thermal energy. Thermal energy, an extensive
property, depends on the number of particles in a substance as
well as the amount of energy each particle has. If either the
number of particles or the amount of energy in each particle
changes, the thermal energy of the sample changes. With identically sized
samples, the warmer substance has a greater thermal energy."