Script commands to calculate EQE of solar cell as a function of wavelength


Dear aalam, Thank you very much your kind effort. However, can you help me by giving suggestion and providing script of
measurement of external quantum efficiency (EQE) of solar cells at each wavelength from 400 um to 1100 um. Let me clear, we want to measure EQE automatically in device simulation at many wavelengths in the range of 400 um to 1100 um to see perfectly in which wavelengths optical adsorptions contribute to the real Jsc announcement. For that, we need to extract solar generation file from optical FDTD simulation for each wavelength and to import this solar generation into device simulation for the same wavelength to see the real conversion of photo current to the electrical current at particular wavelength. By that we can easily see the parasitic photo current profiles which basically does not contribute to the electrical current. So, for that, we need a script what can perform both simulations (FDTD & Device) simultaneously and to measure Jsc at each and same wavelength for many cases automatically.
For your understanding, I attached a script file of EQE of CMOS image sensor that works for different angles. I got it in Lumerical website. We are also looking similar script that can perform for solar cells in different wavelengths.Once again thanks for your help! cis_QE.lsf (2.5 KB)

simulation failing with error message:error during matrix solve

Hi @mj.mendes, My apologies for the tardy reply. I was out of office in the later part of last week and could not get to your question earlier. From your question, my understanding is that you would like to calculate the EQE of your solar cell as a function of wavelength. Is that right? Since the calculation of EQE does not require the use of solar spectrum (the input power gets normalized) you can potentially calculate the EQE as a function of wavelength using the “power absorbed” analysis group which will give you the absorbed power as a function of wavelength. You can then calculate the generation rate from this (G = P / Ephoton) as a function of wavelength and load the data in DEVICE. Finally you can run a sweep in DEVICE to run multiple simulations by sweeping the wavelength index in the data that you’ve loaded into the import optical generation object. The new import optical generation object allows you to import data as a function of some parameter (such as wavelength).

I have created an example based on the simple solar cell example in KB ( to demonstrate this.

  1. Run the solar_EQE_lambda.fsp (269.3 KB) file in FDTD. After running the simulation use the following script commands to save the absorbed power data in a .mat file:

Pabs = getresult("Pabs","Pabs"); matlabsave("Pabs.mat",Pabs);

Note that this Pabs data is a function of wavelength/frequency.

  1. Open the solar_EQE_lambda.ldev (6.3 MB) file in DEVICE. Load the generation rate data into the import generation object using the import_gen_data.lsf (736 Bytes) script file.

  2. Run the sweep “lambda” to sweep the wavelength index of the import generation object. The bias is set up at zero so the current value will be the short circuit current.

  3. Once the sweep is run, use the calculate_EQE.lsf (263 Bytes) script file to calculate the EQE as a function of wavelength (and plot it).

NOTE: The sweep was set up to run for a few points only for demonstration purpose. Also note that I have set the input power to 1000 W/m^2 in the script. However the value itself does not matter since in the EQE calculation the current is divided by the optical power.

Please let me know if you have any questions.


A post was split to a new topic: Solar cell simulation with angled incidence


Dear sir, will you plz modify the code so that we can apply periodic condition.(like solar generation group, i.e: in that group we simulate a small region and by applying specific periods we can get the whole generation and it saves our value able time).
Say I simulated the region of x=-0.25 to 0.25 um region but I want to apply periodic condition and periods of 10 will be me the generation rate between x=-2.5um to 2.5um (In 2D case)

Thanks sir, looking for your reply :slight_smile:


Hi @1105058.mmah, Sorry for the wait. I have modified the script file that imports the data into DEVICE and applies it to the import generation object. The script now copies the data in either x or y direction depending on the value set in the variable “dimension”. The number of periods is set by the variable “period”. The copying (extending) will only work in 2D but you should be able to modify the script in a similar way to make it work for 3D as well (if needed).

Here is the modified script: import_gen_data_periods.lsf (1.5 KB)


Hi @aalam, If you modify the file script entitled “calculat_EQE”, to get the proper results for 3D solar cell.
Or the above steps valid for 3D solar cell?,if not, could you explain how to get the EQE for it?
Thank you


Hi @gsvp6, The script should work for 3D simulations as well. Give it a try and let me know if you have any problem.


Hi @aalam, I wanna thank you for your replying. I had tried it already but the following message appears.

Could you help me to get the mistake?
Thank you


Hi @gsvp6, The lambda value should come from the other script “import_gen_data.lsf”. When you run it in step 2, it reads lambda from the .mat file. You can copy the first few lines from the script to reload the value of lambda. These should do the trick:

matlabload("Pabs.mat"); Pin = 1000; # 1000 W / m^2 x = Pabs.x; y = Pabs.y; z = Pabs.z; lambda = Pabs.lambda; f = Pabs.f; P = Pabs.Pabs;

You will need the value of lambda and Pin from here for the final script file.


Hi @aalam, Thank you for your replying.
I ran the “import_gen_data” before the “EQE_code” to get the proper results. However, when I had run the “EQE_code”, the following window appeared:

Could you help me?

Also, in 3D CHARGE, the norm length isn’t used, as I know. Is the previous “EQE_code” valid in 3D CHARGE?


Hi @gsvp6, Thanks for pointing this out. I have checked the files and you are right. The calculate_EQE script needs to be changed slightly to make it work in 3D. The only change would be on line 7 where you will have to use “y span” instead of “norm length” since you are doing a 3D simulation. Everything else can remain as it is.

Jsc = Isc/getnamed("CHARGE","x span")/getnamed("CHARGE","y span"); # A/m^2


Hi @aalam, thank you for your effort.
While I had tried to ran the “EQE_code” to get the proper results, the following window appeared. Could you help me?


It looks like that the index for lambda that you have in the sweep has values larger than the total number of frequency (wavelength) points in the data you got from FDTD. Can you check what are the index values in your sweep and how many data points you had in your Pabs data from FDTD?
If you are running the scripts on your own file then please make sure that you adjust the sweep in DEVICE to match the number of frequency points you have in your FDTD simulation.


Dear Sir,

When increasing the “number of points” over than 15 points in the sweep to smooth “EQE curve”, the following window appears:

Could you help me to overcome this issue?

Thanks in advance


Hi @gsvp6, if you want to increase the number of points in the sweep then you have to make sure that you have that many points in the generation data as well (from your FDTD simulation). My guess is your sweep is trying to set the index of the generation data to a value larger than the size of the data in the import generation object.