edits to pairwisepotentials.m