Gibbs mixing of partially distinguishable photons with a polarising beamsplitter membrane

For a thought experiment concerning the mixing of two classical gases, Gibbs concluded that the work that can be extracted from mixing is determined by whether or not the gases can be distinguished by a semi-permeable membrane; that is, the mixing work is a discontinuous function of how similar the gases are. Here we describe an optomechanical setup that generalises Gibbs' thought experiment to partially distinguishable quantum gases. Specifically, we model the interaction between a polarising beamsplitter, that plays the role of a semi-permeable membrane, and two photon gases of non-orthogonal polarisation. We find that the work arising from the mixing of the gases is related to the potential energy associated with the displacement of the microscopic membrane, and we derive a general quantum mixing work expression, valid for any two photon gases with the same number distribution. The quantum mixing work is found to change continuously with the distinguishability of the two polarised gases. In addition, fluctuations of the work on the microscopic membrane become important, which we calculate for Fock and thermal states of the photon gases. Our findings generalise Gibbs' mixing to the quantum regime and open the door for new quantum thermodynamic (thought) experiments with quantum gases with non-orthogonal polarisations and microscopic pistons that can distinguish orthogonal polarisations.


Introduction
The importance of the concept of distinguishability in classical and quantum thermodynamics is neatly illustrated by Gibbs' mixing thought experiment [1]. In classical physics the work that can be extracted from mixing two gases is a discontinuous function of their similarity, determined by whether or not the gases can be distinguished by a semi-permeable membrane. In the quantum regime, the possibility of non-orthogonal quantum states allows one to consider gases that are neither perfectly distinguishable nor perfectly indistinguishable but rather at best partially distinguishable [2][3][4][5][6][7][8]. Thus the question arises, how does the work output from mixing quantum gases depend on their distinguishability?
This question has been investigated from an information theoretic perspective. Early studies based on entropy arguments [2][3][4][5] showed that the work output in the thermodynamic limit of large gases should increase continuously with the distinguishability of the two gases, quantified by the overlap in the gas particles' internal states. More recently [6], Gibbs mixing of finite sized quantum gases has been shown to lead to an extractable work, defined as the mixing 'ergotropy' [9], that increases smoothly with distinguishability for homogeneous (made up of the same particles) gases, with more complex behaviour observed for inhomogeneous gases. However, the above approaches [2][3][4][5][6][7][8] do not discuss how the quantum gases and semipermeable membranes (or alternative work extraction mechanisms) might be realised. Nor do they consider the time dependent dynamics of the mixing processes. Thus these information theoretic approaches leave open how such mixing processes could physically manifest.
In this paper we investigate a more concrete quantum generalisation of the Gibbs mixing thought experiment, that may in principle be realised with an optomechanics setup. Specifically, we will investigate the work that can be extracted from mixing two photon gases distinguished by their polarisation. To study this we introduce a novel optomechanical setup that is similar to current experimentally realisable 'membrane-in-the-middle' setups [10][11][12][13][14][15][16][17] and the thought experiment proposed in [18], but uses a PBS instead of the usual beamsplitter (BS). The PBS membrane we consider acts as acts as a beamsplitter for one specific polarisation, say horizontal, while as a mirror on the orthogonal polarisation, vertical, thus realising a quantum version of a semi-permeable membrane.
In Section 2 classical Gibbs mixing is reviewed before we introduce the PBS-in-the-middle optomechanical setup and its Hamiltonian in Section 3. In Section 4 we calculate the time dependent dynamics of the state of the photon gases and the PBS membrane and associate the motion of the membrane with a work output in Section 5. We find, as expected, that the mixing work increases smoothly with the distinguishability of the two photon gases, clearly extending on the discontinuous classical case and inline with previous results for quantum mixing [2][3][4][5][6][7][8]. However, with the explicit time dynamics for the optomechanical setting, we can characterise not just the average work but also build a more complete picture of the mixing process as discussed in Section 6. For example, increasingly large fluctuations in the work output are found that arise from quantum fluctuations as well as classical fluctuations for initial Fock and thermal photon states. Experimental prospects of observing the Gibbs mixing work as a function of distinguishability are discussed in Section 7 before the findings are discussed in the conclusion section 8.  (a) Two homogeneous gases, a 'red' gas and a 'yellow' gas, are initially confined to two halves of a box of volume 2v. To draw work from the mixing of the two gases, a pair of semi-permeable membranes is inserted, with red (yellow) gas particles passing through the red (yellow) membrane while being confined by the yellow (red) membrane. (b) The membranes are held in place with two springs, allowing them to move. Since each membrane confines one gas, which exerts a pressure on it, the membranes will slide and the gases compress the springs, performing work. The expansion of each of the two ideal gases from v to 2v, while in thermal contact with a heat bath at temperature T , thus mixes the gases and produces work while drawing heat from the bath.

Classical Gibbs Mixing
The standard classical protocol [1] for extracting work from mixing two homogeneous gases is sketched in Fig. 1. Initially, there are n particles of an ideal gas of type L and n particles of an ideal gas of type R, confined in two volumes, each of size v, separated by a pair of membranes. One of these membranes is permeable to type L particles while impermeable to type R particles, and vice versa for the second membrane. Both gases are in thermal equilibrium with an external heat reservoir at temperature T and each gas exerts pressure, p, on its confining membrane, while exerting no pressure on the other membrane. By allowing the membranes to move under the force of the gases, the two gases can isothermally expand resulting in them mixing in the space between the membranes, see Fig. 1. At the end of the protocol the two gases occupy the full volume 2v and are fully mixed. By standard thermodynamics, the work done on the membrane as the two distinguishable gases expand from volume v to 2v is given by [1,7] and the energy lost by the gases is continually replenished as heat from the heat reservoir at temperature T . Crucially, this protocol is only possible if two suitable semi-permeable membranes can be found. Clearly, if the gases are in fact indistinguishable then no such membranes are available and thus no work can be drawn from mixing of two indistinguishable gases, W indist = 0. It has been argued by some [3,6] that the discontinuous jump in the extractable work from W indist to W dist is at odds with the fact that the similarity of any two gases may be varied continuously †. However, arguably [19][20][21] this tension is not especially mysterious because, while one can consider gases with varying degrees of similarity (e.g. in terms of composition or †The statement that the similarity of two gases can be varied smoothly is best understood from the operational perspective of an chemist in the lab with a collection of gas specimens. The chemist can measure the properties of the gases (e.g. mass, condensation temperature, solubility etc.) to obtain quantitative measures Figure 2: Optomechanical setup. A microscopically thin polarising beam-splitter membrane is inserted into a cavity and allowed to oscillate. The displacement of the membrane from the mid-point of the cavity is denoted by X M and the creation operator for this mechanical mode is M † . The transmission rate between the horizontally polarised photon modes on the left hand side of the membrane, L † H , and horizontally polarised modes on the right, R † H , is determined by the constant λ. The force exerted per horizontally (vertically) polarised photon on the membrane is given by g H (g V ). As the membrane reflects all vertically polarised photons the force exerted on the membrane by vertically polarised photons is greater than of the horizontally polarised photons, that is g V > g H . mass), it ultimately only matters whether or not two gases can be operationally distinguished. From this perspective, any two (homogeneous) classical gases can either be distinguished or not, and any difficulty doing so is an epistemic limitation due to lack of knowledge and ability to identify suitable membranes on the part of the experimentalist.
However, for quantum systems this does not hold true. In the quantum setting the two (homogeneous) gases could be distinguished not by their isotope or molecular composition but rather by their internal state. For example, a gas could consist of hydrogen atoms in their ground state or of hydrogen atoms in the first excited state. But it is also possible for each hydrogen atom to be in a superposition of its ground state and excited state, and the distinguishability of such a superposition state with respect to the ground state can vary smoothly. In contrast to the classical case, one can thus consider two gases, gas R consisting of hydrogen atoms in the ground state and gas L consisting of hydrogen atoms in an energetic superposition state, that are neither perfectly distinguishable nor perfectly indistinguishable. The quantum regime thus offers the ability to smoothly vary the distinguishability of two gases and explore its impact on the thermodynamics of mixing.

The Optomechanical Setup
Here we introduce a physical setting that enables an assessment of the work that can be extracted from mixing partially distinguishable quantum gases. In general, it is hard to conceive of realistic semi-permeable membranes that can differentiate between different internal states of the difference between the gases. Considering the fundamental elementary composition of the gases one might question the degree to which such difference measures ultimately vary smoothly. However, the point remains that while one can consider gases with varying degree of similarity, the work that can be extracted is discontinuous, depending only on whether the gases are identical or different.
of an atom or molecule, such as the ground and excited state of a hydrogen atom. However, for photon gases of different polarisations [7], a polarising beamsplitter (PBS) satisfies all requirements. A PBS membrane can act as a mirror for vertically polarised (V ) photons, while acting as standard beamsplitter for horizontally polarised (H) photons [22]. Thus similarly to a classical semi-permeable membrane the PBS is permeable to one gas (H) and impermeable to the other (V ). However, unlike a classical semi-permeable membrane, a PBS acts coherently on the H gas, generating superpositions of the left and right H modes, thus generalising the semi-permeable membrane to the quantum realm.
One could conceive of generalising the classical Gibbs mixing protocol, sketched in Fig. 1, by simply replacing the classical gases with photon gases and the semi-permeable membranes with a PBS; however, in that case the pistons are implicitly macroscopic and therefore the work output would remain entirely classical. Instead, we will here model the PBS membrane as a microscopic system such that the pistons, as well as the gases, are quantum mechanical. We further simplify the setting and consider a single piston membrane, as shown in Fig. 2, rather than the pair considered in the original classical protocol. This reduces the number of light modes and mechanical modes required, making both the calculations more tractable and the experimental setting more feasible, while leaving the core physics of the thought experiment unchanged.
Specifically, we consider an optomechanical generalisation of the Gibbs mixing thought experiment in which, as sketched in Fig. 2, a polarising beamsplitter attached to a microscopic cantilever has been placed in the centre of an optical cavity. Gas R (initially on the right of the cavity) consists of horizontally polarised photons, each in state |H , and gas L (initially on the left) consists of photons each polarised in a superposition state |θ = cos(θ) |H + sin(θ) |V , where θ quantifies the degree of distinguishability (and similarity) of the gases R and L. This allows us to explore the transition between perfectly distinguishable and perfectly indistinguishable gases by varying θ.
Hamiltonian. The Hamiltonian describing the 'PBS-in-the-middle' optomechanical setup, is comprised of the non-interacting Hamiltonians of the photons and membrane, H 0 , the polarisation dependent beamsplitter interaction between the photons in the left and right halves of the cavity, H PBS , and the optomechanical interaction between the photons and the membrane, H int [12,18]. The Hamiltonian H 0 for the independent optical and mechanical modes can be written explicitly as Here ω M is the mechanical frequency of the membrane, ω is the light frequency in both halves of the cavity, M † is the creation operator for the phonon membrane mode and L † H (R † H ) and L † V (R † V ) are the creation operators for horizontally and vertically polarised photons respectively in the left (right) cavity [23], for which the standard commutation relations hold, i.e.
While a standard BS, as considered in the standard 'membrane-in-the-middle' setting [11,18], transmits/reflects photons of any polarisation, the PBS considered here will only act as a standard BS on horizontally polarised photons while acting as a mirror for vertically polarised photons. Thus the coupling between the modes in the left and right halves of the cavity is of the form i.e. a horizontally polarised photon on the left is annihilated (L H ) while a horizontally polarised photon is created on the right (R † H ), and vice versa, while there is no such coupling between the left and right modes for vertically polarised photons. The coefficient λ determines the reflection r H and transmission t H coefficients of the horizontally polarised photons at time t, with the evolution of the photonic modes induced by H PBS alone (in the Heisenburg picture) given by  where r H (t) = cos λ 2 t and t H (t) = sin λ 2 t [22]. The vertically polarised photons in the left and right halves of the cavity are confined to their respective halves and thus are uncoupled such that transmission coefficient for vertically polarised photons vanishes, t V = 0, and the photons are always reflected, r V = 1. The key quantum effect is that a single photon initially in a superposition state |θ will in time interact with both the beamsplitter and mirror components of the PBS.
When photons collide with the membrane they will exchange momentum and exert a pressure (radiation pressure) on the surface of the membrane [24] that depends on whether a photon is reflected or transmitted. The total force exerted by photons on the membrane, is the sum of the products of the forces exerted per photon,hg H (hg V ) for a horizontally (vertically) polarised photon, and the difference between the numbers of photons in the left and right halves of the cavity, for horizontally (and vertically) polarised photons. In general g V and g H are independent variables; however, since all vertical photons are reflected but horizontal photons are partially reflected and partially transmitted, the force exerted by vertical photons on the membrane should be greater than that of horizontal photons which implies that g V is larger than g H . This radiation pressure gives rise to an optomechanical interaction energy of the form where is the displacement of the membrane from the centre of the cavity.
The prefactor x zpf is the mechanical oscillator's zero point uncertainty x zpf = h/2mω M with m the mass of the membrane.
Initial state. While in the classical setting the number of particles in each gas is constant and the gases are in thermal contact with a heat bath such that their temperature is also fixed, here the photon gases do not thermalise through mutual interactions with a heat bath and the gases cannot have both a fixed temperature and photon number. However, the cases of fixed temperature and fixed photon number can be studied separately. We consider a Fock state configuration which has precisely n photons per cavity (but no notion of temperature) and thus the initial state of the photons can be written as |ψ n Meanwhile, an initial state ρ T := γ T L (θ) ⊗ γ T R (0) in which the photons in each cavity are in a thermal state at temperature T , with will have a fixed temperature, but no fixed photon number per cavity. While the thermal configuration perhaps makes better contact with the thermodynamics which is central to the original Gibbs mixing thought experiment; the Fock state configuration is conceptually interesting in virtue of the fact that the Fock state is a genuinely quantum mechanical state of light.
In the usual classical setting, the states of the semi-permeable membranes are not explicitly modelled. However, presumably, the membranes are initially at equilibrium with the surrounding heat bath. On this basis, we will similarly take the membrane to be prepared in a thermal state, where, in the thermal configuration, T is also the temperature of the gases so that the setup is at thermal equilibrium.

The Dynamics of Mixing
A qualitative understanding of the expected dynamics of the photons and membrane can be built without explicit calculation of the dynamics. As ρ n F = |ψ n F ψ n F | and ρ T evolve under H, vertically polarised photons are confined to the left half of the cavity while horizontally polarised photons are free to oscillate between the two halves, leading to a mixing of the gases in the left half. When the two gases are perfectly distinguishable, i.e. θ = π/2, the vertically polarised photons, which are confined solely in the left half of the cavity, generate a net rightward force on the PBS membrane and this displaces the membrane from the centre. In contrast, when the two gases are indistinguishable, i.e. θ = 0, both gases are horizontally polarised and, as on average there will be equal numbers of photons in both halves of the cavity, there will be no net force on the membrane. For indistinguishable gases we thus expect the membrane to remain on average in the centre of the cavity. For partially distinguishable gases, i.e. 0 < θ < π/2, the force exerted by the gases on the membrane, and therefore the membrane's displacement, is expected to increase with increasing θ. In analogy to the classical mixing scenario, the displacement of the membrane can be associated with a work output, which is expected to increase with the distinguishability of the two gases. In contrast to the classical case discussed in Section 2, where the thermal bath replenishes the energy lost by the photon gases to the membrane such that the work done on the piston ultimately stems from the heat bath, here the system is closed and therefore the work done on the piston membrane stems solely from the effective energy of the photon gases.
To quantitatively study the dynamics of the light field and mechanical degree of freedom it is helpful to work in the Heisenberg picture since this makes it possible to obtain general results for the evolution of the relevant observables, that is the membrane's displacement and energy, for a general initial state of the photon gases and membrane. To maintain an analogy with classical Gibbs mixing, where the number of gas molecules is fixed and the motion of the pistons are assumed to be frictionless, we here consider an idealised cavity and membrane which experience no dissipative effects. This assumption is relaxed in Section 7 where more realistic experimental implementations are discussed.
The membrane evolves as a quantum harmonic oscillator driven by the radiation pressure from the photons in the cavity. Working in the Heisenberg picture, the equation of motion of the membrane reads where the time dependence of the total force exerted by the photons on the membrane, Eq. (7), is explicitly included. Since the PBS membrane acts as a mirror for vertically polarised photons, the number of vertically polarised photons in the right (and hence left) cavity is conserved for evolutions under H, and therefore However, the horizontally polarised photons are free to oscillate between the two halves of the cavity with their number difference ∆N H coupled to the position of the membrane via Note, that the total Hamiltonian commutes with and therefore the total number of horizontally and vertically polarised photons is conserved.
The dynamics of the photons and membrane are thus determined by the coupled differential equations for the light and mechanical modes, Eq. (12) and Eq. (14). While solving these exactly is prohibitively difficult, a perturbative solution that describes the dynamics of the expectation of selected observables can be constructed. Given that the force exerted by a single photon on the massive membrane is weak ‡, the single photon coupling strengths, g H x zpf and g V x zpf , are expected to be small compared to the PBS coupling strength, λ. We thus choose to solve the dynamics perturbatively in g H and g V .
As the force exerted on the membrane is already linear in g H and g V , Eq. (7), studying the dynamics of the membrane to 1st order in g H and g V amounts to disregarding the backaction that the motion of the membrane has on the dynamics of the photons and evaluating ‡Note, we are implicitly still considering what is usually called the strong coupling regime here in that we have assumed that the cavity damping rate κ is sufficiently small that we can disregard it and therefore g H x zpf > κ and g V x zpf > κ. the dynamics of the photons to 0th order in g H and g V . It follows from Eq. (14) that, in the absence of back-action, the horizontally polarised photons oscillate at a rate λ between the two halves of the cavity according to where The membrane dynamics (12) is thus driven by the sum of an oscillatory force, originating from the oscillatory motion of the horizontal photons between the left and right halves of the cavity, and a constant force, originating from the initial imbalance ∆N V (0) = 0 of the vertical photons. The solution to the equation of motion of the membrane, is composed of a displacement proportional to the difference in number of vertically polarised photons in the left and right halves of the cavity and an oscillatory term, X osc M (t). This oscillatory term is of the form where P M (0) is the membrane's momentum operator in Heisenberg picture at time t = 0 and v H (t) = is an oscillatory function quantifying beating between the driving frequency, λ, and the membrane's natural frequency, ω M . Having found the membrane's dynamics (17) with oscillatory term (18), we are now ready to quantify the thermodynamics of mixing within the present optomechanical setting.

Work output from the Gibbs mixing of photons
To compare the work done by the mixing of the photon gases to that in Gibbs' classical thought experiment, one needs to introduce a measure of work done on the membrane. The question of how to define work and heat in the quantum regime, where energetic coherences can be present, has been discussed extensively elsewhere [25][26][27][28][29][30]. Here we sidestep these fundamental difficulties, and identify a natural candidate for the work output in the present optomechanical setting by drawing an analogy with classical Gibbs mixing.
In the classical Gibbs mixing protocol described in Fig. 1, one could imagine the work done by the expanding gases is stored by the pair of springs that are compressed during the mixing process. By analogy, one might consider the work done on the PBS membrane to be the potential energy associated with its displacement resulting from the mixing of the photon gases, W M (t) ∝ X M (t) 2 . However, in contrast to the classical protocol where the final displacement of the membrane is constant and well defined, in the optomechanical setting the membrane oscillates about its new displaced origin in time and there is some spread to its wave function. In order to have a well defined work output, we therefore take the work done from mixing as given by the potential energy associated with the oscillator's time averaged displaced origin. That is where is the displacement of the membrane averaged over both an oscillation cycle of time τ and the initial quantum state of the two photon gases and the membrane, i.e. either ρ = ρ n F ⊗ γ T M for Fock state photons or ρ = ρ T ⊗ γ T M for thermal state photons, see (10) and (11). The work that can be extracted from the mixing of partially distinguishable photon gases can now be calculated from the expression for the dynamics of the membrane in the Heisenberg picture, Eq. (17). Since the oscillatory component to the membrane's motion X osc M (t) vanishes when averaged over a complete oscillation cycle, the time averaged displacement of the membrane, is directly proportional to the difference ∆N V (0) in the initial number of vertically polarised photons in the two gases. For the initial photon gas states ρ n F or ρ T , both gases have the same total number of photons N = C † H (0)C H (0) + C † V (0)C V (0) per gas C = L, R. I.e. N = n per gas for the Fock states (9) and N = 1/(eh ω/k B T − 1) per gas for thermal states (10). However, the number of vertically polarised photons in the left gas is N sin 2 θ while on the right it is zero. Hence, the time averaged displacement of the membrane is It thus follows that the potential energy associated with the average displacement of the membrane due to mixing of the two photon gases is This is the mixing work associated with the mixing of two homogeneous quantum gases in the "PBS-in-the-middle" setting. The expression implies that the work output vanishes for perfectly indistinguishable gases and is maximised for perfectly distinguishable gases, in agreement with the classical case, as one would expect. However, crucially, in contrast to classical Gibbs mixing and inline with prior analyses, e.g. in terms of the mixing entropy by Luboshitz and Podgoretskii [3] and the ergotropy by Allahverdyan and Nieuwenhuizen [6,9], the work W mix M ∝ X M 2 now smoothly increases between these two extremes. See Fig. 3 for a plot of X M and its standard deviation for the Fock and thermal photon gas states.
The mixing work is highly general in the sense that it holds not only for the initial Fock and thermal photon gas states, but also for any initial photon gas states that have the same number distribution while the left gas is θ-polarised and the right gas is H-polarised. As such, the work output is independent of the purity of the number distribution of the two quantum gases.
We note that even classically one can consider mixing non-homogeneous gases, i.e. gases that are themselves a mixture of different types. However, this would deviate from the spirit of Gibbs' original thought-experiment concerning the mixing of homogeneous gases. Nevertheless, for the optomechanical setting considered here, the work that can be extracted from mixing two non-homogeneous gases, i.e., one gas initially in the state ρ L (0) = cos 2 (θ)|H H|+sin 2 (θ)|V V | and the other initially in the state ρ R (0) = |H H|, is still given by the general mixing work (23).

Optomechanical Gibbs mixing analysis
Before proceeding to discuss how one might observe this continuous work output with distinguishability experimentally in Section 7, here we provide a more detailed account of the thermodynamic properties of Gibbs mixing in this optomechanical setting.

Fluctuations in the work output.
A key distinction between Gibbs mixing in the optomechanical setting compared to prior studies concerns the fluctuations in the work output. When the pistons are assumed to be macroscopic classical systems, as in Gibbs' classical analysis [1] and in prior quantum analyses based on entropic arguments [2][3][4][5], the fluctuations in the work output from mixing are negligible. Here, however, as shown in Fig. 3, the standard deviation of the displacement of the membrane is large as compared to the membrane's average displacement which implies that there are large fluctuations in W mix M . These substantial fluctuations in the work output are a feature arising from using a microscopic quantum piston membrane that is sensitive to the microscopic dynamics of the photon gases. The fluctuations capture both the motion of the mechanical degree of freedom due to the oscillatory force exerted by the photons as well as its quantum uncertainty. This quantum component to the uncertainty stems from the initial vacuum fluctuations of the photonic and phononic modes and the coherent nature of the dynamics. In particular, the PBS interaction gives the photons access to coherent superpositions between the two halves of the cavity and the optomechanical interaction entangles the photonic modes and the microscopic piston generating quantum fluctuations in the membrane's position. As shown in light blue and pink in Fig. 3, the fluctuations per photon are largest for low photon numbers and low temperatures. This can be attributed to the increased relative significance of vacuum fluctuations when the number of photons in the cavity is small.
Temperature dependence. We have until this point focused on the distinguishability dependence of the dynamics; however, classically the temperature dependence of the work output is pertinent and therefore it is natural to also discuss this dependence here. In the current setting, any temperature dependence of the work output W mix M enters through the initial state of the photons. Therefore the work output does not depend on temperature if the number of photons in each gas is temperature independent, such as in the Fock state. However, in the thermal state the average number of photons is N = 1/(eh ω/k B T − 1) and its variance is (N − N ) 2 = eh ω/k B T /(eh ω/k B T − 1) 2 . The resulting temperature dependence of the work output is shown in Fig. 4. To aid comparison with classical Gibbs mixing work for two distinguishable gases, W dist = 2n k B T ln 2 in Eq. (1), we plot the work done on the membrane per photon, W mix M / N , to compensate for the fact that classically the number of particles in the gas is an arbitrary constant n, whereas for thermal photon gases the particle number N is temperature dependent. The log-log plot of work over temperature in Fig. 4 shows that the work output for both distinguishable and indistinguishable gases has the same slope as the classical work in the high temperature limit. Hence, since the classical mixing work is linear in T , the quantum mixing work is also linear in T at high temperatures, in agreement with prior results [3,6]. For low temperatures work per photon W mix M / N tends to zero at a super-linear rate, see Fig. 4. These low temperature deviations from the linear scaling are unsurprising given that the classical and entropic analyses are formulated for the asymptotic limit of large numbers of particles [2][3][4][5], whereas in the low temperature limit here, the gases consist of only a handful of photons.
Total energy transfer. In addition to the work output, another natural thermodynamic quantity to consider is the total energy transfer from the two photon gases to the membrane.   23), to first order in g H and normalised by the average photon gas number N ) grows as a function of the photon state temperature T , Eq. (10), and is zero for indistinguishable gases (θ = 0, not shown). For higher temperatures the slope becomes the same as that of the classical Gibbs mixing work per particle W dist /n (solid black) for distinguishable gases, see Eq. (1). Also shown is the full energy transfer to the membrane given by ∆H M in Eq. (25) for perfectly distinguishable gases (dark blue dashed) and for perfectly indistinguishable gases (light blue dotted). Again in the high temperature regime, both slopes become the same as the classical mixing work (solid black) and hence the energy transfers to the membrane grows linearly with the photon gas thermal state temperature. The classical work is given in units of k B T , and the quantum work W M and energy transfer ∆H M are given in units ofh . In this plot λ/ω M = 2, g V /g H = 6, ω = 10ω M .
In contrast to the work output, Eq. (19), which does not account for the energy associated with the motion of the membrane, the total energy of the membrane is composed of both a kinetic as well as a potential energy component. Thus, while the work output derives entirely from the constant force exerted by the vertically polarised photons, the driving force provided by the oscillatory motion of the photons also contributes to the membrane's energy. Since the dynamics generates oscillatory behaviour and entangles the mechanical and optical degrees of freedom, it is most insightful to consider the time-average of the quantum mechanical expectation value of change in the energy of the membrane, where H M =hω M M † M is the Hamiltonian of the membrane and the time average is taken over a complete oscillation cycle, as in Eq. (20). Using the expression for the evolution of the membrane position operator, Eq. (17), and its derivative, the energy transfer to the membrane is found to be of the form to first order in g H and g V , as a function of the distinguishability θ of the photon gases. Plots are for photon gases initially in a Fock state with n = 1 photons per cavity (light blue squares) and n = 100 photons per cavity (dark blue circles), and for photon gases initially in a thermal state at temperature k B T =hω (pink diamonds) and k B T = 100hω (red triangles). The inset magnifies the data for θ ≤ π/8 to highlight that the energy transfer does not vanish as θ → 0. The high number Fock state (dark blue circles) and high temperature thermal state (red triangles) energy transfers to the membrane converge to the same curve. All energies are given in units ofh where the prefactors α =h M ) 2 depend only on system parameters but not on the initial state of the gases or membrane.
Since the radiation pressure exerted by the vertically polarised photons is greater than that exerted by the horizontally polarised photons, g V > g H , the first term of Eq. (25) dominates the expression and the time averaged change in energy of the membrane can be approximated as where For both thermal and Fock state photon gases, the value of N 2 is always greater than N and therefore the above expression increases monotonically with θ. Thus, as shown in Fig. 5, the energy transfer to the membrane, similarly to the work output, increases continuously with the distinguishability θ of the photon gases. Similarly, as shown in Fig. 4, and inline with the work output, the energy transfer increases linearly with temperature in the high temperature limit.
The above approximation is valid for large enough θ, but when θ → 0 then ∆N 2 V (0) and ∆N V (0)∆N H (0) vanish and the ∆N H (0) and ∆K 2 H (0) terms in (25) become important. These are non-zero implying that the energy transfer to the membrane is strictly non-zero even for the 'mixing' of indistinguishable gases. This phenomenon, arises from the fact that the PBS membrane is a microscopic quantum system and thus experiences heating from the radiation pressure exerted by the photons in the cavity irrespective of their polarisation. While, as indicated in Figs. 4 and 5, the contribution of these terms are small compared to the energy transfer for distinguishable gases, such small energy changes may be detected with state-of-theart experimental techniques [31].
The energy transfer to a standard beamsplitter membrane (BS), as opposed to the polarising beamsplitter membrane considered here, was studied in [18]. There the energy transfer was found to increase with the indistinguishability of the photon gases [18] due to photonic bunching. Since the PBS considered here also acts as a beamsplitter for H-polarised photons, photonic bunching between the H and θ-polarised photon gases also occurs and contributes to the energy transfer to the membrane for any θ = π/2. However, the energy transfer due to bunching is small in comparison to that due to quantum Gibbs mixing and hence the overall energy transfer to the PBS nonetheless increases as a function of distinguishability.

Experimental Prospects
The Fock and thermal configurations were chosen to maintain a close resemblance with the classical Gibbs mixing setting; however, both configurations have experimental limitations. Previous 'membrane-in-the-middle' experiments operate at cryogenic conditions [11] which sets the membrane temperature to a few K. Having a thermal photon state at the same temperature, for a typical cavity frequency ω of the order of THz, implies low photon numbers, N 1, resulting in an un-measurably small mixing work. This could be mitigated by increasing the temperature and hence N of the thermal photon state; however, this will create an additional temperature gradient between the photons and the membrane, and so care would need to be taken to ascertain whether or not the work output could be attributed solely to mixing. For the Fock state photon gases, (9), the challenge is creating a Fock state large enough to have a non-negligible impact on the membrane dynamics or engineering an optomechanical coupling that is sensitive to small numbers of photons. While Fock states of high, e.g., n ≈ 50, remain experimentally demanding, the regime of low photon number optomechanics may be achievable in the near future [32].
In this section we will discuss experimental strategies beyond the Fock and thermal configurations whereby the two halves of the cavity are driven by lasers. Any experimental realisation would in practice experience dissipation of photons from the cavity and damping of the mechanical oscillator, and these effects are also incorporated in what follows.
Specifically, we propose simultaneously strongly driving the left cavity with θ-polarised photons and driving the right cavity with H-polarised photons. Assuming that this driving is performed on resonance with the cavity frequency and that the two driving processes are in phase, this can be modelled by adding the following driving term to the Hamiltonian, where L θ = cos(θ)L H + sin(θ)L V and is the laser driving amplitude [10]. In a frame rotating  32), as a function of distinguishability θ. The steady state displacements in b) for θ = 0, θ = π/4 and θ = π/2 align well with the long time displacements in a) as indicated by the dotted lines. Since parameters for PBS optomechanical systems are not available the following experimental parameters from a standard beamsplitter 'membrane-in-the-middle' setup [13,16] have been used: at the driving frequency, the equation of motion of the photonic modes take the form for p = H, V with H = cos(θ) and V = sin(θ) and where κ is the rate of cavity dissipation. Similarly, the equation of motion of the membrane, cf. Eq.(12), now reads where we account for the damping of the mechanical mode at rate κ M . Fig. 6 shows the average displacement of the membrane as a function of time, X M , found by solving these differential equations to first order in g H and g V and assuming that the left and right halves of the cavity are initially in the vacuum state. The displacement of the membrane is largest for the mixing of perfectly distinguishable photon gases (θ = π/2, red), vanishes for perfectly indistinguishable gases (θ = 0, blue), and sitting between these two extremes is the displacement for partially distinguishable gases (e.g. θ = π/4, purple).
In the limit § in which the cavity damping rate κ is substantially faster than the membrane damping rate κ M , the displacement of the membrane increases initially before reaching a steady §This limit has been realised experimentally for beamsplitter membranes [13]. As polarising beamsplitter membranes are yet to be utilised in an optomechanical experimental setup, their damping rates are not currently known.
oscillatory state about a new displaced origin on the time scale 1 κ t 1 κ M . This new displaced origin is found by disregarding the effect of membrane damping altogether, and evaluating the displacement, averaged over fast oscillations, in the limit of large t. The steady state displacement of the membrane is found to obey in the limit that g V g H . For the parameters used [13] the full numerical displacements given by (22), and shown in Fig. 6a) for θ = 0, θ = π/4 and θ = π/2, align well at long times with the predicted steady state displacements given by (32) and shown in Fig. 6b). Thus the displacement for this driven damped implementation is directly proportional to the displacement discussed in Section 5 for the un-damped and un-driven case, Eq. (22), increasing continuously with the distinguishability of the photon gases. In contrast to the demanding Fock and thermal states, this driven implementation provides a more viable experimental scheme to observe a continuous increase in the mixing work as a function of the distinguishability of two polarised photon gases.
While 'membrane-in-the-middle' experiments using beamsplitter membranes are well established [11][12][13][14][15][16], similar setups utilising polarising beamsplitters membranes have not yet been investigated. As a result, experimental values for g H , g V , m, ω M and κ M for ultrathin PBS membranes are not readily available and this lack of data makes it hard to fully access the viability of our proposal. The smallest polarising beamsplitters currently engineered are a couple of orders of magnitude thicker than the membranes that are typically used in 'membrane-in-the-middle' experiments [16,33,34], suggesting that it might be challenging in the short term to realise quantum regimes of the 'PBS-in-the-middle' setting. However, this is an unknown since it is yet to be tried. Moreover, active progress in miniaturising polarising beamsplitters [33,34] will continue to increase the feasibility of our proposal.

Conclusion and Outlook
In this paper we have proposed an optomechanical setup with a 'PBS-in-the-middle' of a cavity separating two homogeneous photon gases, one H-polarised and the other θ-polarised. Using the Hamiltonian equations of motion for this physically motivated setup we have derived a formula for the work drawn from mixing the two gases as a function of their polarisationdistinguishability θ, and valid for any number distribution of both photon gases. The setting generalises Gibbs mixing to the quantum regime in the sense that the PBS interaction gives the photons access to coherent superpositions between the two halves of the cavity, and the optomechanical interaction entangles the photonic modes and the microscopic piston.
The mixing work here varies smoothly with the distinguishability inline with previous results [3,6], while the proposed optomechanical setup provides a natural physical system where the work is stored: the potential energy associated with the displacement to the microscopic membrane. The fluctuations of the mixing work are not negligible for the microscopic membrane piston and, as we illustrate for Fock and thermal photon number distributions, they are largest at low photon numbers/low temperatures where vacuum fluctuations dominate thermal fluctuations.
In a driven and dissipative cavity setting, the membrane displacement plateaus to a constant steady state that increases smoothly with θ. While previous entropic and informationtheoretic derivations of the mixing work [1,3,6] have provided thermodynamic bounds on the maximal work extraction, the driven optomechanical cavity setting discussed here could conceivably be realised experimentally in the near future offering the chance to measure the continuous quantum mixing work for the first time, without needing to perform an optimal protocol. Nonetheless, it would be interesting to investigate if it is possible to come up with variations of physically realisable schemes that may extract more work from mixing the same gases. One could, for example, consider variants of the setup utilising multiple PBS membranes to enable the two photon gases to mix fully rather than partially as currently.
The 'PBS-in-the-middle' optomechanical setup also provides a framework to further study the mixing of photon gases utilising alternative types of membranes [18]. In addition to the semi-permeable membrane used in Gibbs mixing, many of the pioneering thought experiments in thermodynamics can be framed in terms of gases performing work on a membrane attached to a movable piston. For example, Feynman's ratchet [35] (a variant of the Szilard-experiment [36]) effectively uses a uni-directionally transmissive membrane and a Maxwell demon [37] could take the form of a fictitious semi-permeable membrane that separates fast and slow moving particles. This suggests that 'membrane-in-the-middle' optomechanics has wide ranging potential, not just as a platform to study the role of distinguishability and mixing in thermodynamics, but also for probing the fundamental relationships between information, heat and work.
We note that in the present optomechanical setup temperature enters through the initial thermal state of the membrane, and optionally as the temperature of initially thermal photon gases, but no continual thermalisation with a heat bath is modelled during the mixing process. The continual thermalisation of Gibbs' classical gases could be studied in the current setting either through a more detailed analysis of the dissipative coupling of the cavity modes to their surrounding thermal environment, or by using dye-molecules to actively mediate effective interactions between photons resulting in thermalisation [38,39]. Since the mechanical and light modes interact with different reservoirs, temperature gradients between the gases and the piston could be introduced that we expect will lead to additional quantum thermodynamic effects.