Free energy of active atoms in grain boundaries of nanocrystalline copper, nickel and palladium