ZPL Solve: Diffraction grating Littrow angle solve

  • 24 January 2023
  • 1 reply


Just a very simple ZPL solve to set the incident angle of a transmissive diffraction grating to the Littrow angle for order m = -1.


#Define pi
pi = 2*ACOS(0)

x = SOSO(0) #get preceeding coord break surface number

L = WAVL(PWAV()) #get primary wavelength
G = PARM(1,x+1) #return Lines/um from grating (pg 319)

Litt = asin(L*G/2)*180/pi #Calculate Littrow angle

solvereturn Litt


Just thought I’d share it to potentially save others a little time.

It could be expanded for additional orders.

1 reply

Userlevel 6
Badge +2

Hi James! Thank you for posting this. This is great.

I have created a quick file using it. I have modified "{Zemax}\Samples\Sequential\Diffractive components\Sample Spectrometer.zos"and it works well. I have attached my file. The ZPL solve is part of the zar file.

I have changed the tag to “Code Exchange-Verified”.

Thank you!