  We consider controlled collisions between two ultracold atoms guided by
external harmonic potentials. We derive analytical solutions of the
Schroedinger equation for this system, and investigate the properties of
eigenergies and eigenstates for different trap geometries as a function of a
trap separation and of the scattering length. When varying the trap separation
the energy spectrum exhibits avoided crossings, corresponding to trap-induced
shape resonances. Introducing an energy-dependent scattering length we
investigate the behavior of the system in the vicinity of a magnetic Feshbach
resonance. Finally, we illustrate our analytical results with two examples: the
quantum phase gate controlled by the external magnetic field, and a scheme for
a coherent transport of atoms in optical lattices into higher Bloch bands.
