How are proteins containing other elements encoded?
Let's use an example, a case in point: the best known and plentiful one would be hemoglobin. It is a protein formed through the association of alpha- and beta-globin peptides into dimers or tetramers. The shape is largely a result of the sequence (peptide folding is reproducible, especially with the help of chaperones which may aid the correct folding process) and they fulfill their function by making use of an iron atom which they capture allow for their oxygen-carrying capacity. The iron is not encoded (since it's not an amino acid) but the sequence certainly determines the ability for globins to come together and sequester iron. If you wish, you could mutate the sequence to produce globins which would have reduced (or a complete inability) to use iron at their cores! The organism would be anemic, and depending on the extent of the effect, would be impaired or die.
Quoting the beta-globin gene page:

More than 10 mutations in the HBB gene have been found to cause
methemoglobinemia, beta-globin type, which is a condition that alters
the hemoglobin within red blood cells. These mutations often affect
the region of the protein that binds to heme [iron].

Lastly, a quick note on exactly how iron fits into the picture... inorganic iron can't simply be sequestered by the hemoglobin protein. The iron atom must first be covalently bound to form an organic compound called a heme group (see picture 1 below) which then acts as a 'prosthetic group' for the hemoglobin protein. When both enzymatic protein and prosthetic group come together, we jointly call them a holoenzyme, the complete unit which performs the oxygen capturing, carrying and releasing function inside red blood cells (see picture 2 below).