An atomistic approach to the dielectric modes of BaTiO3 and SrTiO3