The zip archive which accompanies this article (which can be downloaded from the final page of the article) contains a starting point design beam_expander.zmx. This is intended to be a 5x beam expander, working at the red He-Ne line, and to have minimum RMS wavefront error. In the starting design there is no power in the optics and therefore no beam expansion:

The starting design of the beam expander

The starting design

Click on System > General  and choose "Afocal Image Space" so that ZEMAX computes all parameters in afocal units.

Turn on the afocal image space units

Then open the merit function (Editors > Merit Function) and select Tools > Default Merit Function:

The default merit function tool

Note that we can build a default merit function to minimize wavefront error, spot radius (and x, y individually) or angular error as a radius or as x and y separately. In this case, we will choose Wavefront, and use 5 rings in the Gaussian quadrature algorithm because we want a well-corrected system. Press OK to build the default merit function.

The only extra information ZEMAX needs is the size of the output beam. The input beam is 5 mm, and the magnification is x5, so the output beam should have a diameter of 25 mm. Insert a new operand before the DMFS statement in the merit function, and enter the REAY operand as follows:

The REAY operand

This requires the real ray y-coordinate on surface 6 (the image surface) to have a height of 12.5 mm. Then click Tools >  Optimization > Optimization and press the Automatic button!

Press the Automatic button

ZEMAX quickly optimizes the afocal system:

The afocal system after optimization