Charge transfer effects in KNbO3 and sodium