  Dipole words are sequences of magnetic dipoles, in which alike elements repel
and opposite elements attract. Magnetic dipoles contrast with more general sets
of bonding types, called glues, in which pairwise bonding strength is specified
by a glue function. We prove that every glue function $g$ has a set of dipole
words, called a dipole code, that attractively encodes $g$: the pairwise
attractions (positive or non-positive bond strength) between the words are
identical to those of $g$. Moreover, we give such word sets of asymptotically
optimal length. Similar results are obtained for a commonly used subclass of
glue functions.
