{'fraction_non_alphanumeric': 0.030785611777232536, 'fraction_numerical': 0.011018008425535854, 'mean_word_length': 4.513527309851965, 'pattern_counts': {'":': 0, '<': 1, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Dynamics of bacteria scanning a porous environment

It has recently been reported that bacteria, such as E.coli and P. putida, perform distinct modes of motion when placed in porous media as compared to dilute regions or free space. This has led us to suggest an efficient strategy for active particles in a disordered environment: reorientations are suppressed in locally dilute regions and intensified in locally dense ones. Thereby the local geometry determines the optimal path of the active agent and substantially accelerates the dynamics for up to two orders of magnitude. We observe a non-monotonic behavior of the diffusion coefficient in dependence on the tumbling rate and identify a localisation transition, either by increasing the density of obstacles or by decreasing the reorientation rate.

The natural habitat of a wide range of microorganisms are complex crowded media. Examples are microorganisms which populate and colonize rocks, modeled as micro-porous spaces, as well as bacteria which contaminate or purify soil [3,4]. In living matter, microorganisms find themselves in a crowded environment, such as bacteria invading mucus [5][6][7][8] or cells invading tissue [9]. In many of these instances it is vital for the microorganism to move efficiently through the porous and tortuous environment, they are stuck in. The search for nutrients as well as the escape from a poisonous environment has to be sufficiently fast. Many technical applications, such as water purification and decomposition of contaminants trapped in the ground [10,11] rely on efficient dynamics of bacteria. In medical applications bacteria are engineered to sense the porous environment of a tumor [12,13] or microorganism are designed for drug delivery [14], -fast and efficient dynamics of the bacteria being essential for their task. Despite these widespread applications, there is yet no consensus how the dynamics of such organisms are adapted to perform most efficiently in a complex and crowded medium. This has led us to ask: What is the best strategy for active agents to explore large porous regions in short time? To what extent can adaptation to the inhomogeneous environment accelerate the dynamics?
Several theoretical studies and simulations have addressed active particles in a random environment [15][16][17][18][19][20]. Frequently the porous medium is modeled by the Lorentz model [21,22], where static obstacles are placed randomly in space, covering a volume (area) fraction φ o . Zeitz et al. [16] simulated active Brownian particles, whose diffusion constant is depressed due to the tendency of active particles to get stuck around obstacles. Reichhardt et al. [17] include a drift term; surprisingly the drift velocity is non-monotonic as a function of run time for given φ o . Bertrand et al [18] compute the diffusion constant of active particles in a lattice gas model and show that the diffusion constant is non-monotonic in the tumbling rate as long as the obstacles are static (or very slow). More recently Kurtzthaler et al. [19] derived a geometric criterion for optimal spreading, when the run length of the bacteria is comparable to the longest straight path in the porous medium. In contrast to these approaches, we suggest a local adaptation mechanism of the dynamics. Sensing the local density allows the microorganisms to adjust their hopping rate efficiently in a strongly inhomogeneous environment. Reorientation in dilute regions is ineffective and hence suppressed; reorientation in dense regions and in particular in traps is essential and hence fostered.
Local sensing of the environment has been adopted as a survival mechanism in many phyla throughout the animal kingdom. Several microorganisms regulate their behavior according to the density of neighbours or to local gradients in phoretic propulsion. For example, a mechanism known as quorum sensing, allows bacteria to change their speed according to the density of neighbours [23][24][25][26][27][28][29][30]. Schools of fish have been observed to regulate their speed according to the density of neighbours [31,32]. Regarding chemotaxis of bacteria in porous media, it has been suggested that the tumbling rate [33] as well as the tumbling angle [34] changes in response to the local chemotactic concentration. Bacteria with several swimming modes, such as P. putida [2], can switch between different run modes in response to chemotactic conditions optimizing their chemotactic strategy. Volpe and Volpe [35] argue that the topography of the environment globally enhances the random motion as compared to the ballistic one. Recent experiments by Datta et al. [1] on bacterial hopping in porous media revealed that random disorder does not just change the tumbling frequency and consequently also the run length. Instead the bacteria are able to change their dynamics, if trapped, so that hopping becomes dependent on the geometry of the pore space.
Model: We consider the dynamics of an elongated tracer particle in a two-dimensional medium of static ob-stacles with area fraction φ o . The tracer is modeled as a rigid trimer, consisting of 3 beads of radius R t . The position vector of the central bead is denoted by r. The two peripheral beads are rigidly attached to the central bead, forming a linear configuration, whose orientation is specified by a unit vector n = (cos ϕ, sin ϕ). The position vectors of the two peripheral beads are thus given by r ± = r ± 2R t n. The trimer is considered a model for an elongated particle of aspect ratio 3. The obstacles are modeled as disks (2D), much larger than the beads of the trimer. In the following we choose for the ratio of obstacle radius to tracer radius R o /R t = 10. The interaction of the beads with the obstacles, F (r), is taken as a contact potential, modeled by a stiff spring.
Since the trimer is modeled as a rigid body, its dynamics is fully characterized by an equation for the translational motion of the center of mass, which is taken to coincide with r, and an equation of motion for the orientation ϕ. We assume over-damped dynamics, according to:ṙ The total force on the center of mass due to obstacle i at position vector R i , is given by The active velocity v a is applied along the direction of the trimer n. Interactions with the obstacles cause the trimer to rotate: where the torque, τ i , is explicitly given by The torque is always normal to the plane of motion and τ i is the projection of the vectorial torque on the normal of the plane of motion. The occasional tumbling of bacteria has been modeled as a stochastic reorientation process. For example, the bacteria reorient in random directions with a given probability. Such a model is widely accepted for run and tumble dynamics in solution. Does it apply also in dense porous media? Recently it has been shown [1] that bacterial dynamics are changed when they are trapped. This has led us to introduce a reorientation mechanism which depends on the local environment of the tracer. In particular, the reorientations which disturb the ballistic motion in void space and simultaneously prevent the particles from getting trapped, are adapted to the local density in a strongly heterogeneous environment. In that way, we try to model the experimental finding that "hops are guided by the geometry of the pore space" [1].
Physical interactions between bacteria and surfaces are known to be determined by near-field lubrication forces [36][37][38] and steric collisions [39]. Bacterial re-sponses to such interactions vary from trapping in almost deterministic circular trajectories [37] to enhanced reorientations [40] depending on the type of surface and species. It has also been shown [41][42][43] that mechanical load on the flagella alters the flagellar motor kinematics, and thereby modulates reorientations.
With a rate of λ = 1/t re the local volume fraction φ local is calculated inside a region with radius r l , surrounding the trimer's head (see Fig.1). We use a function G(φ local ) to generate the probability of performing a random reorientation in the full range from 0 to 2π. The functional form of G(φ local ) encorporates the sensing mechanism which we refer to as "density sensing" in the following. Constant G results in the standard run and tumble dynamics with the rate of λ = 1/t re , independent of the local environment. For a more sensitive function to φ local we consider a sigmoidal form as for the reorientation probability, with C being the normalization factor. This choice reflects a high probability of reorientation in a locally dense region and a very low probability in a locally more dilute region. To approximate a step function, we choose k = 100 and φ 0 = 0.63 We want to analyse the dynamics of the tracer particle as a function of several parameters. Without density dependent reorientation, these are the magnitude of the active velocity v a and the packing fraction of the obstacles φ o Including density dependent reorientation, the important parameter is the time-scale t re of reorientation. The size of the region, r l , to determine the local density should be comparable to the size of the obstacle. Other functions G(φ o ), mapping φ local to the probability of reorientation, may be considered in future work.
The parameters can be expressed in timescales. We measure lengths in units of 2R t and times in units of the active timescale t a = 2R t /v a which is controlled by the active velocity. In these units, the reorientation time τ re = t re /t a is the Peclet number. The collision time is given Both tumbling as well as collisions randomize the velocity of the active particle and give rise to diffusion and hence cause a crossover from ballistic motion to diffusive motion.
We used HOOMD-Blue [44] to integrate Eq. 1 and run Molecular Dynamics simulations on GPU (∆t MD = 10 −2 ). Freud package [45] is used to investigate the local environment. For each set of (τ re , φ o ), 10 to 50 simulations are performed, each with 100 independent trimers and N o = 2500 random obstacles without overlaps.
Results: We focus here on the dynamics of tracer particles adapted to their local environment. In Fig. 2 we show the MSD for G(φ local ) (full line) in comparison to a constant G (dashed line). The most striking observation is the strong boost of the dynamics for density sensing, when the reorientation time is comparable to the timescale of active motion. The acceleration is due to uninterrupted ballistic motion as well as reduced trapping times. For moderate densities, such as φ o = 0.4 shown in Fig. 2, the first mechanism dominates, whereas for rather dense systems such as φ o = 0.7, the latter dominates (see below). To quantify the acceleration due to density sensing, we extract a diffusion constant as the slope of the MSD in the diffusive regime. It is plotted in the inset of Fig. 2 as a function of τ re for both uniform and sigmoidal G. The diffusion constant is larger by almost two orders of magnitude for density sensing and τ re ∼ 1, i.e. when the reorientation time is comparable to the timescale of ac-tive motion. Furthermore, the diffusion constant is nonmonotonic in τ re , as already observed in Fig. 2. The fastest dynamics is found for τ re ∼ 5 and slows down for increasing as well as decreasing τ re . This non-monotonic behavior has been observed previously for constant reorientation rate [18], where it is in fact more pronounced. It can be explained by the following intuitive argument: For large τ re the particles are stuck for a long time in a locally dense region of obstacles, so that the diffusion constant is small and approximately inversely proportional to τ re . For small τ re , randomization of the active motion is fast, so that the crossover from ballistic motion to diffusive behavior happens at early times, resulting in small values of the diffusion constant for small τ re . These two effects together give rise to an optimal value for τ re , for which the dynamics is fastest.
The difference between uniform and sigmoidal G disappears for very long reorientation times, when reorientation is so rare that ballistic motion is mainly interrupted by collision events which are the same for both models. It has been suggested recently [19] that reversing the velocity of the active particle is an efficient means to accelerate the dynamics. For the sigmoidal G random reorientation and run-reverse dynamics can hardly be distinguished (see Fig.1

in the SM)
The boost of the dynamics with density-sensing can be traced back to the distribution of waiting times, defined as the time interval between two reorientation events. The distribution is a simple exponential for a uniform G and all densities, characterized uniquely by τ re . In contrast, sigmoidal G gives rise to a second exponential, which slows down dramatically as the density decreases, see Fig. 3a. In fact the decay rate β of the distribution increases approximately exponentially with φ o . The long relaxation times for moderate φ o are directly related to increasingly long straight paths for dilute systems. Following refs. [19,46] we compute the distribution of straight paths which lie entirely in the void space of the porous medium. The distribution of these so called chord lengths is shown in Fig. 3b. The distribution strongly resembles the distribution of waiting times. The average waiting time τ w re is the average distance the trimer travels from one trap to another, divided by the swimming speed. We estimate this distance as the mean chord length (extracted from Fig. 3b) times the average number of collisions (evaluated by tracking trajectories) between two tumbling events. The inset of Fig.3b compares this estimate for τ w re to the values computed from the distribution of waiting times (Fig.3a). The good agreement gives further support to our conclusion that the frequency of reorientation is determined by the geometry of the environment. The latter determines the optimal path for the active particle which is clearly seen in the movies in the SM [47]. Interestingly, the mean waiting time τ w re for optimal transport in our model (τ re ∼ 5) lies in a similar range as the experimental data [1] suggest (For details, see the SM [47]). The dependence of the dynamics on the area fraction of obstacles is shown explicitly in Fig. 4. As one expects, we see ballistic motion for short times and then a crossover to diffusion at long times. As the density of obstacles φ o is increased, the diffusion constant is reduced and eventually at φ o = 0.7, all particles are localised, exhibiting a plateau in the MSD. The size of the plateau is the average squared localisation length and independent of the dynamics. At the localisation transition, we observe sub-diffusive behavior. The localisation transition in the Lorentz model with non-overlapping obstacles is a percolation transition. The critical packing fraction for localisation, φ crit , depends on the size ratio R o /R t and has been computed in [48].
A finite fraction of particles is localised even for φ o < φ crit due to the existence of finite size void regions, coexisting with the macroscopic void area. In fact the size of these cages is widely distributed; for φ o = 0.4 it varies over more than two orders of magnitude (See Fig. 3 in SM [47] for an example). A quantitative measure of par- tial localisation is provided by Q(t; d), the fraction of particles which have moved less than d in time t. Choosing d = 0.3L, we observe that Q(t; d) decays to a finite value even well below φ o = 0.7, implying that a finite fraction of the particles is localised (see Fig. 5a). As the percolation transition is approached, the relaxation time of Q(t; d) diverges, as can be seen in Fig. 5b), where we plot τ Q , defined as Q(τ Q ; d) = 0.6. The fraction of localised particles, Q ∞ (d) for φ o ≤ 0.7 depends of course on the chosen value of d. In the above figure this was chosen comparable to system size in order to show that a finite fraction of particles is localised on scales comparable to system size. For dense systems, e.g. φ = 0.6, the dominant mechanism responsible for the speed up of transport is the enhanced escape from cages. Whereas for uniform G particles reorient as much close to the inner boundaries and dead ends of the cage as they do in the center of the cage, for sigmoidal G they effectively reorient only at dead ends, resulting in a negligible number of reorientations, unless it is necessary to escape a trap. Thereby, the mean trapping time is reduced by a factor of approximately 2 for sigmoidal G as compared to uniform G and most pronounced for the highest densities (see Fig. 5c) Localisation can also occur for smaller φ o , such as φ o = 0.4, if the reorientation time is increased accordingly. This is apparent in Fig. 2, where we observe the emergence of a plateau for φ o = 0.4 and τ re ≥ 500. Reorientations are a rare event, but will take place for sufficiently long times. Hence we expect to see a crossover to diffusive behavior for even longer times, in contrast to tracers above the percolation threshold (light blue curve in Fig 4) which are truly localised. Increasing τ re thus provides another route to glassy dynamics in active mat-ter (See Fig. 1 in SM [47]).
We have introduced a model for bacterial spread in a porous medium, which substantially accelerates the dynamics. It is based on a sensing mechanism of the local density and thereby reduces adverse tumbling in locally dilute regions and enhances necessary reorientations, when the bacteria are trapped in local cages. The extremely long waiting times between successive tumbling events for moderate densities can be traced to the geometry of the porous structure which determines the optimal path of the active agent. For the fully random structure under consideration, the diffusion constant can be enhanced by two orders of magnitude. We expect the effect to be even stronger in a structured system whose inhomogeneities extend over finite length-scales.
The model can be easily extended to other transport phenomena which require scanning of the environment. A prominent example is chemotaxis, requiring local sensing of food or poison. Here a concentration dependent tumbling rate may by the simplest model to account for directed motion in a concentration gradient.

MOVIES
The movies illustrate the qualitative difference between the transport of trimers with density-dependent and uniform reorientations in porous media. To study the single agent behavior in porous media we have turned off the interaction between different trimers. In following movies φ o and G vary while τ re = 5.0: • Sigmoidal G: Here G is a sigmoidal function of the local density, as given by Eq. 3 in the main text. Active trimers traverse large distances almost ballistically and reorient almost only at dead ends, where two obstacles form a wedge-shaped trap.
phi obs0.4-sigmoid.webm phi obs0.6-sigmoid.webm • Constant G: Here G is a constant, giving rise to uniform reorientations. The trimers do not sense the environment and reorient with equal probability in the void space or in local cages.
phi obs0.4-uniform.webm phi obs0. 6-uniform.webm For trimers with sigmoidal G, the scanning area around the trimer is displayed by a disk colored by the value of φ local : Blue for small values, white for intermediate values and red for high values. OVITO [1] is used to visualize simulations and make movies.

REVERSE DYNAMICS VS. RANDOM REORIENTATION
It has been suggested recently [2] that reversing the velocity of the active particle is an efficient means to accelerate the dynamics. For the sigmoidal G random reorientation and run-reverse dynamics can hardly be distinguished. In Fig. 1 we compare random reorientation and run-reverse dynamics for both constant G and quorum sensing. The acceleration of the dynamics due to density-sensing is even stronger for run-reverse dynamics (dashed and full green line) than for uniform reorientation (dashed and full red line). Given our simulation of a two-dimensional system, we can only aim for a qualitative comparison to the three-dimensional data of the experiment [3]. In the experiment the bacteria are trapped for times t tr , which are broadly distributed over a range of trapping times 0.4 s...40 s (Fig.4b of ref. [3] ). The relevant quantity to compare to experiment is not τ re but the waiting time: the time between two successive reorientation events. The waiting times of our simulation are also broadly distributed as shown in Fig.3a of the main text. To compare absolute numbers, we estimate the experimental value for t a ∼ 0.1 s (running speed is about 20 µm/s and 2R t ∼ 2 µm). Taking t tr = 4 s as a "typical" value, the ratio is given by t tr /t a ∼ 40. This estimate agrees with our data for the trapping times at high densities (see Fig.5c in the main text) and is furthermore comparable to our theoretical values for the mean waiting time shown in the inset of Fig.3b. However we want to stress again that the comparison is at best qualitative, given that we simulate a two-dimensional system.

GLASSY DYNAMICS
The fraction of localised particles is quantified by Q(t; d). It is displayed in Fig. 2 for d = 0.3L at φ o = 0.4. We observe an intermediate plateau and a second relaxation resembling the glassy dynamics for large reorientation times, τ re ≥ 500. The decay time τ Q is defined as the time at which Q(τ Q ) = 0.6. Fig. 3 exhibits the non-monotonic dependence of τ Q on reorientation time τ re for both constant and sigmoidal G.