Mend_pairs.c

a prelim. draft for Mend pair calculation