An automated classification of the structure of protein loops