An atomistic calculation of extended planar defects in ionic crystals Application to stacking faults in the alkali halides