Fix some bugs with handling ATOM records.

We can't assume that every ATOM record corresponds to some residue
in a sequence.