Rate equation for photochromic glasses considering both thermal and optical regeneration