Disclosed is a method and system for measurement of periodic gratings which
have deviations which result in more than two materials occurring along at
least one line in the periodic direction. A periodic grating is divided
into a plurality of hypothetical layers, each hypothetical layer having a
normal vector orthogonal to the direction of periodicity, each
hypothetical layer having a single material within any line parallel to
the normal vector, and at least one of the hypothetical layers having at
least three materials along a line in the direction of periodicity. A
harmonic expansion of the permittivity .epsilon. or inverse permittivity
1/.epsilon. is performed along the direction of periodicity for each of
the layers including the layer which includes the first, second and third
materials. Fourier space electromagnetic equations are then set up in each
of the layers using the harmonic expansion of the permittivity .epsilon.
or inverse permittivity 1/.epsilon., and Fourier components of electric
and magnetic fields in each layer. The Fourier space electromagnetic
equations are then coupled based on boundary conditions between the
layers, and solved to provide the calculated diffraction spectrum.