It is vital that you have confidence in the results that you have obtained from ZEMAX. Especially in Non- Sequential (NS) mode, it is possible to create very complex geometries, with objects inside of other objects, for example. How do you know whether or not you have made a mistake?
Every so often, you may encounter geometry errors when working in NS ZEMAX or within a hybrid, mixed mode design (Mixed Sequential/Non-Sequential Mode). Geometry errors occur when ZEMAX encounters a section of your design where it is not sure how to trace. These errors are issued via the user interface, and are also logged to the ray database when you are performing an analysis with even millions of rays. It is important to understand that the reported errors are designed to GIVE you confidence that your results are correct. By tracking these errors down, you can have confidence that your system results are accurate.
When geometry errors arise, you need to be able to determine where they come from and how to assess them. There are valuable tools built into ZEMAX (which will be described in this article) that can be used to answer these questions.
As you have probably already guessed, geometry errors are not unique. That is, there is more than one possible scenario or reason as to their existence. In this article, we will cover common reasons for geometry related errors, and illustrate how to locate and fix these errors. Ultimately, these methods may be helpful in diagnosing your own file and aid in determining whether or not the geometry errors require immediate attention. Three of the most frequent causes of geometry related errors are outlined in the table below:
| REASON | DESCRIPTION |
| INVALID PLACEMENT OF ENTRY & EXIT PORTS | Neither the entry or exit ports may intersect with any objects in a Non-Sequential Component (NSC) group. Nor can the exit port be in direct contact with a surface of a Non-Sequential (NS) object. It is important to ensure that both the ports are separated by at least the glue distance from any of the objects in the NSC group. |
| INVALID PLACEMENT OF SOURCES | Sources can exist inside of volume objects, but they must be specified as such using the "Inside Of" flag in the NSC Editor. Sources may not straddle boundaries of volume objects. Misplaced Source Objects will result in geometry errors. |
| INVALID CONSTRUCTION OF SOLID OBJECTS | Sometimes, user defined objects, such as Polygon Objects or Imported Objects, are improperly defined. For example, if a Polygon Object is not fully enclosed, ZEMAX cannot determine when a ray left that object and will issue a geometry error. |
When working in a mixed mode system, it is likely that any issued geometry errors are as a result of invalid placement of entry and/or exit ports. Nonetheless, especially in pure NSC systems, the error message contains useful information as to where the ray trace encountered an error. The reported geometry error message looks something like following:

This error message indicates information about the very first ray which was not successfully traced.
Given these pieces of information, it is possible that in some cases the error in setup becomes quite obvious, though other times it is necessary to further analyze the propagation of the errored ray. Since we have the direction cosines and starting positions of the ray, we could set up a Source Ray to mimic the propagation through our optical system. This isn’t very difficult to do, but ZEMAX has a tool which automates this process for you! To find out more, please advance to the next page.
Any time a geometry error is issued, ZEMAX stores the position and direction cosine information of that ray. These starting values may be used to create a single Source Ray that duplicates the ray with the error. Anytime a geometry error is issued, you may ask ZEMAX to generate this source ray from under the Tools menu of the NSC Editor:
Upon selecting this option, ZEMAX will generate a Source Ray automatically in your NSC Editor with the appropriate position and direction cosines, and turn all of your other sources off by setting the # Layout Rays and # Analysis Rays to zero.
Once the Geometry Error Test Ray is in place, you may use the layouts, ZEMAX Ray Database Viewer, and other diagnostic tools to narrow down the cause for the invalid ray trace. In doing this, it will be helpful to temporarily turn ON the Ignore Errors flag, so that you are not continually issued an error message every time you rotate a plot or move your cursor within the editor:
Note that this a global switch, and it is tied to the Ignore Errors checkbox in the Ray Trace/Detector Control window:
To save and view the details of a ray trace, choose Ignore Errors and save the rays to a desired filename (using the .ZRD extension).
Within the Ray Database (Analysis > Database > Ray Database Viewer), you can view the all of the details of the propagation of the ray, right up to the point in which the error was experienced (denoted by the * in the Z column). This way you can determine the object the ray hit when terminated, the face number of that object, and the entire propagation history. This is very useful in targeting the area of your setup which needs modification in order to proceed without error.
Geometry errors may be an indication of a serious flaw in your setup, leading to erroneous ray tracing results. Thus, it is very important to be able to determine where the error is occurring.
However, it is also important to note that some perfectly good systems occasionally have a few rays fail. This is primarily due to the fact that these rays are incident upon boundaries between facets or surfaces…and accurate intercept points are not possible to compute. These rays are generally “trapped” internally by ZEMAX, and are absorbed or terminated. For the most part, the amount of “lost energy” associated with these rays is small relative to the total power of all sources defined in the design. Therefore, these rays can be safely ignored, as they do not have much significance in the final system results.
So how can you determine the proportion of energy which is lost due to errored rays?
Once a ray trace is complete, ZEMAX will report the lost energy due to thresholds as well as the lost energy due to errors.
This value is reported in absolute units (Watts, for example). If the value of the lost energy is significant, further investigation is required. If the lost energy is extremely small, then chances are just a few rays cannot be traced, and these can be ignored. If the lost energy is small enough to be negligible or if it is zero, then you may proceed with your design in confidence that the ray trace results are correct!
Geometry Errors are issued whenever ZEMAX is not sure how to trace a ray. Common reasons involve ambiguity or error in how objects and surfaces are positioned in ZEMAX. Some examples include:
You can use geometry errors that are issued to track down problems with the definition of your optical system. Sometimes, geometry errors cannot be eliminated completely, and it is perfectly acceptable to have a few rays fail. Typically, the error associated with these errors is minimal, and can be ignored.
If interested in following through some examples which detect and diagnose geometry errors, you may read part II of this two part series:
Design Examples: How To Locate Geometry Errors Part II
References
ZEMAX Optical Design Program User's Guide, ZEMAX Development Corporation