This will need you to modify and develop a new code for Q optimization, as the lumopt is mainly for waveguide propagation design. You can refer the Github https://github.com/SiEPIC/SiEPIC-Tools/blob/master/PythonLumericalTools/lumerical/load_lumapi.py https://readthedocs.org/projects/lumopt/downloads/pdf/latest/ https://lumopt.readthedocs.io/en/latest/basic_theory.html