# Lumerical crashing on custom lsf code

Dear Lumerical,

I wrote some code which uses your custom_source example. Unfortunately, it crashes Lumerical without notice, repeatedly. Here is the code: crash.lsf (3.5 KB).

Thanks!

This might have to do with your other post. Try setting the MATLAB integration status to inactive or use the libeng.dll from 2018b or previous release that is licensed.

One more thing is that you should use addimportedsource instead of addmode (line 35) for a custom source. The mode source solves and injects the modes using an FDE solver, whereas the imported source allows you to inject a source using calculated or imported data.

-Regards
Taylor

Hi @trobertson,

I’m not sure this has anything to do with the Matlab integration, since there are no calls to Matlab from this script. I think I traced the cause to trying to inject 2D data (the rectilinear dataset in the script) to a 2D simulation, where I should actually define it in 1D, as mentioned in one of your examples on the website.
Thanks also for the tip about the addimportedsource, both of these changes seem to make it all work now. But I guess the issue of Lumerical crashing without notification should still be fixed

Did your project window crash completely or did the simulation fail to run? I did some investigating, and experienced error code 1726 when using MATLAB 2019a integration.

I was able to replicate this with a couple different examples, which ran correctly after I switched to MATLAB 2018b libeng.dll. It is strange behavior that I will certainly look into further. In order to rectify this anomaly I would appreciate if you could confirm that we experienced the same behavior or share any further information regarding your script malfunction. Thank you for sharing the information I asked for in the other post. It really helps us to replicate the issue which is the first step in resolving it.

-Thanks

Hi @trobertson,

I did not see that window. The program just shut down, disappearing immediately from windows. I’m not sure if I can somehow generate a log file that would help you?

If you could replicate the issue and share your sim and log file that would be very helpful.

-Thanks

Hi @trobertson,

So I tried running the script I attached previously, without the last line (“run”), and then just save an FSP file. When I click “save”, FDTD crashes! I also do not get any chance of seeing a log and a logfile is also not generated. Apparently, the script is all I can share.
Let me know if there’s something else I could do.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.