Philip D. Gregory, Jacob A. Blackmore, Sarah L. Bromley, Jeremy M. Hutson, Simon L. Cornish

Quantum states with long-lived coherence are essential for quantum computation, simulation and metrology. The nuclear spin states of ultracold molecules prepared in the singlet rovibrational ground state are an excellent candidate for encoding and storing quantum information. However, it is important to understand all sources of decoherence for these qubits, and then eliminate them, to reach the longest possible coherence times. Here we fully characterize the dominant mechanisms of decoherence for a storage qubit in an optically trapped ultracold gas of RbCs molecules using high-resolution Ramsey spectroscopy. Guided by a detailed understanding of the hyperfine structure of the molecule, we tune the magnetic field to where a pair of hyperfine states have the same magnetic moment. These states form a qubit, which is insensitive to variations in magnetic field. Our experiments reveal a subtle differential tensor light shift between the states, caused by weak mixing of rotational states. We demonstrate how this light shift can be eliminated by setting the angle between the linearly polarized trap light and the applied magnetic field to a magic angle of \(\arccos (1/\sqrt{3})\approx 5{5}^{\circ }\). This leads to a coherence time exceeding 5.6 s at the 95% confidence level.