A chemical reaction network implementation of a Maxwell demon

We study an autonomous model of a Maxwell demon that works by rectifying thermal fluctuations of chemical reactions. It constitutes the chemical analog of a recently studied electronic demon. We characterize its scaling behavior in the macroscopic limit, its performances, and the impact of potential internal delays. We obtain analytical expressions for all quantities of interest, namely, the generated reverse chemical current, the output power, the transduction efficiency, and the correlations between the numbers of molecules. Due to a bound on the nonequilibrium response of its chemical reaction network, we find that, contrary to the electronic case, there is no way for the Maxwell demon to generate a finite output in the macroscopic limit. Finally, we analyze the information thermodynamics of the Maxwell demon from a bipartite perspective. In the limit of a fast demon, the information flow is obtained, its pattern in the state space is discussed, and the behavior of the partial efficiencies related to the measurement and the feedback processes is examined.


I. INTRODUCTION
A Maxwell demon (MD) is a thought experiment conceived in 1867 by J. C. Maxwell [1,2] to emphasize the statistical nature of the second law of thermodynamics and to challenge its validity at the microscopic scale.In this thought experiment, a small intelligent being, the demon, seemingly violates the second law by bringing out of equilibrium a gas that was initially in equilibrium without any apparent energetic cost.It achieves this goal by controlling a microscopic gate and sorting gas particles according to their speeds.This alleged violation of the second law stimulated crucial conceptual advances in the last century due to Szilard [3], Brillouin [4], Landauer [5,6] and Bennet [7] that revolutionized our understanding of thermodynamics by incorporating information into it.What was realized was that there is a fundamental thermodynamic cost associated with the processing of information that allows the demon to function.This cost arises either in the measurement process, in the resetting of the demon's memory or in both steps and it ensures that the second law, despite being statistical, continues to hold even at the microscopic scale.Nowadays, the general MD is understood as an "information engine" that functions in accordance with the second law [8][9][10][11][12]: the demon consumes energy to act on a system as an active feedback-control loop, its operation rectifies the system's fluctuations making it possible to extract work from the latter.In the last decades, there have been many experimental realizations corroborating this picture.Their physical implementations are diverse: molecular systems [13][14][15][16], colloidal particles [17,18], laser cooling [19,20], single-electron circuits [21,22], nuclear-spin system [23], electro-photonic system [24], superconducting qubit [25][26][27], DNA-hairpin [28], and cavity QED setups [29].
In the present paper, we thoroughly analyze a theoretical model of a MD based on chemical reaction networks (CRN): we realized that a recent electronic implementation of a MD [30,31] can be translated into chemistry conserving the same structure and working principle.In particular, the resulting MD is composed of two modules that can be thought of as "chemical inverters".This system offers an interesting viewpoint for investigating the analogies and differences between CRN and electronics.Moreover, despite not being the first MD implemented with CRN, it differs qualitatively from the previous ones [13-16, 32, 33].In those prior systems, the macroscopic limit is, in the end, equivalent to having many Maxwell demons working in parallel, whereas the same is not true in our case.Our MD's mechanism shows itself as a rectification of the thermal fluctuations in the numbers of molecules and, since the relative size of these fluctuations goes to zero as the size V of the system increases, the MD effect disappears.In the paper, we investigate the scaling behavior of our MD in the limit V → ∞.We perform it with the tools of stochastic thermodynamics [34][35][36] and, in particular, we take advantage of the bipartite formalism [37,38] to analyze the Maxwell demon's information thermodynamics.The resulting analysis provides a lucid understanding of arXiv:2307.14994v3[cond-mat.stat-mech]28 Nov 2023 the MD's functioning: each component of its chemical reaction network can be distinctly interpreted in relation to its functionality, and the analytical solvability of the model enables a comprehensive exploration of the MD's performance in different regimes.Most results obtained are in line with what was found for the electronic version of the MD [30,31], the main difference being that, in chemistry, increasing the input power does not allow one to mantain a finite MD's output in the macroscopic limit.This paper is organized as follows.Sec.II is an introduction to the concepts of chemical reaction networks necessary for understanding the chemical Maxwell demon.In Sec.III, we present the chemical inverter and its working principle.In III A, we quantitatively analyze its simplified version employed in the rest of the paper, and, in III B, we highlight the main differences with the electronic inverter.The beginning of Sec.IV is a preliminary overview of the chemical Maxwell demon: we dissect its structure, we sketch its working principle, and we briefly discuss its basic thermodynamics.In Sec.IV A, we clarify the detailed setup and how the macroscopic limit is performed; we also outline the procedure followed to solve the Maxwell demon.In Sec.IV B, we show the central role played by the correlations between the number of molecules.Namely, we connect all the other relevant quantities to the covariance between these numbers, which is computed in the subsequent Sec.IV C.This is done paying close attention to the accuracy of rate function methods.The covariance's expression is then used to assess the effect of internal delays in the demon and to derive the transduction efficiency analyzed in Sec.IV D. Finally, Sec.IV E consists in further resolving the thermodynamics of the Maxwell demon from a bipartite perspective: we explain how the demon-system information flow is incorporated into its thermodynamics and we compute it in the limit of a fast demon.The expression of the information flow allows us to infer the behavior of the partial efficiencies related to the measurement and feedback processes.Lastly, we discuss the information flow's pattern in the state space.

II. CHEMICAL REACTION NETWORKS
In this Section, we briefly introduce the concepts of chemical reaction networks [35,36,39] constituting the basis of our chemical Maxwell demon.A chemical reaction network (CRN) is defined as a set of species {α} and chemical reactions {ρ} among these species.We consider as a demonstrative example the network in Fig. 1 a) (black part) that will be later analyzed in Sec.III A:

O+I.
(1) There are four species connected by two chemical reactions; in the second, I represents an enzyme.Physically, we imagine those species to be dissolved in a much more abundant inert solvent forming an ideal-dilute solution of volume V .We assume that the time-scale in which the solute molecules diffuse is much shorter than that of chemical reactions.In this way, the solution can be considered homogenous at all times and the chemical concentrations represent the only out-of-equilibrium degrees of freedom.The states n of the system are the ones corresponding to a given number of molecules for each chemical species, (2) The transition among those states occur through chemical reactions happening stochastically inside the solution.
The resulting system's dynamics is a Markovian jumpprocess.As we will see, stochasticity is a crucial ingredient for the Maxwell demon to function.The stochastic reaction rates λ ρ obey the mass-action law: they are proportional to the product of the number of reactant molecules present in the solution, where k +1 , k −1 , k +2 , k −2 are the rate constants.The volume V shows up to ensure λ ρ ∝ V .For ideal-dilute solutions, where chemical concentrations are the only out-of-equilibrium degrees of freedom, the nonequilibrium chemical potential can be written as a function of the concentration in the form [36,40] The higher the concentration ⟨nα⟩ V , the higher the chemical potential of α. µ 0 α (T ) represents the standard chemical potential which depends on the solvent's nature and on the temperature T .For an isolated CRN, the Gibbs free energy decreases over time until the equilibrium value is reached [36].This means that chemical reactions spontaneously proceed in the direction that reduces the chemical potential difference between reactants and products.When equilibrium is reached, for every reaction, the sum of the chemical potentials of the reactants must be equal to the sum of the chemical potentials of the products, which means, from Eq. (1), If one combines this requirement with the fact that the equilibrium dynamics is detailed-balance and thus there are no net chemical currents, one can derive the local detailed-balance conditions [39] log This condition guarantees the model's thermodynamic consistency and it remains valid also for open CRNs.Now, we move on to discuss open CRNs that can exchange chemical species with the environment.The CRN analyzed in this paper falls into this category and the reason for considering this kind of CRNs is that it simplifies the treatment: it allows one to remove some species from the dynamics by externally fixing their concentrations.We can imagine the system to be connected with chemical reservoirs, known as chemostats.Each chemostat can promptly exchange only one species with the system.Its size is assumed to be much bigger than the size of the system so that any perturbation induced by the evolution of the latter is effectively negligible.By replenishing or taking away molecules, the net effect of each chemostat is to held the concentration (or equivalently the chemical potential) of the exchanged species constant in the system and equal to the chemostat's value.For example, in the CRN of Eq. (1), we can imagine to externally fix the concentration of the species U − , U + by connecting the solution to two chemostats with chemical potentials µ U− , µ U+ .In the case µ U+ > µ U− , the system reaches a nonequilibrium steady state with a nonzero positive current J U+→U− flowing between the two chemostats.In the steady state, the free energy of the system is constant over time.However, free energy is being extracted at a rate ḞU+ = −J U+→U− µ U+ in the U + chemostat and free energy is being released at a rate ḞU− = J U+→U− µ U− in the U − chemostat.The overall free energy consumed in stationary conditions is equal to the dissipation or entropy production rate [34,39] T σ = − Ḟ = −( ḞU+ + ḞU− ) = J U+→U− ∆µ (9) with ∆µ = µ U+ − µ U− .
In the following, all chemical potentials and free energies will be measured in units of k B T .

III. CHEMICAL INVERTER
As mentioned in the introduction, the Maxwell demon is composed of two equivalent modules linked together.These modules can be thought of as chemical inverters.A good starting point for understanding the Maxwell demon is to follow a modular approach [41]: we first introduce and characterize the properties of a chemical inverter alone.The CRN corresponding to the chemical inverter is shown in Fig. 1 a).
Its structure and working principle take inspiration from the CMOS electronic inverter [30] shown in the same figure.In the electronic case, the input potential v in controls the output potential v out .It does so through p-MOS and n-MOS transistors that act on the conductivity of the two channels connecting v out to the terminal potentials V + and V − , with V + > V − .The name "inverter" stems from the fact that when v in is high, v out is low and vice versa.Indeed, if v in is high, what happens is that the p-MOS transistor blocks the upper channel, while the n-MOS transistor makes the lower channel very conductive, resulting in v out ≃ V − .If v in is low, the opposite happens, resulting in v out ≃ V + .In the chemical case, the input species is I, the output species is O, there are two internal species E, EI and two terminal species U + , U − that can interconvert into O through the upper and lower chemical reactions.In this context, the reaction rates and chemical potentials play, respectively, the roles of the conductivity and electric potentials.The terminal species U + and U − are considered to be chemostatted (Sec.II) to chemical potentials µ U+ and µ U− , with µ U+ > µ U− .The input potential µ I controls the output potential µ O in an inverter-like manner by acting on the speed of the lower (O − ⇀ ↽ − U − ) and upper (U + − ⇀ ↽ − O) chemical reactions.In the first case, this influence is made possible via the enzymatic reaction The higher µ I and therefore the concentration ⟨n I ⟩/V (Eq.( 4)), the higher the rate at which this reaction takes place.This reproduces in chemistry the qualitative behavior of the n-MOS transistor: a higher v in results in a more conductive lower channel.In the second case, µ I affects the upper reaction through the subnetwork Whenever µ I is high, the enzyme E is converted into the inactive species IE, thus, slowing down the interconversion U + − ⇀ ↽ − O.This behavior represents the chemical analogue of the p-MOS transistor: a higher v in results in a less conductive upper channel.
Putting everything together, if µ I is high, the lower reaction is much faster than the upper one.This translates into O almost being in equilibrium with the lower species U − , which means µ O ≃ µ U− .If, on the other hand, µ I is low, the reverse happens and we have µ O ≃ µ U+ .We conclude that the CRN of Fig. 1 a) exhibits the qualitative inverter-like behavior.We stress that both the electrical and chemical inverters must dissipate free energy in order to function.As a matter of fact, they need a nonzero potential difference applied to their terminals to be able to respond to an input signal.This potential difference translates, at steady state, into a nonzero electrical/chemical current flowing from the higher to the lower electrical/chemical potential leading to a certain dissipation, which is given by Eq. ( 9) in the chemical case.
A final consideration is that the CRN of Fig. 1 a) still behaves as an inverter even without the "p-MOS subnetwork" (the red portion) [42].This reduced CRN is simpler since there are no internal species and less symmetric because the input potential µ I now only affects the speed of the lower reaction.Nevertheless, this simplified inverter is still sufficient for our goal of building a Maxwell demon and it greatly simplifies its analysis.Therefore, in the rest of the paper, we will consider this version.

A. Analysis of the simplified chemical inverter
The CRN corresponding to the simplified chemical inverter is the one already presented in Eq. (1): In this Section, we quantitatively characterize its behavior.In particular, we find its steady state input-output relation.To this aim, we imagine that the input species I and the terminal species U − , U + are chemostatted respectively to chemical potentials µ I , µ U− , µ U+ (Sec.II).
For convenience of notation, we filter out standard chemical potentials by setting µ 0 O = µ 0 I = 0.This is equivalent to measure µ I relative to µ 0 I and µ O , µ U− , µ U+ relative to µ 0 O .In this way, We assign the rate constants so that they are in compliance with the local detailed-balance conditions (8): By substituting expressions ( 14) and ( 13) into Eq.( 3) we get the stochastic rates: The input-output relation is then obtained by the steady state condition, which requires the two average chemical currents to be equal This leads to Keeping in mind that e µ I is the concentration, we can recognize inside the parenthesis the Hill function [43] with Hill coefficient equal to 1.In Fig. 1 b), we plot this input-output relation.The behavior is the one expected for an inverter: for high µ I , µ O ≃ µ U− , while for low µ I , µ O ≃ µ U+ .In the middle, there is a window of µ I over which the inverter transitions between these two limiting cases.At steady state, to function, the inverter dissipates free energy from its chemostats at a rate given by Eq. ( 9) The dissipation scales ∝ V , the system size.
Finally, we mention in advance two more properties that will be used in the analysis of the Maxwell demon.They come from the fact that the stochastic process depicted in Eq. ( 15) is a 1D linear jump-process [44].Firstly, the relaxation rate for the mean ⟨n O ⟩ is given by Secondly, the steady state distribution P ss (n O ) is Poissonian [44] implying for the fluctuations B. Chemical vs. electronic inverter Before moving to the Maxwell demon, we go a little deeper in the comparison between the two kinds of inverter.From a physical point of view, we already mentioned that the analogues of electric potentials and conductivity are, in chemistry, chemical potentials and reaction rates.Another physical distinction is that, contrary to the electronic case, in chemistry there is no spatial separation of components.With the assumption made in Sec.II, the chemical inverter is a homogeneous solution.For what concerns the behavior of the two inverters, there is a crucial difference.In the electronic case, the steepness of the input-output curve can be increased by raising the powering voltage ∆V = V + − V − (Eq.( 3) in [30]).This is not the case for the simplified and full chemical inverters where, after a certain point, an increase in ∆µ is not reflected by an increase in the steepness.As a matter of fact, the upper bounds on the nonequilibrium response found in [45] apply to both type of chemical inverters setting a limit on their maximum steepness, The derivation of those inequalities is explained in Appendix A. Their implications for the Maxwell demon will be explained in Sec.IV.

IV. CHEMICAL MAXWELL DEMON
In this Section we introduce and study the chemical Maxwell demon.We start with a preliminary overview where we discuss its structure, its qualitative thermodynamics, and working principle.A detailed quantitative analysis will follow.
Structure.As in the electronic case [30], the Maxwell demon is obtained by combining two (simplified) chemical inverters.In Fig. 2 a), the resulting MD CRN is contrasted with its electronic analogue.In Fig. 2 b), the CRN's structure is decomposed into its functions.One chemical inverter plays the role of the system and the other plays the role of the demon.While at the network level the demon and the system are distinct subnetworks, we notice again that they physically constitute the same homogeneous solution.This solution contains six different chemical species: S − , S, S + , which belong to the system, and D − , D, D + , which pertain to the demon.The four terminal species S − , S + , D − , D + are chemostatted: their concentrations are fixed so that the upper species (Fig. 2 b)) have higher chemical potentials, µ S+ > µ S− and µ D+ > µ D− .In this way, if we were to consider the system and the demon separately, we would expect the chemical reactions to proceed in the direction S + → S − and D + → D − .Since these four species are chemostatted, we are left with only two dynamical species, which are S and D. Therefore, the global state is specified by the numbers of molecules n = (n S , n D ): n S represents the state of the system, while n D the state of the demon.The global dynamics is a Markovian jump-process in this 2-D state space.The interaction between the system and the demon occurs through the two enzymatic reactions depicted in Fig. 2 b): S is an enzyme for the demon's inverter and D is an enzyme for the system's inverter.The peculiarity of enzymatic reactions is that they allow for a mutual influence between the two subnetworks without any exchange of energy.In fact, the only thing an enzyme does is to increase the rate of the catalyzed reaction by the same amount both in the forward and backward direction.Therefore, it does not push it in either direction leaving the reaction's equilibrium unchanged.The first enzymatic reaction, the one catalyzed by S, can be interpreted as a way for the demon to collect information about the current state of the system n S and update its state accordingly.The second enzymatic reaction, the one catalyzed by D, is the means by which the demon influences the system: based on its current state n D , which constitutes its internal representation (knowledge) of the system, the demon outputs a feedback on it.
Thermodynamics.As explained below, through the "measurement-feedback" mechanism just mentioned, the demon manages under certain conditions to create a reverse current J S−→S+ in the system, Fig. 2 b).From Eq. ( 9), this current translates into free energy being generated in the system's chemostats that can be equally seen as a local negative entropy production, ḞS = −T σS = J S−→S+ ∆µ S (22) with ∆µ S = µ S+ − µ S− .However, at the same time, the demon needs to consume free energy from its chemostats at a rate ḞD in order to do its job, with ∆µ D = µ D+ − µ D− .Since, from a global perspective, the following inequality holds true [37], the Maxwell demon as a whole is nothing but a free energy transducer that operates in compliance with the second law and the transduction efficiency is given by the ratio The distinctiveness of this free energy transduction is that it is solely mediated by information exchange: enzymatic reactions, as mentioned above, do not lead to any energy exchange between the system and the demon.This information flow and its precise link with the thermodynamics will be better discussed in Sec.IV E.
Working principle.How does the demon manage to generate a reverse current J S−→S+ in the system?The working principle is analogous to the electronic case: it rectifies thermal fluctuations of chemical reactions.To explain it, let's assume ∆µ S = 0 for simplicity.In this condition, the system alone would reach an equilibrium with J S−→S+ = 0.The demon can achieve J S−→S+ > 0 by using a particular strategy: at steady state, any particular fluctuation δn S in the system's number of molecules is expected on average to decay; based on the sign of δn S , the demon can decide how it will relax.If δn S > 0, the demon can "inhibit" the lower reaction by decreasing n D and making it easier for the excess of S molecules to pour into S + , Fig. 2 b).If instead δn S < 0, the demon can boost the lower reaction by increasing n D and thus promoting the replenishment of missing S molecules through the conversion S − → S. In both situations, an upward current J S−→S+ > 0 is favored.Therefore, we see that the essential ingredient to implement this strategy is to have anticorrelations between δn S and δn D .
But these anticorrelations are guaranteed by the fact that the demon behaves as an inverter, thus, "inverting" input fluctuations.In the above reasoning, we are assuming that the demon is quick enough to readjust to system's fluctuations before these ones actually decay.In Sec.IV C, we will analyze the fallout from potential demon's delays.
In conclusion, we see that the Maxwell demon's mechanism manifest itself in the correlations between the numbers of molecules.However, in the limit V → ∞, the covariance between these numbers goes to zero in relative terms.As a consequence, the Maxwell demon effect becomes weaker and weaker until it disappears.One way to prevent this is to increase the inverter's steepness.A greater steepness allows for an amplification of small fluctuations as will be clarified in Sec.IV A. By rescaling it properly, in principle, one could make the output of the MD survive in the large volume limit.This is exactly what was shown for the electronic demon [30].However, the same is not possible in the chemical case due to the bounds of Eq. ( 21).To investigate how the performances of the chemical Maxwell demon scale with the system's size, we perform its analysis at steady state focussing in the limit V → ∞.

A. Setup
In this paragraph, we assign the rates to the Maxwell demon; we describe how the macroscopic limit is performed; we mention the parameters that will allow us to rewrite the analytical results in a compact form; and, finally, we outline the strategy adopted to analytically solve the Maxwell demon.The rate assignment is analogous to expression (15) both for the system and demon inverters: In red and yellow, the influences of the enzymes S and D on the rates are highlighted.As in Eq. ( 13), we measureµ S+ , µ S , µ S− with respect to µ 0 S and µ D+ , µ D , µ D− with respect to µ 0 D to filter out the standard chemical potentials of the S and D species.This rate assignment is in compliance with the local detailed balance condition (8), thus ensuring the thermodynamic consistency of the Maxwell demon's model.We denote with x and y respectively the system and demon's concentrations, The macroscopic limit is taken in the following manner: The precise scaling of ∆µ S will be later derived, Eq. ( 41).
The reason why ∆µ S → 0 is that the Maxwell demon effect becomes weaker and weaker, thus allowing to overcome decreasing chemical gradients ∆µ S .In the limit V → ∞, the deterministic concentrations of the S and D species are, from Eq. ( 17): We denote (x * , y * ) as the working point.In the following, three quantities will turn out to be particularly useful for interpreting the analytical results: the two inverter relaxation rates k S relax , k D relax and the fluctuation-amplifying factor α. The inverter relaxation rates are approximately given by Eq. ( 19) evaluated in the macroscopic limit The fluctuation-amplifying factor α can be introduced through the function n D (n S ) that corresponds to the steady state input-output relation of the demon inverter rewritten in terms of number of molecules.In other words, n D (n S ) is the average number of D molecules assuming that the number of S molecules is kept fixed at the value n S .From Eq. ( 17), it is The fluctuation-amplifying factor is then defined as Put into words, α > 0 is the factor by which small fluctuations δx = δn S /V around the working point get amplified by the demon's inverter assuming it reacted instantaneously.In principle, we would like to increase α as much as possible: the bigger it is, the stronger the Maxwell demon effect.However, the inequality for the steepness of the input-output relation (21) sets an upper bound to its value: We now present the strategy adopted to solve the Maxwell demon.At steady state, one must have for each inverter equal upper and lower average currents, J S+→S = J S→S− and J D+→D = J D→D− (see Fig. 2 b)), and therefore: and From the left-hand side of the above expressions, we see that J S−→S+ , J D+→D− and thus the efficiency η, Eq. ( 25), can be obtained once we know ⟨n S ⟩ and ⟨n D ⟩.
In particular, since J D+→D− scales ∝ V , it can be calculated approximating ⟨n D ⟩ ≃ n * D .Using Eq.( 30) for n * D and substituting inside Eq.( 36) leads to Notice that J D+→D− and thus the free energy consumed by the demon is also ∝ α, the fluctuation-amplifying factor.To calculate J S−→S+ , we need to be more careful as it has a much smaller value: differently from J D−→D+ , it turns out to be intensive in the volume.
Therefore, the same approximation ⟨n S ⟩ ≃ n * S that would be right to obtain the zeroth order of the current fails to give a correct result for J (1) S−→S+ .To obtain this value, we would need to calculate ⟨n S ⟩ with higher accuracy, up to order O(1).The procedure we will follow involves two steps: first, we show that we can link J S−→S+ and thus all the quantities characterizing the Maxwell demon performances to the covariance cov(n S , n D ) ≡ ⟨n S n D ⟩ − ⟨n S ⟩⟨n D ⟩; secondly, we calculate the latter through a Gaussian approximation of the rate function.Note that a more straightforward approach in which one uses the Gaussian approximation to directly calculate ⟨n S ⟩ is wrong.In general, the Gaussian approximation is not accurate enough for first order moments, while it is for second order moments, like cov(n S , n D ).See Appendix B for a discussion.

B.
Maxwell demon's quantities as a function of cov(nS, nD) The covariance cov(n S , n D ) emerges as a pivotal variable.In this paragraph, we link J S−→S+ and all the other quantities describing the Maxwell demon performances to it.This allows us to address the scaling behavior of those quantities from the expected scaling cov(n S , n D ) ∝ V. (39) as the covariance is additive for independent systems.This scaling will be later confirmed in Eq. ( 48).Firstly, we establish the relationship between J S−→S+ and cov(n S , n D ).We do it through Eq. ( 35) working up to first order in ⟨x⟩ − x * and ⟨y⟩ − y * .Calculations are reported in Appendix C; the result is The last factor on the right-hand side is adimensional and only depends on the system's rates.Interestingly, the reverse current generated by the Maxwell demon is proportional to ∝ −cov(n S , n D ) > 0, which is partly due to the fact that the interaction between S and D occurs through two-body reactions (i.e. the enzymatic reactions).Because of Eq. ( 39), we see that J S−→S+ is intensive, it does not vary with the system's size.From expression (40), we also see that the effective reverse affinity created in the system is equal to 0 < ∆µ S < A eff represents the range of vincible chemical gradients.It goes to zero in the deterministic limit.
Having connected the current J S−→S+ to the covariance cov(n S , n D ), we can do the same for the output power ḞS , Eq. ( 22), and the efficiency η, Eq. ( 25).One obtains The efficiency and the output power are quadratic functions of ∆µ S and they are both maximized by This optimal value leads to max The optimal output power and efficiency turn out to be proportional to the square of the covariance and their scaling, from Eq. ( 39), is respectively ḞS ∝ 1/V and η ∝ 1/V 2 .This is due to the fact that the opposite chemical gradient ∆µ max S is ∝ V −1 plus, for the efficiency, the fact that the current in the demon's inverter J D+→D− is ∝ V .In Table I, we summarize these scalings characterizing the Maxwell demon; they are analogous to the ones found for the electronic version [30,31].

Quantity
Scaling Summary of the MD's behavior in the limit V → ∞.We report the scaling of: the system and demon's currents JS − →S + , JD + →D − ; the covariance cov(nS,nD); the input and output power ḞD, ḞS; the optimal adverse chemical gradient ∆µ max

S
; the global and partial efficiencies η, ηS, ηD; and the information flow İ.

C. cov(nS, nD)
As explained in Appendix B, cov(n S , n D ) can be determined with a sufficient accuracy from the Gaussian approximation of the rate function.This approximation can be derived, as was done in [30], from the master equation of the 2D jump-process.The schematic procedure consists in, firstly, substituting (47) in the master equation and, secondly, solving the resulting equation for C, the covariance matrix.The details are reported in Appendix D. The final result is In Fig. 2 c), we plot it as a function of the time-scale separation k D relax /k S relax between the demon and the system.When k D relax /k S relax → ∞, we are in the fast demon limit: the demon inverter responds instantaneously to changes in n S according to Eq. (32).Since fluctuations δx = δn S /V around the working point are small when V → ∞, the demon's response can be actually approximated with the linear part of Eq. ( 32): and the covariance between n S and n D arising from such a response is [46] cov which is in agreement with the value given by Eq. ( 48).On the other hand, when k D relax /k S relax → 0, the demon becomes very slow and its delay results in weaker correlations: D tries to update its state based on that of S, but since it is slow, S may change in the meantime.This is confirmed from Eq. ( 48) From Eq. ( 40) and ( 41), the weaker the correlations, the lower the reverse current J S−→S+ and the affinity A eff produced in the system.In other words, this delay makes the demon feedback on the system anachronistic and thus less effective.

D. Efficiency η
With the covariance calculated in the previous paragraph, we can obtain an explicit expression for the efficiency of Eq. ( 46).The result is max (52) A plot of η as a function of ∆µ D and the time-scale separation k D relax /k S relax between the demon and the system is shown in Fig. 2 d).When k D relax /k S relax → 0, η → 0 because of the negative impact of the demon's delay.Also, when k D relax /k S relax → ∞, η → 0: the demon answers promptly to any system's change but, in order to do so, it consumes an increasing amount of free energy ∝ J D+→D− ∝ k D relax .From Eq. ( 52), the efficiency is maximized when the time-scales of the two inverters are equal: k D relax = k S relax .When ∆µ D → ∞, η → 0: after a certain point, an increase in the demon powering voltage does not translate into an increase of α n * D (Eq. ( 34)) and leads only to more free energy being dissipated.From the plot, we see that the efficiency is maximized for a nonzero ∆µ D .Its maximum value can be upper-bounded exploiting the inequality (34) and the fact that the right-most adimensional parentheses of Eq. ( 52) is ≤ 1/4.
The maximum value is very low as it is inversely proportional to the product of the numbers of S and D molecules present in the solution.For example, in biological conditions, imagining S and D to be proteins inside a cell with n * S , n * D ≃ 10 2 − 10 3 , we would have η < 10 −6 − 10 −8 .

E. Maxwell demon thermodynamics with information flow
In Section IV, we presented the basic Maxwell demon thermodynamics and we highlighted the absence of any energy exchange between the two inverters.In this Section, we dive deeper analyzing the Maxwell demon with the formalism of bipartite systems [37,38].This framework allows one to further resolve its thermodynamics.In particular, two separate second laws can be obtained for the two inverters.They include a new term, the information flow, that quantifies the rate at which information is exchanged between the system and the demon.Thanks to these refined second laws, it is possible to decompose the global efficiency, Eq. ( 25), as the product of two efficiencies related respectively to the demon and the system, or equivalently, to the measurement and feedback processes.In this section, we first explain how the bipartite formalism applies to our chemical MD and then evaluate the information flow, which allows us to discuss the behavior of the two efficiencies above mentioned.We begin by stating in which sense the Maxwell demon is bipartite: it is composed of two degrees of freedom, which are the state of the system n S and the state of the demon n D ; in addition, the possible chemical reactions change either n S or n D but not both at the same time.This last property enables a decomposition of the time derivative of the mutual information into two pieces: one due to reactions changing the state of the system and the other due to reactions changing the state of demon: In these expressions, j(n ′ S ← n S |n D ) represents the net average current along the transition (n S , n D ) → (n ′ S , n D ) and j(n ′ D ← n D |n S ) is defined analogously.In stationary conditions, one must have We call İ the information flow from the demon to the system.As anticipated, for bipartite systems, it is possible to derive two refined second laws valid for each subpart that take into account this quantity [37].They read where σS/D is the steady state local dissipation rate of the system/demon inverter defined in Eq. ( 22)/ (23).These two inequalities embody the thermodynamic understanding of a Maxwell demon: the demon produces mutual information (correlations), İ > 0, by adjusting its state according to that of the system.However, to do this, it needs to dissipate a certain amount of free energy σD ≥ k b İ.This generated mutual information is subsequently burned by the system allowing for a negative local dissipation −k B İ ≤ σS < 0, which corresponds to free energy being extracted from the system.The sum of both inequalities of Eq. ( 58), σS + σD ≥ 0, ensures that the Maxwell demon as a whole operates in compliance with the second law.The refined second laws, Eq. ( 58), also allow us to decompose the overall transduction efficiency, Eq. ( 25), into two partial efficiencies: The partial efficiency η D measures how efficiently the demon converts the consumed free energy into new mutual information, while η S is the efficiency with which the system burns mutual information to release free energy in its chemostats.η D and η S can be, respectively, thought of as the efficiencies of the measurement and feedback step, and are less or equal to one, by virtue of the inequalities in Eq. (58).
a. İ in the chemical Maxwell demon We derive İ analytically for a fast demon and we find its qualitative behavior in the case of a slow demon.Finally, we display the information flow pattern in the state space.In the limit k D relax ≫ k S relax , it is simpler to derive İ.For the sake of its derivation, we can also assume ∆µ S = 0.As a matter of fact, İ can be considered with good approximation constant over the small range of vincible chemical potential gradients 0 ≤ ∆µ S ≤ A eff ∝ 1/V , Eq. (41).We compute İ from İS , Eq. (56).For this, the knowledge of the steady state conditional probability distribution P ss (n D |n S ) is required.In the fast demon limit, this distribution can be approximated with a Poissonian (see the end of Sec.III A) with average n D (n S ) given by Eq. (32).The detailed calculations are reported in Appendix E 1.The result is We notice that İ is an intensive quantity: it does not scale with the volume V .We can combine its expressions with that of J S−→S+ , Eq. ( 40), to obtain the partial efficiency η S in Eq. ( 60).This partial efficiency is maximum for the same ∆µ max S that maximized η, Eq. (44).From the above expression, we see that the partial efficiency with which the system converts mutual information into output free energy scales ∝ 1/V .Knowing from Eq. ( 46) that η ∝ 1/V 2 , we conclude that η D ∝ 1/V (see Table I for a summary).
To make the discussion more exhaustive, we can qualitatively analyze the opposite case of a very slow demon k D relax ≪ k S relax .In this limit, we know through Eq. ( 52) that η ∝ k D relax /k S relax → 0 and we can ask ourselves whether this inefficiency is due to η S or η D .To answer this question, it is necessary to know how the information flow scales.In Appendix E 2, we show that its scaling is Therefore, in the limit of a slow demon, keeping in mind that J S−→S+ ∝ k S relax and J D+→D− ∝ k D relax , the partial efficiencies scale as This means that the loss in efficiency is due to the measuring step: as the demon becomes slower, due to delays, it converts much less effectively consumed free energy J D+→D− ∆µ D into mutual information.We conclude the section by discussing the information flow pattern in the state space.As a matter of fact, from Eq. ( 56), we see that we can break down İ into a sum of contributions coming from each individual transition We can then visualize these contributions by plotting them in the state space: in point (n S , n D ) we show the value İ(n S ,n D )→(n S +1,n D ) .The plot, together with that of P ss (n S , n D ), is shown in Fig. 3.The probability distribution is a rotated ellipsoid, denoting correlations between n S and n D .İ(n S ,n D )→(n S +1,n D ) is everywhere negative, meaning that the system is consuming mutual information.The main contributions to İS arise from the two regions close to the center that are adjacent to the line of Eq. (49).We can elucidate the pattern in the following way.States starting from the line, where P ss (n S , n D ) is concentrated (Fig. 3 a)), diffuse horizontally to the left/right of the dotted line due to random transitions in the system's inverter.This horizontal dilution has the effect of destroying correlations between S and D and, consequently, of reducing mutual information.However, the demon counteracts this horizontal spreading by vertically absorbing back into the line those escaping states.In this way, the demon is generating in those two regions above/below the line new mutual information that compensates the one burned by the system in the same two regions.

V. CONCLUSIONS
In this article, we studied the chemical analog of an electronic Maxwell demon.We examined in detail its structure and working principle (Sec.IV).We highlighted the correlations between the numbers of molecules as the central quantity that captures the essence of the MD (Sect.IV B).We conducted a thorough characterization of the system's scaling in the macroscopic limit, summarized in Table I, and examined the Maxwell demon's efficiency in relation to the time-scale separation of the two inverters, the demon powering chemical potential, and the opposing chemical gradient (Sec.IV D).Finally, the bipartite formalism allowed us to enlighten the details of its thermodynamics through the information flow (Sec.IV E).The system presents some inconveniences: its efficiency is found to be extremely low (Eq.53) and it is not possible to make the MD's output survive in the macroscopic limit even by increasing the input power.Nevertheless, this system enriches our understanding of informationmediated transduction in CRNs and represents a first step towards unveiling deeper connections between electronics and chemistry.Regarding the latter point, we believe it worthwhile to push further the two approaches followed in this paper: the electronics-inspired design of CRNs and their analysis from a modular perspective [41] analogous to the one developed for electronic circuits.
The last inequality can be verified directly through calculations.Alternatively, one can recognize that the inverter falls in the range of application of [45] (Sec.VI).The second bound in ( 21) can be proved by applying the chain rule.Indeeed, the output chemical potential in the full inverter, Fig. 1 plus the relation coming from the conservation law The two together leads to Putting everything back into Eq.(A3), we conclude Appendix B: Accuracy of the Gaussian approximation In this Appendix, we show that the Gaussian approximation of the rate function is not sufficient to calculate first order moments up to order 1/V , like ⟨x⟩ = ⟨n S ⟩ V , while it is for second order moments, like cov(x, y) = cov(n S ,n D ) V 2 , up to the same accuracy.For simplicity, we limit the discussion to the 1D case.Analogous results can be found for the 2D case, which is our case.Consider a system described by an intensive variable x that in our case would be the concentration of the species and by a scale parameter V, the volume.Assume, as in our situation, that the exact steady state distribution has the following scaling behavior P ss (x) = e −V I(x,V ) (B1) with I(x, V ) = I 0 (x) + 1 V I 1 (x) + 1 V 2 I 2 (x) + . . . .

(B2)
The first term on the right-hand side, I 0 (x) = lim V →∞ − 1 V log P ss (x), is called the rate function and can be derived from the master equation of the process by inserting P ss (x) ≍ e −V I0(x) and ignoring terms of lower order in 1/V .The value x * , where the rate function has its minimum I 0 (x * ), represents the deterministic value and Put into words: the rates of the system are infinitely faster than those of the demon, thus, for any given n D , the system equilibrates with respect to n S to a distribution that, due to ∆µ S = 0, is actually independent of n D .In particular, f (n S ) is a Poissonian with average ⟨n s ⟩ = e µ S − = e µ S + .Therefore, in this limit, the steady state probability ditribution factorizes and we can write to next order in ϵ P ss (n S , n D ) = f (n S )g(n D ) + ϵ h(n S , n D ). (E7) The information flow can be evaluated from Eq. ( 56 as claimed in the text. [1] James Clerk Maxwell, Theory of Heat (Longmans, Green, and Co., London, UK, 1871) Chap.12.

FIG. 1 .
FIG. 1.Chemical inverter: a) Comparison between the structure of the chemical and the electronic inverter.The black part of the CRN, without the red subnetwork, constitutes the simplified version of the chemical inverter used to build the Maxwell demon.b) The input-output relation of the simplified chemical inverter in terms of chemical potentials, Eq. (17).The dotted lines correspond to the values µU + and µU − .The parameters are µU + = −µU − = 3 (kBT ),

FIG. 2 .
FIG. 2. Chemical Maxwell demon: a) Comparison of the chemical and electronic versions.(Image readapted from [30]).b) The CRN of the chemical Maxwell demon with its structure made explicit.c) The absolute value of the rescaled covariance as a function of the time-scale separation k D relax /k S relax between the demon and the system.The dotted line represents the limiting value obtained for a fast demon −αn * S /V , Eq. (50).The parameters are chosen so that µU + = −µU + = 3 (kBT ) and k D + V = k D − n * S .d) The efficiency as a function of the time-scale separation between the demon and the system k D relax /k S relax and the demon powering voltage ∆µD (µD + is kept fixed while µD − is progressively lowered).The parameters are n * S = 100, µD + = 4.6 (kBT ), V k D + /k D − = V k S + /k S − = 100.

FIG. 3 .
FIG. 3. Information flow's pattern in the state space (fast demon limit): a) stationary probability distribution; b) in point (nS, nD) it is shown the individual contribution to the information flow coming from the horizontal transition (nS, nD) → (nS + 1, nD).In both pictures, the dotted black line represents the approximated linear demon's response nD(nS), Eq. (49).The parameters are n * S = 148, n * D = 80, α = n * D /n * S , V k S + /k S − = 100.
D3) can be explicitly solved for C yieldingC 12 =cov(n S , n D ) in the limit of a fast demonWe obtain Eq. (61) starting from Eq. (56).We perform calculations setting ∆µ S = 0 as justified in the text.İ = − İS (E1) = − n D ,n S j ss (n S + 1 ← n S |n D ) log P ss (n D |n S + 1) P ss (n D |n S ) .In this regime, P ss (n D |n S ) is a Poissonian with mean n D (n S ) given by Eq. (32).In the large volume limit, n D (n S ) can be approximated by the linear relation Eq. (49).This leads to log P ss (n D |n S + 1)P ss (n D |n S ) = log e α 1 − α n D (n S ) n D ≃ α n D (n S ) − n D n D (n S ) − 1 2 α 2 n D n D (n S ) 2 ≃ −α (n D − n * D ) + α(n S − n * S )on the right-hand side is a constant and it gives zero contribution to Eq. (E1) sincen D ,n S j ss (n S + 1 ← n S |n D ) = 0. (E3)This equality comes from the fact that the barycenter of a steady state distribution does not move horizontally.The term −α(n D −n * D )+α(n S −n * S ) n * D enters in Eq. (E1) together with j ss (n S + 1 ← n S |n D ) ≃ (E4) k S relax [n * S P ss (n S , n D ) − n S P ss (n S + 1, n D )].To obtain the final result İ = α 2 n * average with respect to n D , firstly, and with respect to n S , secondly: ⟨n D ⟩ is given by the linear relation (49) and ⟨n S ⟩ can be approximated in this context with ⟨n S ⟩ ≃ n * S .2. Scaling of İ in the limit of a slow demon We call ϵ = k D relax /k S relax .With ∆µ S = 0, one has lim ϵ→0 P ss (n S |n D ) = f (n S ).(E6) ) asİ = İD = n S n ′ D >n D j(n ′ D ← n D |n S ) log P ss (n S |n ′ D ) P ss (n S |n D ).(E8) Around the working point, from where the major contributions to İ come from, the current along D scalesj ss (n ′ D ← n D |n S ) ∝ k D relax (E9)and from Eq. (E7),P ss (n S |n D ) = f (n S ) + ϵ h(n S , n D ) g(n D )(E10) so that log P ss (n S |n ′ D ) P ss (n S |n D )