Taylor Robertson
Ansys Employee

Hello Matthias,

You have defined the indices of GaN as a list, but the materials need to be defined as a arrays, or using a string for the predefined materials in material library. In python [,,] creates a list data type which you need to convert to np array.

Passing-Data-Python-API

This type conversion between python and lsf can get a little complicated. I would suggest keeping it as simple as possible.

mode.setmaterial(material, "Refractive Index", np.array(n_GaN))
mode.setmaterial(material, "Imaginary Refractive Index", np.array([0, 0, 0]))