Rocks are commonly divided, according to their origin, into three major classes—Igneous, sedimentary, and metamorphic. They are caused by the effects of heat, deforming pressure, shearing stress, hot/chemically active fluids, or a combination of these. All of these changes occur while the rock remains essentially in the solid state. In theory, rocks are formed when the things surrounding them are in equilibrium with ambient physical conditions. If the conditions are changed by movements in the earth's crust or by igneous activity, metamorphism occurs to reestablish equilibrium and changes the physical character of the rock mass.