Solved

OpticStudio metalens example doesnt work

  • 23 October 2023
  • 12 replies
  • 432 views

I have the latest version of OpticStudio and am trying to run an example https://optics.ansys.com/hc/en-us/articles/18254409091987

When I open the.zprj file from step 6 of the manual, I get the following error (Image attached). What is wrong with it? How I can fix it?

icon

Best answer by Niki 24 October 2023, 18:46

View original

12 replies

Userlevel 7
Badge +2

Hi @Mery,

 

I believe this is a duplicate of:

In general, it is a good practice to post your question only once. One of the main reason being that someone might find one of the posts and starts working on an answer, while the other post could be answered already. Thereby wasting time for that person. Please consider that most people who contribute to that community are doing it for free, and I’m sure you wouldn’t want them to spend time answering a question that was already answered elsewhere. Please consider deleting one of the questions, or ask Zemax staff if you do not manage yourself.

I have never tried this example, do they also give you the source code of that DLL? You could try to recompile it for your machine. Also, can you confirm that the users is correct in the path, since you masked it in your screenshot it is hard to say, but is it the same as in your file explorer?

I hope you find a solution soon. Take care,

 

David

Hi @David.Nguyen ,

 

I first posted it in the general question section and then found the DLL section more appropriate for this question. 

 

Yes, the path is correct. This example is very new, and I had a number of troubles with the Lumercal steps first. Lumerical part was somehow solved.

 

The dll is provided in the installation file of the R2.02 version of OpticStudio as the default file. No source code is provided. It probably handles the .h5 database to be correctly imported to OpticStudio.

 

Kind regards,

Mery

 

 

Hi Mery,

Thank for reaching out! I have followed your posts on our forums and I am currently trying to find the reason you are facing this issue. Can you please inform me wether or not you have followed the previous steps of our Large-Scale Metalens – Ray Propagation article? Have you managed to generate the .h5 file? Following the steps 2 and 3?

Kind Regards,

Niki

Let’s keep the discussion on this post. Please reply only here, and when we end up finding the cause I can update the other forum posts as well.

Hi Niki,

 

Yes, I followed the previous steps of the example. The issue I was having when following steps 2 and 3 was that the command to create h5 file only works in the 2023 version of Lumerical. I had version 2022. Unfortunately, this is a common computer, and I could not update the Lumerical to the 2023 version, so I packaged h5 in Matlab. I followed the structure described in the Lumerical script. The file seems fine. It is attached here. The size of the lens is decreased for memory considerations. Throughout the process, I was helped by the tech support from Lumerical.

Then I tried to run zprj file in OpticStudio. It appeared that I can't open it in OpticStudio, and I couldn't find any information about zprj files support in OpticStudio. Lumerical support suggested that I have an old version of OpticStudio, which was R2.1. I installed R2.02 version, and now zprj file is readable. It is apparently sort of a zip file that creates a lot of different files in my folder. 

 The current problem is when I run zprj file, it automatically changes metasurface layer to standard and shows the error of dll file. When I change it to user-defined and choose any other dll from the Surface folder, it has no errors. 

 

Additionally, step 5 says: 

  1. Locate the 3 .dll files lumhdf5.dll, lumhdf5_hl.dll, and zlib1.dll in the install folder of Lumerical and copy them in the installation folder of Zemax

I am not sure what does word installation folder means. Step 3 clearly shows the path, here I am not sure where I suppose to copy it. I copied it to the Surface folder as can be seen from provided screenshot.

 

I hope that my story will help people, as I guess I somehow stumbled over each step of the manual:)

 

Kind regards,

Mery

Hi Mery,

Thank you for sharing your .h5 file and your detailed explanation!

I managed to make it work with your file from my end. I currently have Ansys Zemax OpticStudio 2023 R2.02 version. What I did was to locate the lumhdf5.dll, lumhdf5_hl.dll, and zlib1.dll files. In my case they were here: C:\Program Files\Lumerical\v232\bin. I suppose it is the same for you if not you can search your pc and find them. I copied and pasted them here: C:\Program Files\Ansys Zemax OpticStudio 2023 R2.02. Again I believe that you should have this folder in the same location. If not search for Ansys_Zemax_OpticStudio_Prerequisites on your pc, right click and then open file location, you should see a folder with some more folders and .dll files:

I renamed the .h5 file that you send me to rcwa_R10mm_f300mm.h5 and put it into the Zemax>DLL>Surfaces folder. You can find this folder by following the steps below:

  1. Open ZOS
  2. Go to Set up Tab
  3. select OpticStudio Preferences
  4. Select Folders 
  5. Find were the Data are located
  6. Copy and paste this path to your folder explorer

  7. Find the DLL file

  8. Find the surfaces file

  9. Paste the .h5 file there:

 

I hope that works for you as well! Please let me know either way!

Hi Niki,

 

I followed all your instructions, and the error is still there. 

 

Kind regards,

Mery

Hi Mary,

I am sorry to hear that. Will you be able to send me some screenshots as I did above to confirm that the files are at the right place? Also, is there a chance that you have the previous version of Zemax still installed? If yes, you might need to uninstall it, and again make sure that you are placing the files at the right folders and not on a previous version of Zemax.

Kind Regards,

Niki

Hi Niki,

 

These are the screenshots; please let me know if you need anything else. Just to remove the topic from the conversation I deleted all other versions of Ze

max from a computer. The folder, though, was correct.

 

Maybe I can use your lumerical-metasurface xxx.dll maybe I have a broken one?

 

I attached one more screenshot that shows clearly that the program sees dll file.

 

Kind regards,

Mery

Hi Mery,

I noticed on your screenshots that your .dll files have an old timestamp, hence I believe you need to update them. You can find more information here: Zemax - Lumerical RCWA dynamic linking updates & known bugs .

Also, running a repair from of the OpticStudio installation, or even unstalling and reinstalling the Software might help you overcome this issue.

Hope that helped!

Hi Niki,

 

Repairing the program worked!

 

Kind regards,

Mery

Hi @Niki 

I am encountering a similar issue to Mery's. I have attached a screenshot for reference. I was following the instructions provided at https://optics.ansys.com/hc/en-us/articles/18254409091987-Large-Scale-Metalens-Ray-Propagation.

I successfully completed up to step 5, following the guidance provided above. However, at step 6, neither the .zprj file nor the .dll for my metasurface was generated. I also tried to do repair and reinstall.

Could you advise on how I might resolve this issue?

 

Hi Minjeong,

Thank you for your question. Correct me if I am wrong, you fully completed step 5 and you are now expecting to see a .zprj file in your local disk? If that’s the case I think you are lookin on the wrong place. The .zprj file is in your downloaded from the example files: 

Hope that was helpful, let me know if I am missing something though.

Kind Regards,

Niki

Reply