Controlling the phases of matter is a challenge that spans from condensed materials to biological systems. Here, by imposing a geometric boundary condition, we study the controlled collective motion of Escherichia coli bacteria. A circular microwell isolates a rectified vortex from disordered vortices masked in the bulk. For a doublet of microwells, two vortices emerge but their spinning directions show transition from parallel to anti-parallel. A Vicsek-like model for confined self-propelled particles gives the point where the two spinning patterns occur in equal probability and one geometric quantity governs the transition as seen in experiments. This mechanism shapes rich patterns including chiral configurations in a quadruplet of microwells, thus revealing a design principle of active vortices.
!!!All Science Journal Classification (ASJC) codes