\section*{Results and discussion}

\subsection*{Model of DNA coated colloids}
We have modeled the self-assembly of DNA-labeled colloidal nanoparticles via overdamped Langevin dynamics simulations of $N$ particles, interacting pairwise with a coarse-grained potential $V(r)$, with $r$ being the center-to-center distance between two colloids, see Fig.~\ref{fig:fig1}. The potential consists of a volume-exclusion repulsion modeled with a Weeks-Chandler-Andersen (WCA) potential \cite{weeks1971role} with an exclusion diameter of $\sigma$, and selective short-range attractive interactions modeled with a Morse potential with amplitude $D_{ij}$ between pairwise particle indices $i$ and $j$. Such a potential has been demonstrated previously to accurately represent selective attractions between two DNA-labeled surfaces \cite{rogers2011direct,manoharan2015colloidal}. Self-assembly with this model can be designed to yield nanoclusters of pre-specified sizes and symmetry, by tuning $D_{ij}$ with respect to $k_{\mathrm{B}}T$, which is Boltzmann constant times temperature \cite{meng2010free,zeravcic2014size,das2021variational}. We consider this self-assembling system evolving within a nonequilibrium steady-state under a shear flow with a constant shear flow rate $f$. The shear flow displaces the particles by competing with the natural diffusive velocity gradient scale for the system, $f^{*}=k_{\mathrm{B}}T/\sigma^{2}$. Given the mechanical driving force of shear performs dissipative work on the system, it may change the relative stability of configurations as well as the rate of interconversions between them.
We investigate whether optimal design principles can be found that can tune the dynamics of self-assembly independently from configurational probabilities for pre-specified target order parameters.

\subsection*{Equilibrium constraints on self-assembly dynamics}
Thermal equilibrium constrains the dynamics of rates of interconversion between stable self-assembled structures to the yields of those structures. Both quantities can be viewed as trajectory-averaged quantities.
We denote a simulated trajectory of particle positions $\mathbf{r}^{N}(t)$ as a function of time $t$, by $X=\{\mathbf{r}^{N}(0),\mathbf{r}^{N}(\delta t),\dots,\mathbf{r}^{N}(t_{f})\}$, with $t_{f}$ being the duration of the trajectory and $\delta t$ the simulation time step. We take $t_{f}$ much longer than the free colloidal diffusion timescale $t^{*}=\gamma\sigma^{2}/k_{\mathrm{B}}T$, where $\gamma$ is the friction coefficient for the free colloids in solution, such that the colloids relax into a steady-state and trajectory averages of order parameters are independent of $t_{f}$. The expected yield, $Y_\mathrm{A}$, of any target structure A over this trajectory can be computed from a trajectory average of the indicator function,
\begin{equation}
Y_{\mathrm{A}}=\frac{1}{t_{f}}\int_{0}^{t_{f}}\mathbf{1}_{\mathrm{A}}[r^{N}(t)] dt\, ,
\end{equation}
where $\mathbf{1}_{\mathrm{A}}[r^{N}(t)]$ returns 1 when the system is in state A and is 0 otherwise. For computing the interconversion rates, we first define the probability flux from state A to state B, $q_{\mathrm{AB}}$. The steady state flux can be evaluated from a two-time correlation function between the indicator functions for state A and B over a lag-time $\tau$,
\begin{equation}
q_{\mathrm{AB}}=\frac{1}{\tau(t_{f}-\tau)}\int_{\tau}^{t_{f}}\mathbf{1}_{\mathrm{A}}[\mathbf{r}^{N}(t-\tau)]\mathbf{1}_{\mathrm{B}}[\mathbf{r}^{N}(t)]dt \, ,
\end{equation}
which is a time-scaled, joint probability of being in A at some time and being in B after time $\tau$.  This flux directly counts the number of times A transfers to B over a trajectory. If the lag-time $\tau$ is larger than the relaxation time within the A state, but much smaller than the typical waiting time for the transition, $q_{\mathrm{AB}}$ reports on the rate constant $k_{\mathrm{AB}}$ as $k_{\mathrm{AB}}=q_{\mathrm{AB}}/Y_{\mathrm{A}}$, independent of $\tau$ \cite{chandler1978statistical}.

In thermal equilibrium, probability fluxes are balanced, such that $q_{\mathrm{AB}}=q_{\mathrm{BA}}$ and the probability current $j_{\mathrm{AB}}\equiv q_{\mathrm{AB}}-q_{\mathrm{BA}}=0$. This implies that the ratio of forward and backward rates of interconversion $k_{\mathrm{AB}}$ and $k_{\mathrm{BA}}$ is strictly coupled to the relative stability of A and B, $k_{\mathrm{AB}}/k_{\mathrm{BA}}=Y_{\mathrm{B}}/Y_{\mathrm{A}}$. A configuration that is more energetically stable is necessarily less reactive at equilibrium, and thus the rate of error correction and annealing towards the globally stable state is reduced. This trade-off is the reason for the existence of an optimal zone for self-assembly in or near thermal equilibrium \cite{whitelam2015statistical}. Far-from-equilibrium conditions may be designed to stabilize otherwise unstable or exotic structures, but may not always break detailed balance, if the driving force does not couple to the relevant reactive mode. We describe next how to design far-from-equilibrium steady-states to tune rate constants and structural stabilities independently, and how to break detailed balance in any target coordinate.

\begin{figure*}[t]
\centering
\includegraphics[width=17.6cm]{fig1b.png}
\caption{Optimal probability flux between polytetrahedron and octahedron. (Top panel) Optimal $\textit{alphabets}$ for high yield and high flux. (Bottom left) Pairwise interaction potential. (Bottom center and right) Average values of observable $\langle O\rangle\in\{Y,k\tau,q\tau\}$ with respect to shear, keeping the \textit{alphabet}s fixed at $\mathbf{S}$ and $\mathbf{AS}$.}
\label{fig:fig1}
\end{figure*}

\subsection*{Optimal design of function}
We use an iterative optimization algorithm to find the best choice of design parameters $\{D_{ij}\}$ and shear flow rate $f$ that maximizes fluxes or currents $q_{\mathrm{AB}}$ and $j_{\mathrm{AB}}$ for a given choice of states A and B. We construct a cost function for optimization, $\langle\Omega\rangle$, that encodes the minimal change to a reference system to maximize either observable by minimizing the Kullback–Leibler divergence between the steady-states of the reference and the controlled system \cite{das2021variational}. For the overdamped dynamics we consider, this is given by $\langle\Omega\rangle=\left\langle \lambda O-\sum_{i=1}^{N}(\mathbf{u}_{i}-\mathbf{F}_{i})^{2}/4\gamma k_{\mathrm{B}}T\right\rangle $, where $\lambda$ is a biasing parameter, $O$ is a time-averaged static or dynamic order parameter, $q_{\mathrm{AB}}$ or $j_{\mathrm{AB}}$ for example, $\mathbf{u}_{i}$ is the total force that the $i$-th particle experiences, $\mathbf{F}_{i}$ is the WCA force from the interparticle potential, and $\langle \dots \rangle$ denote an average over the steady-state.
The second term, deriving from the Kullback-Leibler divergence between trajectory ensembles with and without the added force $\mathbf{u}_i-\mathbf{F}_i$ \cite{das2019variational}, acts as a regularizer for the optimization in regions of design space where the first term is either zero or degenerate.  We optimize $\langle\Omega\rangle$ through stochastic gradient descent by computing its explicit gradients with respect to any design parameter $c$, from a generalized fluctuation-response relation
\begin{equation}\label{eq:grad}
    \frac{\partial\langle\Omega\rangle}{\partial c}=\left\langle \frac{\partial\Omega}{\partial\mathbf{u}}.\frac{\partial\mathbf{u}}{\partial c}\right\rangle +\int_{0}^{\infty}\left\langle \delta\Omega(t)\delta\left( \frac{\partial\dot{\ln}P[X]}{\partial \mathbf{u}}.\frac{\partial\mathbf{u}}{\partial c}\right) (0)\right\rangle  dt
\end{equation}
where $P[X]$ is the Onsager-Machlup probability of trajectory $X$\cite{Onsager_Machlup,warren2012malliavin}. We choose initial values for the design parameters, simulate a steady-state molecular dynamics trajectory to converge the terms in Equation \ref{eq:grad}, change the design parameters by taking a gradient descent step, and keep iterating till we converge to a locally optimal design. Further details and a pseudocode are in the Supplemental Information (SI).

\subsection*{Symmetric and asymmetric strategies for maximal flux}
We first apply this algorithm to the interconversion between polytetrahedral (A: $\mathrm{C}_{\mathrm{2v}}$) and octahedral (B: $\mathrm{O}_{\mathrm{h}}$) configurations in a sheared steady-state with $N=6$ particles, for a fixed choice of lag-time $\tau=0.025t^{*}$, slightly longer than typical transition timescales. The optimal design that maximizes yields $Y_{\mathrm{A}}$ and $Y_{\mathrm{B}}$ are known to be the \textit{Maximal Alphabet} $\mathbf{A}$ and $\mathbf{B}$ for the $D_{ij}$ matrix, shown schematically in Fig. \ref{fig:fig1}, in which an uniform attractive energy stabilizes each contact pair \cite{das2021variational,hormoz2011design}. \textit{Alphabet} matrices possess a degeneracy to permutations of particle indices, a symmetry that the variational optimization spontaneously breaks \cite{das2021variational}. In order to interpret physically meaningful distinctions between alphabets and to interpolate between them, we have permuted them to be the least different (see SI for details).

Optimization for maximal $q_{\mathrm{AB}}$ yields $f/f^{*}=50$, the highest allowed value during optimization, and two distinct $D_{ij}$ alphabet solutions, denoted $\mathbf{S}$ and $\mathbf{AS}$. Maximizing $q_{\mathrm{BA}}$ however yields only the alphabes $\mathbf{S}$. Figure \ref{fig:fig1} shows a slice through the design space in the direction of varying $f$ but keeping $D_{ij}$ fixed. Far-from-equilibrium conditions amplify the fluxes by increasing the rates of interconversion in both directions. At $f=0$, detailed balance constraints $q_{\mathrm{AB}}=q_{\mathrm{BA}}$ as seen by the trade-offs in $(Y_{\mathrm{A}},k_{\mathrm{AB}})$ and $(Y_{\mathrm{B}},k_{\mathrm{BA}})$. The $\mathbf{S}$ matrix maximizes both $q_{\mathrm{AB}}$ and $q_{\mathrm{BA}}$ symmetrically, such that probability flows predominately between states A and B even far-from-equilibrium. This is accomplished with alphabet $\mathbf{S}$ being intermediate in bond-strength to the alphabets $\mathbf{A}$ and $\mathbf{B}$. $\mathbf{S}$ preserves the common bonds in $\mathbf{A}$ and $\mathbf{B}$ and codes for weak bond energies for the unique bond in each structure.

With the other solution $\mathbf{AS}$, shear flow amplifies the flux in the forward direction more than the reverse, breaking detailed balance. Figure \ref{fig:fig1} shows how this is achieved by starting with a $Y_{\mathrm{A}}$ higher than the previous case and thus a smaller $k_{\mathrm{AB}}$, at equilibrium. At high shear, the $k_{\mathrm{AB}}$ is amplified to similar absolute values as with $\mathbf{S}$, without a proportional reduction in $Y_{\mathrm{A}}$.
The solution $\mathbf{AS}$ codes for a bonding arrangement different from $\mathbf{A}$ or $\mathbf{B}$. This class of asymmetric high-flux solutions is generally found as a locally optimal design principle for other pairs of nanoclusters as well.

\begin{figure*}[t]
\centering
\includegraphics[width=17.8cm]{fig2b.png}
\caption{Optimal breakdown of detailed balance induced by shear flow. (Top center) Schematic of the isomerization intermediate. (Top right) Reactive displacement trajectories $J_{\mathrm{AB}}(t)$. (Bottom left) Average values of observable $\langle O\rangle\in\{Y,k\tau,q\tau\}$ with respect to shear, keeping the alphabet fixed at $\mathbf{C}$. (Bottom center) Probability distribution of time spent in 11-bonded state during transitions, $\tau_{\mathrm{I}}$.
(Bottom right) Difference of covariance of shear work $W$ and $\tau_{\mathrm{I}}$, during forward and backward transitions.
}
\label{fig:fig2}
\end{figure*}

\subsection*{Strategy for maximal probability current}
For the same polytetrahedron (A) and octahedron (B) clusters, we have also found the optimal $D_{ij}$ matrices and shear flow rates $f$ that maximize the probability currents $j_{\mathrm{AB}}$ and $j_{\mathrm{BA}}$. For $j_{\mathrm{AB}}$, we find the optimal solution to be $f/f^{*}$ close to $50$ and alphabet $\mathbf{C}$, shown in Fig. \ref{fig:fig2}.
For $j_{\mathrm{BA}}$ optimization, we do not find any design where $j_{\mathrm{BA}}$ is positive and the optimization algorithm always finds the trivial maximum with low $D_{ij}$ where $Y_{\mathrm{A}}=Y_{\mathrm{B}}=0$. A slice through the parameter space in the $f$ direction, keeping alphabet $\mathbf{C}$ fixed, is shown in Fig. \ref{fig:fig2}. The algorithm has found a design to break detailed balance maximally in this pre-specified direction, by decoupling constraints between $(Y_{\mathrm{A}},k_{\mathrm{AB}})$ and $(Y_{\mathrm{B}},k_{\mathrm{BA}})$. When we compare these observables to those with the symmetric high-flux alphabet $\mathbf{S}$ in Fig. \ref{fig:fig1}, we find that the high current with $\mathbf{C}$ arises due to $Y_{\mathrm{B}}$ having a quicker turnover than before. An equivalent explanation is $k_{\mathrm{BA}}$ does not increase as expected from detailed balance considerations. As a result, structural (yield) constraints have been decoupled optimally from rate constraints in nonequilibrium. The gap between $Y_{\mathrm{A}}$ and $Y_{\mathrm{B}}$ in log-scale, exactly balanced at equilibrium by the gap between $k_{\mathrm{AB}}$ and $k_{\mathrm{BA}}$, has been designed to no longer be so at the optimal shear.

Broken detailed balance results in a \textit{reactive displacement} over time $J_{\mathrm{AB}}(t)=\int_{\tau}^{t+\tau}\left[ \mathbf{1}_{\mathrm{A}}(t^{'}-\tau)\mathbf{1}_{\mathrm{B}}(t^{'})-\mathbf{1}_{\mathrm{B}}(t^{'}-\tau)\mathbf{1}_{\mathrm{A}}(t^{'})\right] dt^{'}$,
where the full arguments of the indicators have been suppressed for brevity. The expectation of this observable counts the difference between the expected number of transitions happening in the forward and backward directions. We have shown a typical trajectory of the reactive displacement with time at zero and optimal shear rates, for the alphabet $\mathbf{C}$. The approximately uniform and rapid growth of $J_{\mathrm{AB}}$ with time, and the comparable magnitudes of fluctuations in the two curves, shows how the shear is preferentially amplifying the reactive flux in the forward direction and that this happens through a higher number of small jumps rather than through large rare events. This suggests that the reactive \textit{cycle} involved in breaking detailed balance in the $\mathrm{A}\to\mathrm{B}$ coordinate consists of all edges with comparable reaction rates and comparable changes in configuration space.

The distinction between the forward and backward transitions  with alphabet $\mathbf{C}$ in the presence of shear flow can be understood mechanistically.  Both clusters have 12 bonds, but to transition between the two states requires breaking a bond, and thus passing through an 11-bonded intermediate, like that shown in Fig. \ref{fig:fig2}. We have computed the time spent in an 11-bonded configuration, $\tau_\mathrm{I}$, during transitions, at $f/f^{*}=50$ with the alphabet $\mathbf{C}$. As evidenced by the lifetime distributions in Fig.~\ref{fig:fig2}, forward paths spend more time in the intermediate state on average as well as with higher probability as compared to backwards paths, meaning that this state behaves more as a metastable state than a transient that is stabilized by the shear flow.

To identify the role of shear flow in this asymmetry in $\tau_{\mathrm{I}}$, we have computed the covariance between $\tau_{\mathrm{I}}$ and the work done by shear flow, $W=\sum_{i=1}^{N}\int_{t_{1}}^{t_{2}}\mathbf{f}_{i}^{\mathrm{S}}(\mathbf{r}_{i}).\dot{\mathbf{r}_{i}}dt$, which is integrated between $t_{1}$ and $t_{2}$, the starts and ends of forward and backward transition paths. The difference in covariance

\chi  = \langle \delta \tau_{\mathrm{I}} \delta W \rangle_\mathrm{AB}- \langle \delta \tau_{\mathrm{I}} \delta W \rangle_\mathrm{BA}

between forward and reverse reaction paths, is plotted in Fig. \ref{fig:fig2}, with respect to increasing shear. The difference in the covariance increases initially and then peaks near the optimal shear flow for high current. This implies that even at the level of individual trajectories, spending time in the 11-bonded intermediate state is correlated with the effect of shear more in the trajectory ensemble of forward reactions than the reverse ones. Past the turnover, the difference becomes smaller and then negative, with fluctuations that grow with further increasing shear, suggesting participation of competing sheared reaction pathways involving more broken bonds.
\begin{figure}[t]
\centering
\includegraphics[width=8cm]{fig3b.png}
\caption{Symmetric and asymmetric strategies to maximize probability flux and current in 7-particle clusters. (Left column) Profile of reactive fluxes with changing shear, keeping the optimized high-flux and current alphabets fixed. Top, center and bottom panels are for symmetric high-flux, asymmetric high-flux and high current solutions. Solid (dashed) lines represent forward (backward) reactive flux. Colors correspond to the edges in the reaction networks in the right column. (Right column) Reactions for which optimal solutions exist.}
\label{fig:fig3}
\end{figure}

Detailed studies of the local stability of these strategies in design space (SI) show that detailed balance is preserved all along linear interpolations in parameter space between $\mathbf{A}\to\mathbf{S}\to\mathbf{B}$ even in a high shear flow, with the highest flux occurring at $\mathbf{S}$ as found by the optimization algorithm.
Employing similar interpolations between $\mathbf{S}\to\mathbf{AS}\to\mathbf{C}$, we find that $q_{\mathrm{AB}}$ increases monotonically between $\mathbf{C}\to\mathbf{AS}$, which explains why $\mathbf{AS}$ can be discovered by gradient descent when starting from $\mathbf{C}$.
The close connection between solutions $\mathbf{C}$ and $\mathbf{AS}$ suggests that the existence of a nontrivial high current locally optimal solution in any reaction direction depends on the existence of an asymmetric high flux solution with a positive current.

\begin{figure*}[t]
\centering
\includegraphics[width=17cm]{fig4b.png}
\caption{Independent tuning of hopping flux and microphase structure by shear flow. (Top left) Pairwise interaction potential. (Inset) Schematic illustration of hopping in a microphase. (Center and right columns) Color maps in clockwise order of $Y_{6}$ at $f/f^{*}=1$ and $25$, and $q_{6}\tau$ at $f/f^{*}=25$ and $1$, with respect to changing assembly and disassembly barriers. Corresponding color scales are indicated next to each color map. (Bottom left) Trajectories of the yield of particles of color $c$ as a function of time, with different noise realizations.}
\label{fig:fig4}
\end{figure*}

\subsection*{Generality of nonequilibrium strategies}
We test the generality of the design strategies uncovered in the specific previous case, by studying  probability fluxes and currents for interconversions between four rigid nanoclusters with $N=7$ DNA-labeled particles, as shown in Fig. \ref{fig:fig3}. These are the four highest yield clusters at equilibrium for a nonspecific short-range pairwise attraction \cite{das2021variational,hormoz2011design}. We find that the nonequilibrium strategies discovered for interconverting the polytetrahedron and octahedron nanoclusters are also applicable more widely.
When pairwise interaction matrices are set to the optimized alphabets, most reactive fluxes are amplified by a far-from-equilibrium shear flow due to a larger enhancement in rate constants compared to the decay in yields.
The far-from-equilibrium optima exhibit qualitatively different dynamics than a near-equilibrium perturbative regime. For high probability flux in pairwise transitions, in most cases we find locally optimal symmetric alphabets that preserve detailed balance even far-from-equilibrium. The symmetric solutions are always locally optimal in both forward and reverse directions of the transitions. As before, these solutions result from restricting transitions between only these two tagged configurations, and preventing leakage to competing structures.  In many cases we find distinct locally optimal asymmetric alphabets that break detailed balance at large $f$. The alphabets for this strategy are typically only optimal for reactive flux in one reaction direction. When optimized for high probability current, we find many locally optimal alphabets that channel the shear flow into breaking detailed balance in a particular reaction direction, and thus maximizes the difference between forward and backward reactive flux.  These alphabets are distinct from, but closely related to, the asymmetric high-flux alphabets.  For any given reaction, optimal high-current solutions exist if and only if there are optimal asymmetric high-flux solutions that have a positive current.  While in each case we have not investigated the microscopic mechanism of the decoupling of detailed balance constraints on yields and rates, we expect it to arise from a differential impact in forward and reverse reactions, of the work done by shear flow, on the stability of intermediate structures.

\subsection*{Particle hopping flux in a sheared microphase}
Extending these strategies to a macroscopic system of DNA-labeled colloids straightforwardly requires a prohibitive $\mathcal{O}(N^{2})$ scaling of the necessary alphabet size, as any colloid in a distinct nanocluster must not attract bonding partners from adjacent nanoclusters \cite{hormoz2011design,zeravcic2014size}. This attraction is a nanoscale manifestation of surface tension that tries to relax the system towards a bulk condensate. If however a long-range repulsion arising from a screened Coulomb interaction is combined with the short-range DNA-labeled attractive forces, large systems can self-assemble into a  \textit{microphase} at equilibrium, characterized by the spontaneous emergence of an intermediate length-scale at which nanoclusters are stabilized \cite{zhuang2016recent, hagan2021equilibrium}. Microphase separation or self-limited assembly is often used in biological systems to regulate the volumes of viral capsids, cells and membraneless organelle \cite{caspar1962physical,tanaka2008atomic,courchaine2016droplet}.

Self-limited clusters in biological systems are not static structures but highly fluxional. Nonequilibrium surface reactions are used by cells to stabilize microphase droplets \cite{zwicker2015suppression,soding2020mechanisms,kirschbaum2021controlling}, and components of self-limited clusters continuously exchange with the surrounding solute pool in a dynamic steady-state \cite{brackley2017ephemeral}. Here we focus on how to tune the dynamics of particle exchange between nanoclusters given we have a microphase separated state. By studying the optimal design of a particle hopping flux between multiple nanoclusters, we demonstrate that a sheared nonequilibrium steady-state can break equilibrium constraints relating stability and flux.

We start with a microphase separated state at equilibrium, self-assembled from DNA-labeled colloids  having a pairwise repulsive Yukawa potential $V(r)=\epsilon\exp(-\kappa r)/r$ in addition to the previous short-ranged interactions. We are interested in the yield and reactive flux of compact nanoclusters consisting of 6 colloids and with at least 9 bonds, regardless of its shape. Such nanoclusters are denoted as state A. The cutoff on the number of bonds ensures we are accurately counting reactions involving hopping of particles between clusters instead of complete dissociation of a cluster. We calculate the average yield $Y_{\mathrm{6}}$ at any time $t$, by checking whether each particle is in a cluster of type A, as $Y_{\mathrm{6}}=\int_{0}^{t_{f}}\sum_{i=1}^{N}\mathbf{1}_{i\in\mathrm{A}}(t)dt/Nt_{f}$. For counting particle hops we take a lag-time $\tau=0.025t^{*}$ slightly larger than the timescale of typical adsorption and desorption transitions of colloids from nanoclusters. With this, our hopping flux between 6-colloid clusters becomes
\begin{equation}
    q_{6}=\frac{1}{N\tau(t_{f}-\tau)}\int_{\tau}^{t_{f}}\sum_{i=1}^{N}\mathbf{1}_{i\in\mathrm{A}^{'}}(t-\tau)\mathbf{1}_{i\in\mathrm{A}^{''}}(t)dt
\end{equation}
where $\mathrm{A}^{'}$ and $\mathrm{A}^{''}$ refer to distinct clusters of type A with the only common particle being that with index $i$. This condition ensures that only the exchange of a single particle at a time, \textit{i.e.} a \textit{hop}, is being counted, as illustrated in Fig. \ref{fig:fig4}.

As we are not recording the shapes of clusters so long that they are compact, we do not use an alphabet in our design space, but rather a nonspecific value of the attraction $D$ that competes against the repulsion energy scale $\epsilon$ over a lengthscale of $\kappa^{-1}$. We constrain the total pairwise force and potential to go to zero at a cutoff distance of $5\sigma$ with a shifted forces approximation \cite{toxvaerd2011communication}. This constraint leaves the potential energy function with two relevant effective features, the energy barrier to bond formation or the assembly barrier $\Delta E_{\mathrm{a}}$, and the energy barrier to bond breaking or the disassembly barrier $\Delta E_{\mathrm{d}}$, shown in Fig. \ref{fig:fig4}. We study the effect of far-from-equilibrium conditions on $Y_{6}$ and $q_{6}$ by variationally optimizing $D$, $\epsilon$ and $\kappa$, keeping the shear flow rate fixed at $f/f^{*}=1$ and 25. We also compute the yield and reactive flux landscape by directly sweeping over the design parameters such that we can elucidate their dependence on $\Delta E_{\mathrm{a}}$ and $\Delta E_{\mathrm{d}}$.

\subsection*{Breaking equilibrium constraints on hopping flux}
At equilibrium, large values of both barriers $\Delta E_\mathrm{d}$ and $\Delta E_\mathrm{a}$ stabilizes the microphase, where their difference $\Delta E_\mathrm{d}-\Delta E_\mathrm{a}$ is the energy gain on forming a new bond starting from a dispersed state. The reactive flux for the bond formation and breakage, however, is dependent on both of these energy barriers, slowing exponentially as they increase. As can be anticipated from detailed balance, at and near equilibrium changing $\Delta E_\mathrm{d}$ or $\Delta E_\mathrm{a}$ to optimize yield degrades the reactive flux and vice-versa. This trade-off is shown near thermal equilibrium, $f/f^*=1$, in Fig. \ref{fig:fig4} in the color maps of $Y_{6}$ and $q_{6}$, for a system of $N=90$ colloids at a packing fraction $\phi=0.02$, where the yield and reactive flux both exhibit narrow peaks at distinct parameters.

Far-from-equilibrium, however, the constraint between yield and reactive flux is decoupled, and both have broad regimes of near optimal behavior that overlap one another. Shear flow thus allows an optimal regime in parameter space having high yield of a microphase as well as a high reactive flux of particles hopping between nanoclusters.  This occurs by expanding the regime of stability of the microphase over a broader $\Delta E_\mathrm{a}$ range than near equilibrium (see Fig. \ref{fig:fig4}), through stabilizing nonrigid nanoclusters \cite{das2021variational}. These nonrigid clusters are compact with $\geq 9$ bonds in total, but have dangling bonds that are energetically more susceptible to break, contributing to a high hopping flux.  We find that though far-from-equilibrium shear flow reduces the yield of the nanoclusters by 30\% from the near-equilibrium regime, the highest reactive flux is amplified by more than 600\%. This points at a large amplification in the underlying rate constants by the breakdown of equilibrium constraints. In all cases the variational algorithm optimizes the parameters accurately to arrive close to the optima given it is started from a point in parameter space where either observable is measurably non-zero.

We have demonstrated an application of the increased hopping flux between nanoclusters by an example of an autocatalytic switching reaction. We assume that colloids in the nanoclusters are energetically identical but each carry a color, $c$ or $nc$, similar to phosphorylation tags on biomolecules or competing conformations in proteins \cite{brackley2017ephemeral,michaels2020dynamics}. At $t=0$ in a steady-state only one particle is initialized as $c$ with the rest being $nc$. Every time a $c$-colored particle is in a cluster of type A, it instantly converts every other particle in the cluster to $c$, similar to models for cooperative switching in biomolecules \cite{sourjik2004functional}. The yield $Y_{c}$ of particles of color $c$ is expected to increase fastest when colloids from type A clusters hop fastest directly to other type A clusters in a steady-state. Keeping $D$, $\epsilon$ and $\kappa$ fixed at the optimal value for the highest microphase yield $Y_{6}$ at $f/f^{*}=1$, we show example trajectories of $Y_{c}$ for $f/f^{*}=0$ and $25$ with a system size $N=300$, in Fig. \ref{fig:fig4}. We find that the far-from-equilibrium system indeed shows a higher rate of increase of $Y_{c}$ over the equilibrium scenario. At this optimal design the mechanical and nonspecific shear driving has been optimally channeled into amplifying reactive flux in the hopping reaction coordinate.

We note that the reactive fluxes we discussed are autonomously driven within the sheared steady-state assembly. Our insights on how autonomous driving can nevertheless break equilibrium constraints in specific reaction coordinates can help design molecular machines that efficiently transduce energy through internal rearrangements \cite{seifert2012stochastic}. This work also opens a promising window towards designing dynamical phases of functional materials, and shows how to tune fluxionality without compromising structure, by going to nonperturbative far-from-equilibrium regimes \cite{whitelam2012self}.

{\bf Materials and Methods} A pseudocode of our optimization algorithm, a detailed description of the numerical simulations, learning curves, and optimal alphabets are available in the SI.

{\bf Acknowledgements} This work has been supported by NSF Grant CHE-1954580. AD was also supported by the Philomathia Graduate Student Fellowship from the Kavli Energy Nanoscience Institute at UC Berkeley.

\section*{Simulation details}
We simulate the self-assembly of colloids in a cubic box of length $L$ using an overdamped Langevin equation in a thermal bath, as
\begin{equation}\label{eq:eom}
    \gamma\dot{\mathbf{r}}_{i}=\mathbf{u}_{i}+\boldsymbol{\eta}_{i}
\end{equation}
where $\dot{\mathbf{r}}_{i}$ refers to the time-derivative of the position of the $i$-th particle, $\mathbf{u}_{i}$ is the total force and $\boldsymbol{\eta}_{i}$ are Gaussian white noise with
\begin{equation}
\langle\pmb{\eta}_{i}(t)\rangle=0 \,, \quad \langle\pmb{\eta}_{i}(t)\pmb{\eta}_{j}(t')\rangle=2\gamma k_{\mathrm{B}}T \mathbf{I}_{3}\delta_{ij} \delta(t-t')
\end{equation}
where $\mathbf{I}_{3}$ is the $3\times3$ identity matrix and the averaging operation is performed over thermal noise. In the presence of shear flow, we use Lees-Edwards periodic boundary conditions \cite{lees1972computer}. For the first part of the paper, any given nanocluster has been effectively isolated by simulating the colloids at a packing fraction of $\phi=0.01$.
The total force $\mathbf{u}_{i}$ is composed of shear flow and conservative forces,
\begin{equation}\label{eq:force}
\mathbf{u}_{i}=\mathbf{f}^{\mathrm{S}}_{i}(\mathbf{r}_{i})-\pmb{\nabla}_{i}\sum_{j\neq i} V(r_{ij})
\end{equation}
where $r_{ij}=|\mathbf{r}_{i}-\mathbf{r}_{j}|$ is the pairwise center-to-center distance.
The shear flow has the form
\begin{equation}\label{eq:shearflow}
\mathbf{f}^{\mathrm{S}}_{i}(\mathbf{r}_{i})=fz_{i}\mathbf{\hat{x}}
\end{equation}
with the shear flow rate $f$. The potential energy is composed of Weeks-Chandler-Andersen (WCA), Morse and Yukawa potentials that represent the volume-exclusion repulsion, DNA-mediated attraction and screened Coulomb repulsion respectively. The WCA pair potential has the form
\begin{align}\label{eq:wcapair}
V_\mathrm{WCA}(r_{ij})&= 4\epsilon_{\mathrm{WCA}} \left[\left( \frac{\sigma}{r_{ij}}\right )^{12}-\left (\frac{\sigma}{r_{ij}} \right)^{6} \right] +\epsilon_{\mathrm{WCA}} \, , \quad r_{ij}<2^{1/6}\sigma \nonumber\\
&=0 \, , \quad  r_{ij}\geq2^{1/6}\sigma
\end{align}
with particle diameter $\sigma$ and energy scale $\epsilon_{\mathrm{WCA}}=10k_{\mathrm{B}}T$. The Morse potential has the form
\begin{equation}\label{eq:morse}
V_{\mathrm{Morse}}(r_{ij})=D_{ij}\left( e^{-2\alpha(r_{ij}-2^{1/6}\sigma)}-2e^{-\alpha(r_{ij}-2^{1/6}\sigma)} \right)
\end{equation}
with $D_{ij}$ being the bond energy and $\alpha=10\sigma^{-1}$ determining its width. The Morse potential has been truncated with a shifted forces approximation \cite{toxvaerd2011communication} such that both the potential and the force decay smoothly to zero at $r=2.12\sigma$. We integrate Equation \ref{eq:eom} in an Ito fashion with an Euler algorithm \cite{frenkel2019understanding} with the time step $\delta t=5\times10^{-5}t^{*}$. All stochastic integrals throughout the paper have also been performed in the Ito sense \cite{rogers2000diffusions}. For the variational optimization iterations and for sweeping over the parameter space, trajectories have been propagated upto $t=6\times10^{5}t^{*}$ for isolated nanoclusters and upto $t=5\times 10^{4}t^{*}$ for the microphase separated state. We constrain the optimization parameters to stay within pre-specified upper and lower bounds to avoid ill-behaved potential energy functions, and prohibitively slow relaxation in the steady-state simulations. These constraints are $0\leq D_{ij}/k_{\mathrm{B}}T\leq 10$, $0\leq f/f^{*}\leq50$, $0\leq \epsilon/k_{\mathrm{B}}T\leq10$ and $0.1\leq \kappa\sigma\leq10$.

\section*{Optimization algorithm}
We optimize the steady-state averaged cost-function $\langle\Omega\rangle$ by gradient descent, taking its explicit gradients with respect to force parameters. We choose a large positive value for $\lambda$ such that the first term is at least an order of magnitude larger than the second during the initial optimization step \cite{das2019variational}. At every optimization iteration, we fix the value of the parameters and propagate steady-state trajectories over which we estimate the gradient, using Eq. 2 in the main text. The temporal integration is done on-the-fly upto a time $\Delta t$ in future. We reduced the variance of the gradient of $f$ by accounting for the diffusion of the center of mass of the nanocluster in the large simulation box \cite{das2021variational}. With the statistical estimate, we update the parameters in the direction of the gradients and keep iterating. The learning rate $\alpha^{c}$ for every parameter $c$ is fixed at the start of the optimization by constraining the magnitude of the first optimization step to a desired value, $\Delta c_{0}$. In case that the observable changes during the optimization by several orders of magnitude, we performed the optimization first with a large learning rate, and then reduced the learning rate as soon as a large peak was detected, so that convergence remains smooth. If any optimization step takes a parameter out of the allowed range, it is reset to be at the edge of that range. The optimization is converged when the cost-function stops changing within a tolerance. A pseudocode for the optimization algorithm is provided in Algorithm \ref{algo}.

\begin{figure}
\begin{algorithm}[H]
	\caption{Gradient Descent with Malliavin weights}\label{algo}
	\begin{algorithmic}[1]
		\State \textbf{inputs} Variational parameters $c$ for force  $\mathbf{u}^{(c)}(\mathbf{r}^{N})$
		\State \textbf{parameters} Magnitude of first optimization step $\Delta c_{0}$; lower and upper bounds on allowed values of $c$ are $c_{l}$ and $c_{m}$; total optimization steps $I$; trajectory length $t_{f}$ consisting of $J$ time steps of duration $\delta t$ each; number of trajectories $M$
		\State \textbf{initialize} Choose initial weights $c$. Force gradient learning rate $\alpha^{c}$ will be chosen during the first iteration. Define iteration variables $i$ and $j$. Define force gradients $\delta_{\mathbf{u}}^{(c)}$. Define functional form for stepwise differential increments (rewards) $\xi$ to the temporally integrated cost-function $\lambda t_{f}O-\int_{0}^{t_{f}}dt\sum_{i=1}^{N}(\mathbf{u}_{i}-\mathbf{F}_{i})^{2}/4\gamma k_{\mathrm{B}}T $.
		\State $i\gets0$
		\Repeat
		\State Generate trajectory $X$ with first-order Euler propagation in presence of the force $\mathbf{u}^{(c)}$ and wait till it relaxes into a nonequilibrium steady-state. Configurations, times, noises (with variance $2\boldsymbol{\gamma}k_{\mathrm{B}} T\delta t$), Malliavin weights, and rewards are denoted by $\mathbf{r}^{N}_{j},t_{j},\boldsymbol{\eta}_{j},\zeta^{(c)}(t_{j})$ and $\xi(t_{j})=\xi_{j}$ respectively. Reward contributions from stepwise increments to $O$ are derived from products of indicators $\mathbf{1}(t_{j})$ with stored information from $\tau$ times past, $\mathbf{1}(t_{j}-\tau)$.
		\State $j\gets0$
		\State $\delta_{\mathbf{u}}^{(c)}\gets0$
		\State $\zeta^{(c)}(t_{0})\gets0$
		\Repeat
		\State $\dot{\zeta}^{(c)}(t_{j})\gets\boldsymbol{\eta}_{j}\cdot\nabla_{c}\mathbf{u}^{(c)}(\mathbf{r}^{N}_{j},t_{j})/2k_{\mathrm{B}} T\delta t$
		\State $\zeta^{(c)}(t_{j+1})\gets \zeta^{(c)}(t_{j})+\delta t\dot{\zeta}^{(c)}(t_{j})$
		\State $\delta_{\mathbf{u}}^{(c)}\gets\delta_{\mathbf{u}}^{(c)}+\xi_{j}\zeta^{(c)}(t_{j+1})$
		\State $j\gets j+1$
		\Until{$j=J$}
		\State $\delta_{\mathbf{u}}^{(c)}\gets\delta_{\mathbf{u}}^{(c)}/J$
		\State average $\delta_{\mathbf{u}}^{(c)}$ over $N$ trajectories to get $\overline{\delta}_{\mathbf{u}}^{(c)}$
		\If {$i==0$}
		    \State $\alpha^{c}=\Delta c_{0}/\overline{\delta}_{\mathbf{u}}^{(c)}$
		\EndIf
		\If {$c_{l}\leq c+\alpha^{c}\overline{\delta}_{\mathbf{u}}^{(c)}\leq c_{m}$}
		    \State $c\gets c+\alpha^{c}\overline{\delta}_{\mathbf{u}}^{(c)}$

		\ElsIf {$c+\alpha^{c}\overline{\delta}_{\mathbf{u}}^{(c)}<c_{l}$}
		    \State $c\gets c_{l}$
		\ElsIf {$c+\alpha^{c}\overline{\delta}_{\mathbf{u}}^{(c)}>c_{m}$}
		    \State $c\gets c_{m}$
		\EndIf
		\State $i\gets i+1$
		\Until{$i=I$}
	\end{algorithmic}
\end{algorithm}
\end{figure}

\begin{figure}
\centering
\includegraphics[width=\textwidth]{sifig1.png}
\caption{Learning curves for conversion between polytetrahedron ($\mathrm{A}$) and octahedron ($\mathrm{B}$) as a function of optimization steps $I$. Each row shows the observable $\langle O\rangle$ being optimized on the left, $f$ optimization in the middle, and on the right the optimization of the independent $D_{ij}$ elements, $i>j$. Row-wise from top: optimization of a) $j_{\mathrm{AB}}$ starting from octahedral Maximal Alphabet $\mathbf{B}$; b) $j_{\mathrm{BA}}$ starting from $\mathbf{B}$; c) $q_{\mathrm{AB}}$ starting from $\mathbf{B}$; d) $q_{\mathrm{BA}}$ starting from $\mathbf{B}$; e) $q_{\mathrm{AB}}$ starting from $\mathbf{C}$; f) $q_{\mathrm{BA}}$ starting from $\mathbf{C}$.}
\label{fig:sifig1}
\end{figure}

The discovery of high probability flow and current solutions is revealed in learning curves starting from different points in the alphabet space. In Figure \ref{fig:sifig1} we show learning curves for optimizing $j_{\mathrm{AB}}$, $j_{\mathrm{BA}}$, $q_{\mathrm{AB}}$ and $q_{\mathrm{BA}}$ for states $\mathrm{A}$ and $\mathrm{B}$ being the $\mathrm{C}_{\mathrm{2v}}$ and $\mathrm{O}_{\mathrm{h}}$ clusters in Figs. 1 and 2 of the main text. The starting alphabets are either the octahedral Maximal Alphabet $\mathbf{B}$ with the bond-energies set to $5k_{\mathrm{B}}T$, or the alphabet $\mathbf{C}$ obtained first from the $j_{\mathrm{AB}}$ optimization. $f/f^{*}$ is started from $50$. In all cases except the $j_{\mathrm{BA}}$ optimization, the observable is optimized, sometimes over many orders of magnitude, accompanied by a spontaneous breaking in permutation symmetry in the $D_{ij}$ parameters \cite{das2021variational}. This symmetry breaking chooses specific bond energies for specific particle indices, out of a collection of identical colloids. The optimization profiles show the stability of the symmetric flux solution $\mathbf{S}$ for high values of both $q_{\mathrm{AB}}$ and $q_{\mathrm{BA}}$. They also show the close association of the high-current solution $\mathbf{C}$ to the asymmetric high flow solution $\mathbf{AS}$, in that $\mathbf{AS}$ can be discovered by gradient descent when starting from $\mathbf{C}$.

\section*{Interpolation between optimal alphabets}

\begin{figure}
\centering
\includegraphics[width=0.7\textwidth]{sifig2.png}
\caption{The forward (black) and backward (orange) probability fluxes along linear interpolations in design space, keeping shear fixed at $f/f^{*}=50$.}
\label{fig:sifig2}
\end{figure}

In Fig. \ref{fig:sifig2} we have characterized the local stability of optimal designs in parameter space for maximal probability flux and current, by computing the flux along symmetry lines in design space at a fixed $f/f^{*}=50$. For comparing two different optimized alphabets, we have to first take into account the spontaneous breaking of labeling symmetry that may occur differently in the two cases.
We choose a reference alphabet $D_{ij}^{(0)}$, which for $N=6$ and $7$ are the Maximal Alphabets for the $\mathrm{O}_{\mathrm{h}}$ cluster and one of the $\mathrm{C}_{\mathrm{3v}}$ clusters respectively. For every permutation of the particle labels $i\to p(i)$, we then compute the labeling cost-function $\Gamma[p]=\sum_{i,j|i>j}g[D^{(0)}_{ij}-D_{p(i)p(j)}]^{2}+[i-p(i)]^{2}+[j-p(j)]^{2}$, where $g$ is a scaling parameter that we choose to be $100$, and the sum is over all particles. The first term in $\Gamma$ denotes the mismatch in bond energies. If there are multiple permutations that minimize the first term, the second and third terms together consistently choose one solution that minimizes mismatch in labeling. We compute $\Gamma$ over all 720 (5040) enumerated permutations for $N=6$ ($7$) particles and choose the optimal permutation that minimizes $\Gamma$. All alphabets reported in this work have been permuted in this procedure so that they can be compared against each other and are physically meaningful.

We now plot the forward and backward flux while going from the alphabet $\mathbf{A}$ to $\mathbf{S}$ with a linear interpolation of $D_{ij}$ matrix elements, and then complete a loop by similarly visiting $\mathbf{B}$, $\mathbf{AS}$ and then $\mathbf{A}$. We find that even in this far-from-equilibrium condition, detailed balance is preserved on the line $\mathbf{A}\to\mathbf{S}\to\mathbf{B}$, and that $\mathbf{S}$ is locally optimal for fluxes in both directions. Further, the Maximal Alphabets themselves, $\mathbf{A}$ and $\mathbf{B}$, are not optimal for either high flux or for breaking detailed balance in this reaction coordinate, even in a high shear flow. Hence, our nonequilibrium design algorithm is essential to design the dynamics of assembly.

The $\mathbf{AS}$ solution breaks detailed balance and is locally optimal along this line for the forward flux but not the reverse. $\mathbf{S}$ and $\mathbf{AS}$ also appear to be in distinct solution basins along this line, but that does not imply local stability of both solutions in the entire multidimensional parameter space.

In the second plot, we connect $\mathbf{S}$, $\mathbf{AS}$ and $\mathbf{C}$ directly through linear interpolations to study the relative stability of these strategies. We find that $\mathbf{AS}$ is only barely stable with respect to $\mathbf{S}$ for the forward flux, and almost stable with respect to $\mathbf{S}$ for the backward flux, evidenced by the flatness of the gradients of $q_{\mathrm{AB}}$ and $q_{\mathrm{BA}}$ to changing $D_{ij}$. The gap between $q_{\mathrm{AB}}$ and $q_{\mathrm{BA}}$ opened up by $\mathbf{AS}$ stays open as we interpolate to $\mathbf{C}$, which has much lower fluxes in both direction but maximizes the gap. $q_{\mathrm{AB}}$ increases $\mathbf{C}\to\mathbf{AS}$, implying there is at least one gradient descent path. Indeed, we only discovered the solution $\mathbf{AS}$ when the optimization algorithm was initiated from $\mathbf{C}$. Similarly, $q_{\mathrm{BA}}$ increases monotonically from $\mathbf{AS}$ to $\mathbf{S}$, showing why $\mathbf{AS}$ is not locally optimal for $q_{BA}$.

In the third plot, we computed the fluxes as we interpolate from $\mathbf{C}$ to $\bm{\varnothing}$, which is the trivial solution $D_{ij}=0$ and thus $Y_{\mathrm{A}}=Y_{\mathrm{B}}=q_{\mathrm{AB}}\tau=q_{\mathrm{BA}}\tau=0$. The gap between $q_{\mathrm{AB}}$ and $q_{\mathrm{BA}}$ only vanishes when going to either $\bm{\varnothing}$ or the $\mathbf{A}\to\mathbf{S}\to\mathbf{B}$ line, and never changes sign. Since the former produces a lower design cost from the Kullback-Leibler divergence term in the gradient descent cost-function $\Omega$, optimization of $j_{\mathrm{BA}}$ eventually converges to $\bm{\varnothing}$.

In summary, the symmetric high-flux solution is optimal in both directions. The asymmetric high flux solution is close to being optimal for both, and indeed in some cases for $N=7$ clusters we find distinct designs that asymmetrically amplify the flux in either direction. However, if there exists an asymmetric high flux solution but the flux is still not higher than in the reverse direction, there is no distinct high current solution.

\section*{Optimized alphabets for $N=7$}
We show in Fig. \ref{fig:sifig3} color maps of all optimized alphabets for maximizing probability fluxes and currents in the reaction network in Fig. 3 of the main text.

\begin{figure}
\centering
\includegraphics[width=\textwidth]{sifig3.png}
\caption{Optimized alphabets for maximal probability flux and currents between $N=7$ clusters. The colors of the arrows in the top panel correspond to the $D_{ij}$ matrices in the bottom panel. Left column is for symmetric strategies for maximal probability flux, middle column for asymmetric strategies and right column for maximal probability current.}
\label{fig:sifig3}
\end{figure}

\section*{Hopping flux in microphase}
We optimized design parameters to find maximal yield and maximum hopping flux regimes near and far from thermal equilibrium. Fig. \ref{fig:sifig4} shows the corresponding optimization curves, keeping the value of $f/f^{*}$ fixed at $1$ and $25$. As the yields and fluxes are nonzero over only small regions in the design space, the optimization needs to be started close to these regions for the observable to have measurable nonzero value over finite trajectory durations. If the observable is nonzero, the algorithm recognizes the first term in the cost-function and the observable is optimized, sometimes over multiple orders of magnitude. After convergence, the design parameters continue to explore degenerate values that all lead to the same optimum.

Fig. 4 in the main text was computed by sweeping over a rectangular grid of $D$, $\epsilon$ and $\kappa$. The grid was linearly spaced for $D$ and $\epsilon$ and logarithmically spaced for $\kappa$. We computed $\Delta E_{d}$ and $\Delta E_{a}$ for each choice of the design parameters, and coarse-grained the resultant nonuniform grid with Gaussian functions in order to interpolate and obtain the color maps in Fig. 4. The essential features of the color maps were invariant to the choice of the variance of the Gaussian functions.

\begin{figure}
\centering
\includegraphics[width=\textwidth]{sifig4.png}
\caption{Learning curves with the microphase for yield of compact 6-particle clusters, and hopping flux between such clusters. Each row shows the observable $\langle O\rangle$ being optimized on the left, and $D$, $\epsilon$ and $\kappa$ optimizations on the right. Row-wise from top: optimization of a) $Y_{6}$ at $f/f^{*}=1$; b) $Y_{6}$ at $f/f^{*}=25$; c) $q_{6}$ at $f/f^{*}=1$; d) $q_{6}$ at $f/f^{*}=25$.}
\label{fig:sifig4}
\end{figure}