We numerically constructed elementary phase-correct global quantum gates by using molecular electronic and vibrational states to encode two qubits and implement the Deutsch–Jozsa algorithm. The calculations were based on optimal control theory (OCT). The molecular species we chose were Na
2 and Li
2. The electronic
kWW" alt="Click to view the MathML source" align="absbottom" border="0" height=22 width=40> and
kWW" alt="Click to view the MathML source" align="absbottom" border="0" height=20 width=38> states were ta
ken as two orthonormalized energy levels of the electronic qubit. The vibrational qubits were those involved in these electronic states. The time duration of the optimized pulses with high fidelity was typically 500–900 fs, which reflects the wavepac
ket dynamics in electronically ground and excited states. When implementing the Deutsch–Jozsa algorithm by combining these elementary gates, we obtained a maximum probability 83.12%for Li
2 molecule, which indicates that the electronic–vibrational qubits are worse than the vibrational–vibrational and the vibrational–rotational qubits reported so far.