Density functional calculations for stacking faults and grain boundaries in silicon