We develop a theoretical understanding of trapping divalent Rydberg atoms in
optical lattices. Because the size of the Rydberg electron cloud can be
comparable to the scale of spatial variations of laser intensity, we pay
special attention to averaging optical fields over the atomic wavefunctions.
Optical potential is proportional to the ac Stark polarizability. We find that
in the independent particle approximation for the valence electrons, this
polarizability breaks into two contributions: the singly ionized core
polarizability and the contribution from the Rydberg electron. Unlike the
usually employed free electron polarizability, the Rydberg contribution depends
both on laser intensity profile and the rotational symmetry of the total
electronic wavefunction. We focus on the J=0 Rydberg states of Sr and
evaluate the dynamic polarizabilities of the 5sns(1S0) and
5snp(3P0) Rydberg states. We specifically choose Sr atom for its optical
lattice clock applications. We find that there are several magic wavelengths in
the infrared region of the spectrum at which the differential Stark shift
between the clock states (5s2(1S0) and 5s5p(3P0)) and the J=0
Rydberg states, 5sns(1S0) and 5snp(3P0), vanishes. We tabulate
these wavelengths as a function of the principal quantum number n of the
Rydberg electron. We find that because the contribution to the total
polarizability from the Rydberg electron vanishes at short wavelengths, magic
wavelengths below ∼1000 nm are ``universal" as they do not depend on the
principal quantum number n