  We study controlled phasegates for ultracold atoms in an optical potential. A
shaped laser pulse drives transitions between the ground and electronically
excited states where the atoms are subject to a long-range 1/R^3 interaction.
We fully account for this interaction and use optimal control theory to
calculate the pulse shapes. This allows us to determine the minimum pulse
duration, respectively, gate time T that is required to obtain high fidelity.
We accurately analyze the speed limiting factors, and we find the gate time to
be limited either by the interaction strength in the excited state or by the
ground state vibrational motion in the trap. The latter needs to be resolved by
the pulses in order to fully restore the motional state of the atoms at the end
of the gate.
