# Modifying GRAPE for open quantum systems

This question requires the knowledge of GRAPE. More info can be found here and in this short presentation.

I have tried to modify the grape_unitary() function in grape.py also to accommodate open quantum systems. One can use it to generate time varying fields for synthesising unitaries for them. I have tried to run it for the same system as in this jupyter notebook.

I have run into a problem as to some sets of collapse operators give spurious overlap values.

The code seems to work well for the closed system, though it is slower than the original jupyter notebook. Here is the code

fsa.py is the file analogous to grape.py. tca.py is the example file (almost entirely based on this notebook ) where I run it for a closed quantum system (as in the aforementioned notebook). otca.py, otca1.py and other otca*.py are files where I run them for various collapse operators. tej_plotter.py is just a small python script file to save graphical representation of the final unitaries.

The explanation of the main idea is here. An updated version will be found here

$$\begin{array} {|r|r|}\hline file & output & collapse\ operator \\ \hline tca.py & copA0 & none \\ \hline otca.py & ocopA0 & x \otimes y \\ \hline otca1.py & o1copA0 & x \otimes y , y \otimes z \\ \hline otca2.py & o2copA0 & y \otimes z \\ \hline otca3.py & o3copA0 & z \otimes x \\ \hline otca4.py & o4copA0 & x \otimes y, z \otimes x \\ \hline otca5.py & o5copA0 & y \otimes z, z \otimes x \\ \hline otca6.py & o6copA0 & x \otimes y , y \otimes z, z \otimes x \\ \hline \end{array}$$ I have also raised this as an issue on the QuTiP page.

Could this be fixed by redefining (generalising) _overlap(A, B) function in grape.py ?