wild - type bacillus subtilis cells ( strain 168 ) were grown in terrific broth ( sigma ) . a monoclonal colony was transferred from an agar plate to 25 ml of medium and left to grow overnight at 35c on a shaker . the culture was diluted 200-fold into fresh medium and harvested after approximately 5 hours when more than 90% of the bacteria were swimming , as visually verified on a microscope . 10 ml of the suspension was then concentrated by centrifugation at 1500 g for 10 minutes , resulting in a pellet with volume fraction approximately 20% which was used without further dilution . the microchambers were made of polydimethyl siloxane ( pdms ) bound to a glass coverslip by oxygen plasma etching . these comprised a square , triangular or linear lattice of ~ 18 m - deep circular cavities with 60 m between centres , each of diameter ~ 50 m , connected by 425 m - wide gaps for linear and square lattices ( fig . 1a , e ; supplementary fig . 6 ) and 1025 m - wide gaps for triangular lattices ( fig . 3a approximately 5 l of the concentrated suspension was manually injected into the chamber using a syringe . we imaged the suspension on an inverted microscope ( zeiss , axio observer z1 ) under bright field illumination , through a 40 oil - immersion objective . movies 10 s long were recorded at 60 f.p.s . on a high - speed camera ( photron fastcam sa3 ) at 4 and 8 minutes after injection . though the pdms lattices were typically ~ 15 cavities across , to avoid boundary effects and to attain the pixel density necessary for piv we imaged a central subregion spanning 6  6 cavities for square lattices , 7  6 cavities for triangular lattices , and 7 cavities for linear lattices ( multiple of which were captured on a single slide ) . fluorescence in supplementary video 3 was achieved by labelling the membranes of a cell subpopulation with fluorophore fm4 - 64 following the protocol of lushi et al.16 the suspension was injected into an identical triangular lattice as in the primary experiments and imaged at 5.6 f.p.s . on a spinning - disc confocal microscope through a 63 oil - immersion objective . for each frame of each movie , the bacterial suspension flow field u(x , y , t ) was measured by standard particle image velocimetry ( piv ) without time averaging , using a customized version of mpiv ( http://www.oceanwave.jp/softwares/mpiv/ ) . piv subwindows were 16  16 pixels with 50% overlap , yielding ~ 150 vectors per cavity per frame . cavity regions were identified in each movie by manually placing the centre and radius of the bottom left cavity , measuring vectors to its immediate neighbours , and repeatedly translating to generate the full grid . pillar edges were then calculated from the cavity grid and the gap width ( measured as the minimum distance between adjacent pillars ) . the spin vi(t ) of each cavity i at time t is defined as the normalized planar angular momentum vi(t)=z^.[(x , y)iri(x , y)u(x , y , t)]u(x , y)i|ri(x , y)| , where ri(x , y ) is the vector from the cavity centre to ( x , y ) , and sums run over all piv grid points ( x , y)i inside cavity i. for each movie , we normalize velocities by the root - mean - square ( rms ) suspension velocity u=u(x , y , t)21/2 , where the average is over all grid points ( x , y ) and all times t , to account for the effects of variable oxygenation on motility9 ; we found an ensemble average e[u]=12.1ms1 with s.d . this definition has vi(t ) > 0 for counter - clockwise spin and vi(t ) < 0 for clockwise spin . a vortex of radially - independent speed , i.e. u(x , y , t)=u^ where ^ is the azimuthal unit vector , has vi(t ) = 1 ; conversely , randomly oriented flow has vi(t ) spin correlation  of a movie is then defined as =i~jvi(t)vj(t)i~j|vi(t)vj(t)| , where i~j denotes a sum over pairs { i , j } of adjacent cavities and    denotes an average over all frames . if all vortices share the same sign , then  = 1 ( ferromagnetism ) ; if each vortex is of opposite sign to its neighbours , then  = 1 ( antiferromagnetism ) ; if the vortices are uniformly random , then  = 0 . similarly , the circulation pj ( t ) about pillar j at time t is defined as the normalized average tangential velocity pj(t)=(x , y)ju(x , y , t)t^j(x , y)u(x , y)i1 , where t^j(x , y ) is the unit vector tangential to the pillar , and sums run over piv grid points ( x , y)j closer than 5 m to the pillar j. results presented are typically averaged in bins of fixed gap width . all plots with error bars use 3 m large bins , calculated every 1.5 m ( 50% overlap ) , and bins with fewer than 5 movies were excluded . c ; supplementary figs . 4 & 7 ) are 8 , 8 , 13 , 14 , 21 , 27 , 27 , 22 , 18 , 22 , 20 , 11 , 7 , 13 , 7 ; bin counts for triangular lattices ( fig . 3d ) are 5 , 14 , 16 , 13 , 16 , 15 , 5 , 5 , 10 , 7 ; and bin counts for linear lattices ( supplementary fig . 6 ) are 5 , 7 , 8 , 8 , 9 , 9 , 6 , 5 , 6 , 7 , 6 , 8 , 9 , 5 , 6 , 5 , 6 . wild - type bacillus subtilis cells ( strain 168 ) were grown in terrific broth ( sigma ) . a monoclonal colony was transferred from an agar plate to 25 ml of medium and left to grow overnight at 35c on a shaker . the culture was diluted 200-fold into fresh medium and harvested after approximately 5 hours when more than 90% of the bacteria were swimming , as visually verified on a microscope . 10 ml of the suspension was then concentrated by centrifugation at 1500 g for 10 minutes , resulting in a pellet with volume fraction approximately 20% which was used without further dilution . the microchambers were made of polydimethyl siloxane ( pdms ) bound to a glass coverslip by oxygen plasma etching . these comprised a square , triangular or linear lattice of ~ 18 m - deep circular cavities with 60 m between centres , each of diameter ~ 50 m , connected by 425 m - wide gaps for linear and square lattices ( fig . 1a , e ; supplementary fig . 6 ) and 1025 m - wide gaps for triangular lattices ( fig . 3a approximately 5 l of the concentrated suspension was manually injected into the chamber using a syringe . we imaged the suspension on an inverted microscope ( zeiss , axio observer z1 ) under bright field illumination , through a 40 oil - immersion objective . movies 10 s long were recorded at 60 f.p.s . on a high - speed camera ( photron fastcam sa3 ) at 4 and 8 minutes after injection . though the pdms lattices were typically ~ 15 cavities across , to avoid boundary effects and to attain the pixel density necessary for piv we imaged a central subregion spanning 6  6 cavities for square lattices , 7  6 cavities for triangular lattices , and 7 cavities for linear lattices ( multiple of which were captured on a single slide ) . fluorescence in supplementary video 3 was achieved by labelling the membranes of a cell subpopulation with fluorophore fm4 - 64 following the protocol of lushi et al.16 the suspension was injected into an identical triangular lattice as in the primary experiments and imaged at 5.6 f.p.s . on a spinning - disc confocal microscope through a 63 oil - immersion objective . for each frame of each movie , the bacterial suspension flow field u(x , y , t ) was measured by standard particle image velocimetry ( piv ) without time averaging , using a customized version of mpiv ( http://www.oceanwave.jp/softwares/mpiv/ ) . piv subwindows were 16  16 pixels with 50% overlap , yielding ~ 150 vectors per cavity per frame . cavity regions were identified in each movie by manually placing the centre and radius of the bottom left cavity , measuring vectors to its immediate neighbours , and repeatedly translating to generate the full grid . pillar edges were then calculated from the cavity grid and the gap width ( measured as the minimum distance between adjacent pillars ) . the spin vi(t ) of each cavity i at time t is defined as the normalized planar angular momentum vi(t)=z^.[(x , y)iri(x , y)u(x , y , t)]u(x , y)i|ri(x , y)| , where ri(x , y ) is the vector from the cavity centre to ( x , y ) , and sums run over all piv grid points ( x , y)i inside cavity i. for each movie , we normalize velocities by the root - mean - square ( rms ) suspension velocity u=u(x , y , t)21/2 , where the average is over all grid points ( x , y ) and all times t , to account for the effects of variable oxygenation on motility9 ; we found an ensemble average e[u]=12.1ms1 with s.d . this definition has vi(t ) > 0 for counter - clockwise spin and vi(t ) < 0 for clockwise spin . a vortex of radially - independent speed , i.e. u(x , y , t)=u^ where ^ is the azimuthal unit vector , has vi(t ) = 1 ; conversely , randomly oriented flow has vi(t ) = 0 . spin correlation  of a movie is then defined as =i~jvi(t)vj(t)i~j|vi(t)vj(t)| , where i~j denotes a sum over pairs { i , j } of adjacent cavities and    denotes an average over all frames . if all vortices share the same sign , then  = 1 ( ferromagnetism ) ; if each vortex is of opposite sign to its neighbours , then  = 1 ( antiferromagnetism ) ; if the vortices are uniformly random , then  = 0 . similarly , the circulation pj ( t ) about pillar j at time t is defined as the normalized average tangential velocity pj(t)=(x , y)ju(x , y , t)t^j(x , y)u(x , y)i1 , where t^j(x , y ) is the unit vector tangential to the pillar , and sums run over piv grid points ( x , y)j closer than 5 m to the pillar j. results presented are typically averaged in bins of fixed gap width . all plots with error bars use 3 m large bins , calculated every 1.5 m ( 50% overlap ) , and bins with fewer than 5 movies were excluded . . 4 & 7 ) are 8 , 8 , 13 , 14 , 21 , 27 , 27 , 22 , 18 , 22 , 20 , 11 , 7 , 13 , 7 ; bin counts for triangular lattices ( fig . 3d ) are 5 , 14 , 16 , 13 , 16 , 15 , 5 , 5 , 10 , 7 ; and bin counts for linear lattices ( supplementary fig . 6 ) are 5 , 7 , 8 , 8 , 9 , 9 , 6 , 5 , 6 , 7 , 6 , 8 , 9 , 5 , 6 , 5 , 6 .
despite their inherent non - equilibrium nature1 , living systems can self - organize in highly ordered collective states2,3 that share striking similarities with the thermodynamic equilibrium phases4,5 of conventional condensed matter and fluid systems . 
 examples range from the liquid - crystal - like arrangements of bacterial colonies6,7 , microbial suspensions8,9 and tissues10 to the coherent macro - scale dynamics in schools of fish11 and flocks of birds12 . yet , the generic mathematical principles that govern the emergence of structure in such artificial13 and biological69,14 systems are elusive . 
 it is not clear when , or even whether , well - established theoretical concepts describing universal thermostatistics of equilibrium systems can capture and classify ordered states of living matter . here , 
 we connect these two previously disparate regimes : through microfluidic experiments and mathematical modelling , we demonstrate that lattices of hydrodynamically coupled bacterial vortices can spontaneously organize into distinct phases of ferro- and antiferromagnetic order . 
 the preferred phase can be controlled by tuning the vortex coupling through changes of the inter - cavity gap widths . 
 the emergence of opposing order regimes is tightly linked to the existence of geometry - induced edge currents15,16 , reminiscent of those in quantum systems1719 . 
 our experimental observations can be rationalized in terms of a generic lattice field theory , suggesting that bacterial spin networks belong to the same universality class as a wide range of equilibrium systems .