Mechanism for electro-optic effect in BaTiO3