  We use first principles density functional theory calculations to examine the
effect of multiple anions on the Peierls distortion in the rutile oxyfluoride
TiOF. By using a structure enumeration approach, we obtain the ground state
atomic structure for TiOF and identify the driving forces behind the
experimentally observed two-dimensional anion ordering along rutile (110)
planes. We find that adjacent edge-connected octahedra comprise like atoms with
an --O-O/F-F/O-O/F-F-- pattern along the rutile [001] direction. This anion
pattern coexists with a Peierls-like distortion leading to the formation of a
singlet state between neighboring Ti$^{3+}$ cations. We show that the anion
ordering arises from competition between electrostatic interactions, owing to
the Ti-F cation-anion pairs, and the tendency of the $d^1$ Ti$^{3+}$ cation to
form Ti-Ti dimers, characterized by increased metal-metal bonding. We find that
the addition of strong on-site Coulombic interactions to the Ti $d$ manifold
suppresses the formation of the singlet state. By increasing the correlation
strength, we uncover two first-order phase transitions: first, from a
nonmagnetic insulator to a ferromagnetic half-metal, and then second to a
ferromagnetic insulator. Last, we show that the electronic configuration of the
transition metal cation in rutile oxyfluorides is responsible for the observed
anion order, enabling design of ordered heteroanionic materials exhibiting
collective phenomena through cation sublattice control.
