Nonlinear optical coefficients in group IV and III-V semiconductors