## 3 Rapid Spin Initialization with Optical Fields
### Time-Dependent Control  
Here, we exploited numerical optimal control to find time-dependent Rabi frequency profiles \(\Omega(t)\) that maximized \(\rho_{22}(T)\), while they vanished at \(t=0\) and \(t=T\), i.e., they satisfied the boundary conditions:  
\[\Omega(0)=\Omega(T)=0. \tag{20}\]  
Such controls are easier to implement experimentally, since they do not contain jumps at the initial and final times. The control \(\Omega(t)\) was found using the BOCOP optimal control solver [38]. The advantages of this program are that it can take into account conditions as in Equation (20) and additionally offer the option to use as a control function a polynomial of time. Here, we treated the Rabi frequency \(\Omega\) as an extra state variable, with boundary conditions (20), and used a polynomial control in the derivative:  
\[\frac{d}{d\tau}\left(\frac{\Omega}{\gamma}\right)=\sum_{k=0}^{4}a_{k}\tau^{k}, \tag{21}\]  
where \(\tau=\gamma t\) is normalized time. Observe that we used a control polynomial of order four in the derivative, with coefficients \(a_{k}\) to be found using the optimal control solver. The following condition was also imposed:  
\[0\leq\Omega(t)/\gamma\leq 20, \tag{22}\]  
to assure that the Rabi frequency lied within values that were feasible for experimental implementation. The optimal control problem for Equations (1)-(7), augmented by Equation (21) for \(\Omega\), was to determine the coefficients \(a_{k}\) that maximized \(\rho_{22}(T)\) for a given final time \(T\), while the constraints (20) and (22) \begin{table}
\begin{tabular}{c c c c} \hline
**Purcell factors** & **Good** & **Medium** & **Bad** \\ \hline \(F_{x}\) & 4.64435 & 4.72492 & 4.73458 \\ \(F_{z}\) & 8.23301 & 8.40487 & 8.43176 \\ \hline \end{tabular}
\end{table} 
Table 1: Optimal Purcell factors related to the three cases marked by red stars in the second column of Figure 3, where the final time is \(T=2/\gamma=1.097\) ns: good quality MoS\({}_{2}\) layer at \(R=3.5\) nm, medium quality MoS\({}_{2}\) layer at \(R=6\) nm, and bad quality MoS\({}_{2}\) layer at \(R=7.5\) nm. Figure 5: Contours of \(\rho_{22}(T)\) for duration \(T=2/\gamma=1.097\) ns versus the distance \(R\) between the QD-monolayer and the Rabi frequency \(\Omega\), for the bad quality MoS\({}_{2}\) and three values of the host dielectric permittivity, (**a**) \(\epsilon_{1}=2\), (**b**) \(\epsilon_{1}=4\), and (**c**) \(\epsilon_{1}=6\). Observe that similar levels of fidelity are obtained with the case where the host medium is taken to be the free-space vacuum (\(\epsilon_{1}=1\)), although they are slightly reduced with increasing permittivity. Specifically, the maximum fidelities for the three displayed cases with \(\epsilon_{1}=2,4,6\) are \(0.9943,0.9941,0.9939\), respectively. were satisfied. After calculating these optimal \(a_{k}\), we could find the corresponding Rabi frequency profile by integrating Equation (21):  
\[\frac{\Omega(t)}{\gamma}=\sum_{m=1}^{5}\frac{a_{m-1}}{m}(\gamma t)^{m}. \tag{23}\]  
The examples that we considered corresponded to the three cases marked with red stars in the second column of Figure 3: good quality semiconductor layer at \(R=3.5\) nm, medium quality semiconductor layer at \(R=6\) nm, and bad quality semiconductor layer at \(R=7.5\) nm. In all the examples, the duration was set to \(T=2/\gamma=1.097\) ns. The optimal coefficients found using BOCOP are listed in Table 2. In Figure 6, we display for each case (for each row, the order is good, medium, bad, from top to bottom) the resulting control field \(\Omega(t)\) (first column) and the corresponding evolution \(\rho_{22}(t)\) (second column). Observe that the shape of the optimal \(\Omega(t)\) was similar for all the cases, as was also verified by examining the coefficients \(a_{k}\) in Table 2, which were close to each other. The reason was that the Purcell factors used in the system of Equations (1)-(7) were similar for all three cases; see Table 1 or Figure 2 (points highlighted with a red star).