Fixed error in getClusterOnSiteEnergy function in PBC code