an error when using the "optimizeposition" function

I want to caculute the best overlap between silicon waveguide mode and a gaussian beam.
The script were written with the reference of lumerical example.

My scripts are as follows,

However, it displays error “optimizeposition is not a valid function or variable name”.

Thanks for your kind help!

Hi, baiyanfei,

did you miss any semicolon in your script?
your script looks fine from above.


One day, I’ve had a similar problem, but with other function. I can’t recall one, since it was non-critical for simulation.
It seemed to me that the programme can’t find the function in its stock.

I checked the script again and found no miss of any semicolon.

The script can work well until the use of optimizeposition function.

Since I need to calculate the overlap with different parameters, it would take a lot of time to click the button “Optimize Position” at various situations.
Did you solve the problem with other functions?

Dear @baiyanfei

It looks like another user has the same problem. Please follow the post in this link:

I am working on his case but If it didn’t answer your question, feel free to continue your question in this post.