Optimal Control of Hydrogen Atom-Like Systems as Thermodynamic Engines in Finite Time

Nano-size machines are moving from only being topics of basic research to becoming elements in the toolbox of engineers, and thus the issue of optimally controlling their work cycles becomes important. Here, we investigate hydrogen atom-like systems as working fluids in thermodynamic engines and their optimal control in minimizing entropy or excess heat production in finite-time processes. The electronic properties of the hydrogen atom-like system are controlled by a parameter κ reflecting changes in, e.g., the effective dielectric constant of the medium where the system is embedded. Several thermodynamic cycles consisting of combinations of iso-κ, isothermal, and adiabatic branches are studied, and a possible a-thermal cycle is discussed. Solving the optimal control problem, we show that the minimal thermodynamic length criterion of optimality for finite-time processes also applies to these cycles for general statistical mechanical systems that can be controlled by a parameter κ, and we derive an appropriate metric in probability distribution space. We show how the general formulas we have obtained for the thermodynamic length are simplified for the case of the hydrogen atom-like system, and compute the optimal distribution of process times for a two-state approximation of the hydrogen atom-like system.


Introduction
Optimal control of physical and chemical systems, and of the processes taking place in such systems, has been a major goal since the beginning of scientific investigations [1,2]. Essentially any application of scientific insights to practical problems has constituted such an effort in optimal control of some kind-even if not formulated as a mathematical control problem-, with the objective ranging from minimizing the difference of the values of characteristic parameters and quantities between the ideal theory and the real experiment [3,4], to maximizing the amount or quality of the desired output for given material and technical constraints. One can distinguish between those controls that are based on practical limitations due to the availability of tools and materials or lack thereof, and those based on the laws of physics.
Perhaps the classical examples of optimal control based on laws of physics have been the analyses of thermodynamic cycles [5][6][7], where the famous formulas for maximal efficiencies of hypothetical engines are sometimes given a status nearly equal to the fundamental laws of thermodynamics [6]. Such formulas have typically been derived under the assumption of infinite time available for each step of the cycles, allowing us to move from equilibrium state to equilibrium state. About fifty years ago, engineers and scientists began to question this assumption and re-formulated the optimal control problem by demanding that the cycle should be performed in a given finite amount of time, leading to the development of the field of finite-time thermodynamics [8][9][10][11].
A second aspect of optimal control based on the laws of physics is to reduce the engine under consideration to the most elementary physical systems that are stripped of all weaknesses and complications which are associated with the macroscopic aspects of the experimental apparatus employed in their realization, resulting in the creation and investigation of molecular machines [12]. Typically, this involves reducing the size of the system in the sense that we are dealing with a macroscopic system as a (non-interacting) ensemble of elementary but microscopic systems. Of course, in practice, isolating the individual elementary system often requires a very large experimental apparatus, but for the purpose of the analysis of the physics and the optimal control of the system, this counts as "environment" and "control tools", whose optimality in themselves are usually irrelevant to the issue of optimally controlling the (ensemble of) elementary system(s) as such. Many experiments have been performed where single atoms or ions in vacuum [13][14][15] or single defects in solids [16,17] have been studied and controlled in some fashion.
A third feature of achieving optimal control of systems on the level of physical laws is dealing with the quantum nature of these elementary systems, which is forced upon us when reducing the elementary systems to atomic dimensions. While the quantum aspects are unavoidable, one can nevertheless often separate them from the issue of optimal control one investigates, especially if the time resolution of the control is so large that many quantum aspects can be captured by, e.g., effective decay rates.
From the point of view of a theorist, such a reduction to elementary physical systems is often a desirable feature because it allows us to focus on the elementary system itself-which can, in many cases, be analyzed analytically to a certain point-while assigning all other aspects to a generic environment. Examples are the optimal control of harmonic oscillator systems, which have been studied both on the classical and on the quantum mechanical level [18][19][20][21][22][23][24][25][26], spin systems [26][27][28], particles in a box [26], and generic two-level systems [29].
In this study, we are going to analyze the basic concepts of optimal control at the example of a hydrogen atom-like system, which we employ as an engine, or more specifically, the working fluid of such an engine, to perform a thermodynamic cycle within finite time. On the technical mathematical level, the electronic Hamiltonian possesses a very high degree of symmetry allowing at least some analytical treatment. On the level of possible applications, there exist systems equivalent to hydrogen-like atoms, e.g., excitons inside a solid [30], that can be controlled by modifying the environment while the hydrogen atom-like system remains in its state. Controlling such a system might allow us to construct nano-size engines inside solids. Alternatively, we can consider isolated hydrogen atoms inside a cavity [31], where also the conditions can be controlled such that the hydrogen atom becomes a modified hydrogen atom.
We will analyze the stages of the thermodynamic control cycle on the general level of probability distributions, both for the ideal (infinite-time) cycle and the cycle at finite time, derive an optimality criterion for minimal waste of work/minimal excess production of heat (dissipation)/minimal production of entropy during finite-time processes for general statistical mechanical systems, and apply these formulas to the example of the hydrogen atom-like system. Note that we are dealing with an "electronic" states-based engine, not with a standard thermal atom movement-based engine as studied, e.g., in [13].

Aspects of the Hydrogen Atom-Like System
Due to the high symmetry of the Coulomb potential, the electronic Schrödinger equation for the hydrogen atom can be solved analytically, and we get for the energy eigenvalues where α = me 4 2 2 . The degeneracy of the n'th energy level is g(n) = n 2 . In principle, we need to add a factor 2 for the spin degeneracy of the electron, but this factor is not relevant for this study and will be dropped.
If we consider hydrogen atom-like systems, the formula for the energy is modified by, e.g., changing the mass of the electron or quasi-particle m → m * , i.e., α → α * = m * m α, by changing the effective charge that generates the Coulomb field e → q 1 * and/or the effective charge of the quasi-particle e → q 2 * , i.e., α → α * = m(q 2 * ) 2 (q 1 * ) 2 2 2 or by introducing a shielding dielectric constant ε 1, such that E n = − α n 2 , or combinations thereof. Quite generally, we note that these modifications can be incorporated in a straightforward fashion by introducing a modification factor such that E n (κ) = −κ α n 2 = κE n (κ = 1).
If we can apply external forces or fields to the system such that κ (i.e., m * , q 1,2 * and/or ε) can be smoothly varied, then we can modify the energy levels in a controlled fashion. In that case, the hydrogen atom-like system is used as the working fluid of an engine, where the changing of the energy levels leads to a change in energy that may be extracted as work. A change of the statistical occupation of the various energy levels at given temperature T is associated with the entropy content and the heat exchanges of the system, and we can define work cycles in, e.g., (κ, T)-space. Examples for individual legs (or branches) of such a cycle would be adiabatic or isothermal changes in κ from some initial value κ in to a final value κ f , and iso-κ changes in temperature where we keep κ constant (see Figures 1-3

below).
If we allow interaction with a heat bath, we need to consider an ensemble of identical isolated localized hydrogen atom-like systems such that we can apply statistical mechanics to evaluate the (equilibrium) probabilities of occupation of the individual energy levels. From a statistical point of view, the microstates correspond to the eigenstates of the hydrogen-like atom. For concreteness, we always define (without loss of generality) and > to denote the smallest and largest value of on the cycle, and = as the lowest temperature in the cycle. Starting point of the cycle is always , = ( , ). Together with the assignment of path types to the legs (adiabatic, isothermal, iso-), there is only one additional temperature, which we can choose, e.g., = or = ; all other temperatures and values of the cycle are then fixed. We always assume smooth changes in both and along the legs of the cycle, i.e., for example, the system is exposed to an infinite number of heat baths with intermediary temperatures when changing .
Note that we use the terms adiabatic and isentropic essentially interchangeably for thermodynamic equilibrium paths, since we assume that the system is in thermodynamic equilibrium both at the starting and at the end point of a leg. In the general case of such an adiabatic path, only the entropy remains constant along the path. However, for some physical systems, such as the hydrogen atom-like ones we are going to discuss, not only the entropy but also the equilibrium Boltzmann distribution remains unchanged along an adiabatic path, and we call such paths "special adiabatic".
For such a macroscopic system, Figures 1 and 2 show cycles combining two iso-legs with two isothermal or adiabatic legs, respectively. We excite the ensemble of atoms via change in temperature → = > , while we keep at the value : = = . Next, we perform/extract work while we increase from = to = > . This can be done adiabatically, thus involving a concomitant change in temperature during the process ( → = > ), or isothermally keeping the temperature constant at → = = . In leg 3, we de-excite the atom ensemble via change in temperature → = < , while we keep at the value = = , and finally, we decrease from = back to = ; again, this can be done either adiabatically ( → = < ) or isothermally at → = = . Note that for cycles containing two iso-branches, the only condition on is > . In the literature, one sometimes calls the iso--adiabatic cycle an Otto cycle, in analogy to the isochore-adiabatic cycle, which is the underlying cycle of an Otto engine [7], and similarly, we could call the iso--isothermal cycle a Stirling cycle in analogy to the isochore-isothermal cycle belonging to the Stirling engine [7].   [1] , T [1] = (κ in , T 1 ), [2] = κ [2] , T [2] = (κ in , T 2 ), [3] , T [3] = κ f , T 2 and [4] = κ [4] , T [4] = κ f , T 1 in the (κ, T) plane. Note that for given κ in , κ f > κ in and T [1] = T 1 , there remains only one variable, e.g., T [2] = T 2 , we are free to choose; all other variables are fixed by the choice of path types. All cycles for which T 2 > T 1 are feasible iso-κ-isothermal cycles.  An alternative type of cycle shown in Figure 3 would include no legs with constant ; instead, we combine two adiabatic and two isothermal legs to the analogue of a Carnot cycle [7]. We adiabatically increase from = to = , < < , appropriately changing the temperature during the process ( → = > ), followed by an isothermal leg where we increase from = to = = while keeping the temperature constant at → = = . Next, we adiabatically decrease from = to = , < < , while appropriately changing the temperature ( → = < ), and finally, we decrease from = back to = while keeping the temperature constant → = = .
Entropy 2020, 22, x FOR PEER REVIEW 6 of 33 When analyzing the work performed and the heat exchanged along the legs of the cycles, we do not include the work done on the environment of the hydrogen atom-like system (e.g., the solid or the cavity), which is needed to vary . Of course, we can take that into account, e.g., via replacing by the pressure as control variable if = ( ) depends on pressure in a monotonic fashion, and then compute the work needed to establish such a pressure inside the solid. However, the focus is on the hydrogen-atom like system, and not on the whole solid or cavity where the system might be realized in the experiment. Thus, we will stay with using as the control variable, and only consider the change in the hydrogen atom-like system itself.
There are several general aspects that need to be considered regarding the equilibrium distributions, relaxation, and entropy/excess heat production along the cycles. How close are the instantaneous probability distributions over the states of the system to the (equilibrium) Boltzmann distributions at the various temperatures along its iso-legs? Similarly, for branches where is changed, how does the finite time available to vary affect our ability to keep the probability distribution close to the appropriate Boltzmann distribution for isothermal processes, and how close   [1] are isothermal legs, respectively. Note that the adiabatic legs run along straight lines through the origin. The four corners of the cycle are the points [1] = κ [1] , T [1] = (κ in , T 1 ), [2] = κ [2] , T [2] = (κ 2 , T 2 ), [3] , T [3] = κ f , T 2 , and [4] = κ [4] , T [4] = (κ 4 , T 1 ) in the (κ, T) plane. Note that for given κ in , κ f > κ in and T [1] = T 1 , there remains only one variable, e.g., T [2] = T 2 , we are free to choose; all other variables are fixed by the choice of path types. However, only cycles for which T max are feasible adiabatic-isothermal cycles for the hydrogen atom-like system.
In this context, one should note that, e.g., the dielectric constant ε = ε(p, T) depends on both temperature and pressure, complicating the issue considerably; for small ranges of temperature and pressure, ε(p, T) commonly changes with temperature and pressure in an approximately linear fashion in a solid [32,33], i.e., ε(p, T) ≈ ε p re f , T re f + γ T p re f , T re f T − T re f + γ p p re f , T re f p − p re f .
Depending on the type of system, we may have γ T p re f , T re f > 0 and γ p p re f , T re f < 0, respectively [32], or the opposite [33], or other combinations. Thus, e.g., we find that κ ∼ 1 ε 2 increases with pressure and decreases with temperature for CdF 2 [32], and we could translate our analysis from using (κ, T) to (p, T) as control variables, in principle. Of course, all energy levels of the hydrogen atom-like system will exhibit nonzero occupancy in thermodynamic equilibrium in general-in principle, even including the continuous distribution of energy levels associated with modified plane-wave states beyond the ionization energy (although these will most likely be irrelevant due to the assumed localization or confinement of the electron). However, for practical calculations, one can often simplify the system by considering, e.g., only the two lowest energy levels E 1 and E 2 . Frequently, such simplified models can yield some quantitative results and help to better understand the qualitative behavior of the full system [34]. Finally, we note that there are other ways to modify the electronic states of the hydrogen atom-like system, e.g., by breaking the spherical symmetry of the Hamiltonian, such that Equations (1)-(3) no longer apply. Since the corresponding changes in the eigenvalue spectrum of such a modified Hamiltonian are very specific to the way we break the symmetry and need to be treated on a case-by-case basis, we are not going to discuss such systems and only allow modifications of the hydrogen atom-like system that preserve the spherical symmetry and the 1/r dependence of the Coulomb potential.

Thermodynamic Cycles for the Hydrogen Atom-Like System
In general, we can distinguish two ways to change the occupation of the energy levels: directly via radiation with suitable frequencies corresponding to energy differences between specific energy levels, and stochastically by contact to heat baths at various temperatures. However, in the case of a radiation driven a-thermal cycle, we are not dealing with a system close to thermodynamic equilibrium, and the classical thermodynamic optimal control might not be suitable. Thus, in this study, we focus on the more familiar cycles involving interactions with heat reservoirs.
Regarding the notation, we write X ( j) or X j→j+1 to indicate that the variable, parameter, or quantity X belongs to leg ( j) which runs from corner [ j] to corner [ j + 1] of the four-leg cycle (corner [5] = corner [1], of course). Furthermore, quantities associated with corner [ j] are referred to as X [ j] . This notation is introduced to keep the labeling of legs and corners distinct from the one for quantities such as the probability distribution → p i at step i along each branch when analyzing the effect of finite-time processes. Finally, the subscripts {κ; T}, {κ; S}, and {S; T} indicate that the quantity is associated with an iso-κ-isothermal, iso-κ-adiabatic, or adiabatic-isothermal cycle, respectively.
If we allow interaction with a heat bath, we need to consider an ensemble of identical isolated localized hydrogen atom-like systems such that we can apply statistical mechanics to evaluate the (equilibrium) probabilities of occupation of the individual energy levels. From a statistical point of view, the microstates correspond to the eigenstates of the hydrogen-like atom. For concreteness, we always define (without loss of generality) κ in and κ f > κ in to denote the smallest and largest value of κ on the cycle, and T [1] = T 1 as the lowest temperature in the cycle. Starting point of the cycle is always κ [1] , T [1] = (κ in , T 1 ). Together with the assignment of path types to the legs (adiabatic, isothermal, iso-κ), there is only one additional temperature, which we can choose, e.g., T [2] = T 2 or T [4] = T 4 ; all other temperatures and κ values of the cycle are then fixed. We always assume smooth changes in both κ and T along the legs of the cycle, i.e., for example, the system is exposed to an infinite number of heat baths with intermediary temperatures when changing T.
Note that we use the terms adiabatic and isentropic essentially interchangeably for thermodynamic equilibrium paths, since we assume that the system is in thermodynamic equilibrium both at the starting and at the end point of a leg. In the general case of such an adiabatic path, only the entropy remains constant along the path. However, for some physical systems, such as the hydrogen atom-like ones we are going to discuss, not only the entropy but also the equilibrium Boltzmann distribution remains unchanged along an adiabatic path, and we call such paths "special adiabatic".
An alternative type of cycle shown in Figure 3 would include no legs with constant κ; instead, we combine two adiabatic and two isothermal legs to the analogue of a Carnot cycle [7]. We adiabatically increase κ from κ [1] = κ in to κ [2] = κ 2 , κ in < κ 2 < κ f , appropriately changing the temperature during the process (T [1] → T [2] = T 2 > T 1 ), followed by an isothermal leg where we increase κ from κ [2] = κ 2 to κ [3] = κ 3 = κ f while keeping the temperature constant at T [2] → T [3] = T 3 = T 2 . Next, we adiabatically decrease κ from κ [3] = κ 3 to κ [4] = κ 4 , κ in < κ 4 < κ f , while appropriately changing the temperature (T [3] → T [4] = T 4 < T 3 ), and finally, we decrease κ from κ [4] = κ 4 back to κ [1] = κ in while keeping the temperature constant T [4] → T [1] Note that a feasible isothermal-adiabatic cycle usually will have an additional condition on T [2] . For the special adiabatic legs of a hydrogen atom-like system, feasibility requires that the temperature at the second corner fulfills the condition where otherwise, leg 3 would have a larger slope than leg 1, violating the condition that κ in < κ 2 , κ 4 < κ f . When analyzing the work performed and the heat exchanged along the legs of the cycles, we do not include the work done on the environment of the hydrogen atom-like system (e.g., the solid or the cavity), which is needed to vary κ. Of course, we can take that into account, e.g., via replacing κ by the pressure p as control variable if κ = κ(p) depends on pressure in a monotonic fashion, and then compute the work needed to establish such a pressure inside the solid. However, the focus is on the hydrogen-atom like system, and not on the whole solid or cavity where the system might be realized in the experiment. Thus, we will stay with using κ as the control variable, and only consider the change in the hydrogen atom-like system itself.
There are several general aspects that need to be considered regarding the equilibrium distributions, relaxation, and entropy/excess heat production along the cycles. How close are the instantaneous probability distributions over the states of the system to the (equilibrium) Boltzmann distributions at the various temperatures along its iso-κ legs? Similarly, for branches where κ is changed, how does the finite time available to vary κ affect our ability to keep the probability distribution close to the appropriate Boltzmann distribution for isothermal processes, and how close can the adiabatic path in (κ, T)-space which is realized in experiment, be to the ideal adiabatic path? All these questions directly lead to the issue of relaxation to the appropriate Boltzmann distributions in finite time, for which we can hope to derive general formulas as long as we can assume that the processes are slow enough for the system to always remain close to thermodynamic equilibrium throughout the cycle.

Statistical Mechanics and Thermodynamics of Cycles
Regarding the statistical mechanics and thermodynamics of cycles, the starting point of our analysis will be the first law of thermodynamics, along a piece of path in thermodynamic space, which is equivalent to δW = δQ − dE. Here, dE > 0 means that the internal energy of the system is increased along the leg, and δQ > 0 means that heat is added to the atom from the reservoir(s) the atom is in contact with along the path, thus increasing the system's internal energy. δW > 0 means that the system does work on the apparatus, radiation field or the environment in general, along the leg, and reduces the system's internal energy in the process.
To avoid confusion, we note that in the literature δW(> 0) is frequently defined in an alternative fashion to refer to the amount of work done by the apparatus on the system increasing its internal energy; as a consequence, one then would write the first law as dE = δQ + δW and δW = dE − δQ.
The connection to statistical mechanics appears via the information theoretic definition of the entropy where p j is the probability for the microstate j to be occupied, and the sum is over all N S microstates [5].
In equilibrium at given temperature T, these probabilities π j correspond to the equilibrium Boltzmann probability distribution, for the case of the canonical ensemble, where the sum over states Z(T) = k B T serves as the normalization of the probability distribution, and E j is the energy of microstate j. Keep in mind that the equilibrium distribution maximizes the entropy, for a given set of boundary conditions that are, e.g., defining the ensemble.
If we consider the energy levels E n (= E n ) of the states instead of the microstates themselves in the formula of the entropy, then we need to include the degeneracies g n of the energies E n . As far as the equilibrium probabilities are concerned, we can assume that the probabilities of occupying two states i and j with the same energy E i = E j = E n are equal; for convenience, we define ρ n = π i = π j , and thus π n = g n ρ n , is the equilibrium probability to find the system with energy E n . In general, we can write the equilibrium entropy as where now the summation goes over the N E energy levels and π n are the equilibrium probabilities to find the system in a state with energy E n . Note that for non-degenerate states, i.e., g n = 1, this expression reverts to the original microstate-based formula, and for the special case π n = 1 for n = m while π n = 0 for n m, we obtain the formula for the entropy in the microcanonical ensemble, S = k B ln(g m ).
Finally, for those probability distributions where we deviate from the equilibrium distribution but nevertheless can assume that the probabilities of being in a state with energy E i = E j = E n are the same, we can define r n = p i = p j , and thus p n = g n r n . Then, we get for the entropy the expression S = −k B N E n = 1 g n r n ln(r n ) = −k B N E n = 1 p n ln p n g n and the normalization N E n = 1 g n r n = N E n = 1 p n = N S j = 1 p j = 1. Note that this is a substantial restriction in the set of allowed probability distributions; thus, unless this assumption is valid, we need to employ the microstate formulation of the problem. As a shorthand notation, we can represent the probability distributions by vectors → p = p 1 , . . . , p N S , and expressions like N S j = 1 p j ln p j can be written as where ln → p = ln(p 1 ), . . . , ln p N S . Similarly, . , E N S , and we can relate the equilibrium probabilities of the Boltzmann distribution to the energies via where g → π is a constant that can be related to an overall shift of the energy scale, and → 1 = (1, . . . , 1) [35]. The expectation value of the energy is then given by or, for the case of the expectation value in equilibrium, Note that some of these energies will appear many times in this vector if the energy level is degenerate. Another example is the expectation value of the square of the energy, If appropriate, we can replace the sums over the N S microstates by sums over the N E energies, i.e., In the case of the single atom-like system, the microstates correspond to the eigenfunctions of the Hamiltonian of an electron (or a quasi-particle) in a (shielded) Coulomb potential. Note that we are not considering the degeneracy due to the multiple copies of the atom-like system in the ensemble-the ensemble is only introduced to allow us to visualize the occupation probabilities of the single atom-like system with which we are dealing. Since the energy is a state function, the change of its equilibrium expectation value along a leg ( j) of the path does not depend on the choice of path, i.e., the total change in energy can be computed directly from taking the difference between the two states, For the heat delivered/absorbed by the atom along a leg if we stay at the equilibrium distribution along the path, and an analogous expression in → p if we deviate from the equilibrium distribution because of, e.g., finite-time effects: Finally, the work performed by the atom can be computed via the first law by taking the difference between δQ and dE along the path. Along the legs where κ is constant, both Q and ∆E will vary as they are both functions of the probability distribution, which in turn evolves as the temperature changes. To compute ∆E is no problem, but the expression for Q is nontrivial. We can switch coordinates to follow the change in temperature instead of the change in entropy, However, we note that this way of writing Q ( j) does not necessarily make the integral easier to perform in general either, even though κ, and thus all the energy levels E n (κ), are constant along these legs of the cycle. However, since the work δW would usually be associated with changes in κ, we expect that W = 0 along thermodynamic equilibrium paths with fixed κ, and therefore, Q = ∆E. Using Equations (16) and (12), we find: since → 1 ·d → π = 0 along a thermodynamic equilibrium path because of probability conservation. Note that we have not exploited the fact that we are dealing with a hydrogen atom-like system, and thus this result is general for any statistical mechanical system along legs with κ = constant, even for the most general case of many control parameters κ= → κ = (κ a , κ b , . . .). If we consider the complete cycle, the changes in energy will sum to zero, and thus W = Q over the whole cycle, i.e., the net heat added to the atom over the cycle must be converted into net work done by the atom on the apparatus. The discussion in this subsection is standard procedure from equilibrium thermodynamics [5,6], but has been included to establish the concepts and notation needed for analyzing the thermodynamics of the cycles of statistical mechanical systems in finite time in the next sections.

Finite-Time Optimal Control along a General Path in (κ, T) Space
If thermodynamic processes are performed in finite time, one usually encounters deviations in the heat exchanged and work performed along the path from those values that one finds for the ideal quasi-static processes for which infinite times are available, because the system cannot maintain thermodynamic equilibrium over the whole cycle when the total time τ is finite. As a consequence, a net amount of entropy is produced over the whole cycle or excess heat/work is found while the system tries to move towards or stay close to the elusive thermal equilibrium along the path. Typically, one would attempt to minimize this entropy or excess heat production, leading to the formulation of the minimum excess heat/work production optimal control problems discussed in finite-time thermodynamics. In this study, we will focus on minimum entropy production and minimum excess heat production; other possible optimal control objectives such as maximum power or maximum efficiency are not considered. In the following, the subscript Q will indicate minimization of excess heat, while the subscript S indicates minimization of entropy production.
In general, one would need to analyze each process in depth, in order to compute the excess heat or excess work associated with the given physical situation. However, we can perform an approximate analysis of the difference I Q = Q→ π − Q→ p between the heat Q→ π we would obtain under the assumption that along the path the system is everywhere in thermodynamic equilibrium, i.e., , and the corresponding expression Q→ p along the path for the real probability distribution where i.e., we can approximate For the remainder of this study, we will assume that Equation (20) is a suitable approximation; the issue of incomplete relaxation to equilibrium of [35,36]. Using Equations (16) and (17) where λ now corresponds to time, we get Here, N st is the number of possible steps in (κ, T) space during the finite time τ assuming that each temperature-plus-κ change requires a "relaxation-to-equilibrium" time of (∆t) st , i.e., τ = N st (∆t) st . In the above derivation, several approximations were applied. First, we have employed the fact that → p (t) essentially follows → π(t), and thus is very small, and thus we can make a Taylor expansion of ln Next, we assumed that we can make a large number of changes in (κ, T) along the path, such that we can replace the integral by a sum over such discrete changes, resulting in and finally we assumed that Equation (20) holds, i.e., Analogously, we can derive an expression for the entropy production over the path as Looking at the expressions for the excess heat and the entropy production that are to be minimized, we see that , repectively, are positive definite diagonal matrices that can serve as metrics in the space of probability distributions with components which allows us to define distances in thermodynamic space, and thus yield the corresponding thermodynamic lengths of the path. Note that both the temperature T i and → π i (which is a function of (κ i , T i )) depend on i, and thus the metrics ↔ M Q/S vary along the path. I Q/S is now minimized by picking the stopping points along the path such that the thermodynamic lengths respectively, of all N st pieces of the path are equal. This follows from the Cauchy-Schwarz inequality implying that equality holds only if the lengths of all individual pieces ∆L Q/S i are equal, Note that this criterion of equal thermodynamic lengths of sub-pieces is equivalent to the constant thermodynamic speed criterion [37] employed, e.g., in the context of optimization of global optimization algorithms [38], where thermodynamic speed corresponds to thermodynamic distance per relaxation, i.e., time is measured in units of relaxation-to-equilibrium times.
is a diagonal matrix, we can rewrite each term in the sum as where d is the infinitesimal difference between the equilibrium probability distributions at steps i − 1 and i. For the total length of the path along, e.g., leg ( j) with N ( j) steps, we thus get the expression where λ is the variable of integration along the branch ( j). Note that we have taken the absolute value of the integral, since L ( j) Q ≥ 0 by definition, independent of whether λ increases or decreases along the path. Analogously, we obtain for L Of course, we must first choose the path in (κ, T)-space between the starting and end point of the leg in such a way that its total length is minimal. For general statistical mechanical systems, where the Hamiltonian is controlled not only by one single parameter κ but by a whole set of such parameters → κ = (κ a , κ b , . . .), this task is usually very complex. However, for the individual legs of the cycles for the hydrogen atom-like system, this is trivial, as we have only one parameter which can be varied (either just κ with fixed T for the isothermal leg, or both κ and T but in a synchronized fashion along the adiabatic leg, or finally only T with fixed κ along the iso-κ leg), and thus the path itself is given, and we can only vary the location of the steps i along the path. One additional aspect needs to be addressed: the optimization encompasses the whole cycle, and thus the available time τ needs to be distributed over the four legs, i.e., we have τ = τ (1) + τ (2) + τ (3) + τ (4) . In principle, this poses no difficulty as long as the relaxation times per step are the same for all legs, ∆t ( j) = (∆t) T = (∆t) κ = (∆t) a , regardless of whether we are dealing with an isothermal, iso-κ, or adiabatic leg: knowing the thermodynamic lengths for the four legs L (1) , L (2) , L (3) , and L (4) , we use L cycle = L (1) + L (2) + L (3) + L (4) and the principle of constant thermodynamic speed [37] to assign the times as Once τ (i) is known, then the number of available steps along the leg is given by However, if the relaxation times vary between the legs-or more generally, vary along the legs as function of κ and T, i.e., (∆t) st = (∆t) st (κ, T)-, we need to be more circumspect. Assuming that (∆t) st (κ, T) is known, in a first step, we would evaluate the average relaxation time along the path, (∆t) av , which allows us to compute an estimate of the number of discrete steps along the path N st = τ/(∆t) av . With this information, we can use Equation (25) to compute the optimal length of By construction, the value of (∆L) opt is independent of the position (κ i , T i ) of sub-piece i along the path. Since the relaxation time varies with position i, we now need to assign each sub-piece i its own time τ(κ i , As long as the relaxation times do not vary much along the path, the sum of the assigned times N st i = 1 τ i = τ cycle will nearly equal the total available time τ cycle ≈ τ, and the result is self-consistent. Otherwise, we need to set up a feedback loop and re-compute N st , via, e.g., N , and then assign τ i , until self-consistency has been reached, i.e., For further discussions concerning the influence of varying relaxation times in step optimal control processes, we refer to the literature [35,36].
Note that this derivation did not depend on the specific features of the hydrogen atom-like system. Thus, the minimal thermodynamic length criterion of optimality we have derived is valid for general statistical mechanical systems, whose Hamiltonian is controlled by a set of parameters In this context, we note that the metric ↔ M Q at each point i along the path is proportional to T i , and thus we expect that the branches ( j) (or parts thereof) that lie in a high temperature region, should exhibit larger thermodynamic lengths L ( j) Q than those at lower temperatures since the formulas for those lengths contain √ T i as factors in each term or integral. We now turn to the three special cases of iso-κ, isothermal, and isentropic (adiabatic and special adiabatic) paths.

Finite-Time Optimal Control along Isothermal Legs
For the legs with isothermal change in the parameter κ, Equation (21) yields for the excess heat and similarly, Equation (22) for the entropy production takes at least a time of (∆t) κ , i.e., τ = N κ (∆t) κ . Again, I Q/S is minimized by picking the stopping points along the path such that the thermodynamic lengths respectively, of all N κ pieces of the path are equal, We realize that the change in κ can be interpreted as the change in the Hamiltonian of the system. Thus, the isothermal branch of the cycle for a system with only one control parameter κ represents a special case of the general estimates of the difference between computational work and the free energy (at constant temperature)-which is computed via various thermodynamic integration methods [39][40][41] between two different Hamiltonians in finite time-, for which the optimal control problem has been analyzed in earlier work [35]. In this earlier study, it had been found that as long as we can stay close to the equilibrium distribution such that we can assume that the actual probability distribution → p i at step i equals the equilibrium probability distribution → π i−1 at the previous step i − 1, the amount of excess work along an isothermal leg is given by However, this is just the same expression as I Q;iso−T , which we have obtained for the excess heat along an isothermal leg in (κ, T)-space, as one would have already expected from energy conservation. Since the temperature is constant along the path, we can pull T as a factor in front of the summation when computing the excess heat, and thus the thermodynamic length L Q of an isothermal leg ( j) is proportional to √ T ( j) . Nevertheless, since the matrix 1 ↔ π i varies along the path, the computation of the thermodynamic length is not trivial in general. Equations (28) and (29) can be specialized to an isothermal path by replacing λ by κ, and explicitly computing and Plugging this into Equations (28) and (29), we obtain Var→ π ∂E ∂κ dκ and L ( j) respectively. Note that the term under the square root is the variance of ∂E ∂κ with respect to the equilibrium probability distribution → π(κ, T), Var→ π ∂E ∂κ , as function of T and κ.

Finite-Time Optimal Control along Iso-κ Legs
Next, we turn to the case of changing temperature while keeping κ constant. Along those branches, only the temperature varies, but we cannot directly profit from the fact that κ is constant when computing the excess heat. Equations (21) and (22) where N T is the number of changes in the value of the temperature T along the branch, which are feasible during the finite time τ, assuming that each temperature change takes at least a time of (∆t) T , i.e., τ = N T (∆t) T .
Again, we see that finding the optimal solution of distributing N T temperature changes over the path corresponds to minimizing I Q/S , where the thermodynamic length of each piece i of the path is respectively. To do so, we first minimize the thermodynamic length of the complete path, ∆L Q/S total = N T i = 1 ∆L Q/S i , and then pick the size of each step such that they all have the same thermodynamic length Equations (28) and (29) can be specialized to an iso-κ path by replacing λ by T, switching variables to β = 1 k B T and explicitly computing and where Var→ π (E) is the variance in energy E(κ) with respect to the probability distribution → π. Plugging this into Equation (28), we obtain respectively, where C(κ, T) = 1 k B T 2 Var→ π (E) is the specific heat at T and κ. Note that these expressions are reminiscent of optimal control results for the minimal entropy/excess heat production for paths where we change the temperature of a thermodynamic system in finite time [36,42]. Furthermore, for iso-κ legs along which the specific heat is approximately constant, we find L ( j)

General Adiabatic Paths
Clearly, minimizing the excess heat along a general isentropic adiabatic path is just another special case of the finite-time optimal control along general paths in (κ, T)-space. Thus, we find where N a is the number of changes in the values of (κ, T(κ)), or equivalently (κ(T), T) along the branch, which are feasible during the finite time τ assuming that each change in (κ, T) requires at least a time of (∆t) a , i.e., τ = N a (∆t) a . We keep in mind that any change in κ automatically determines a corresponding change in T such that the thermodynamic equilibrium entropy after the move has not changed, or conversely, changing the temperature enforces an appropriate change in κ.
Again, I Q/S is minimized by picking the stopping points along the path such that the thermodynamic lengths respectively, of all N a pieces of the path are equal: However, for a general adiabatic path, no system independent simplification of Equations (28) and (29) is possible, since both κ and T change along such a path and their relationship T(κ) varies from system to system.

Special Adiabatic Paths
As mentioned above, there are physical systems where not only the equilibrium entropy but also the equilibrium probability distribution of the occupancy of the microstates does not change along an adiabatic isentropic path. For such special adiabatic paths, adiabaticity is equivalent to a constant equilibrium probability distribution along the path, i.e., i.e., along such a leg there is no excess heat being produced due to finite time effects. We can see this also directly from the general expression for the thermodynamic length of the general adiabatic path: since → π i = → π i−1 along a special adiabatic path, and analogously (∆L S ) total = 0. Here, N a is the number of steps along the special adiabatic path. As a consequence, the work performed by the system on the apparatus equals the negative of the energy difference between the two end points of leg ( j), , regardless of whether we were restricted to finite time or not, and thus no excess work or heat is present, at least to first order under the assumptions we have made. Even when including higher orders, the fact that → π i is constant along the whole path together with → p i = 0 = → π i = 0 ensures that all higher order terms vanish because no relaxation of → p i to → π i is ever needed, thus also eliminating the issue of incomplete relaxation to equilibrium discussed in refs. [35,36]. The way finite-time considerations can enter the estimates along a special adiabatic branch must therefore involve deviations of the control itself from the true adiabatic path. Note that we did not consider such deviations from the target curve of the control parameters for the isothermal or the iso-κ branches. Since, in general, any motion of the system along these two types of branches already involves substantial changes in the equilibrium probability distribution, → π i → π i−1 , one usually assumes that the additional effects related to being "off-target" can be ignored in the analysis, although the issue of keeping the control parameters "on target" might be quite relevant in practical applications! However, since → π i ≡ → π i−1 along the ideal special adiabatic path, deviations in the control parameters now become the primary source of entropy or excess heat production; other possible sources such as equilibrium fluctuations in the probability distribution → p i about → π i will not be considered here. As we have no knowledge about the way the control would be established in practice (i.e., in the experiment), we make the reasonable assumption that trying to stay as close as possible to the ideal adiabatic values of the control requires us again to maximize the number of change steps. This is analogous to how we proceeded earlier, where we assumed that the optimal solution of minimizing excess heat or entropy production for the general adiabatic, the isothermal, and the iso-κ branches would be found using the maximal number of steps feasible between the two endpoints of the leg: if the optimal solution requires fewer than the maximally possible number of steps, then we can just "throw away" the superfluous steps by assigning zero time to them and/or placing them at one of the endpoints of the branch.
The maximal-number-of-steps assumption implies that we cannot perform an optimal control on the sub-step level, i.e., the deviation associated with the movement from one point i − 1 with values (κ i−1 , T i−1 ) along the ideal adiabatic curve to the next point i with values (κ i , T i ) can only involve one "virtual stopping point" away from the curve "halfway" between the two curve points. In general, there exist an infinite number of choices for such "halfway points", but from the basic modeling point of view, only two of them make sense, i.e., are consistent with our deviation analysis: (κ i , T i−1 ) "below" the adiabatic curve or (κ i−1 , T i ) "above" the adiabatic curve for paths moving from low to high temperatures; conversely, if we move from high to low temperatures, the (κ i , T i−1 ) points are "above" and the (κ i−1 , T i ) "below" the adiabatic curve (see Figure 4 below). If we could be closer to the curve than these points, then we would appear to have the ability to access temperatures and κ values in-between those of the two consecutive points along the adiabatic curve, suggesting that we have not yet maxed out the number of steps. Of course, this is only a plausibility argument and not a proof that such closer points would not be possible, but for this analysis we will employ the two virtual points given above since no further information about the actual functioning of the experimental apparatus is available. In fact, we can interpret our choice of virtual points as providing a heuristic upper bound on the entropy/excess heat production along the special adiabatic path; we essentially assume that we are able to be perfectly on target in either κ or T, and the excess production is due to the adjustment in the lagging parameter T or κ, respectively. In the following discussion, we only employ the metric

Application to the Hydrogen Atom-Like System
Regarding the hydrogen atom-like system, we first note that and enter the formulas for the equilibrium probability distribution everywhere in the combination In particular, this means that the ratio remains constant along the adiabatic legs of the cycle, ensuring that ⃗ does not change along this branch. Thus, the adiabatic branches for cycles involving the hydrogen atom-like system belong into the special category where not only the entropy but the whole equilibrium probability distribution is constant along the path. Note that in the cycle diagram (Figures 2 and 3), an adiabatic branch ( ) for the hydrogen atom-like system is always a straight line (that can be continued through the origin) with slope ( ) . Of course, the actual value of the ratio will be different for each adiabatic leg. For an adiabatic leg ( ), it follows that = . For the combination of iso-and adiabatic legs, we have = = and = = ; therefore, we get Analogously, for the combination of adiabatic and isothermal legs, we have the two adiabatic branches (legs 1 and 3) with → ≠ → , for which = and = , and the isothermal legs yield the conditions = and = . Thus, we have the relations Regarding the expressions for the thermodynamic lengths of the various legs in this section, we remark that the main effect of dealing with the hydrogen atom-like system is the special adiabaticity of the isentropic paths, such that the contribution of the adiabatic paths to the excess heat or entropy production can be set equal to zero unless we include the "off-target" contributions discussed in Section 3.4.2. In addition, we can exploit Equation (3) to rewrite the specific heat as . Sketch of an optimal setting of step points along a (special) adiabatic leg moving from corner [3] to corner [4], where the excess heat associated with being "off-target" with respect to the ideal adiabatic path is minimized. Note that the density of step points (κ i , T i ) along the leg increases with temperature, approximately in a square-root fashion. Red lines are the isothermal and blue lines the iso-κ sub-pieces, respectively, which connect two points (κ i−1 , T i−1 ) and (κ i , T i ) along the perfect adiabatic path via the virtual intermediary off-target points (κ i−1 , T i ).
We note that reaching the point i via either of the virtual points requires an isothermal step and an iso-κ step. Since no sub-optimization along these steps is possible, we can directly write down the excess heat associated with each half-step and sum them. For the virtual point (κ i , T i−1 ), we have for the thermodynamic length to go from i − 1 to i: where → π i−1 = → π (κ i−1 , T i−1 ) and → π i = → π (κ i , T i ) are the two consecutive points on the adiabatic curve, and we have used the fact that Similarly, for the virtual point (κ i−1 , T i ), we have Since it is not clear which of the two virtual points would be more suitable, one might suggest that a decent approximation for ∆L Q i would be the average of the two thermodynamic lengths for the two points: However, from the point of view of optimal control, this average is not very helpful; in particular, the thermodynamic metric becomes a very complicated expression.
Instead it is more effective to systematically pick one of the two virtual points, e.g., (κ i , T i−1 ), because this allows us to write the excess heat production due to deviations in the control from the special adiabatic path as where each ∆L Q i is the thermodynamic distance between the points i − 1 and i computed with the , with the virtual intermediary point fixed as (κ i , T i−1 ).
We note that the probability distribution → π(κ i , T i−1 ) at the virtual point, which enters the expression for ∆L Q i , is completely determined from our information about the temperatures and κ-values of the two consecutive points along the ideal special adiabatic path which are "connected" via the virtual point. Thus, there is no internal degree of freedom left for the piece of path between the points i − 1 and i, which could be adjusted as part of the optimal control analysis. As a consequence, the choice of the locations of the consecutive points along the special adiabatic path completely determines ∆L Q i , although in a slightly more involved fashion than for the isothermal and the iso-κ legs. This allows us to conclude that choosing the step points (κ i , T i ) such that the lengths of all the ∆L Q i have the same value, again yields the optimal solution for minimizing the excess heat.
While the general formula for the metric and thus the thermodynamic length of the path is more complicated than for the isothermal or iso-κ legs, we note that the metric is still essentially proportional to k B T i at step i. Furthermore, due to the leg being special adiabatic, the term does only weakly vary as function of the probability distribution → π i since the distribution is constant on the path, and should only differ slightly from → π i along the virtual points. Thus, we can conclude that the thermodynamic length of the virtual-point pieces between two points along the special adiabatic path mostly depends on the temperature, with As a consequence, the optimal distribution of points will be related to the square root of the temperature in the sense that the distance of step points along the leg (as function of temperature) will monotonically decrease as 1/ √ T i , leading to a higher density of step points at higher temperatures (c.f. Figure 4).

Application to the Hydrogen Atom-Like System
Regarding the hydrogen atom-like system, we first note that κ and T enter the formulas for the equilibrium probability distribution everywhere in the combination such that In particular, this means that the ratio κ T remains constant along the adiabatic legs of the cycle, ensuring that → π does not change along this branch. Thus, the adiabatic branches for cycles involving the hydrogen atom-like system belong into the special category where not only the entropy but the whole equilibrium probability distribution is constant along the path. Note that in the cycle diagram ( Figures 2 and 3), an adiabatic branch ( j) for the hydrogen atom-like system is always a straight line (that can be continued through the origin) with slope 1 A ( j) . Of course, the actual value of the ratio A will be different for each adiabatic leg. For an adiabatic leg ( j), it follows that κ For the combination of iso-κ and adiabatic legs, we have κ [1] = κ [2] = κ in and κ [3] = κ [4] = κ f ; therefore, we get κ in κ f = T [1] T [4] = T [2] T [3] .
Analogously, for the combination of adiabatic and isothermal legs, we have the two adiabatic branches (legs 1 and 3) with A 1→2 A 3→4 , for which κ [1] T [2] = κ [2] T [1] and κ [4] T [3] = κ [3] T [4] , and the isothermal legs yield the conditions T [3] = T [2] and T [1] = T [4] . Thus, we have the relations T [2] = κ [1] κ [2] = κ [4] κ [3] = κ in Regarding the expressions for the thermodynamic lengths of the various legs in this section, we remark that the main effect of dealing with the hydrogen atom-like system is the special adiabaticity of the isentropic paths, such that the contribution of the adiabatic paths to the excess heat or entropy production can be set equal to zero unless we include the "off-target" contributions discussed in Section 3.4.2. In addition, we can exploit Equation (3) to rewrite the specific heat as where both the variance Var→ π (E(1)) = → π· → (E(1)) 2 − → E(1)· → π 2 = 1 κ 2 Var→ π (E) and the specific heat C(κ, T) are functions of A = κ T . Furthermore, we can rewrite Equation (35) as where π k is a function of κ T , and thus Equation (36) becomes Note that the variance of ∂E ∂κ in Equation (36) is now transformed into a variance of the energy E(1) of the unmodified hydrogen atom.
For each cycle discussed below, we first write down a formula for the total work done by the atom and the heat absorbed by the atom in the quasi-static approximation, where → p i = → π i everywhere along the cycle, and subsequently, we provide formulas for the efficiency, and the optimality criterion for the minimal excess heat production.

Iso-κ-Adiabatic Cycle
In the case of the iso-κ-adiabatic cycle where the legs 2 and 4 are adiabatic and do not contribute to the heat production, we can focus on legs 1 and 3 when computing the heat exchange with the  (18) and (19), we obtain therefore for the total heat exchange over the full cycle: S [1] TdS + S [4] S [3] TdS = T [2] S [2] − T [1] S [1] + k B T [2] T [1] → π(T, κ in )·ln → π(T, κ in ) dT+ T [4] S [4] − T [3] S [3] Since T [2] > T [1] , T [4] < T [3] , and furthermore, the equilibrium entropy at higher temperatures is always larger than the one at lower temperatures, the term belonging to leg 1 transfers heat into the system, while along leg 3, the system gives off heat.
Of course, this equals the total work around the cycle, which needs to balance the total heat by energy conservation. If we want to compute the expressions for the work along each of the four legs-e.g., in order to talk about the efficiency of the hydrogen atom-like system as working fluid in an engine, we need to add the contribution for the energy change. We then find: ). This shows that we reduce the internal energy of the hydrogen atom-like system by a certain amount along leg 2 and raise it along leg 4 but by a much larger amount. Taking the sum, we obtain since κ f > κ in and [2] . Thus, during this cycle, the apparatus performs net work on the system over the legs 2 and 4.
For the efficiency, a possible definition is to take the ratio between the net work along the legs where κ is varied, and total heat added to/extracted from the system. With this definition, we find Of course, one can define many other efficiencies, depending on the quantities and processes of interest. Regarding the excess heat, we note that due to Equation (52), the adiabatic legs are special. We do not include the effect of being "off-target" during the adiabatic legs, and thus we only consider the two terms from the iso-κ legs 1 and 3: Using Equations (42) and (56), we get for the whole cycle dT + κ f T [4] T [3] Var→ π (E(1)) Switching variables to A = κ T for the integration, keeping in mind that Var→ π (E(1)) is a function of A = κ T , and using A [2] = A [3] and A [4] = A [1] since legs (4) and (2) are adiabatic, we find since κ f > κ in . In the case of the adiabatic legs considered here, we do have the problem that, to first order, the thermodynamic length vanishes as long as we are perfectly on target with the thermodynamic controls. Thus, the formula for τ ( j) yields zero time for the adiabatic legs of the path, which essentially means we could jump directly from the end of the first leg (= beginning of the second leg) to the beginning of the third leg (= end of the second leg), and analogously for the fourth branch. In practice, this does not make too much sense, and we would want to employ the off-target formula derived above, even though this requires additional information from experiment, or make assumptions about the location of the virtual intermediary points discussed above. Alternatively, we can make heuristic assumptions about the (hopefully short, i.e., τ a τ) minimal time τ a = τ Q needed to move along the adiabatic leg without noticeable deviations from the ideal adiabatic curve in (κ, T) space and subtract these times from the total available time τ, τ iso−κ = τ − 2τ a , before assigning τ , the optimal time allocation for the two legs must be and thus we obtain τ We remark that when we minimize the entropy production and thus use the metric ↔ M S , we find L S and, after subtracting τ a = τ Due to the sum over microstates for the heat capacity with nontrivial energy eigenvalues under the square root and the nontrivial temperature dependence of → π(T, κ), no further analytical simplifications appear to be possible. Thus, the allocation along the individual legs is an open question, but should depend on the variance Var→ π (E(1)) as function of κ T .
Again, we compute the efficiency as Regarding the excess heat production, all four legs contribute in this case. Thus, we have Note that N T and N K of the individual legs will be determined from the ratios τ ( j) (∆t) T,κ , where we again will assume that the relaxation times are constant. Employing Equations (37), (42) and (56)-(58), the total thermodynamic length of the cycle is then Keeping in mind that Var→ π (E(1)) depends only on A, we switch variables in all integrals from T and κ to A = κ T , to obtain A [2] Var→ π (E(1)) A [3] Var→ π (E(1)) A [4] Var→ π (E(1)) Note that since all legs contribute already to first order to the total thermodynamic length, the times spent in each leg in the optimal case are proportional to the thermodynamic lengths of each leg, Since the values of A at the corners are all different, no simple general estimate of assigning times to the various legs appears possible. However, for the special case of (approximately) constant variance Var→ π (E(1)), we find L (1) . From this follows and thus the optimal times for the four legs we obtain τ (1) Analogous results are obtained using the metric ↔ M S for the case of minimum entropy production. In particular, if we again assume an approximately constant variance Var→ π (E(1)), we obtain L . From this follows for the total thermodynamic length of the path L S;cycle = 2 , yielding the optimal time assignments to the legs as τ

Isothermal-Adiabatic Cycle
In the case of the isothermal-adiabatic cycle where the legs 1 and 3 are adiabatic and do not contribute to the heat exchange, we have from legs 2 and 4: Here, we have used the fact that the temperature does not change along legs 2 and 4, T [2] = T [3] and T [1] = T [4] , and that the entropy does not change along the adiabatic legs, i.e., S [1] = S [2] and S [3] = S [4] .
Since T [2] > T [1] , and furthermore, for equal temperatures, the equilibrium entropy decreases with κ, i.e., S [3] < S [2] = S [1] , we have a rejection of heat over the cycle, i.e., the hydrogen atom-like system converts work performed on it into heat transferred to the environment. Furthermore, the term belonging to leg 2 absorbs heat in the system, while along leg 3, we are removing heat from the system.
For the "efficiency", we again compute the ratio between the net work along the isothermal legs and the total heat exchanged η isothermal Alternatively, we could use the two adiabatic legs to extract/perform work, i.e., in that case, we get for the efficiency η adiabatic Clearly, η isothermal {ad;T} + η adiabatic {ad;T} = 1, since W cycle = Q cycle . Regarding minimizing the excess heat, we do not include the effect of being "off-target" during the adiabatic legs, and thus we only have the two terms from the isothermal legs 2 and 4: We can use Equations (37) and (58) to write an expression for the thermodynamic length of the cycle: Var→ π (E(1)) Var→ π (E(1)) We note that for the hydrogen atom-like system, the integrand in the thermodynamic length integrals of the isothermal legs is the square root of the heat capacity, just as in the case of the iso-κ legs. We again switch to integration over A = κ T , and find for the thermodynamic lengths A [3] A [2] Var→ π (E(1)) A [1] A [4] Var→ π (E(1)) T [1] , A [2] = A [1] , and A [4] = A [3] along the special adiabatic legs, and Var→ π (E(1)) depends only on A.
As far as distributing the available time over the four legs, we again have to face the problem of the adiabatic legs being of zero thermodynamic length as long as we can keep the controls on target along these legs. We assume a short (i.e., τ a τ) time τ a = τ Q needed to move along the adiabatic leg without noticeable deviations from the ideal adiabatic curve in (κ, T) space and subtract these times from the total available time τ, τ iso−T = τ − 2τ a , before assigning τ (2) Q and τ (4) Q according the principle of constant thermodynamic speed. Assuming constant relaxation times, we determine the optimal times using the ratio of the thermodynamic lengths, to be τ and τ . Analogously, when minimizing the entropy production instead of the excess heat, we obtain L S , and thus with τ a = τ S , the optimal time assignment to the two legs is τ Again, due to the sum over microstates with nontrivial energy eigenvalues under the square root, further analytical calculations require additional simplifications; in particular, the optimal placement of the steps along each of the isothermal paths remains open but is expected to vary according to the specific heat.

Preliminaries
In many cases of statistical mechanical systems, one can find analytical solutions for a problem, if we can restrict ourselves to a two-state model; perhaps the most straightforward example for our purposes is the spin 1/2 system [27,28]. This is also the case here, since we can employ the probability π 1 of one of the two states as the integration variable, π = π 1 . Probability conservation then determines the occupation probability of the second state as π 2 = 1 − π 1 = 1 − π, thus eliminating the complicated sum over the microstates. This was demonstrated in [35], where the thermodynamic length was computed for a paramagnet in a magnetic field for an isothermal path along which the energy of the paramagnet was changed by varying the magnetic field in finite time. In this fashion, one could compute the thermodynamic length and subsequently assign the steps by the equal thermodynamic length criterion, thus solving the optimal control problem.
However, the situation is more complex in the case of the cycle of the hydrogen atom-like system, because along the iso-κ legs the temperature varies, adding a nontrivial function T(π) to the integrand for the case of minimizing the excess heat. On the other hand, the approximation of any statistical mechanical system by a two-state system actually leads to many generic properties associated with the thermodynamic cycles of the two-state system, i.e., many of the results obtained below do not depend on the specific property in Equation (3), E n (κ) = κ E n (1), of the hydrogen atom-like system.

Thermodynamic Cycles
With the formulas derived above, we can compute some of the expressions given in the previous section for the work and heat transfer along the legs of the cycles explicitly, such as, e.g., where the last equality only holds for the hydrogen atom-like system. Here, π in = π [ j] and π f = π [ j+1] are the values of π at the beginning and at the end of the leg ( j). If we are considering an iso-κ branch, then we have κ(π) = κ ( j) = constant, and thus B(π) = B ( j) = constant, from which follows Q ( j) = −k B B ( j) π f − π in . Furthermore, if in addition the temperature increases along the leg, then π(T) will decrease, E κ ( j) , T will increase, and thus Q ( j) > 0. We note that along such a branch, we also have (∆E and thus for any two-state system, we have Q ( j) = (∆E) ( j) and W ( j) = 0 along the iso-κ branches. This is a special case of the earlier general result, Equation (19). For the adiabatic path ( j), we recall that these paths are special for any two-state system, i.e., π = constant, and thus the heat term yields Q ( j) = − π f π in k B B(π)dπ = 0 since π f = π in . Finally, for an isothermal leg, we have where the last equality holds for the hydrogen atom-like system. In the following, we are not going to re-compute for the two-state hydrogen atom-like system all the general work and heat-related expressions derived in Section 4. We only note that for the cycles with iso-κ legs, we find again that η {κ;T} = 1 and η {κ;S} = 1, which are the same results as we had obtained for the complete hydrogen atom-like system, Equations (62) and (70). Thus, for the two-state system, the net work performed by the "atom" along the isothermal or adiabatic legs equals the net heat added to the system over the whole cycle because Q ( j) = (∆E) ( j) along the iso-κ legs.
Taking this into account, we find for the infinitesimal element of thermodynamic length: where the (+)-sign is employed if π increases along the path (dπ > 0) and the (−)-sign is employed if π decreases along the path (dπ < 0). We note that Equations (93) and (94) apply to any two-state system and are not restricted to hydrogen atom-like systems. As mentioned above, the adiabatic pieces of the cycle are special for a two-state system, and thus there is no excess heat production to first order since π is constant along these legs, and thus |dπ| = 0; alternatively, we can note that the initial and final values of π, π in , and π f , respectively, for an adiabatic path are the same, π f = π in , and thus However, we should introduce a phenomenological time τ a required for the external controls to follow the ideal path along an adiabatic leg. For the isothermal pieces of the cycle, we can compute the corresponding thermodynamic lengths L Q analytically, since Assuming constant relaxation times (∆t) T along the path, the optimal assignment of time follows automatically; along the optimal path with optimal times τ (2) and τ (4) , and thus N (2) = τ (2) (∆t) T and N (4) = τ (4) (∆t) T given, we find along leg 2, and π (4) i along leg 4. Note that we have employed the (+)-sign in the integral for leg 2 since π (2) f > π (2) in , and similarly the (−)-sign for leg 4 since π (4) in > π (4) f . However, for the iso-κ leg, we need to compute the integral which is not straightforward even for constant B. Here, the (+)-sign refers to legs with increasing π (i.e., leg 3) and the (−)-sign to legs with decreasing π (i.e., leg 1), and we have used Equation (88) to replace T(π). Thus, any cycle containing an iso-κ leg does not allow us to compute the actual distribution of steps along the leg once the optimal time assignment to the legs has been performed. Note that the √ κ dependence of the thermodynamic length of an iso-κ branch is specific to the hydrogen atom-like system and is not a property of a general two-state system.
Nevertheless, we note that for an iso-κ-adiabatic cycle, π [2] = π [3] and π [1] = π [4] because of the special adiabaticity of legs (2) and (4), where we assume as usual that we need the time τ a to proceed along an adiabatic leg without generating excess heat such that the available time is τ iso−κ = τ − 2τ a . Then we determine the optimal assignment of times as τ (1) , according to the ratio of the optimal times, ; we had found the same result for the general hydrogen atom-like system in Equation (66). In contrast to this result, for the iso-κ-isothermal cycle, the relative sizes of the four legs are unknown, and thus we cannot assign optimal times to the four legs of this cycle, even though we have an analytical expression for the thermodynamic lengths of the two isothermal legs. Among the three cycles we have considered, only the isothermal-adiabatic one can be completely solved analytically when minimizing excess heat, yielding L (1) and L (4) Q = k B T [1] arcsin 1 − 2π [1] − arcsin 1 − 2π [4] .
The ratio of the two assigned times is the same as that which we had found in Equation (84), i.e., we need to spend more time in the high-temperature leg than in the low-temperature leg when minimizing the excess heat of the system. The assignment of the step points along each leg now follows directly from Equations (96) and (97). We note that we did not need to employ the special properties of the hydrogen atom-like system to derive the finite-time thermodynamics results in Equations (95)-(97) and (99)-(104). Thus, the optimal ratio of assigned times T [2] /T [1] is the optimality criterion for the adiabatic-isothermal cycle of any two-state system. This agrees with the analysis of a spin 1/2 two-state system in finite time where the power along the cycle was maximized [28], and is reminiscent of similar general results obtained in the analysis of Carnot cycles in finite time [10].

Summary and Discussion
In the previous sections, we have presented three thermodynamic cycles for a hydrogen atom-like system in (κ, T) space, where κ allows us to control the electronic energy levels of the system: iso-κ-isothermal, iso-κ-adiabatic, and adiabatic-isothermal. We have written down expressions for heat and work along the legs of these cycles and derived conditions that yield optimal ways to run through the cycles in finite time such that the entropy production or the excess heat production is minimal.
In particular, we found that the optimal allocation of time-in units of relaxation-to-equilibrium times-including the allocation of discrete steps along the cycle, should take place in such a way that a) the path in (κ, T) space, for given corners ( [1], [2], [3], [4]) and prescribed types of branches, should be chosen such that the total thermodynamic length of the cycle is a minimum, b) the time allocated to each leg of the cycle should be proportional to the thermodynamic length of each leg separately, and c) the discrete steps along each leg should be spaced in such a way that the thermodynamic lengths between all pairs of consecutive points along the branch are identical. We showed that the thermodynamic length could be evaluated using an appropriate metric, in probability distribution space, which was obtained as part of the optimal control analysis.
We note that condition a) is trivial for the cycles chosen in the present study, since each leg is completely determined by the assignment of its end points and the type of path, i.e., whether it is iso-κ, isothermal, or adiabatic. If there were several control parameters κ a,b,... that influence the change in the energy levels of the system, then step a) would be a major part of the optimal control problem of minimizing entropy or excess heat production, of course.
Furthermore, we discussed the minimization of excess heat along special adiabatic branches, which by construction equals zero due to the condition that the equilibrium probability distribution is constant along such a special adiabatic path, and thus never an imbalance between actual and equilibrium distribution can build up; for example, by construction, all two-state statistical mechanical systems constitute examples where adiabatic paths are special. Thus, only our inability in practice to keep the control parameters on-target while moving along a special adiabatic path generates deviations from the equilibrium occupation of the microstates of the system, which are the main source of excess heat or entropy production. We derived approximate expressions for the thermodynamic length of generic off-target paths that still remain close to the ideal adiabatic path.
We note that the issue of on-target path control arises for every leg of any cycle, but that one usually ignores these contributions to the entropy or excess heat production. The reason for discounting them is twofold; for one, they tend to be overwhelmed by the effects of having only finite time available to run through the legs of the cycle. Perhaps more important is the fact that an analysis would require information about the apparatus employed to move the system in the (κ, T) space, which is specific to each experiment, and thus usually not within the purview of the theoretical study.
Related finite-time analyses have been performed for thermodynamic engines in the past by assuming, e.g., a generic heat leakage or (inefficient) heat conduction during the processes of the cycle, which are described by phenomenological laws [43][44][45]. However, this leakage was not connected to the issue of being "on-target" vs. "off-target"; instead, the thermodynamic controls were assumed to be perfect, and the inefficiencies associated with, e.g., friction or heat conduction were considered part of the working of the engine.
These optimality criteria and the associated thermodynamic metrics are very general and apply to essentially all statistical mechanical systems, as long as the energy levels can be controlled by a generic parameter κ or set of parameters → κ = (κ a , κ b , . . .). Thus, there are connections to other general results [35,[46][47][48][49][50]. For example, the excess heat we consider corresponds to the excess work investigated by Sivak and Crooks [47], and thus Equations (28) and (29) for the thermodynamic lengths L Q/S correspond to the generalized thermodynamic length they define via the time-integrated force covariance matrix [47]. Furthermore, the relationship ↔ M Q = T ↔ M S for statistical mechanical systems observed in this study corresponds to the conformal equivalence of the energy and entropy metric demonstrated by Salamon and co-workers for thermodynamic equilibrium systems [50]. This also shows that the excess heat metric ↔ M Q measures the dissipation or loss of availability when proceeding along the path in finite time, as had been shown earlier in the context of optimally measuring free energy differences in statistical mechanical systems [35] and computing thermodynamic lengths within computer simulations [46].
Specific to the hydrogen atom-like system is the observation that E n (κ) = κE n (κ = 1) for all energy levels n. From this follow certain simplifications, such as the fact that κ and T appear only in the combination A = κ T in the equilibrium probability distribution → π, and therefore all adiabatic paths in (κ, T) space are special and lie on straight lines that contain the origin (κ = 0, T = 0). In particular, we observed that for the isothermal-adiabatic cycle the time allocation to the two isothermal branches should be proportional to the square roots of the temperatures associated with these branches when minimizing the excess heat production. Similarly, for the iso-κ-adiabatic cycle, the time allocation for the two iso-κ branches should be proportional to the square roots of the κ values associated with these branches. In contrast, when minimizing the entropy production of the cycles that contain two adiabatic branches, the optimal times assigned to the two isothermal or iso-κ-legs should be equal. Here, we note that the results obtained in Section 4 would be applicable to any system whose energy spectrum scales with the control parameter κ according to Equation (3), such as, e.g., a quantum harmonic oscillator if one modifies only the basic frequency, ω 0 → κω 0 , or a spin system with N L energy levels in a magnetic field as long as we only change the strength of the applied magnetic field, B 0 → κB 0 . For an analysis of the influence of the eigenvalue spectrum of a system on the finite-time performance, we refer to [51].
For the case of the hydrogen atom-like system, we have also considered a two-state approximation, which allows us to perform further analytical evaluations of the optimal control conditions. When minimizing excess heat, we can analytically solve the isothermal-adiabatic cycle, while for minimal entropy production, all three cycles can now be solved analytically. These results are quite general and hold for any two-state system, as can be seen from the agreement with results obtained from, e.g., a spin-1/2 system [28]. Furthermore, the result for the Carnot cycle is reminiscent to the outcome of some finite time optimal control calculations for heat engines, working between two reservoirs [10], and agrees with corresponding results for the spin 1/2 system [28].
However, thermal interactions with the environment affect all energy levels, making the two-state approximation of the hydrogen atom somewhat artificial. On the other hand, enforcing transitions via narrow band radiation allows us to focus on single pairs of energy levels, thus providing a more realistic example of a two-state system at the price of dealing with an a-thermal cycle.
A possible four-leg cycle for the two-state version of a single hydrogen atom-like system (i.e., only two of the electronic energy levels n 1 and n 2 > n 1 participate in the process) without contact to a heat bath is shown in Figure 5 for the case n 1 = 1 and n 2 = 2. No temperature is involved, and the cycle runs as follows, where we take as starting point the atom in the state n 1 with energy E [1] = E n 1 (κ in ) for κ [1] = κ in . In leg 1, we excite the atom from n = n 1 to n = n 2 via irradiation at frequency ν in (hν in = E [2] − E [1] = E n 2 (κ in ) − E n 1 (κ in )), while we keep κ at the value κ in , κ [2] = κ in . Next, we increase κ to κ [3] = κ f , while keeping the atom in the excited state n = n 2 , i.e., E [3] = E n 2 κ f . This is followed by the reverse operations, i.e., we de-excite the atom back to n = n 1 via irradiation at frequency ν f (hν f = E [3] − E [4] = E n 2 κ f − E n 1 κ f ), while keeping κ at the value κ f , κ [4] = κ f , followed by the decrease of κ to κ = κ in , while keeping the atom in the state n = n 1 , thus closing the cycle.
Note that legs 2 and 4 would be the analogues to adiabatic branches in the thermal cycle. There, we perform or extract work on the system by changing the energy content of the hydrogen atom-like system from E n 2 (κ in ) to E n 2 κ f and from E n 1 κ f to E n 1 (κ in ), respectively. The total amount of work (done by the atom) associated with these two legs would be since κ f > κ in and n 2 > n 1 . Thus, our external apparatus, which changes κ, performs a net amount of work on the atom along these two legs. frequency (ℎ = − = ( ) − ( )), while we keep at the value , = . Next, we increase to = , while keeping the atom in the excited state = , i.e., = ( ). This is followed by the reverse operations, i.e., we de-excite the atom back to = via irradiation at frequency (ℎ = − = ( ) − ( )), while keeping at the value , = , followed by the decrease of to = , while keeping the atom in the state = , thus closing the cycle. Figure 5. Sketch of an a-thermal iso--"adiabatic" cycle for a two-state system comprising the ground state and the first excited state of the hydrogen-like atom. Branches 1 → 2 and 3 → 4 are iso--legs and branches 2 → 3 and 4 → 1 are "adiabatic" legs, respectively. Note that the Figure 5. Sketch of an a-thermal iso-κ-"adiabatic" cycle for a two-state system comprising the ground state and the first excited state of the hydrogen-like atom  [1] are "adiabatic" legs, respectively. Note that the adiabatic legs run along straight lines that pass through the origin and through the point (κ, E) = (1, −α) for the adiabatic leg in the ground state, and through the origin and through the point (κ, E) = (1, −α/4) for the adiabatic leg in the first excited state, respectively. The four corners of the cycle are the points [1] = κ [1] , E [1] = (κ in , E 1 ), [2] = κ [2] , E [2] = (κ in , E 2 ), [3] = κ [3] , E [3] = κ f , E 3 , and [4] = κ [4] , E [4] = κ f , E 4 in the (κ, E) plane. Note that E [1] = κ in E 1 (κ = 1), E [2] = κ in E 2 (κ = 1), E [3] = κ f E 2 (κ = 1), and E [4] = κ f E 1 (κ = 1).
Concerning legs 1 and 3, which would be the analogues to the heating and cooling branches of a typical thermodynamic cycle, it is not obvious how to account for the equivalent of heat transferred from and to the heat reservoir at different temperatures, and thus make a connection to thermodynamic cycles. If the radiation fields had a black-body frequency distribution, the formulas of radiation thermodynamics would apply [52][53][54], but this would weaken the desired approximation of the system through only two energy levels. What we can consider is a "reservoir" of photons with frequencies ν in and ν f , which the hydrogen atom-like system is in contact with during the excitation and de-excitation processes in legs 1 and 3, respectively. However, such a radiation field that consists of narrow frequency bands does not act as a standard thermal heat source as far as the hydrogen atom-like system is concerned. Instead, we treat the radiation field as part of the external apparatus for the purpose of this discussion, analogous to the pressure we might apply to the material to change the properties of the excitons representing the hydrogen atom-like system. As a consequence, the net work done by the radiation field on the atom equals i.e., the energy of the radiation field shows a net increase along legs 1 and 3 by the same amount as the atom gained in energy when we applied work along legs 2 and 4.
We can thus visualize the two-state approximation of our hydrogen atom-like system as an "engine" that acts as a "frequency conversion pump" while keeping the number of photons conserved. A possible co-efficient of performance would be i.e., the a-thermal cycle of the single controllable hydrogen atom-like system represents a perfect energy conversion apparatus from photons with one frequency to photons with another frequency. We note that this perfect restriction of the hydrogen atom-like system to a two-state system would also work if the modification of the Hamiltonian breaks the symmetry of the Coulomb field, as might be the case by exposing the hydrogen atom to an anisotropic external electric field inside a cavity. Of course, in practice, this a-thermal cycle will encounter finite-time losses, too. The sources of possible finite-time losses have to be identified in an analysis of the quantum processes involved when changing the Hamiltonian and exciting/de-exciting the electrons between the two levels, including the degree of coherence maintained in the system along each leg. An analysis of these issues would go beyond the purview of this study, however. Possible approaches on how to analyze these issues can be found in some of the cited references dealing explicitly with the quantum aspects of heat engines [18][19][20][21][22][23][24][25][26][27][28][29]48,49,51].
A final question is whether there are experimental systems where the thermodynamic or a-thermal cycles discussed in this study might be realized. The most straightforward suggestion would be to take an individual hydrogen atom inside a cavity whose shape can be changed, such that the energy levels can be modified in some way [31]. This system should allow an a-thermal cycle, but the momentum transfer during absorption would start injecting kinetic energy, which would re-appear as a source of heat to the system. In the case of a thermodynamic cycle, where we were to expose the atom to a heat reservoir over a sufficiently large temperature range for exciting the hydrogen atom(s) to a noticeable degree, the system's translational degrees of freedom would quickly establish thermal movement with all that implies, possibly overwhelming the thermodynamic quantities of interest in the electronic two-state system. However, since the experimental control of the hydrogen atom as a thermal engine based on the translational degrees of freedom has been quite successful already [13], a quasi-a-thermal or a thermodynamic engine based on the occupation of the electronic states and on the modification of their energy levels should be feasible.
An alternative would be an excitonic defect in a solid, since this is usually more localized (but still mobile, in principle) and thus probably less susceptible to the kinetic thermal contributions. Furthermore, the reference value of κ, κ in , should be rather small, and thus small changes in temperature would already lead to noticeable changes in the occupation probabilities of the excitonic states. On the other hand, as mentioned earlier, varying κ in a solid can be nontrivial, since the quantities entering κ will depend on both pressure-which would be a suitable control variable-and temperature. As a consequence, in a (p, T) space representation, the iso-κ branches would involve closely coordinated changes both in pressure and temperature. Additionally, an a-thermal cycle might be difficult to achieve, due to the strong thermal coupling of the exciton to the rest of the solid. Nevertheless, it appears that a variety of systems exist which might serve as substrates for the realization of an electronic states-based engine with a single hydrogen atom-like system as the working fluid.
Funding: This research received no external funding.