improvement to calcualte atom distance consider pbc and record positions in xy plane