Scoring function for automated assessment of protein structure template quality