Reversible nanovalves in inorganic materials