The following is the definition of heavyAtoms_end in Residue.hh
Atoms::const_iterator heavyAtoms_end() const
return atoms_.begin() + nheavyatoms() - 1;
With this definition, any loop of the form for( conformation::Atoms::const_iterator blah = res.sidechainAtoms_begin(); blah != res.heavyAtoms_end(); ++blah), will SKIP iterating over the LAST heavyatom in the residue. From my understanding of the iterator concept, the end iterator should always point to one past the last element to be accessed.
Is this a bug or am I missing something here?