A system composed of a harmonic oscillator coupled to a two-level atom is one of the quantum systems, which can be completely solved. Although this system is simple, it is never a easy work for the quantum calculations, especially when the system consists of many such simple constituent parts. In this paper, we present a programming method, by which the calculation tasks for the matrix representation of the Hamiltonian of system can be automatically fulfilled. Coupled-cavity array systems are used to demonstrate our programming method. Some quantum properties of these systems are also discussed.

Many experiments showing quantum phenomena have been conducted in different ways. Considerable effort for realizing photonic devices has been made. Various methods to study this subject have been proposed, such as single-photon switching,1–11 single-photon transistors12–15 and so on. When working with these photonic devices, we need to deal with the interaction between photons and atoms or other particles.16–18 For the photons to be under good conditions, i.e., a great chance for the light involved in the physical processes to interact with the atoms or other particles, researchers usually turn to optical cavities19,20 for help. For the sake of simplicity, when we analyze such systems in quantum mechanics, they can be abstracted as a quantum oscillator coupling to a two-level atom. This model is simple but very important and has been studied by many researchers.6,7,21

Although the abstracted model is quite simple, no analytical solution has been reached. The most common way in dealing with the problem of such a model is to apply the rotating-wave approximation (RWA) method,22,23 which was first introduced by Jaynes and Cummings in 1963.24 The RWA method has been used in a large amount of works. It helps to solve such problems, yet the calculation tasks are still very heavy. In view of this, we come up with a method using the computer, together with the RWA method, to efficiently solve the quantum computing problems. In the process of dealing with the problems concerning finite dimensional quantum systems, which can be spanned by a set of discrete bases, we managed to calculate the matrix representation of Hamiltonian using a programming method (see supplementary material). In this paper, we present our methods and provide some examples.

First, we consider a coupled-cavity array system consisting of a finite number of cavities. For simplicity, each cavity is embedded with a two-level system, and only one single field is considered. For convenience, we first study a system containing only two cavities, just as illustrated in Ref. 21. For such a system, its Hamiltonian can be written as follows (=1):

H=i=1,2ωcâiâi+ωa|eiei|+Aâ1â2+â2â1+i=1,2gâi|giei|+âi|eigi|.
(1)

where ωc and ωa represent the cavity and atom frequencies, respectively; A is the inter-cavity coupling constant and g is the coupling strength between atom and cavity, both being in the same cavity. âi (âi) is the creation (annihilation) operator for the field in the ith cavity. In such a two-level system, |gi and |ei represent the ground and excited states, respectively, where the suffix i indicates which cavity they are in. Thus, the atomic lowering and raising operators in the ith cavity can be represented as |giei| and |eigi|, respectively.

Although the Hamiltonian of this form is clear and concise, if no state vector is given, the Hamiltonian would have only some literal meaning. In practical calculations, dealing with operators acting on vectors in some certain vector spaces is what we expect. In this case, if we restrict the total excitation number to 1, the basis states may be expressed as follows:

|ϕ1=|01g1|02e2,
(2a)
|ϕ2=|01g1|12g2,
(2b)
|ϕ3=|01e1|02g2,
(2c)
|ϕ4=|11g1|02g2.
(2d)

Thus the matrix representation of the Hamiltonian Eq. (1) in bases |ϕ1,|ϕ2,|ϕ3,|ϕ4 can be expressed as

H=ωag00gωc0A00ωag0Agωc.
(3)

The process for performing these calculations is very easy. However, if the number of cavities is increased to even greater, such as 10 cavities, and the total excitations are increased to 2, then the number of basis states would be 200. The work for writing out all the basis states along with calculating the matrix representation would be too heavy for manual calculation. For this reason, we introduce our method for the calculation work using computers, in the hope of improving work efficiency. Systems that can be expressed within finite dimensional Hilbert spaces are considered below. Two steps are involved in our method: (i) calculating the basis states, for example, |ϕ1,|ϕ2,,|ϕn, which compose the Hilbert space; (ii) calculating the matrix representation of the Hamiltonian according to the basis states.

To construct a set of complete orthogonal basis states, a straightforward method is to initially enumerate all the possible states and then select the ones that satisfy certain conditions. For example, if we restrict the number of total excitations in Eq. (1) to 2, then the possible values for the number of photons in each cavity are 0, 1, and 2, whereas the possible states of atom are 0 and 1, where we have denoted states |g and |e as |0 and |1 (i.e. |g|0 and |e|1), respectively, for the sake of programming. By now it should be clear that numbers in different positions have different meanings. For example, if a number n appears in the position for photonic state, then n photons exist; similarly, if a number 0 (1) appears in the position for atomic state, then it means the atom is in ground (excited) state. In this way, a state such as |ψ=|2111|2212 is one of our candidates until the restriction that the number of total excitations be two is applied to it. As a result, this state |ψ should of course be eliminated. A total of 3×2×3×2=36 possible candidates exist; we can easily list them out. Furthermore, for some software, dealing with the list of our candidates as a whole is recommended to be more efficient. However, when processing the high-dimensional Hilbert space, storing all the possible candidates will consume quite a large amount of resources and would then cause the computer to crash or to behave abnormally.

To enumerate and check all the possible candidate states in a convenient way, we introduce the mixed radix number systems in our method. Following the above example, three possible values exist for the number of photons and two possible values for the energy levels of atom in one cavity. Thus, the mixed radix can be denoted as {3, 2, 3, 2} and all the possible candidate states in this base format should run from 03020302 = 010 to 23122312 = 3510, where the subscripts indicate the bases for the digits. For convenience, their relationship can be expressed in a general way as

n10=d1b1d2b2d3b3d4b4,
(4)

where n is a decimal number, the sequence {b1, b2, b3, b4} is the mixed radix, and the list of numbers {d1, d2, d3, d4} is the representation of n in this mixed radix number system. The length of the list being 4 is determined by the number of particles involved in our system, which consists of two cavities, each containing photons and an atom. In programming, we check the list {d1, d2, d3, d4}, in accordance with the restriction that the total excitations are two and decide if this list should be used to construct our basis states for the Hilbert space. For example, as 310 = 03021312 and 0 + 0 + 1 + 1 = 2, we thus use this sequence of numbers, which denotes a state |01g1|12e2 indicating that there is one photon, and the atom is in the excited state in the second cavity. When the number increases to 410 = 03022302, which indicates two photons in the second cavity, we also use this sequence {0, 0, 2, 0}. By contrast, the number 03022312, which is 510, indicates two photons and one excited atom exist in the second cavity. It fails to satisfy our restriction. We should just increase the value of n and do the check in accordance with our restriction.

For different systems, the mixed radix bases and the restrictions used to select the basis states may be different. We should have no problem extending our method to more complicated systems, for example, systems with more cavities, more atoms, more total excitations, and more complicated energy levels for the atoms.

Using the method illustrated above, we would obtain a set of basis states making up the Hilbert space for our quantum system. Given the basis states, we can generate the matrix representation of the Hamiltonian H, whose element looks like

Hi,j=ϕi|H|ϕj=kCkϕi|ϕk=kCkδi,k.
(5)

Ck reflects the operations that the Hamiltonian operator needs to perform when converting a vector |ϕj into another vector |ϕk or just the same vector |ϕj. One operation of the Hamiltonian, acting on a basis state, can do the following things:

  • Creating one photon in one cavity, while annihilating one photon in an adjacent cavity and vice versa;

  • Raising the atom level from the ground state |g to the excited state |e, while annihilating a photon within the same cavity and vice versa;

  • Keeping the photons and atoms in their eigenmodes unchanged.

Each of the nontrivial elements, say Hi,j, represents one (just only one) of the above three operations.

To describe our method in a general and convenient way, we consider a system containing three cavities (each contains a two-level atom) and restrict the number of excitations to be two. In our programming method, to obtain Ck as expressed in Eq. (5), we first compare the differences, regarding the photons and atom in the same cavity as a whole, between the two vectors |ϕi and |ϕj. Four different situations exist.

First, more than two differences exist. For example,

|ϕi=|0,g1|0,g2|2,g3,
(6a)
|ϕj=|1,g1|1,g2|0,g3,
(6b)

where the subscripts indicate the sequence numbers of cavities. In this situation, just performing one operation of the Hamiltonian cannot change a vector, |ϕi (|ϕj), into another, |ϕj (|ϕi). Thus, we have

Hi,j=Hj,i=0.
(7)

Second, 0 difference exists, implying that the two vectors |ϕi and |ϕj are the same. To keep the state unchanged, the operation of the Hamiltonian keeps the photons and atoms in their eigenmodes. For example, for the following states,

|ϕi=|0,g1|0,g2|2,g3,
(8a)
|ϕj=|0,g1|0,g2|1,e3,
(8b)
|ϕk=|0,g1|0,e2|0,e3,
(8c)

the corresponding elements for the matrix representation are

Hi,i=0+0+2ωc+0+0+0ωa=2ωc,
(9a)
Hj,j=ωc+ωa,
(9b)
Hk,k=2ωa.
(9c)

Third, one difference exists. In this case, the Hamiltonian changes both the photon and atom states in one of the cavities, while leaving the states for all the other cavities unchanged. Performing the second operation only once can fulfill this task. For example,

|ϕi=|0,g1|0,g2|2,g3,
(10a)
|ϕj=|0,g1|0,g2|1,e3.
(10b)

These two states differ from each other by the states in the third cavity. In order for the Hamiltonian to change the state |ϕi into state |ϕj, it should annihilate one photon and raise the ground state of atom up to the excited state. For the change from |ϕj to |ϕi, it should lower the excited state to the ground state and create a photon. We have

Hi,j=Hj,i=2g.
(11)

For states

|ϕi=|0,g1|0,e2|0,e3,
(12a)
|ϕj=|0,g1|0,e2|1,g3,
(12b)

the matrix elements are

Hi,j=Hj,i=g.
(13)

Finally, two differences exist, i.e., for two-state vectors, after performing one operation of the Hamiltonian, two cavities differ from the previous ones. Performing the first operation once is deemed appropriate for this task, which results in a nontrivial matrix element. However, things are slightly complicated here, and we need to make further study. The different situations are presented as follows:

  • Both the first and second operations are involved. Although only one of the first operation is involved, however, the interaction between atom and photons may still change the states in each cavity. For example,

|ϕi=|0,g1|0,g2|1,e3,
(14a)
|ϕj=|0,g1|0,e2|0,e3,
(14b)

the transform from |ϕi to |ϕj can be processed in the following way: first hopping a photon from cavity 3 to cavity 2, and then annihilating a photon while raising the ground state of the atom to the excited state in the second cavity. Thus, as more than one operations of the Hamiltonian is processed, we will have

Hi,j=Hj,i=0,
(15)

for these situations. Cases such as the following also exist:

|ϕi=|0,g1|0,g2|1,e3,
(16a)
|ϕj=|0,g1|1,e2|0,g3,
(16b)

with the total excitations of cavity 2 in state |ϕi being 0, whereas the total excitations of cavity 2 in state |ϕj being 2, indicating that at least two of the first operations are involved. Besides the operations of communicating photons between cavities 2 and 3, the second operation is also involved. Now that more than one operation are involved, we have

Hi,j=Hj,i=0.
(17)
  • More than one of the first operation are involved. For example,

|ϕi=|0,g1|0,g2|2,g3,
(18a)
|ϕj=|0,g1|2,g2|0,g3.
(18b)

In this situation, at least two photon hopping processes are needed. Thus, we have

Hi,j=Hj,i=0.
(19)

In cases such as

ϕi=0,g10,g21,e3,
(20a)
ϕj=1,g10,g20,e3,
(20b)

we also have

Hi,j=Hj,i=0.
(21)
  • After eliminating the above nonsignificant bare state pairs, some selected ones that can transform from/to one another by performing the first operation only once remain. For example,

|ϕi=|0,g1|0,g2|1,e3,
(22a)
|ϕj=|0,g1|1,g2|0,e3,
(22b)

|ϕi can be transformed into |ϕj by hopping a photon from cavity 3 to cavity 2, whereas |ϕj can be transformed into |ϕi by hopping a photon from cavity 2 to cavity 3. Thus, for this case, we obtain

Hi,j=Hj,i=A.
(23)

For situations such as

|ϕi=|0,g1|0,g2|2,g3,
(24a)
|ϕi=|0,g1|1,g2|1,g3,
(24b)

we have

Hi,j=Hj,i=2A.
(25)

The above is our programming method. Now for our three-cavity system, following the processes illustrated above, running from 010 = 030203020302 to 21510 = 231223122312 and selecting the appropriate list of numbers to make up a complete set of basis states, for example, {|ϕ1,|ϕ2,,|ϕn}, by which the Hilbert space can be composed, we would get the matrix representation of the Hamiltonian as follows:

H=Δ2g00A00000000000002g00002A000000000000002Δgg000000000000000gΔ0gA00000000000A0g0Δg000000A0000002A0gg002A00000A0000000A00Δ2g000000A000000002A2g000000002A00000000002Δg00g0000000000000gΔ0A0g000000000000002Δg00g000000000000AgΔ000gA00000A000g000Δg000000000A000g00g00A00000000A000g000Δg0000000002A000g0Ag002A00000000000A0000Δ2g0000000000000002A2g0.
(26)

In this expression, we introduce the energy detuning, which is expressed as Δ=ωaωc, to make it fit the width of layout without changing the eigenvectors and the order of the eigenvalues. After getting the matrix representation of the Hamiltonian, we can calculate the eigensystem of the quantum system, which is not a problem nowadays because our computers (even the plain personal laptops) are quite good at processing things such as this, and get most of the information about the system.

In the above description about our method, we take the one-dimensional coupled cavities as examples. However, extending our method to two- or three-dimensional systems is easy. Things to be aware of are the adjacent conditions. We take a two-dimensional system for the detailed introduction. Figure 1 shows nine cavities: five nonempty cavities each containing a two-level atom, and four empty cavities. If any two cavities are indexed as m,n and p,q, then the conditions of adjacent cavities can be expressed as

mp=0nq=1ormp=1nq=0.
(27)
FIG. 1.

Schematic of our two-dimensional coupled-cavity system. The large open circle represents a cavity and the small black spot in some of the circles represents a two-level atom. We only treat the horizontally and vertically adjacent cavities as adjacent cavities.

FIG. 1.

Schematic of our two-dimensional coupled-cavity system. The large open circle represents a cavity and the small black spot in some of the circles represents a two-level atom. We only treat the horizontally and vertically adjacent cavities as adjacent cavities.

Close modal

We consider the subspace with total excitations being 2. The mixed radix of the system, counting the cavities from left to right and from top to bottom, can be expressed as {3, 2, 3, 1, 3, 2, 3, 1, 3, 2, 3, 1, 3, 2, 3, 1, 3, 2}, where we used the normal digits to describe the nonempty cavities, whereas the bold digits are used to describe the empty cavities. Following the processes illustrated above, we can get a set of basis states composing this Hilbert space. When calculating the matrix element, these new adjacent conditions should be taken into consideration. Obtaining the matrix representation of this Hamiltonian is as easy as in the last example.

Next, we use our method to solve some more “practical” problems. Let us consider a one-dimensional coupled resonator waveguide, as depicted in Refs. 6,7. We can see that the total excitation is 1, and some two-level atoms are embedded in the middle cavities of the cavity array, whereas the left and right end up being empty cavities. In this paper, we first study the time evolution of a certain state, say |ψ(0). Once we get the system state |ψ(t) at time t, we can give the probability distribution of the excitation as a function of time; that is to say, we can determine at any time whether the excitation exists as a photon in the ith cavity or as an excited atom in the jth cavity. However, in cases where many cavities exist, these distributions are slightly complex for us to read. To derive results which are concise and of great significance, we divide the cavity array into three parts: the left part consisting of the left nL empty cavities; the middle parts, the middle nM cavities (each of which is embedded with a two-level atom); and the right part, nR empty cavities. If we can turn off the interaction between the photon and atom, that cavity would be empty for photon. By contrast, if we turn the interaction on, that cavity would be nonempty for photon. Thus, we can adjust the numbers nL, nM, and nR with this method. In the following, we mainly discuss the properties of the system based on the probability distributions for finding the excitation to be in these three parts.

Let us denote the bases of the system as |ϕi, i=1,,m. Using our method discussed above, we can easily obtain the eigensystems of the quantum systems when the numbers of empty and nonempty cavities are different. Let us denote the eigenstates of the Hamiltonian as |Ep, thus the completeness condition satisfies

I=p|EpE|.
(28)

If the state at the beginning is illustrated as

|ψ(0)=p|EpE|ψ(0),
(29)

then the state at time t can be expressed as

|ψ(t)=eiĤtp|EpE|ψ(0)=peiEpt|EpE|ψ(0),
(30)

where Ep is the eigenvalue for state |Ep. If the initial state is one of the eigenstates of the system, the state will not change over time, except for a global phase factor. Thus the probability distributions of the excitation in the three parts would be constants. Let us start with a simple system, where nL = nR = 1 and nM = 2. We choose the eigen states as the initial states. The probability distributions, say pL, pM and pR, as functions of time are shown in Fig. 2. Clearly, they are all constants over time.

FIG. 2.

The six pictures from (a) to (f) are arranged in ascending order of eigenenergies. Each picture plots the probability distributions for the left part, middle part and the right part of the cavity array. Parameter values are A = 0.01g and Δ=10g.

FIG. 2.

The six pictures from (a) to (f) are arranged in ascending order of eigenenergies. Each picture plots the probability distributions for the left part, middle part and the right part of the cavity array. Parameter values are A = 0.01g and Δ=10g.

Close modal

We are not interested in the eigenstate cases. In this paper, we assume that, at the very beginning, no photon exists in any of the cavities, and the atoms in this coupled-cavity array are all in their ground states. Then, suddenly, a photon is injected into the leftmost cavity. If we number the cavities from left to right as 1,2,,n, such an initial state can be expressed as |1,g1|0,g2|0,gn, where n = nL + nM + nR, or just |1|0|0nL1|0,g|0,gnM|0|0nR. In most of the cases, such a state would not be one of the eigenstates of the system but rather be a linear combination of all the eigenstates, such as Eq. (29), with coefficients being Ep|ψ(0). As time goes on, the coefficients eiEptEp|ψ(0) vary for different eigenvalues; that is to say, the relative phases of the evolutionary state vary with time. The changes in the relative phases, which is resulted from different eigenvalues of different eigenstates, lead to the photon hop processes between the adjacent cavities. The length of the cavity array, the number of the atoms, the detuning between atom energy level and photon frequencies, and the hopping strength contribute a lot to the state evolution.

We first consider changing the number of empty cavities, and keeping other factors unchanged. The parameters are nM = 1, Δ=0, and A = 0.01g, and we assign 1, 2, 3, 4 to nL and nR, where nL = nR. The results are shown in Fig. 3. The probability distribution curves exhibit the sinusoidal/cosine oscillations over time. For the longer-length cavity array systems, it takes more time for the excitation to be transmitted to the other end of the cavity array. Thus the oscillation periods become longer as we increase the length, by adding more empty cavities, of the cavity array. Throughout the process, the excitation as a photon state exists in the left or the right empty cavities. The nonempty cavity seems inactive in the evolution process.

FIG. 3.

Probability distributions over time, where the number of atoms in these cavity arrays are all set to 1. The pictures from (a) to (d) correspond to the four cases when numbers of empty cavities on any side are set to be nL = nR = 1, 2, 3 and 4, respectively.

FIG. 3.

Probability distributions over time, where the number of atoms in these cavity arrays are all set to 1. The pictures from (a) to (d) correspond to the four cases when numbers of empty cavities on any side are set to be nL = nR = 1, 2, 3 and 4, respectively.

Close modal

Next, we increase the number of atoms while keeping all the other parameters unchanged to conduct further study. We obtain the following results as shown in Figs. 4 and 5. By increasing the number of nonempty cavities, we see that when we increase the number of nonempty cavities rather than the empty cavities, the oscillation periods increase more significantly. Generally, a greater number of cavities involved in the system means more time required for the oscillation to go through a period.

FIG. 4.

Probability distributions over time, where the number of atoms in these cavity arrays are all set to 2. The pictures from (a) to (d) correspond to the four cases when numbers of empty cavities on any side are set to be nL = nR = 1, 2, 3 and 4, respectively.

FIG. 4.

Probability distributions over time, where the number of atoms in these cavity arrays are all set to 2. The pictures from (a) to (d) correspond to the four cases when numbers of empty cavities on any side are set to be nL = nR = 1, 2, 3 and 4, respectively.

Close modal
FIG. 5.

Probability distributions over time, where the number of atoms in these cavity arrays are all set to 3. The pictures from (a) to (d) correspond to the four cases when numbers of empty cavities on any side are set to be nL = nR = 1, 2, 3 and 4, respectively.

FIG. 5.

Probability distributions over time, where the number of atoms in these cavity arrays are all set to 3. The pictures from (a) to (d) correspond to the four cases when numbers of empty cavities on any side are set to be nL = nR = 1, 2, 3 and 4, respectively.

Close modal

In the above discussions, the excitation always exists as a photon state in the empty cavities. The length of the cavity array seems to be a trivial factor for finding the excitation to exist as an excited atom state. Thus, we turn to the detuning, that is, Δ, for answers. The results are shown in Fig. 6. As the detuning increases, the probability for us to find the excitation to be in the nonempty cavities increases obviously. When Δ=0, the interaction between the photon and atom is very intense. As a result, the photon is blocked from being transmitted to the other end. If we increase the detuning, the interactions within the system seem to be less intense, which leads to the transmission of the photon throughout the system. As expected, the oscillating period gets shorter as we keep on increasing the detuning. The length of the cavity array still plays an important role in the evolution processes. The situation is just as we illustrated above. If we increase the length of the cavity array, the oscillating period will get longer. This result is shown in Fig. 7.

FIG. 6.

Probability distributions over time. The parameters are nL = nM = nR = 1, A = 0.01g. The pictures from (a) to (d) correspond to the four cases when the detunings are set to be 0, 10g, 20g and 30g, respectively.

FIG. 6.

Probability distributions over time. The parameters are nL = nM = nR = 1, A = 0.01g. The pictures from (a) to (d) correspond to the four cases when the detunings are set to be 0, 10g, 20g and 30g, respectively.

Close modal
FIG. 7.

Probability distributions over time. The parameters are nL = nM = nR = 3, A = 0.01g. The pictures from (a) to (d) correspond to the four cases when the detunings are set to be 0, 10g, 20g and 30g, respectively.

FIG. 7.

Probability distributions over time. The parameters are nL = nM = nR = 3, A = 0.01g. The pictures from (a) to (d) correspond to the four cases when the detunings are set to be 0, 10g, 20g and 30g, respectively.

Close modal

Finally, we consider the hopping strength. The results are shown in Fig. 8. It makes the photon hopping processes between adjacent cavities more intense as we increase the hopping strength. As a result, it speeds up the time evolution process of the system.

FIG. 8.

Probability distributions over time. The parameters are nL = nM = nR = 1, Δ=0. The pictures from (a) to (d) correspond to the four cases when the hopping straights are set to be 0.01g, 0.1g, g and 10g, respectively.

FIG. 8.

Probability distributions over time. The parameters are nL = nM = nR = 1, Δ=0. The pictures from (a) to (d) correspond to the four cases when the hopping straights are set to be 0.01g, 0.1g, g and 10g, respectively.

Close modal

In the above examples, our programs completed the computational tasks quite well. Now we are still working to improve them to be more useful. There have been many programming projects for solving the quantum computing problems. The most famous one among these projects must be QuTiP, the Quantum Toolbox in Python,25,26 which is very powerful. In dealing with quantum computing problems, the exponentially increasing dimensionality of the Hilbert space often severely limits the size of system that can be analytically calculated. In this regard, our programming method just consider some certain subpart of the whole Hilbert space. A similar approach also exists in QuTiP. In order to make the problem simple and without losing the generality, just as illustrated in the above, a subspace in each physical system containing a total of one excitation is considered. Regarding the quantum dynamics of physical systems in these smaller spaces, we obtain the analytical result for each curve. However, it should be clear that as the quantum system grows too large, where even the subspace is too big for us to obtain the analytical solution, we should turn to the numerical method, just as illustrated in Refs. 25,26, for help.

In this paper, the quantum systems consisting of harmonic oscillators and two-level atoms are considered. We first introduced our method for calculating the matrix representation of Hamiltonian in finite dimensional quantum systems using a programming method. To implement this method, two main procedures are described in detail.

For the first process, we introduced two ways to build a Hilbert space. The first way is to enumerate all possible candidates first and then select the ones that meet the requirements. It consumes a lot of memory, which is a disaster for physical systems with large dimensions. Thus, we thought of another way, that is, checking the candidates one by one and deciding whether they meet the requirements. In this way, all the chosen ones would make up a set of bases for the Hilbert space. The mixed radix number systems are introduced for efficiency.

For the second process, we introduced three important operations, describing how a Hamiltonian would change a state vector into another vector, and described in detail the construction of a matrix representation of a Hamiltonian. In order for the off-diagonal elements of the matrix to be nontrivial, the most important thing that we should emphasize is that the excitation exchanging requirement must be satisfied.

Finally, to test our method, we gave some examples about cavities and discussed some of their properties. Nonetheless, this method is not limited to this model only. This method can be applied to more complicated models.

See supplementary material for more details about the partial source code of program for calculating the excitation number restricted state space, not reported in the main text. In this program (programmed by Mathematica software), the state space for a system containing five cavities, each consists of one two-level atom and some photons, are calculated.

We acknowledge the support by the National key research and development program of China (2017YFA0303700) and the National Natural Science Foundation of China (11534006).

1.
J. T.
Shen
and
S.
Fan
, “
Coherent photon transport from spontaneous emission in one-dimensional waveguides
,”
Opt. Lett.
30
,
2001
2003
(
2005
).
2.
G.
Manzaccaa
,
G.
Cincotti
, and
K.
Hingerl
, “
Ultrafast switching by controlling Rabi splitting
,”
Appl. Phys. Lett.
91
,
231920
(
2007
).
3.
J. Q.
Liao
,
J. F.
Huang
,
Y. X.
Liu
,
L. M.
Kuang
, and
C. P.
Sun
, “
Quantum switch for single-photon transport in a coupled superconducting transmission-line-resonator array
,”
Phys. Rev. A
80
,
014301
(
2009
).
4.
N. C.
Kim
,
J. B.
Li
,
Z. J.
Yang
,
Z. H.
Hao
, and
Q. Q.
Wang
, “
Switching of a single propagating plasmon by two quantum dots system
,”
Appl. Phys. Lett.
97
,
061110
(
2010
).
5.
J. T.
Shen
and
S.
Fan
, “
Coherent single photon transport in a one-dimensional waveguide coupled with superconducting quantum bits
,”
Phys. Rev. Lett.
95
,
213001
(
2005
).
6.
Y.
Chang
,
Z. R.
Gong
, and
C. P.
Sun
, “
Multiatomic mirror for perfect reflection of single photons in a wide band of frequency
,”
Phys. Rev. A
83
,
013825
(
2011
).
7.
L.
Zhou
,
Z. R.
Gong
,
Y. X.
Liu
,
C. P.
Sun
, and
F.
Nori
, “
Controllable scattering of a single photon inside a one-dimensional resonator waveguide
,”
Phys. Rev. Lett.
101
,
100501
(
2008
).
8.
L.
Zhou
,
H.
Dong
,
Y. X.
Liu
,
C. P.
Sun
, and
F.
Nori
, “
Quantum supercavity with atomic mirrors
,”
Phys. Rev. A
78
,
063827
(
2008
).
9.
L.
Zhou
,
S.
Yang
,
Y. X.
Liu
,
C. P.
Sun
, and
F.
Nori
, “
Quantum Zeno switch for single-photon coherent transport
,”
Phys. Rev. A
80
,
062109
(
2009
).
10.
J. Q.
Liao
,
Z. R.
Gong
,
L.
Zhou
,
Y. X.
Liu
,
C. P.
Sun
, and
F.
Nori
, “
Controlling the transport of single photons by tuning the frequency of either one or two cavities in an array of coupled cavities
,”
Phys. Rev. A
81
,
042304
(
2010
).
11.
J.
Lu
,
L.
Zhou
,
L. M.
Kuang
, and
F.
Nori
, “
Single-photon router: Coherent control of multichannel scattering for single photons with quantum interferences
,”
Phys. Rev. A
89
,
013805
(
2014
).
12.
D.
Witthaut
and
A. S.
Søensen
, “
Photon scattering by a three-level emitter in a one-dimensional waveguide
,”
New J. Phys.
12
,
043052
(
2010
).
13.
D. E.
Chang
,
A. S.
Søensen
,
E. A.
Demler
, and
M. D.
Lukin
, “
A single-photon transistor using nanoscale surface plasmons
,”
Nat. Phys.
3
,
807
812
(
2007
).
14.
A.
Wallraff
,
D. I.
Schuster
,
A.
Blais
,
L.
Frunzio
,
R. S.
Huang
,
J.
Majer
,
S.
Kumar
,
S. M.
Girvin
, and
R. J.
Schoelkopf
, “
Strong coupling of a single photon to a superconducting qubit using circuit quantum electrodynamics
,”
Nature (London)
431
,
162
167
(
2004
).
15.
M.
Hijlkema
,
B.
Weber
,
H. P.
Specht
,
S. C.
Webster
,
A.
Kuhn
, and
G.
Rempe
, “
A single-photon server with just one atom
,”
Nat. Phys.
3
,
253
255
(
2007
).
16.
J. Q.
You
and
F.
Nori
, “
Superconducting circuits and quantum information
,”
Physics Today
58
(
11
),
42
47
(
2005
).
17.
J. Q.
You
and
F.
Nori
, “
Atomic physics and quantum optics using superconducting circuits
,”
Nature
474
,
589
597
(
2011
).
18.
P. D.
Nation
,
J. R.
Johansson
,
M. P.
Blencowe
, and
F.
Nori
, “
Colloquium: Stimulating uncertainty: Amplifying the quantum vacuum with superconducting circuits
,”
Rev. Mod. Phys.
84
,
1
24
(
2012
).
19.
H.
Walther
,
B. T. H.
Varcoe
,
B. G.
Englert
, and
T.
Becker
, “
Cavity quantum electrodynamics
,”
Rep. Prog. Phys.
69
,
1325
1382
(
2006
).
20.
R.
Miller
,
T. E.
Northup
,
K. M.
Birnbaum
,
A.
Boca
,
A. D.
Boozer
, and
H. J.
Kimble
, “
Trapped atoms in cavity QED: coupling quantized light and matter
,”
J. Phys. B
38
,
S551
S565
(
2005
).
21.
E. K.
Irish
,
C. D.
Ogden
, and
M. S.
Kim
, “
Polaritonic characteristics of insulator and superfluid states in a coupled-cavity array
,”
Phys. Rev. A
77
,
033801
(
2008
).
22.
E. K.
Irish
,
J.
Gea-Banacloche
,
I.
Martin
, and
K. C.
Schwab
, “
Dynamics of a two-level system strongly coupled to a high-frequency quantum oscillator
,”
Phys. Rev. B
72
,
195410
(
2005
).
23.
E. K.
Irish
, “
Generalized rotating-wave approximation for arbitrarily large coupling
,”
Phys. Rev. Lett.
99
,
173601
(
2007
).
24.
E. T.
Jaynes
and
F. W.
Cummings
, “
Comparison of quantum and semiclassical radiation theories with application to the beam maser
,”
Proc. IEEE
51
,
89
109
(
1963
).
25.
J. R.
Johansson
,
P. D.
Nation
, and
F.
Nori
, “
QuTiP: An open-source Python framework for the dynamics of open quantum systems
,”
Comput. Phys. Commun.
183
,
1760
1772
(
2012
).
26.
J. R.
Johansson
,
P. D.
Nation
, and
F.
Nori
, “
QuTiP 2: A Python framework for the dynamics of open quantum systems
,”
Comput. Phys. Commun.
184
,
1234
1240
(
2013
).

Supplementary Material