Chemical durability of glasses; a thermodynamic approach