3 spin state is determined by optical pumping, the protocol does not require the temperature of the original atomic cloud to be below J/k$_{B}$ [16]. The same procedure can be used to load the atoms in the evanescent field system. In both experimental systems, during photon storage, an incoming photon of momentum ⃗ k$_{i}$ (parallel to the atomic chain axis) is absorbed while a control field pho- ton of momentum ⃗ k$_{c}$ is emitted. The k -vector of the spin wave is, thus, equal to the projection on the atomic chain axis of ⃗ k$_{i}$ − ⃗ k$_{c}$ [12]. For example, if | ⃗ k$_{i}$ | ≈ | ⃗ k$_{p}$ | ≈ π/a , then an angle [29] of ≈ 60 ◦ between the control beam and the atomic chain axis gives the desired spin-wave k -vector of ± π/ (2 a ). For N = 1000 and 2 a ∼ 1 µ m, the length of the medium is Na ∼ 500 µ m. Thus, one could indeed use two focused control beams to store independently two single photons from the opposite directions. One could also store photons incident from the same direction, in which case additional Raman transitions or gradients in Zeeman or Stark shifts may be used to produce the de- sired spin-wave momenta. Spin-wave retrieval is carried out in the same manner. Imperfections. —We now consider several errors that can arise during gate execution. First, to estimate the error due to the finite t/U ratio, we perform two con- secutive Shrieffer-Wolff transformations to compute the t $^{4}$/U3 corrections to H . A perturbative calculation then shows that the dominant effect of these corrections, be- yond a slight and unimportant modification of the dis- persion ϵ ( k ), is an additional nonlinear phase ∼ ( t/U ) $^{2}$. This yields an error p$_{1}$ ∼ ( t/U ) $^{4}$, which can be further reduced by tuning V (see Conclusion). Second, photon storage and retrieval with error p$_{2}$ ∼ 1 / ( ηN ) [31] can be achieved at any detuning [15] and for pulse bandwidths as large as ∼ ηN Γ [32], where ηN is the resonant op- tical depth on the e - g transition whose linewidth is Γ. Third, the error due to the decay of the s - g coherence with rate γ$_{0}$ is p$_{3}$ ∼ γ$_{0}$T . An additional error comes from the reshaping of the pulse due to the nonlinearity of the dispersion. This error falls off very quickly with N , and already for N = 100 we find it to be as low as ∼ 10 − $^{4}$. Moreover, pulse shape distortion can be fur- ther corrected during retrieval [15, 31, 33], making the corresponding error negligible. With an experimentally demonstrated η = 0 . 01 [9, 10], we need N ≳ 1000 to achieve efficient photon storage and retrieval (small p$_{2}$ ). To suppress t $^{4}$/U3 corrections to H , we take ( t/U ) 2 = 0 . 01, which reduces p$_{1}$ down to ≲ 10 − 4 and yields velocity v = 8 t $^{2}$/U and propagation time T = N/ (2 v ) = N/ (0 . 16 U ). For U = (2 π )4 kHz [34] and N = 1000, this gives T ∼ 250 ms, which is shorter than the experimentally observed coherence times of ∼ 1 s [24, 35]. Thus, a proof-of-principle demonstration of our gate can be carried out with current experimental technology. With improved experimental systems, a faster and higher fidelity implementation will be possible. In particular, coherence times and η can likely be improved with better Experimental realizations. —Two experimental systems well suited for the implementation of our phase gate are atoms confined in a hollow-core photonic band gap fiber [8, 9] and atoms trapped in the evanescent field around an ultrathin optical fiber [10]. In the former system, a running-wave red-detuned laser can be used to provide a transverse potential limiting atomic motion to a tube and preventing collisions with fiber walls. Then either a blue-detuned [24] or another red-detuned beam can be used to create a 1D lattice in the tube. To prepare the atoms, one can load a Bose-Einstein condensate into the fiber with the lattice turned off (but the tube confinement on), and then adiabatically turn on the lattice bringing the atoms via a phase transition into the Mott state [26]. Recent experiments indicate a temperature of U/ (37 k$_{B}$ ) [26], at which, with a properly adjusted density, a state of one atom per each of N = 1000 sites would be defect- free [27]. In fact, > 99% probability of single-site unit occupancy has already been demonstrated in a Mott in- sulator [28]. Before loading, optical pumping and state selective trapping can be used to prepare all the atoms in state g . It is important to note that, since the initial An alternative way to see the emergence of the minus sign is to note that, for V = 0 and ignoring boundaries, the eigenstates of the two-excitation sector of Eq. (1) are ∝ ∑ j<j ′ ( e $^{ikj}$eipj ′ − e $^{ipj}$eikj ′ ) | j, j $^{′}$〉 and have energy ϵ ( k )+ ϵ ( p ), where p and k are quantized as before, p < k , and | j, j $^{′}$〉 = S + j S + j ′ | vac 〉 . The simultaneous propagation of R and L spin waves then explicitly exhibits the mi- nus sign: ∑ j<j ′ [ R ( j, τ ) L ( j $^{′}$, τ ) − R ( j $^{′}$, τ ) L ( j, τ )] | j, j $^{′}$〉 , so that at τ = 0 ( τ = T ) only the first (second) term in the square brackets contributes. and has width ∼ N that is nevertheless small enough for R ( j, 0) to be negligible near the edge ( j = 1) and in the middle ( j = N/ 2) of the chain. Furthermore, we assume that ˜ R ( k, 0) is centered around k = π/ 2 with Fourier-transform-limited width ∼ 1 /N , so that, for N ≫ 1, the dispersion is approximately linear for all rel- evant k : ϵ ( k ) ≈ [ k − ( π/ 2)] v , where the velocity (in sites per second) is v = 2 J . Then, provided the pulse does not reach j = N , it moves to the right with velocity v : R ( j, τ ) ≈ e $^{iτJπ}$R ( j − vτ, 0). Such spin-wave propagation plays an important role in quantum information trans- port in spin chains [25]. Similarly, the spin wave L ( j, 0) centered around j = 3 N/ 4 with carrier momentum − π/ 2 approximately evolves as L ( j $^{′}$, τ ) ≈ e $^{iτJπ}$L ( j ′ + vτ, 0). Finally, if both R and L are stored simultaneously, they propagate as ∑ j R ( j, τ ) c † j ∑ j ′ L ( j $^{′}$, τ ) c † j ′ | vac 〉 , so that af- ter time τ = T ≡ N/ (2 v ) they exchange places. However, in addition, when rewriting the final state in terms of spin operators S + j , an extra minus sign appears since for all relevant j and j $^{′}$, j > j $^{′}$. Thus, the state | 1 〉| 1 〉 picks up an extra π phase relative to the other three basis states, giving rise to the two-qubit photonic phase gate once the spin waves are retrieved.