kch3782 / torcwa

GPU-accelerated RCWA with automatic differentiation
Other
102 stars 20 forks source link

Materials module not installed #12

Closed MahmutRuzi closed 1 year ago

MahmutRuzi commented 1 year ago

Thank you for making it publicly available. I installed it. But it seems the Materials module is not available upon installation. Hope it could be fixed. But I imported some refractive indices data from https://refractiveindex.info and run some simulations. It worked.

Besides, it would be great if a few more materials (for example, silicon) could be added to materials. Or even better, a module to import refractive indices from the the database.

Another improvement could be providing some estimation of how much time it takes to complete each example.

Anyway, thanks again !

kch3782 commented 1 year ago

The examples can be simulated using Materials.py in the Example folder. The reason why Materials.py is not included in the package when installing is that it cannot be used in general cases and can be used only for amorphous silicon. Our group is testing the general material code internally and plans to add it to the torcwa package later. Importing from a database like refractiveindex.info is a good suggestion. We will consider adding these features if possible.

The time taken varies depending on the device and environment, so I did not show the time on GitHub. Instead, for some selected environments, times according to truncated Fourier order are presented in the torcwa paper. You may want to refer to this.

Thank you.

MahmutRuzi commented 1 year ago

Thank you for the timely response ! I tried the package for silicon nano-disks and able to reproduce Figure 2a of this paper. Very quick and results are very close !

I also tried it on some metals in the IR range, and get pretty good results ! Impressive. I have a few other comments & questions.

1) PyTorch supports Mac m1 GPU and AMD GPU as well. Right now, TORCWA seems to support only Nvidia GPU. I'm not sure how much an effect it takes to extend the GPU support. It would be great it it can work in other GPUs as well.

2) Did you try it on HPC clusters ? If yes, what is the best CPU/GPU ratio ? Besides, does it get faster if the wavelength is divided into n CPUs ? Ot is it already fast enough due to GPU?

3) Is there a function to get & plot the epsilon values of a layer ? and plot according to the epsilon value using plt.pcolormesh? Also similar visualisation along the vertical cross-section would be helpful, too.

Cheers

kch3782 commented 1 year ago
  1. We will test other GPUs later. Thanks for the great suggestion.

  2. It is difficult to give an answer now, because we have not been able to test HPC cluster. We will try it later if we have enough computer resources.

  3. The rcwa class does not save the epsilon value on the grid, but only values after Fourier transform. The function that recovers the epsilon value stored as the Fourier order value for a specific layer onto a uniform grid is as follows.

    eps_recover, mu_recover = rcwa.return_layer(layer_num=0,nx=100,ny=100)

However, please note that the output of this function is different from the distribution of epsilon values used for actual input. We will also consider adding a function to get or visualize the vertical cross-section in the future.

Thank you.

MahmutRuzi commented 1 year ago

Thanks for the detailed response.
Hope more researchers will discover & use it.