When the grating is formed and exposed to the atmosphere, n-type impurity dopants such as Si and O inevitably stick to the grating, which equivalently lowers the carrier density in this interface region of the p layer and therefore raises the resistance.