  We study the effect of external trapping potentials on the phase diagram of
bosonic atoms in optical lattices. We introduce a generalized Bose-Hubbard
Hamiltonian that includes the structure of the energy levels of the trapping
potential, and show that these levels are in general populated both at finite
and zero temperature. We characterize the properties of the superfluid
transition for this situation and compare them with those of the standard
Bose-Hubbard description. We briefly discuss similar behaviors for fermionic
systems.
