\section{Introduction}
Understanding the role of active galactic nuclei (AGN) in its host galaxy's transition from a blue starforming disk to a red quiescent ellipsoid is one of the forefront problems in studying galaxy evolution, with molecular gas at the center of the debate.  A dearth of galaxies appearing in the optical ``green valley'' \citep{faber+07} seems to indicate that galaxies must transition between these two stages rapidly.  It has been suggested that the expulsion of a galaxy's starforming material through AGN feedback might provide a mechanism that is both sufficiently powerful and rapid to achieve this transition \citep{springel+05,hopkins+06}.  Recent observations have shown many galaxies with AGNs host molecular outflows (\citealt{feruglio+10,alatalo+11,aalto_1377,cicone+14} and references therein).  In fact, AGN-driven molecular winds might be a ubiquitous property, as molecular observations of these types of objects become more numerous.

Markarian 231 (at a distance of 181\,Mpc; \citealt{boksenberg+77}) is an ideal laboratory to study the ways in which supermassive black holes and star formation interact with molecular gas.  Mrk\,231 has both a rapidly accreting, powerful AGN \citep{braito+04} and a starburst, with a star formation rate of $170~M_\odot$~yr$^{-1}$ \citep{veilleux+09}, and is classified an ultraluminous infrared galaxy (ULIRG; \citealt{sanders+mirabel96}).  Its disturbed morphology \citep{hutchings+neff87} confirm that it is in the late stages of an ongoing merger, which \citet{hamilton+keel87} suggest is the origin of both the starburst and quasar activity.  Recently, it has also been shown that Mrk\,231 hosts a massive outflow, observed in molecular gas \citep{fischer+10,feruglio+10,aalto+12}, neutral gas \citep{rupke+05,rupke+11,teng+13} and warm ionized gas \citep{lipari+09,rupke+11,veilleux+13}.  These properties make Mrk\,231 the ideal laboratory to test the ways in which dense molecular gas, star formation, and an AGN intermingle within a merging system, shedding light on the fate of the starforming material, and ultimately, the galaxy as a whole, after a merger.

We present new high resolution Combined Array for Research in Millimeter Astronomy (CARMA; \citealt{carma}) continuum, CO(1--0) and CS(2--1) observations of Mrk\,231.  In \S\ref{obs}, we describe the observations and data analysis.  In \S\ref{disc}, we use the CARMA measurements to put the molecular gas in Mrk\,231 into context, both in terms of star formation properties and depletion timescales.  In \S\ref{conc}, we present our conclusions.  We use the cosmological parameters $H_0 = 70$~km~s$^{-1}$, $\Omega_M = 0.3$ and $\Lambda = 0.7$ \citep{wmap} throughout.

\section{Observations and Data Reduction}
\label{obs}
Mrk\,231 was observed with CARMA between 2010 November and 2011 May in two different configurations: C array (1$''$ resolution) and B array (0\farcs7).  \hbox{$^{12}$CO}(1--0) and CS(2--1) were observed simultaneously, utilizing the upgraded correlator.  The primary beam has a diameter of 2$'$ at CO(1--0), which covers all emission from Mrk\,231.  All observations used a long integration on a bright quasar to calibrate the passband, and alternated integrations between a gain calibrator \hbox{(1419+543)} and Mrk\,231.  We then used the Mrk\,231 3mm continuum source \citep{joyce+75} to self calibrate.  The self calibration step was able to mitigate atmospheric fluctuations for the longer baseline arrays.  The data were reduced using the Multichannel Image Reconstruction Image Analysis and Display ({\sc miriad}) software package \citep{miriad}. Calibration and data reduction steps were followed identically to \citet{alatalo+13}.   Figure \ref{fig:cospec} presents the CO(1--0) spectrum, using the aperture defined by the integrated intensity (moment0) map (seen as an inset in Fig. \ref{fig:cospec}). Table \ref{tab:results} presents the derived properties from the CARMA observations.

\begin{table*}
\centering
\caption{Mrk\,231 properties} \vspace{1mm}
\begin{tabular}{l c c c c c c c c}
\hline \hline
{\bf Tracer} & $\theta_{\rm maj}\times\theta_{\rm min}$ & K per Jy$^\ddagger$ & $\Delta v$ & RMS & RMS per channel & Area & $F_{\rm peak}$ & $F_{\rm int}$ \\
& ($''$) & & (km~s$^{-1}$) & (mJy~beam$^{-1}$) & (mJy) & $\Box''$ & (Jy~beam$^{-1}$~km~s$^{-1}$) & (Jy~km~s$^{-1}$) \\
\hline
{\bf CO(1--0)} & $1.80\times1.57$ & 35.54 & 100 & 2.77 & 7.70 & 7.7 & $30.4\pm5.8$ & $74.3\pm3.0$ \\
{\bf CS(2--1)} & $1.40\times1.26$  & 78.35 & 34 & 1.28 & 1.82 & 3.9 & $0.92\pm0.13$ & $1.43\pm0.19$ \\
\hline
{\bf Blue} & $1.19\times1.07$  & 78.48 & 400 & 0.57 & -- & 5.3 & $1.91\pm0.23$ & $4.30\pm0.53$ \\
{\bf Red} & $1.19\times1.07$  & 78.48 & 400 & 0.54 & -- & 5.9 & $1.50\pm0.21$ & $4.60\pm0.53$ \\
\hline \hline
\end{tabular} \\
\noindent $^\ddagger$ Kelvin per Jansky factor for each observation
\label{tab:results}
\end{table*}

The {\sc miriad} task {\tt uvlin} was used to separate out continuum emission from Mrk\,231 from the line emission, and we estimate the continuum flux of Mrk\,231 to be $20.9\pm0.3$ mJy\footnote{This does not include the absolute flux calibration uncertainty of 20\%} in the unself-calibrated data.  A centroid was computed to determine the position of the 3mm continuum and compare it to the VLBI-determined radio core \citep{ma+98}, and found that the two positions agree to 0.04$''$.

To image the blue-shifted and red-shifted wings, we created images with velocities between $-800<v<-400$\,km~s$^{-1}$\ and $400<v<800$\,km~s$^{-1}$, respectively.  Figure \ref{fig:cospec} shows the continuum-subtracted CO(1--0) spectrum derived from the 100\,km~s$^{-1}$ CARMA channel maps, using the moment0 map (Fig. \ref{fig:cospec} inset) as the masking aperture in each channel. The corresponding wing images and spectra are shown in Figure \ref{fig:lobes}, overlaid on {\em B}-band {\em HST} imaging of Mrk\,231 (right; \citealt{kim+13}).  CARMA derives a total flux of $74.3\pm3.0$~Jy~km~s$^{-1}$, in agreement within errors with the flux recovered by Plateau de Bure \citep{feruglio+10,cicone+12}.

CARMA has successfully resolved the high velocity CO(1--0) wings, finding a separation between the centroids of $0.49''$ (415\,pc), a distance 5.8 times larger than the centroiding error\footnote{$\epsilon_{\rm centroid} = \theta_{\rm beam}/(2\times{\rm SNR})$}, and the blue- and red-shifted lobes have sizes of 2.3$''$ (1980\,pc) and 2.2$''$ (1820\,pc), respectively.  The fluxes associated with each imaged wing was determined by summing the emission that lay inside the 3$\sigma$ contours of the emission, and were found to be $F_{\rm CO,blue} = 4.30\pm 0.53$~Jy~km~s$^{-1}$ and $F_{\rm CO,red} = 4.60\pm0.53$~Jy~km~s$^{-1}$, which is larger than what was found in \citet{cicone+12}, though it is possible that our apertures were larger.  The lobes also appear to be separated in the East-West direction, with the centroid of the blue lobe located at [12:56:14.245, +56:52:25.24] and for the red lobe centroid at [12:56:14.213, +56:52:25.21], with the 3mm continuum point source (white cross) located between the lobes.

CS(2--1) observations are shown in Figure \ref{fig:cs}.  Construction of channel maps, integrated intensity (moment0) maps, mean velocity (moment1) maps, spectra, and the corresponding determinations of the root mean square noise were performed identically to the methods described in \citet{alatalo+13}.  CS(2--1) channels have an (optically-defined) velocity width of 34\,km~s$^{-1}$.  The total CS(2--1) flux, determined by summing across the shaded channels in the spectrum, is $1.43\pm0.19$\,Jy~km~s$^{-1}$, and covers an area of 3.9\,arcsec$^2$.

\section{Results and Discussion}
\label{disc}

\subsection{Dense molecular gas traced by CS(2--1)}
Using the local thermal equilibrium $F_{\rm CS(2-1)}$--$M_{\rm H_2,dense}$ relation discussed in \citet{a14_sfsupp} of
\[N_{\rm CS} = 1.90\times10^{11} T_{\rm ex}~e^{7.05/T_{\rm ex}}~I_{\rm CS(2-1)}\]

\noindent where $I_{\rm CS(2-1)}$ is the integrated intensity of the CS(2--1) line in K~km~s$^{2-1}$, assuming $T_{\rm ex}\approx70$\,K \citep{vanderwerf+10}, and a CS abundance of $\approx10^{-9}$, we find a total dense gas mass of $\approx1.8\pm0.3\times10^{10}~M_\odot$.  This dense gas mass is consistent with the total dense gas mass found with other tracers \citep{solomon+92,solomon+vandenbout05,feruglio+10}, given the uncertainty in the CS/H$_2$ abundance, which is at least a factor of 2. Our dense gas mass estimate is lower than the dynamical mass derived within 1100\,pc of the center of Mrk\,231 is $3.15\times10^{10}$~M$_\odot$\footnote{Not including the uncertainty associated with converting CS to $M$(H$_2$) \citep{a14_sfsupp}} \citep{downes+solomon98}, necessitating that the majority of the central mass in Mrk\,231 is in the form of dense molecular gas. The signal-to-noise ratio of the CS data and resolution of these data are not able to confirm whether the CS is part of the face-on warped disk reported in \citet{davies+04}, and in dense gas by \citet{aalto+15}. Despite the limitation in resolution, the gradient seen in the CS moment1 map also appears consistent with the HCN kinematics seen by \citet{aalto+12}.   The agreement of the molecular gas mass also appears consistent with the idea that the majority of the molecular gas in Mrk\,231 is in a dense form.

Our integrations were not sufficiently sensitive to detect CS(2--1) emission associated with broad wings (as is the case in other dense gas tracers, including HCN, reported by \citealt{aalto+12}), and warrants deeper observations to determine whether gas traced by CS (suggested to be a tracer of some of the densest molecular cores; \citealt{baan+08}) is also taking part in the molecular outflow.

To derive the dense gas column along the line-of-sight to the AGN in Mrk\,231 (white cross on Fig. \ref{fig:cs} moment maps), we find that the pixel associated with the radio point source contains intensity of $51.8\pm2.0$\,K~km~s$^{-1}$ (using a Kelvin per Jansky factor of 78.35).  Converting this intensity into a column density of H$_2$ (assuming an excitation temperature of 70\,K and a CS/H$_2$ abundance of 10$^{-9}$), we find a CS-derived line-of-sight column to the AGN of $1/2\times N_H=N({\rm H_2})\approx1.1\times10^{24}$\,cm$^{-2}$ (if the AGN were sitting beneath the maximum value in the CS(2--1) map, the obscuring column would be $N({\rm H_2})\approx1.5\times10^{24}$\,cm$^{-2}$). While this value was consistent with a previous estimate from X-ray absorption models \citep{braito+04}, newer results from {\em NuSTAR} show $N_H$ to be $1.2\times10^{23}$~cm$^{-2}$ \citep{teng+14}.  The discrepancy between the CS-derived column might suggest that the obscuring medium in the nucleus of Mrk\,231 is quite clumpy (at a scale much smaller than the CARMA resolution), which is consistent with the suggestion by \citet{teng+14} that the wind punching out of the system has created a preferential line-of-sight to the AGN.

\begin{figure}[t]\centering
\includegraphics[width=0.49\textwidth]{figures/mrk231_COspec.eps}
\caption{Integrated CO(1--0) spectrum of Mrk\,231 from CARMA.  The shaded regions correspond to the ranges summed to search for wing emission, of $400<v<800$\,km~s$^{-1}$ for the red-shifted wing and $-800<v<-400$\,km~s$^{-1}$ for the blue-shifted wing.  The moment0 map is shown as an inset in the top left, where a white cross pinpoints the location of the AGN. }
\label{fig:cospec}
\end{figure}

If we were to use the CS to investigate the star formation efficiency within Mrk\,231, the total dense gas-traced surface density is $\Sigma_{\rm H_2} \approx 6450~M_\odot$~pc$^{-2}$.  Comparing this to the star formation surface density (assuming the dense gas and star formation are co-spatial) of $61~M_\odot$~yr$^{-1}$~kpc$^{-2}$, we find that this matches the expectation from the Kennicutt-Schmidt relation \citep{ken98}.

\subsection{Resolved CO(1--0) outflow}
Accounting for the distance to Mrk\,231, $0.49''$ corresponds to a projected separation between the CO(1--0) centroids of 415\,pc. The CARMA data also successfully resolve the lobes, with sizes of 2.2$''$ and 2.3$''$ of the red- and blue-shifted wings, respectively.  To deproject this distance, an accurate inclination angle is needed.  Inclination angles derived for the molecular disk (which we assume is perpendicular to the outflow) has derived inclinations angles ranging from $i=10^\circ$ \citep{downes+solomon98,davies+04} to $i=45^\circ$ \citep{richards+05}, meaning that the deprojected distance ranges between 570 and 2390\,pc.  If we assume that the outflow is conical with a large opening angle \citep{rupke+11,cicone+12}, then the   distance between the wings is likely similar to the diameter of the lobes, which we estimate to be 1800\,pc (after de-convolving the lobes).   This size is slightly larger than the CO(1--0) separation found by \citet{cicone+12}, although we see extension in the East-West direction and opposite of the rotation of the CS disk, rather than the North-South direction as was observed in HCN by \citet{aalto+12}.  While this is consistent with the angle of rotation of the molecular disk, the velocities probed by the CARMA observations exceed the escape velocity, and therefore are unlikely to be due to rotation.

We use 600\,km~s$^{-1}$\ for the characteristic velocity of each wing (as well as the de-projected radius, 900\,pc) to calculate the dynamical timescale of the outflow of $\tau_{\rm dyn} \approx 1.5$\,Myr, about twice as long as the timescale originally reported by \citet{feruglio+10}.  If we use this dynamical timescale in conjunction with the outflow mass from \citet{feruglio+10}, and supported by \citet{aalto+12} of 5.8$\times10^8~M_\odot$, we find that the total mass outflow rate is $390~M_\odot$~yr$^{-1}$, a factor of 2 smaller than \citet{feruglio+10}, and a factor of $\approx2$ larger than the star formation rate in the system \citep{veilleux+09}.  If all $390~M_\odot$~yr$^{-1}$ taking part in the molecular outflow were to {\em escape} the galaxy, we would expect the molecular gas to be depleted in $\approx46$\,Myr through the action of the molecular outflow alone, and 32\,Myr if both outflow and the star formation gas consumptions are considered.  This depletion timescale assumes that all molecular gas in the thin disk is intercepted by the molecular outflow, which is assumed to be traveling perpendicular to the disk.  If the molecular outflow is unable to interact with most of the gas in the molecular disk, this could increase the molecular outflow depletion timescale considerably.

\subsection{The importance of competing depletion mechanisms}
In Mrk\,231, the molecular gas is being depleted by three competing mechanisms: consumption through star formation, escape from the galactic potential via a molecular outflow and accretion onto the supermassive black hole.  The timescale for star formation to completely consume the central gas is 110\,Myr.  The molecular outflow appears to be the dominant depleter within the Mrk\,231 system (assuming that the outflowing molecular mass is being completely expelled).

\begin{figure*}[t]\centering
\subfigure{\includegraphics[height=3.7in]{figures/mrk231_wings.eps}}
\subfigure{\includegraphics[height=3.7in,clip,trim=0cm 0.9cm 0cm 1cm]{figures/wings_COspec.eps}}
\caption{{\bf(Left):}  {\em B}-band archival image of Mrk\,231 from {\em HST} (grayscale, \citealt{kim+13}) is overlaid with the integrated CARMA maps of the blue-shifted ($-800<v<-400$ km~s$^{-1}$; blue) and red-shifted ($400<v<800$ km~s$^{-1}$; red).  Contours for the red lobe is [3,4,5,6,7]$\sigma$ and [3,4,5,6,7,8]$\sigma$ for the blue lobe, where $\sigma$ is the root mean square noise of the map.  The blue and red crosses represent the centroids on the blue- and red-shifted wings, respectively.  The white cross represents the position of the centroid of the 3mm continuum point source.  Separation between the lobes is $\approx 0.49''$, a well-resolved distance, where the size of the red and blue crosses represent the centroiding errors for each wing.  The separation is detected to 5.8 times the centroiding error.  It is of note that the CO(1--0) wings velocity range almost entirely exceeds the escape velocity out of the central kiloparsec of Mrk\,231. {\bf(Right):} Integrated CO(1--0) spectrum of Mrk\,231 using emission exceeding a signal-to-noise of 3 in red- and blue-shifted wing images to create the extraction apertures.  This seems to indicate that CARMA has successfully detected emission in the red- and blue-shifted wings.}
\label{fig:lobes}
\end{figure*}

While $\dot{M}_{\rm out}$ of Mrk\,231, updated in the prior section is indeed larger than $\dot{M}_{\rm SFR}$, $\dot{M}_{\rm out}$ might not be an accurate representation of the mass of molecular gas that is currently being expelled from the system.  Mrk\,231 is a massive system, with an estimated stellar mass of $\approx3\times10^{11}~M_\odot$ \citep{U+12}, and thus much of the outflowing molecular gas will not escape the potential well of Mrk\,231, instead falling back and ``stirring up'' the massive molecular disk in the center.
Using a dynamical mass within 1100\,pc of the center of Mrk\,231 of $3.15\times10^{10}~M_\odot$ \citep{downes+solomon98,davies+04}, and derive an escape velocity from the central kiloparsec of $\sim500$\,km~s$^{-1}$.  If we assume that all gas that is traveling above $v_{\rm esc}$ will be able to successfully escape the system, then 15\% of the total outflowing molecular gas (from the gaussian fit of \citealt{feruglio+10}) escapes\footnote{This estimate only accounts for the the molecular gas traced by CO(1--0), although the Mrk\,231 outflow has been detected in additional tracers of netural gas, including OH \citep{sturm+11}, Na\,D \citep{veilleux+09} and \hbox{H\,{\sc i}}\ \citep{teng+13}.}.  We use our updated maps to calculate the total escaping mass from the blue- and red-shifted wing fluxes reported in Section \ref{obs} and Table \ref{tab:results}, using a conservative merger-based conversion factor \citep{narayanan+11}, and find $M_{\rm esc} = (2.93\pm0.49)\times10^8~M_\odot$.  Dividing by the dynamical time, we find
 $\dot{M}_{\rm esc}\approx 195~M_\odot$~yr$^{-1}$, which is quite comparable to the current star formation rate of 170~$M_\odot$~yr$^{-1}$ than were we to assume all outflowing mass is escaping.  This updates the depletion timescale due to the escape of molecular gas, $\tau_{\rm esc}$ to 92\,Myr.  The combined depletion timescale $\tau_{\rm SF+esc}$ is then 49\,Myr.

The accretion onto the black hole can be derived using the bolometric luminosity of the AGN (of $\approx 2.8\times10^{12}~L_\odot$; \citealt{veilleux+09,veilleux+13}), and assuming an efficiency $\eta = 0.17$, to be $\dot{M}_{\rm acc}\approx 1~M_\odot$~yr$^{-1}$, or at a rate $\sim10^{-2}$ other depletion rates, a minor constituent to the depletion of the central molecular gas, and requiring a Hubble time to completely remove the molecular gas from the system.

Without a constant driving mechanism, the majority of the molecular outflow will eventually fall back into the center, either to be accreted, formed into stars, or re-launched.  One would expect that this gas would fall back and re-inject energy into the central molecular disk, possibly acting to inhibit star formation \citep{guillard+14,a14_sfsupp}, and therefore extend the molecular gas consumption timescale.  An extension of the depletion timescale expected for Mrk\,231 from $\sim20$\,Myr (the typical lifetime for O-stars) to $\sim50$\,Myr, appears more consistent with the poststarburst population found in Mrk\,231 \citep{canalizo+00}, and common in other quasars \citep{cales+11,canalizo+13}, as well as other hosts of molecular outflows (such as NGC\,1266; \citealt{alatalo+11,a14_stelpop}).

The rapidity at which Mrk\,231 is currently expelling its molecular material compared with weaker AGNs might be due to the different circumstances that created this system and outflow. A major merger occurred in a system already sufficiently massive to host a massive black hole, which is thus energetically capable of driving the bulk of the molecular gas from the system.  Sub-$v_{\rm esc}$ gas would be able to fall back into the system and inject turbulence, in effect, temporarily stalling efficient star formation and possibly extending the depletion time just slightly.  This would account for the mismatch in depletion timescales between $\sim30$\,Myr (the depletion timescale should all outflowing gas escape and with the current star formation rate) and $\sim50$\,Myr (the stellar population age seen in Mrk\,231; \citealt{canalizo+00}).

\begin{figure*}\centering
\subfigure{\includegraphics[height=4.8cm,clip,trim=0cm 0cm 0cm 0cm]{figures/CS_moms.eps}}
\subfigure{\includegraphics[height=4.8cm,clip,trim=1cm 0.5cm 0cm 3cm]{figures/cs_spec.eps}}
\subfigure{\includegraphics[width=0.99\textwidth]{figures/cs_chans.eps}}
\caption{ {\bf(Top left \& middle):} The integrated intensity (moment0) and mean velocity (moment1) maps of CS(2--1) within Mrk\,231 from CARMA.  While there does appear to be some ordered motion, overall the spectrum appears quite turbulent.  Contour levels are [0.01,0.1,0.3,0.5,0.7,0.9] times the maximum value of the moment0 map. {\bf(Top right):} The integrated CS(2--1) spectrum, with the RMS per channel shown as a small error bar on the left-hand side of the spectrum.  The CS(2--1) line appears to have a width of $\approx$300\,km~s$^{-1}$. {\bf(Bottom):} The CS(2--1) channel maps.  Contours are [-2.5,2.5,3.5,4.5]$\sigma$, where $\sigma$ is the rRMS of the CS(2--1) cube.  The negative contours are gray.}
\label{fig:cs}
\end{figure*}

Deeper observations of the molecular outflow in Mrk\,231, focusing on spatial resolution on at different distances away from the AGN will be able to determine what fraction of the molecular gas is escaping the gravitational potential, and provide a more complete understanding of the driving mechanism as well as the energy injection rate.  Low frequency imaging could pinpoint the location of fossil shells \citep{schoenmakers+00}, as Mrk\,231 has already been detected at low frequency \citep{cohen+07}.  Combining these observations with the multiwavelength suite available for Mrk\,231 will provide additional constraints, such as whether the molecular outflow changes phase as it accelerated, and whether there is any evidence that gas ultimately falls back into the molecular disk of Mrk\,231.

\section{Conclusions}
\label{conc}
We have presented 3mm continuum, and CO(1--0) and CS(2--1) high resolution molecular gas maps of Mrk\,231 from CARMA.  The CS(2--1) data paint a picture of the dense molecular gas in Mrk\,231 that is consistent with other dense gas tracers \citep{aalto+12}.  CS(2--1) predicts a dense gas mass (of $M_{\rm dense}=1.8\pm0.3\times10^{10}~M_\odot$), and a line-of-sight column toward the AGN of $N({\rm H_2}) \approx 10^{24}$~cm$^{-2}$, inconsistent with the X-ray derived column \citep{teng+14}, possibly indicative of a clumpy ISM, and the AGN-driven winds punching a preferential line-of-sight to the AGN.  If we use the dense gas to derive a star formation efficiency, we find that Mrk\,231 is consistent with the prediction of the Kennicutt-Schmidt relation.

CARMA was able to resolve the individual CO(1--0) broad line-wings, with an inferred separation between the wings to be $\approx1.8$\,kpc given the angular size of the lobes and possible inclination angles of the outflow.  This is slightly larger than the CO(1--0) lobe separation reported in \citet{cicone+12}.  If we assume that not all molecular gas will successfully escape the galaxy, we can re-calculate the depletion timescale for Mrk\,231 based on the mass {\em escape} rate, of $\approx195~M_\odot$~yr$^{-1}$.  A depletion timescale using $\dot{M}_{\rm esc}+\dot{M}_{\rm SFR}$, rather than $\dot{M}_{\rm out}+\dot{M}_{\rm SFR}$ is more consistent with the poststarburst stellar populations that are seen in Mrk\,231 as well as many other quasars.

\section{Acknowledgments}
K.A. would like to thank Mark Lacy, Lauranne Lanz and Kristina Nyland for useful conversations and proofreading, which improved the text, as well as the anonymous referee, for a substantive report that has significantly improved the manuscript.
K.A. is supported by funding through Herschel, a European Space Agency Cornerstone Mission with significant participation by NASA, through an award issued by JPL/Caltech.  Support for CARMA construction was derived from the states of California, Illinois, and Maryland, the Gordon and Betty Moore Foundation, the Kenneth T. and Eileen L. Norris Foundation, the Associates of the California Institute of Technology, and the National Science Foundation. Ongoing CARMA development and operations are supported by the National Science Foundation under a cooperative agreement, and by the CARMA partner universities.  This research has made use of the NASA/IPAC Extragalactic Database (NED) which is operated by the Jet Propulsion Laboratory, California Institute of Technology, under contract with the National Aeronautics and Space Administration.  Based on observations made with the NASA/ESA Hubble Space Telescope, and obtained from the Hubble Legacy Archive, which is a collaboration between the Space Telescope Science Institute (STScI/NASA), the Space Telescope European Coordinating Facility (ST-ECF/ESA) and the Canadian Astronomy Data Centre (CADC/NRC/CSA).
\\
\bibliographystyle{apj}


\subsection*{Connection with the statistical learning theory}

The idea of convexification of the loss function in order to construct computationally tractable procedures
has been widely used in statistical learning theory \citep{Zhang1}. In this part of the discussion, I would like
to share some thoughts about the similarities of the two approaches.

To this end, let me briefly recall the principle of loss convexification in the problem of binary classification.
One observes $n$ iid pairs $\{(X_i,Y_i)\}_{i=1,\ldots,n}$ drawn from an unknown distribution $P$ on the
product space $\mathcal X\times\mathcal Y$ with $\mathcal Y=\{-1,+1\}$ and the goal is to design a prediction rule
$g:\mathcal X\to\mathcal Y$ with the smallest possible misclassification error rate
\begin{align}\label{risk}
R_P(g) = \mathbf E_P[\mathds 1(Y\not = g(X))]   = \mathbf E_P[\mathds 1(-Yg(X)\ge 0)].
\end{align}
The convexification is achieved in two steps. First, the classification risk is replaced by the $\phi$-risk
\begin{align}\label{riskA}
A_P(g) = \mathbf E_P[\phi(-Yg(X))],
\end{align}
where $\phi:\mathbb{R}\to\mathbb{R}$ is a convex function often referred to as the convex surrogate loss. Second, the set of ``pure''
classification rules $g:\mathcal X\to\mathcal Y$ is extended to ``generalized'' rules $h:\mathcal X\to\mathbb{R}$ with the convention
that the predictions furnished by $h$ and $\sign(h)$ are the same. The $\phi$-risk is accordingly extended
to all generalized prediction rules: $A_P(h)=\mathbf E_P[\phi(-Yh(X))]$. As a consequence of this construction,
if $\mathcal H$ is a convex subset of the set of all measurable functions from $\mathcal X$ to $\mathbb{R}$, then the computation of the empirical
risk minimizer (ERM)
\begin{align}\label{ERM}
\widehat h_{n,\mathcal H} \in\text{arg}\min_{h\in\mathcal H} \frac1n\sum_{i=1}^n \phi(-Y_ih(X_i))
\end{align}
amounts to solving a convex program. The most common choices for the function $\phi$ are the hinge loss
$\phi(u) = (1+u)_+$, the exponential loss $\phi(u)= e^u$ and the logistic loss $\phi(u) = \log(1+e^u)$.

Let me turn now to the problem of testing two hypotheses  $\Theta_{0}$ and $\Theta_{1}$ based on $n$ observations
$X_1,\ldots,X_n$ independently drawn from a distribution $P_{\theta^*}$ on $\mathcal X$.  Let $\Theta = \Theta_0\cup \Theta_1$ and
$s:\Theta\to\{\pm1\}$ be the function that equals $-1$ on the set $\Theta_0$ and $+1$ on the set $\Theta_1$.
The usual loss of a pure test $T:\mathcal X^n\to\{\pm 1\}$ associated with a sample $\boldsymbol X^{(n)}=(X_1,\ldots,X_n)$ drawn from
$P_{\theta^*}^n:=P_{\theta^*}^{\otimes n}$ is
$$
\ell\big(T(\boldsymbol X^{(n)}),\theta^*\big) = \mathds 1\big(T(\boldsymbol X^{(n)})\not = s(\theta^*) \big) = \mathds 1(-T(\boldsymbol X^{(n)})s(\theta^*)\ge 0).
$$
The corresponding risk is $R_{P_{\theta^*}}(T) = \mathbf E_{{\theta^*}}\big[\ell\big(T(\boldsymbol X^{(n)}),\theta^*\big)\big]$
and the worst case risk is
\begin{align}\label{eps}
\epsilon(T) &= \sup_{\theta\in\Theta}R_{P_{\theta^*}}(T) = \sup_{\theta\in\Theta} P_{\theta}\big(T(\boldsymbol X^{(n)})\not = s(\theta)\big)\nonumber\\
&=\sup_{\theta\in\Theta} \mathbf E_{{\theta}}[\mathds 1(-T(\boldsymbol X^{(n)})s(\theta)\ge 0)].
\end{align}
Comparing (\ref{eps}) with (\ref{risk}), one can see some clear similarities between the problems of finding binary predictors $g$
minimizing the misclassification error rate and that of finding testing procedures $T$ minimizing the worst case error rate $\epsilon(T)$.
In both problems the decision rules form a nonconvex set and the performance measure is defined as the expected loss for a nonconvex
loss function  (the Heaviside step function). However, there is an important difference consisting in the fact that---contrary to
(\ref{risk})---the expectation at the right-hand side of (\ref{eps}) does not admit an empirical counterpart that is easily computable
from the sample.  Therefore, even if one applies the aforementioned two steps of convexification, this does not readily yield a test procedure
computable by solving a convex program (in the spirit of (\ref{ERM})).

Elaborating on these ideas,
one can define the following  convexified strategy for testing the hypothesis $\Theta_0$ against $\Theta_1$. Given a convex subset $\mathcal H$ of the set of measurable functions
from $\mathcal X^{n}$ to $\mathbb{R}$ and a convex loss $\phi:\mathbb{R}\to\mathbb{R}$, define
\begin{align}\label{test}
\widehat h_{n,\mathcal H}^{\phi} \in \text{arg}\min_{h\in\mathcal H} \sup_{\theta\in\Theta} G_\phi(h,\theta),
\qquad
G_\phi(h,\theta)=
\mathbf E_{\theta}\big[\phi\big(-h(\boldsymbol X^{(n)})s(\theta)\big)\big].
\end{align}
In this ``saddle-point'' formulation, the outer minimisation problem has the attractive property of being convex: it has a convex feasible set and a convex cost function.
Unfortunately, in general, the inner maximization problem is not concave and there is no particular reason to expect that it can be efficiently solved
for any given $h$ when the dimensionality of $\theta$ is large. To circumvent this drawback, the authors
had the ingenious idea to combine the following three facts:
\begin{itemize}
\item the saddle point of $G(h,\theta)$ coincides with the saddle point of $\log G(h,\theta)$,
\item when the model $\{P_\theta:\theta\in\Theta\}$  belongs to an exponential family, it is natural to
choose $\mathcal H$ as the linear span of the sufficient statistics: $\mathcal H_0 = \text{Span}(S_j:j=1,\ldots,m)$,
\item for some statistical models\footnote{It could be helpful to mention that the concavity property holds for the usual
parameterization and does not hold for the parameterization in terms of the natural parameters in the sense of exponential families.}
belonging to an exponential family, for every $h\in\mathcal H_0$,
the mapping $\theta\mapsto \log\big(\mathbf E_{\theta}[ \exp(-h(\boldsymbol X^{(n)}))]\big)$  is concave.
\end{itemize}
This leads to the test procedure
\begin{align}\label{T-exp}
\widehat h_{n,\mathcal H_0}^{\rm exp} \in \text{arg}\min_{h\in\mathcal H_0}\ \sup_{\theta\in\Theta}\ \ \log G_{\rm exp}(h,\theta),
\qquad G_{\rm exp}(h,\theta)=\mathbf E_{\theta}\big[e^{-h(\boldsymbol X^{(n)})s(\theta)}\big].
\end{align}
The final step of construction aims at convexifying the feasible set of the inner maximization problem. In the case when $\Theta = \Theta_0\cup \Theta_1$
with convex sets $\Theta_0$ and $\Theta_1$, this aim is achieved by replacing $\sup_{\theta\in\Theta}\ \log G_{\rm exp}(h,\theta)$ by the expression
$\sup_{(\theta,\bar\theta)\in\Theta_0\times\Theta_1}\  \log G_{\rm exp}(h,\theta) + \log G_{\rm exp}(h,\bar\theta)$, which does not impact the error of testing too
much in view of the inequalities
\begin{align*}
\sup_{\theta\in\Theta}\ \log G_{\rm exp}(h,\theta) &\le \sup_{(\theta,\bar\theta)\in\Theta_0\times\Theta_1}\  \big\{\log G_{\rm exp}(h,\theta) +
\log G_{\rm exp}(h,\bar\theta)\big\} \\
&\le 2\sup_{\theta\in\Theta}\ \log G_{\rm exp}(h,\theta).
\end{align*}
An important remark to be made here is that---in the case of exponential loss $\phi$---taking the logarithm of $G_\phi$
does not break the convexity with respect to $h$. So, in this notation, the test proposed and studied by the authors is
\begin{align}\label{T-exp1}
\tilde h_{n,\mathcal H_0}^{\rm exp} \in \text{arg}\min_{h\in\mathcal H_0}\ \sup_{(\theta,\bar\theta)\in\Theta_0\times\Theta_1}\
\big\{\log G_{\rm exp}(h,\theta) + \log G_{\rm exp}(h,\bar\theta)\big\}.
\end{align}
I believe that these explanations shed some additional light on the construction proposed in Theorem~2.1 of the paper under discussion.
This also raises several questions that might be interesting to investigate in the future. In particular, a compelling question is to
characterize the set of surrogate loss functions $\phi$ that lead to computationally tractable testing procedures and for which the testing
error rate remains small. Another question is the possibility to deal with test (\ref{T-exp}) directly, without using the final step of
convexification. At a heuristic level, the risk of $\widehat h_{n,\mathcal H_0}^{\rm exp}$ should be smaller than that of $\tilde h_{n,\mathcal H_0}^{\rm exp}$.
Therefore, the advantage of the latter would be only computational tractability. I wonder if it is possible to efficiently compute
the test $\widehat h_{n,\mathcal H_0}^{\rm exp}$, despite the lack of convex-concavity of the cost function, exploiting the facts that (a)
for every $h$, the sup of $\log G_{\rm exp}(h,\theta)$ over $\Theta$ can be efficiently computed, and (b) for every $\theta$, the minimum
of $\log G_{\rm exp}(h,\theta)$ over $\mathcal H_0$ can be efficiently computed as well.

\subsection*{Reduction to testing simple hypotheses}

The definition of the test given by the authors in Theorem 2.1, see also Eq.\ (\ref{T-exp1}) above, is well suited for the computational
purposes but, in my opinion, has the inconvenience of hiding the main reason why the proposed test is a natural one to use in the setting
under consideration. In fact, the proposed test can be alternatively defined as follows: in order to distinguish between two
(convex) hypotheses $\Theta_0$ and $\Theta_1$ based on a sample $\boldsymbol X\sim P_{\theta^*}$,
\begin{enumerate}
\item Determine the two closest points $\theta_0\in\Theta_0$ and $\theta_1\in\Theta_1$ in terms of the Hellinger distance between the corresponding
distributions (in other terms, find the two representers $P_{\theta_0}$ and $P_{\theta_1}$ in the families $\{P_\theta:\theta\in\Theta_0\}$ and
$\{P_\theta:\theta\in\Theta_1\}$ that are the hardest to distinguish). This step is completely data independent.
\item Apply the standard likelihood-ratio test to the problem of choosing among two simple hypotheses $H_0: \theta = \theta_0$ versus
$H_1:\theta=\theta_1$.
\end{enumerate}
The equivalence of these two definitions follows from the proof of Theorem 2.1, see Eq.\ (52). In Section 2.3.2, this interpretation is presented
for the discrete observation scheme. At a conceptual level, it is important to underline that the same interpretation holds true in the general case
as well. However, from a practical point of view, the definition given in the paper is more convenient than the foregoing one since the first step of
the latter, generally, is not computationally tractable.

\subsection*{Testing error for inexact solutions}

As it is judiciously noted by the authors, in many practical situations, the exact computation of the saddle point in (\ref{T-exp1}) can
not be performed. Then, one relies on an approximation of the saddle point and it is a central task to assess how this approximation error impacts
the error of testing. I find it relevant to measure the error of approximation in terms of the magnitude of violation of first-order optimality
conditions (see, for instance, Eq.\ (8) of the paper under discussion). In such a context, the authors establish upper bounds on the error
of the test based on an approximate solution to the saddle point problem. For example, in the case of the Gaussian observation scheme explored
in Section 2.3.1, it is shown that the worst-case error rate of the test based on the exact solution is
\begin{equation}\label{bound0}
\varepsilon_* = 1-\Phi\Big(\frac12\big\|\Sigma^{-1/2}(\theta_0-\theta_1)\big\|_2\Big),
\end{equation}
where $\Phi$ is the cumulative distribution function of the standard normal distribution and $(\theta_0,\theta_1)$ is the second argument
of the solution to the saddle point problem. On the other hand, when an inexact solution $(\tilde\theta_0,\tilde\theta_1)$ is used, with
an approximation error bounded by $\delta>0$, the worst-case error rate satisfies (see Eq. (9)):
$$
\tilde \varepsilon \le 1-\Phi\Big(\frac12\big\|\Sigma^{-1/2}(\tilde\theta_0-\tilde\theta_1)\big\|_2-\frac{\delta}{\|\Sigma^{-1/2}(\tilde\theta_0-\tilde\theta_1)\|_2}\Big).
$$
In my opinion, it is worth complementing this upper bound by another one that involves only the exact solution $(\theta_0,\theta_1)$ and, therefore,
makes it easier to compare the two errors $\varepsilon_*$ and $\tilde\varepsilon$. In the case of Gaussian observation scheme, this can be easily done.
In fact, one can deduce from the first-order exact and approximate optimality conditions that
\begin{equation}\label{bound1}
\|\Sigma^{-1/2}(\theta_0-\theta_1)\|_2-\sqrt{\delta}\le \|\Sigma^{-1/2}(\tilde\theta_0-\tilde\theta_1)\|_2\le \|\Sigma^{-1/2}(\theta_0-\theta_1)\|_2+\sqrt{\delta}
\end{equation}
Since the Gaussian cdf is increasing, we infer from this inequality that
$$
\tilde \varepsilon \le 1-\Phi\Big(\frac12\big\|\Sigma^{-1/2}(\theta_0-\theta_1)\big\|_2-\frac{\sqrt{\delta}}{2}-
\frac{\delta}{\|\Sigma^{-1/2}(\theta_0-\theta_1)\|_2-\sqrt{\delta}}\Big).
$$
An even more elegant bound can be obtained if the normalized approximate optimality condition is used:
$\forall (\theta,\bar\theta)\in \Theta_0\times\Theta_1$, it holds
$$
(\tilde\theta_1-\tilde\theta_0)\Sigma^{-1}(\theta-\tilde\theta_0) +
(\tilde\theta_0-\tilde\theta_1)\Sigma^{-1}(\bar\theta-\tilde\theta_1) \le \delta\|\Sigma^{-1/2}(\tilde\theta_0-\tilde\theta_1)\|_2^2.
$$
In this case, inequalities (\ref{bound1}) take the form
\begin{equation}\label{bound1'}
\frac{\|\Sigma^{-1/2}(\theta_0-\theta_1)\|_2}{1+\sqrt{\delta}}\le \|\Sigma^{-1/2}(\tilde\theta_0-\tilde\theta_1)\|_2\le
\frac{\|\Sigma^{-1/2}(\theta_0-\theta_1)\|_2}{1-\sqrt{\delta}}
\end{equation}
and we get
$$
\tilde \varepsilon \le 1-\Phi\bigg\{\Big(\frac12-\delta\Big)\frac{\big\|\Sigma^{-1/2}(\theta_0-\theta_1)\big\|_2}{1+\sqrt{\delta}}\bigg\}.
$$
This inequality allows for an easy comparison of $\tilde\varepsilon$  and $\epsilon_*$ in the case of Gaussian observations. In the case
of other observation schemes, deriving this type of upper bounds seems to be more challenging and constitutes an interesting avenue of future
research.

{\renewcommand{\addtocontents}[2]{}
\section*{Acknowledgments}
The research of the author is partially supported by the grant Investissements d'Avenir (ANR-11-IDEX-0003/Labex Ecodec/ANR-11-LABX-0047).
}

\bibliographystyle{plainnat}

{\renewcommand{\addtocontents}[2]{}


\section{A. Systematic perturbative approach to Josephson effect with capacitance}
\renewcommand{\theequation}{A.\arabic{equation}}
\setcounter{equation}{0}

We shall show how to get at least two lowest order corrections to the adiabatic canonically quantized Hamiltonian, outlining the general procedure. We start from (\ref{eee}) and (\ref{eee1}) from the main text. Sandwiching (\ref{eee}) with $\langle e_\phi$, in the lowest order, we get
\begin{equation}
E_{e\phi}\psi_e\simeq (e^2/2C)\langle e_\phi|\partial_\phi^2\psi|g_\phi\rangle
\end{equation}
Plugging it into the last term of (\ref{eee1}) we get the  desired higher order term.
Note also that in the lowest order
$
\langle g_\phi|\partial_\phi^2\psi_e|e_\phi\rangle\simeq2(\partial_\phi\psi_e)\langle g_\phi|\partial_\phi|e_\phi\rangle
$ and
$
\langle e_\phi|\partial_\phi^2\psi|g_\phi\rangle\simeq 2(\partial_\phi\psi)\langle e_\phi|\partial_\phi|g_\phi\rangle
$.
The final form of the equation with two lowest corrections is
\begin{equation}
E'\psi\simeq E_{g\phi}\psi-\frac{e^2}{2C}\partial_\phi^2\psi+\psi(e^2/2C)\sum_e|f_{e\phi}|^2
+\frac{e^4}{C^2}\sum_e f^\ast_{e\phi}\partial_\phi(E^{-1}_{e\phi}\partial_\phi(\psi f_{e\phi}))\label{eee3}
\end{equation}
with $f_{e\phi}=\langle e_\phi|\partial_\phi|g_\phi\rangle$.

\section{B. Analytic calculation of $c(\phi)$.}
\renewcommand{\theequation}{B.\arabic{equation}}
\setcounter{equation}{0}

\subsection{Scattering matrix}

To operate on the continuum states we need to find their scattering matrix. Note that the natural directions of electron/hole propagation as in Fig. \ref{prop}, may be different from in/out-going scattering eigenstates of $h_{BCS}$
because the direction depends on the sign of group velocity $\partial \epsilon/\partial k$ as depicted in Fig. \ref{inout}
\begin{figure}
\includegraphics[scale=0.5]{seh.pdf}
\caption{The propagation of $e$-lectrons and $h$-oles. We shall use the notation $R/L$ for the modes at $x>/<0$}
\label{prop}
\end{figure}

We have 4 incoming and 4 outgoing modes depicted below, indexed by $nAa$, where
$n=1,2$ denotes the superconductor $A=R,L$ (right/left) denotes the side of wave $(R\equiv x=0+,L\equiv x=0-)$ and
$a=i,o$ denotes $i$-ncoming and $o$-utgoing mode,see also Fig.\ref{inout}.

\begin{figure}
\includegraphics[scale=0.5]{rlio.pdf}
\caption{The $k$ dependence of direction of BCS eigenstates, based on group velocity $\partial\epsilon/\partial k$.}
\label{inout}
\end{figure}

The scattering matrix connects the modes amplitudes
\begin{equation}
A_o=
\begin{pmatrix}
A_{Ro}\\
A_{Lo}\end{pmatrix}
=
\begin{pmatrix}
A_{1Ro}\\
A_{2Ro}\\
A_{1Lo}\\
A_{2Lo}\end{pmatrix}
=S
\begin{pmatrix}
A_{1Li}\\
A_{2Li}\\
A_{1Ri}\\
A_{2Ri}\end{pmatrix}
=S\begin{pmatrix}
A_{Li}\\
A_{Ri}\end{pmatrix}=SA_i
\end{equation}

We take $\theta>0$. For  energies $\pm\Delta\cosh\theta$ we  take $\theta_{Ro}=\theta_{Li}=\pm\theta$ and
$\theta_{Ri}=\theta_{Lo}=\mp\theta$.
Then the boundary condition in normal scattering matrix (\ref{smat}) leads to
\begin{eqnarray}
&&e^{\theta/2}A_{Ro}+e^{-\theta/2}A_{Ri}=S_e(e^{\theta/2}A_{Li}+e^{-\theta/2}A_{Lo})\nonumber\\
&&e^{-\theta/2}A_{Ro}+e^{\theta/2}A_{Ri}=S_h(e^{-\theta/2}A_{Li}+e^{\theta/2}A_{Lo})
\end{eqnarray}
equivalent to
\begin{equation}
\begin{pmatrix}
e^{\theta/2}&-e^{-\theta/2}S_e\\
e^{-\theta/2}&-e^{\theta/2}S_h
\end{pmatrix}
\begin{pmatrix}
A_{Ro}\\
A_{Lo}\\
\end{pmatrix}
=\begin{pmatrix}
e^{\theta/2}S_e&-e^{-\theta/2}\\
e^{-\theta/2}S_h&-e^{\theta/2}
\end{pmatrix}
\begin{pmatrix}
A_{Li}\\
A_{Ri}\\
\end{pmatrix}
\end{equation}
so
\begin{equation}
S=\begin{pmatrix}
e^{\theta/2}&-e^{-\theta/2}S_e\\
e^{-\theta/2}&-e^{\theta/2}S_h
\end{pmatrix}^{-1}
\begin{pmatrix}
e^{\theta/2}S_e&-e^{-\theta/2}\\
e^{-\theta/2}S_h&-e^{\theta/2}
\end{pmatrix}
\end{equation}
We have to solve
\begin{equation}
\begin{pmatrix}
e^{\theta/2}&-e^{-\theta/2}S_e\\
e^{-\theta/2}&-e^{\theta/2}S_h
\end{pmatrix}
\begin{pmatrix}
a&b\\
c&d
\end{pmatrix}=1
\end{equation}
which is equivalent to
\begin{eqnarray}
&&e^{\theta/2}a-e^{-\theta/2}S_ec=1,\:e^{\theta/2}b=e^{-\theta/2}S_ed\nonumber\\
&&e^{-\theta/2}a=e^{\theta/2}S_hc,\:e^{-\theta/2}b-e^{\theta/2}S_hd=1
\end{eqnarray}
Substituting $a=e^\theta S_hc$ and $b=e^{-\theta}S_ed$ we get
$
(e^{\theta}S_h-e^{-\theta}S_e)c=e^{-\theta/2}$ and $(e^{-\theta}S_e-e^\theta S_h)d=e^{\theta/2}
$

Let us focus on the matrix
$
W=e^\theta S_h-e^{-\theta}S_e=(e^{\theta} \bar{S}_h-e^{-\theta}\bar{S}_e)
$
which appears in
\begin{equation}
\begin{pmatrix}
e^{\theta/2}&-e^{-\theta/2}S_e\\
e^{-\theta/2}&-e^{\theta/2}S_h
\end{pmatrix}^{-1}=\begin{pmatrix}
e^{\theta/2}S_h&-e^{-\theta/2}S_e\\
e^{-\theta/2}&-e^{\theta/2}\end{pmatrix}W^{-1}
\end{equation}
We have
\begin{equation}
e^{\theta} \bar{S}_h-e^{-\theta}\bar{S}_e=2\begin{pmatrix}
r\sinh\theta& it\sinh(\theta-i\phi)\\
it\sinh(\theta+i\phi)&r\sinh\theta
\end{pmatrix}
\end{equation}
The determinant is equal $4M$, where $M=|\sinh(\theta+i\phi)|^2=\sinh^2\theta+t^2\sin^2\phi$.
Then
$
W^{-1}=(4M)^{-1}(e^{\theta} \bar{S}_h^\dag-e^{-\theta}\bar{S}_e^\dag)
$
Finally
\begin{equation}
4MS=
\begin{pmatrix}
e^{\theta/2}\bar{S}_h&-e^{-\theta/2}\bar{S}_e\\
e^{-\theta/2}&-e^{\theta/2}
\end{pmatrix}(e^{\theta} \bar{S}_h^\dag-e^{-\theta}\bar{S}_e^\dag)
\begin{pmatrix}
e^{\theta/2}\bar{S}_e&-e^{-\theta/2}\\
e^{-\theta/2}\bar{S}_h&-e^{\theta/2}
\end{pmatrix}
\end{equation}
or explicitly
\begin{equation}
\begin{pmatrix}
r\sinh^2\theta&-t\sinh\theta\sin(\phi-i\theta)&-t^2\sin\phi\sin(\phi-i\theta)&-rt\sinh\theta\sin\phi\\
t\sinh\theta\sin(\phi+i\theta)&r\sinh^2\theta&rt\sinh\theta\sin\phi&-t^2\sin\phi\sin(\phi+i\theta)\\
-t^2\sin\phi\sin(\phi+i\theta)&-rt\sinh\theta\sin\phi&r\sinh^2\theta
&-t\sinh\theta\sin(\phi+i\theta)\\
rt\sinh\theta\sin\phi&-t^2\sin\phi\sin(\phi-i\theta)&t\sin\theta\sinh(\phi-i\theta)&r\sinh^2\theta
\end{pmatrix}\label{sss}
\end{equation}

\subsection{Andreev bound states}
Apart from the continuum states, there are evanescent subgap solutions of the equation $\epsilon=h$ for $h=h_{BCS}+h_T$
given by (\ref{hhh}). For evanescent modes $e^{\kappa x}\psi$, denoting $\kappa=\Delta\sin\beta$, $|\beta|\leq \pi/2$
we get eigenvalues $\epsilon_\pm=\pm \Delta\cos\beta$ with eigenvectors
$$
\psi_\pm=2^{-1/2}\begin{pmatrix}
e^{\mp i\beta/2}\\
\pm e^{\pm i\beta/2}\end{pmatrix}_{eh}
$$
Certainly these modes can exist only in the vicinity of the junction point $x=0$ forming bound states.
The Andreev bound states are formed by left ($L$ for $x<0$) and right ($R$ for $x>0$) evanescent modes.
Let us take $\beta_R=-\beta_L=\beta<0$ for the  $\epsilon_+$ and $\beta_R=-\beta_L=-\beta<0$
for $\epsilon_-$. We use the boundary condition at $x=0$ to get
\begin{eqnarray}
&&e^{-i\beta/2}A_R=e^{i\beta/2}S_eA_L\nonumber\\
&&e^{i\beta/2}A_R=e^{-i\beta/2}S_hA_L\label{abse}
\end{eqnarray}
for the scattering matrices given by (\ref{smat}).
Hence
$A_R=e^{i\beta}S_eA_L=e^{-i\beta}S_hA_L
$
The condition for existence of solution is
\begin{equation}
0=\det(e^{i\beta}S_e-e^{-i\beta}S_h)=4\det
\begin{pmatrix}
ir\sin\beta&-t\sin(\beta+\phi)\\
-t\sin(\beta-\phi)&ir\sin\beta
\end{pmatrix}
\end{equation}
The last determinant is equal
$-r^2\sin^2\beta-t^2\sin^2\beta\cos^2\phi+t^2\cos^2\beta\sin^2\phi$
which is $-\sin^2\beta+t^2\sin^2\phi$. Since it must vanish, we get the condition
\begin{equation}
\sin\beta=\pm t\sin\phi\label{abs}
\end{equation}
the amplitudes are found by
$
ir\sin\beta A_{L1}=t\sin(\beta+\phi)A_{L2}
$.
Plugging (\ref{abs}) we get
$
\pm ir\sin\phi A_{L1}=(\pm t\sin\phi\cos\phi+\cos\beta\sin\phi)A_{L2}
$
which lead to
$
\pm irA_{L1}=(\cos\beta\pm t\cos\phi)A_{L2}
$.
Note that $\cos\beta=(1-t^2\sin^2\phi)^{1/2}=(r^2+t^2\cos^2\phi)^{1/2}>|t\cos\phi|$
and
$
(\cos\beta+ t\cos\phi)(\cos\beta-t\cos\phi)=\cos^2\beta-t^2\cos^2\phi=r^2
$
so we have
$
\pm i(\cos\beta\mp t\cos\phi)^{1/2}A_{L1}=(\cos\beta\pm t\cos\phi)^{1/2}A_{L2}
$.
The normalized solution reads
\begin{equation}
A_L=2^{-1/2}\begin{pmatrix}
(1\pm t\cos\phi/\cos\beta)^{1/2}\\
\pm i(1\mp t\cos\phi/\cos\beta)^{1/2}
\end{pmatrix}
\label{absl}
\end{equation}
Rewriting equations (\ref{abse}) in the form
\begin{eqnarray}
&&e^{-i\beta}A_R=S_eA_L\nonumber\\
&&e^{i\beta}A_R=S_hA_L\label{abse2}
\end{eqnarray}
and subtracting the second from the first equation we get
\begin{equation}
-2i\sin\beta A_R=(S_e-S_h)A_L
=2\begin{pmatrix}
0&-t\sin\phi\\
t\sin\phi&0\end{pmatrix}A_L
\end{equation}
and finally, plugging (\ref{abs}) and (\ref{absl}) we get
\begin{equation}
A_R=\begin{pmatrix}
(1\mp t\cos\phi/\cos\beta)^{1/2}\\
\pm i(1\pm t\cos\phi/\cos\beta)^{1/2}
\end{pmatrix}
\end{equation}
The final wavefunctions have to be normalized by multiplying by $|t\sin\phi|^{1/2}$.

\subsection{Berry phase}

The Berry phase itself will be irrelevant for the lowest orders of perturbative approach.
Nevertheless, we shall need it because of usefulness in other calculations.
We ask what happens when the eigenbasis is parameter-dependent. The parameter is $\phi$ in our case.
For the nondegenerate eigenvalues the differential Berry phase is defined by
$
\langle\psi|\partial_\phi|\psi\rangle=i\gamma
$
where $\gamma$ is real because
$
0=\partial_\phi\langle\psi|\psi\rangle=i(\gamma-\gamma^\ast)
$
For degenerate case we collect all the states of the same energy. Assume (it will be anyway our case)
that degeneracy is not lifted by changing $\phi$ (except some singular points). We construct matrix $\gamma$
with
$
\langle\psi_m|\partial_\phi|\psi_n\rangle=i\gamma_{mn}
$
Note that
$
0=\partial_\phi\langle\psi_m|\psi_n\rangle=i(\gamma_{mn}-\gamma_{nm}^\ast)
$
which shows that $\gamma$ is Hermitian. We can find individual Berry phases by diagonalizing $\gamma$. Then
eigenvalues will be differential Berry phases.

Let us calculate first the Berry phase for Andreev bound states.
The derivative of spatial part is real so it cannot give any contribution to Berry phase.
Acting on $e^{\pm i\beta/2}$ the net result is also zero as both signs appear with equal weight.
Finally acting on $A_{R/L}$ we get real numbers, so again they cannot give any Berry phase. The conclusion is that
the phase convention we used in construction of Andreev bound states representatives gives zero Berry phase.

For scattering states we have the total state combined from incoming wave and scattered outgoing wave
$
\psi_a=\psi_{ia}+\sum_c\psi_{oc}S_{ca}
$
where $a,c=R/L,1/2$. Only $S$ can depend on $\phi$ so the matrix $\gamma$ is  given by
\begin{equation}
i\gamma_{ba}=\left(\langle\psi_{ib}|+S^\dag_{bd}\sum_d\langle\psi_{od}|\right)
\sum_c|\psi_{oc}\rangle \partial_\phi S_{ca}
\end{equation}
The overlap of $Ri/Ro$ and  $Li/Lo$ is $\sim i/\sinh\theta$, so it does not contain any $\delta$ term
(the $i/o$ states have opposite momentum) so the term vanishes in the continuum limit (infinite length of the junction).
Therefore
$
i\gamma=S^\dag\partial_\phi S/2
$
because the outgoing waves are halves of full waves.
The final calculation gives $2M\gamma=$

\begin{equation}
t\sinh\theta
\begin{pmatrix}
-t\cosh\theta&ir\cosh(\theta+i\phi)&0&
i\cos\phi\\
-ir\cosh(\theta-i\phi)&t\cosh\theta&
-i\cos\phi&0\\
0&i\cos\phi&t\cosh\theta&ir\cosh(\theta-i\phi)\\
-i\cos\phi&0&-ir\cosh(\theta+i\phi)&-t\cosh\theta
\end{pmatrix}
\end{equation}

We shall also need
$
i\tilde\gamma=S\partial_\phi S^\dag/2
$
which is $2M\tilde\gamma=$\
\begin{equation}t\sinh\theta
\begin{pmatrix}
-t\cosh\theta&-ir\cosh(\theta+i\phi)&0&
-i\cos\phi\\ir\cosh(\theta-i\phi)&t\cosh\theta&
i\cos\phi&0\\
0&-i\cos\phi&t\cosh\theta&-ir\cosh(\theta-i\phi)\\
i\cos\phi&0&ir\cosh(\theta+i\phi)&-t\cosh\theta
\end{pmatrix}
\end{equation}

\subsection{Contribution to $c(\phi)$ from ABS}
We shall calculate all contributions to $c$ defined by (\ref{ccc}) by inspection of all relevant excited states, depicted in Fig.\ref{abslev}.
Let us first calculate $A=\langle\psi_\pm|\partial_\phi|\psi\rangle$
where $\psi_\pm$ is one of Andreev bound states, while $\psi$ is any eigenstate.
If $\psi$ is the opposite Andreev bound state there is no contribution from spatial part $|\kappa|^{1/2}e^{-|\kappa x|}$
for the same reason as the Berry phase vanishes. If the derivative act on $e/h$ components then the contribution cancels
from orthogonality of $A_{1/2}$. The only nonzero term is when acting on $A_{1/2}$. The final result is
\begin{equation}
\langle\psi_\pm|\partial_\phi|\psi_\mp\rangle=\pm it^2r\sin^2\phi/2(1-t^2\sin^2\phi)
\end{equation}
and $c_A=t^4r^2\sin^4\phi/4(1-t^2\sin^2\phi)^2$

The relevant cross terms between ABS and scattering states are when their energies have opposite signs.
Therefore the sign $\pm$ in ABS will determine the energy (its sign is the  sign of $-\beta=\mp t\sin\phi$).
We are interested in the vector
$
\langle\psi_\pm|(|\psi_{1Ro}\rangle,|\psi_{2Ro}\rangle,|\psi_{1Lo}\rangle,|\psi_{2Lo}\rangle)\tilde\gamma
$
because $\partial_\phi$ act only on scattering matrix, $\partial_\phi S$, accompanied by outgoing states and we can insert
$S^\dag$ at the end (since the relevant quantity is Hermitian square).
The result is
\begin{eqnarray}
&&\frac{-2i|t\sin\phi|^{1/2}\sinh((\theta+i\beta)/2)}
{(2\cosh\theta)^{1/2}(|t\sin\phi|- i\mathrm{sgn}\beta\sinh\theta)}\times
\nonumber\\
&&((1\mp t\cos\phi/\cos\beta)^{1/2},\mp i(1\pm t\cos\phi/\cos\beta)^{1/2},-(1\pm t\cos\phi/\cos\beta)^{1/2},
\pm i (1\mp t\cos\phi/\cos\beta)^{1/2})\tilde\gamma
\end{eqnarray}
The final element
$
c_{B\theta}=\sum_a|\langle\pm|\partial_\phi|\psi_a\rangle|^2
$
is equal
\begin{equation}
\frac{|t^3\sin\phi|\sinh^2\theta(\cosh\theta-\cos\beta+2r^2\sin^2\phi/\cos\beta)}
{(\cosh\theta-\cos\beta)(\cosh\theta+\cos\beta)^3\cosh\theta}
\end{equation}
Its total relevant contribution is $c_B=\int_0^\infty c_{B\theta}\cosh\theta d\theta/2\pi$ which
is
\begin{equation}
\frac{|t^3\sin\phi|}{8\pi\cos^4\beta}
\left(\frac{2\beta\cos^2\beta}{\sin\beta}+2\cos^3\beta-\pi|\sin\beta|\cos^2\beta
+\cos^2\phi\left(\pi|\sin\beta|+\frac{2\beta\cos 2\beta-\sin 2\beta}{\sin^3\beta}\right)\right)
\end{equation}
For small $t$ ($\beta\to 0$) the leading terms are
$
|t^3\sin\phi|(1+2\sin^2\phi)/6\pi-t^4\sin^4\phi/8
$

\subsection{Contribution to $c(\phi)$ from scattering states}

We are interested in terms
$
c_{\theta\vartheta}=\sum_{ab}|\langle\theta_a|\partial_\phi|\vartheta_b\rangle|^2
$
where $|\theta_a\rangle$ is a scattering state with energy $-\Delta\cosh\theta$ while
$|\vartheta_b\rangle$ is a scattering state with energy $+\Delta\cosh\vartheta$. By analogous considerations
as with ABS, the derivative effectively gives $(\partial_\phi S)S^\dag=-i2\tilde\gamma$
Therefore $c$ is equal
$
4\mathrm{Tr}\tilde\gamma^2(\vartheta)Q
$
where
$
Q_{ab}=\sum_c\langle\vartheta_{oa}|\theta_c\rangle\langle\theta_c| \vartheta_{ob}\rangle
$
The middle part is
\begin{equation}
\sum_c|\theta_c\rangle\langle\theta_c|=\sum_c|\theta_{ic}\rangle\langle\theta_{ic}|+
\sum_{dc}|\theta_{od}\rangle (SS^\dag)_{dc}\langle\theta_{oc}|+
\sum_{cd}|\theta_{oc}\rangle S_{cd}\langle\theta_{id}|+\mathrm{h.c.}
\end{equation}
From unitarity of $S$ we get
\begin{equation}
\sum_c|\theta_c\rangle\langle\theta_c|=\sum_{c;x=i,o}|\theta_{xc}\rangle\langle\theta_{xc}|+
\sum_{cd}|\theta_{oc}\rangle S_{cd}\langle\theta_{id}|+\mathrm{h.c.}
\end{equation}
Therefore
$
Q=B_iB_i^\dag+B_oB_o^\dag+B_iS^\dag B_o^\dag+B_oSB_i^\dag
$
where
$
B_x=\langle\vartheta_o|\theta_x\rangle
$
with $x=i,o$.
We find
\begin{equation}
B_i=\frac{i\sinh((\vartheta-\theta)/2)}{(\cosh\theta\cosh\vartheta)^{1/2}(\sinh\theta-\sinh\vartheta)}\begin{pmatrix}
0&I\\
-I&0\end{pmatrix},\:
B_o=\frac{-i\sinh((\vartheta+\theta)/2)}{(\cosh\theta\cosh\vartheta)^{1/2}(\sinh\theta+\sinh\vartheta)}\begin{pmatrix}
I&0\\
0&-I\end{pmatrix}
\end{equation}
where $I$ is $2\times 2$ identity matrix.
Plugging in all matrices we get
\begin{equation}
c_{\theta\vartheta}=\frac{(2t\sinh\theta\sinh\vartheta)^2(\cosh\theta\cosh\vartheta+1-2\cos^2\phi-t^2\sin^2\phi)}{\cosh\theta\cosh\vartheta(\cosh\theta+\cosh\vartheta)^2(\sinh^2\theta+t^2\sin^2\phi)(\sinh^2\vartheta+t^2\sin^2\phi)}
\end{equation}
The final relevant integral is
$
c_C=\int_0^\infty d\sinh\theta d\sinh\vartheta c_{\theta\vartheta}/(2\pi)^2
$

We can divide the integral into divergent and convergent parts $c_c=c_{div}+c_{con}$
with
\begin{equation}
c_{div}=\int_0^\infty\frac{d\theta d\vartheta}{(2\pi)^2}\frac{4t^2(\cosh\theta\cosh\vartheta+1-2\cos^2\phi-t^2\sin^2\phi)}
{(\cosh\theta+\cosh\vartheta)^2}
\end{equation}
and
\begin{equation}
c_c=-\int_0^\infty\frac{d\theta d\vartheta}{(2\pi)^2}\frac{4t^4\sin^2\phi(\cosh\theta\cosh\vartheta+1-2\cos^2\phi-t^2\sin^2\phi)(t^2\sin^2\phi+\sinh^2\theta+\sinh^2\vartheta)}
{(\cosh\theta+\cosh\vartheta)^2(\sinh^2\theta+t^2\sin^2\phi)(\sinh^2\vartheta+t^2\sin^2\phi)}
\end{equation}
In the first integral we make substitution $2A=\theta+\vartheta$, $2B=\theta-\vartheta$.
The calculation needs a cutoff in the first term at $A_{max}$ and then gives
$
\pi^2c_{div}=t^2A_{max}-t^2\cos^2\phi-t^4\sin^2\phi/2
$
Now $c_{con}=c_{con1}+c_{con2}$ with
\begin{eqnarray}
&&
c_{con1}=-\int_0^\infty \frac{2t^4\sin^2\phi d\theta d\vartheta}{\pi^2(\sinh^2\vartheta+t^2\sin^2\phi)}
\frac{\cosh\theta\cosh\vartheta+1-2\cos^2\phi-t^2\sin^2\phi}{(\cosh\theta+\cosh\vartheta)^2}
\nonumber\\
&&
c_{con2}=\int_0^\infty \frac{2t^6\sin^4\phi d\theta d\vartheta
(\cosh\theta\cosh\vartheta+1-2\cos^2\phi-t^2\sin^2\phi)/\pi^2}
{(\cosh\theta+\cosh\vartheta)^2(\sinh^2\theta+t^2\sin^2\phi)(\sinh^2\vartheta+t^2\sin^2\phi)}
\end{eqnarray}

We shall integrate over $\theta$ with help of identities
\begin{eqnarray}
&&\int_0^\infty d\theta (\cosh\theta+\cosh\vartheta)^{-1}=\vartheta/\sinh\vartheta
\\
&&\int_0^\infty d\theta (\cosh\theta+\cosh\vartheta)^{-2}=\frac{\vartheta\cosh\vartheta-\sinh\vartheta}{\sinh^3\vartheta}
\nonumber\\
&&
\int_0^\infty d\theta (\cosh\theta+\cosh\vartheta)^{-3}=\frac{\vartheta(3+2\sinh^2\vartheta)-3\sinh\vartheta\cosh\vartheta}{2\sinh^5\vartheta}
\nonumber\end{eqnarray}
the integration gives
\begin{equation}
c_{con1}=-\int \frac{2d\vartheta t^4\sin^2\phi/\pi^2}{\sinh^2\vartheta+t^2\sin^2\phi}\left(\frac{\vartheta\cosh\vartheta}{\sinh\vartheta}
-(\sinh^2\vartheta+t^2\sin^2\phi+2\cos^2\phi)\frac{\vartheta\cosh\vartheta-\sinh\vartheta}{\sinh^3\vartheta}\right)
\end{equation}
We shall integrate $C_{c2}$ over $\theta$, noticing residua in $i\beta$, $i(2\pi-\beta)$, $i(\pi\pm\beta)$, and $\pm \vartheta+i\pi$.
\begin{eqnarray}
&&
c_{con2}=\int \frac{2t^6\sin^4\phi d\vartheta}{\pi^2(\sinh^2\vartheta+\sin^2\beta)}\times
\\
&&
\left[\frac{(\pi-\beta)(\cos\beta\cosh\vartheta+\cos^2\beta-2\cos^2\phi)}
{2\sin\beta\cos\beta(\cosh\vartheta+\cos\beta)^2}-\frac{\beta(\cos^2\beta-\cos\beta\cosh\vartheta-2\cos^2\phi)}
{2\sin\beta\cos\beta(\cosh\vartheta-\cos\beta)^2}\right.
\nonumber\\
&&
\left.+\frac{1-\vartheta\coth\vartheta}{\sinh^2\vartheta}
+\frac{2\cos^2\phi(1-\vartheta\coth\vartheta)-\vartheta\sinh\vartheta\cosh\vartheta}
{\sinh^2\vartheta(\sinh^2\vartheta+\sin^2\beta)}-
\frac{4\cos^2\phi\vartheta\sinh\vartheta\cosh\vartheta}
{\sinh^2\vartheta(\sinh^2\vartheta+\sin^2\beta)^2}\right]
\nonumber
\end{eqnarray}
The integration over $\vartheta$ needs noting that $\sinh^2\vartheta+\sin^2\beta=(\cosh\vartheta+\cos\beta)(\cosh\vartheta-\cos\beta)$ and further integrals  (for simplicity we assume $\beta\in[0,\pi] $)
\begin{equation}
P_1(\beta)=\int_0^\infty d\vartheta (\cosh\vartheta+\cos\beta)^{-1}=\beta/\sin\beta
\end{equation}
and by derivatives ($\sin^{-1}\beta d/d\beta$)
\begin{eqnarray}
&&P_2(\beta)=\int_0^\infty d\vartheta (\cosh\vartheta+\cos\beta)^{-2}=\frac{\sin\beta-\beta\cos\beta}{\sin^3\beta}
\\
&&
P_3(\beta)=\int_0^\infty d\vartheta (\cosh\vartheta+\cos\beta)^{-3}=\frac{\beta(3-2\sin^2\beta)-3\cos\beta\sin\beta}{2\sin^5\beta}\nonumber
\end{eqnarray}
Also
\begin{eqnarray}
&&\bar{P}_1(\beta)=\int_0^\infty d\vartheta (\sinh^2\vartheta+\sin^2\beta)^{-1}=(P_1(\pi-\beta)-P_1(\beta))/2\cos\beta
=(\pi/2-\beta)/\sin\beta\cos\beta
\\
&&
\bar{P}_2(\beta)=\int_0^\infty d\vartheta (\sinh^2\vartheta+\sin^2\beta)^{-2}=
-\bar{P}_1'(\beta)/2\sin\beta\cos\beta
\nonumber\\
&&
\bar{P}_3(\beta)=\int_0^\infty d\vartheta (\sinh^2\vartheta+\sin^2\beta)^{-2}=-
\bar{P}_2'(\beta)/4\sin\beta\cos\beta
\nonumber\end{eqnarray}

A more complicated integral
\begin{equation}
Q_1(\beta)=\int_0^\infty\frac{\vartheta\cosh\vartheta d\vartheta}{\sinh\vartheta(\cosh\vartheta+\cos\beta)}
=\frac{2\beta^2\cos\beta+\pi^2(1-\cos\beta)}{4\sin^2\beta}
\end{equation}
And its derivatives
\begin{eqnarray}
&&Q_2(\beta)=\int_0^\infty\frac{\vartheta\cosh\vartheta d\vartheta}{\sinh\vartheta(\cosh\vartheta+\cos\beta)^2}
=\frac{\pi^2(2-\sin^2\beta-2\cos\beta)+4\beta\sin\beta\cos\beta+\beta^2(2\sin^2\beta-4)}{4\sin^4\beta}
\nonumber\\
&&
Q_3(\beta)=\int_0^\infty\frac{\vartheta\cosh\vartheta d\vartheta}{\sinh\vartheta(\cosh\vartheta+\cos\beta)^3}=
\\
&&\frac{\pi^2(1-\cos\beta)+2\cos\beta\sin\beta+6\beta\sin\beta(\sin^2\beta-2)+\beta^2(2\cos\beta-\sin\beta\cos\beta+2\cos\beta\sin^2\beta)}{4\sin^6\beta}
\nonumber\\
&&
\int_0^\infty d\vartheta (\sinh^2\vartheta+\sin^2\beta)^{-1}=\frac{\pi/2-\beta}{\sin\beta\cos\beta}
\nonumber\end{eqnarray}
Another important integral is
\begin{equation}
R_1(\beta)=\int_0^\infty d\vartheta \frac{\vartheta\cosh\vartheta}{\sinh\vartheta(\sinh^2\vartheta+\sin^2\beta)}
=\int_0^\infty d\vartheta \frac{\vartheta\sinh\vartheta\cosh\vartheta}{\sin^2\beta}
[\sinh^{-2}\vartheta-
(\sinh^2\vartheta+\sin^2\beta)^{-1}]
\end{equation}
Differentiating $R_1\sin^2\beta$ over $\beta$ we get
\begin{equation}
\int_0^\infty d\vartheta \frac{2\sin\beta\cos\beta\sinh\vartheta\vartheta\cosh\vartheta}{(\sinh^2\vartheta+\sin^2\beta)^2}
\end{equation}
Integrating it by parts we get
\begin{equation}
\int_0^\infty d\vartheta \frac{\sin\beta\cos\beta}{(\sinh^2\vartheta+\sin^2\beta)^2}=(\pi/2-\beta)
\end{equation}
from the previous integral.
We note also that $R_1(\beta)\sin^2\beta\to 0$ for $\beta\to 0$ so
\begin{equation}
R_1(\beta)=\beta(\pi-\beta)/2\sin^2\beta=(Q_1(\pi-\beta)-Q_1(\beta))/2\cos\beta
\end{equation}
Its derivatives
\begin{eqnarray}
&&R_2(\beta)=\int_0^\infty d\vartheta \frac{\vartheta\cosh\vartheta}{\sinh\vartheta(\sinh^2\vartheta+\sin^2\beta)^2}
=-R_1'(\beta)/2\sin\beta\cos\beta\nonumber\\
&&R_3(\beta)=\int_0^\infty d\vartheta \frac{\vartheta\cosh\vartheta}{\sinh\vartheta(\sinh^2\vartheta+\sin^2\beta)^3}
=-R_2'(\beta)/4\sin\beta\cos\beta\end{eqnarray}

It gives $c_{con1}\pi^2/t^2$ equal
\begin{equation}
\sin^2\beta+\beta^2-\pi|\beta|+
2\cos^2\phi\left(\frac{\pi|\sin\beta-\beta\cos\beta|}{\sin^2\beta\cos\beta}
+2\cos\beta-2\beta/\sin\beta+2\frac{\beta(\beta\cos\beta-\sin\beta)}{\sin^2\beta\cos\beta}\right)
\end{equation}
and $c_{con2}\pi^2/2t^6\sin^4\phi$ equal
$$a(\beta)+b(\beta)\cos^2\phi$$
with $a$ equal
\begin{eqnarray}
&&\frac{P_1(\pi-\beta)}{2}\left(\frac{P_1(\pi-\beta)}{4\cos^2\beta}-\frac{P_2(\beta)}{2\cos\beta}
+\frac{P_1(\beta)}{4\cos^2\beta}\right)
\\
&&
+\frac{P_1(\beta)}{2}\left(\frac{P_1(\beta)}{4\cos^2\beta}+\frac{P_2(\pi-\beta)}{2\cos\beta}+\frac{P_1(\pi-\beta)}{4\cos^2\beta}\right)
-R_2(\beta)+\frac{R_1(\beta)-\bar{P}_1(\beta)-1/2}{\sin^2\beta}
\nonumber\end{eqnarray}
and $b$ equal
\begin{eqnarray}
&&-\frac{P_1(\pi-\beta)}{\cos\beta}\left(\frac{P_1(\pi-\beta)}{8\cos^3\beta}-\frac{P_3(\beta)}{2\cos\beta}-\frac{P_2(\beta)}{4\cos^2\beta}-\frac{P_1(\beta)}{8\cos^3\beta}\right)
\\
&&
+\frac{P_1(\beta)}{\cos\beta}\left(-\frac{P_1(\beta)}{8\cos^3\beta}+\frac{P_3(\pi-\beta)}{2\cos\beta}-\frac{P_2(\pi-\beta)}{4\cos^2\beta}+\frac{P_1(\pi-\beta)}{8\cos^3\beta}\right)
-4 R_3(\beta)+\frac{2R_1\beta-2\bar{P}_1(\beta)-1}{\sin^4\beta}+\frac{2R_2(\beta)-2\bar{P}_2(\beta)}{\sin^2\beta}
\nonumber
\end{eqnarray}
In the lowest order
$
c_{con}\simeq -|t^3\sin\phi|(1+2\sin^2\phi)/3\pi+2t^4\sin^4\phi/\pi^2+t^4\sin^4\phi/4
$
so the $t^3$ terms from ABS cancel!
\end{document}


\section{Introduction}
The modification of magnetic properties of ferro(i)magnetic films (F) by antiferromagnetic films (AF) is of huge physical and technological interest for instance for the development of magnetoresistive (MR) devices like magnetic tunnel junctions (MTJs)\cite{MTJ,MTJsMoodera,OxideSpintronics,SpintronicsApps}. MTJs primarily consist of two ferro(i)magnetic conducting films, which are separated by a non-magnetic insulator. In case both ferro(i)magnetic films are comprised of the same material, it is essential to shift the coercive field of one of the films. The AF/F exchange coupling causing an exchange bias can be utilized to have two different switching fields. Thus, the magnetization of the films can be switched separately and an alternation of the alignment of the magnetization between parallel and antiparallel is possible.\\
Magnetite (Fe$_{3}$O$_{4}$) is a promising material for such applications due its half-metallic\cite{halfmet} character and a high spin polarization at the Fermi level. The ferrimagnetic oxide has a high Curie temperature (860\,K) and a saturation moment of almost 4$\mu_{B}$. It crystallizes in an inverse spinel structure with a cubic lattice constant of 0.83964\,nm at 300\,K. Below the so called Verwey temperature T$_{V}$ = 120\,K occurs a phase transition, whereby magnetite adopts a monoclinic structure, becomes insulting and its susceptibility changes.\\
NiO is an antiferromagnetic ionic insulator with a high thermal stability. It is inert against corrosion and has a N$\rm \acute{e}$el temperature of T$_{N}$ = 523\,K and therefore well suited as exchange bias material  NiO crystallizes in a rock salt structure with a lattice constant of 0.41769\,nm.\\
MgO is isostructural to NiO with a slightly larger lattice constant of 0.42117\,nm. Hence, the lattice mismatch between NiO and MgO is about 0.8\,\% while the misfit between Fe$_{3}$O$_{4}$ and MgO is about 0.3\,\% and MgO is apparently well suited as substrate for both.\\
The AF/F exchange coupling was first reported in 1957 in Co/CoO systems\cite{FirstExchangeCoupling}. This pinning effect increases the coercive field of the F film and leads to a shift of the hysteresis loop by a bias field, the so called exchange bias. The pinning effect can be induced by cooling the AF/F bilayer from high temp through the N$\rm \acute{e}$el temperature of the AF under the application of a magnetic field.\\
The exchange bias on Fe$_{3}$O$_{4}$ films has been investigated in prior studies, i.e. by using different substrates to change the growth direction of the AF and analyzing the influence of a compensated NiO(001) and a fully uncompensated NiO(111) interface on the exchange bias\cite{Fertbilayer}. The influence of the stacking order was also examined in that study.\\
Models have been developed to describe the exchange bias, i.e a domain state model (DSM) based on Monte Carlo simulations\cite{DomainI}, which shows that the magnitude of the exchange bias is dependent on the degree of dilution of the antiferromagnet. This domain state model has been verified by experiments\cite{DomainII}.\\
Shortly after the exchange coupling, the trainings effect was found,too. The trainings effect denotes the descending of the initial exchange bias to a smaller residual value during measuring the hysteresis loops. D. Paccard has reported about the training effect\cite{TrainingsEffect1} in AF/F systems.\\
Since the film thickness, the crystal quality of the films and AF/F interface structure and roughness strongly influence the magnetic properties of the bilayers, we have investigated the thickness dependence of the strutural quality of Fe$_{3}$O$_{4}$/NiO-bilayers on the film thickness of each film. Both NiO and Fe$_{3}$O$_{4}$ were grown at 250$^{\circ}$ substrate temperature to avoid the unwanted interdiffusion of magnesium ions from the substrate into the bilayer\cite{PressureRate}. A substrate temperature of 250$^{\circ}$ is also considered as the lower limit for the growth of well-ordered magnetite films\cite{NiOMagnetit}.\\
The stoichiometry of the bilayers were analyzed $in-situ$ by x-ray photoelectron spectroscopy (XPS), while the structural properties were investigated by $in-situ$ low energy electron diffraction (LEED) and $ex-situ$ x-ray diffraction (XRD). The XRD data were evaluated using kinematic diffraction theory.\\

\section{EXPERIMENTAL SETUP AND SAMPLE PREPARATION}
The sample preparation was carried out in multi chamber ultra high vacuum (UHV) systems with a preparation chamber (base pressure of 10$^{-8}$\,mbar) and an analysis chamber (base pressure of 10$^{-10}$\,mbar). The available $in-situ$ characterization methods are low energy electron diffraction (LEED) and x-ray photoelectron spectroscopy (XPS). The XPS system operates with an hemispherical analyzer and an Al K$_{\alpha}$ x-ray anode (1486.6 eV).
To perform reactive molecular beam epitaxy (RMBE) the preparation chamber is equipped with electron beam evaporators for nickel and iron, a heatable manipulator and an oxygen source.\\
Before film deposition the MgO substrates were annealed at 400$^\circ$C in a 10$^{-4}$\,mbar oxygen atmosphere to obtain well-ordered and clean surfaces as proved by LEED and XPS, respectively.
After the preparation of the substrates NiO films were deposited using RMBE at 250$^\circ$C in a 10$^{-5}$\,mbar oxygen atmosphere. Afterwards, Fe$_{3}$O$_{4}$ films with constant thickness were grown on the NiO films also via RMBE at 250$^\circ$C in a 5$\times$10$^{-6}$ mbar oxygen atmosphere.
The thicknesses of the different films were in situ controlled by a quartz crystal microbalance.
Later ex situ XRR measurements were performed to prove the thickness of all films of the samples.
Two different series of Fe$_{3}$O$_{4}$/NiO bilayers were grown on MgO(001) supports. In series one the NiO film thickness was modified, while the magnetite film thickness was kept constant. The bilayers of series two has a constant NiO film thickness, while the magnetite thickness was varied.\\
After each annealing step and each film deposition the samples were transferred to the analysis chamber for $in-situ$ LEED and XPS measurements.\\
After the sample preparation the samples were exposed to ambient conditions for diverse $ex-situ$ experiments. The film thickness and structure of the films was analyzed by XRR and XRD, respectively.
These experiments were carried out at Deutsches Elektronen-Synchroton (DESY), Hamburg at PETRA III beamline P08. This is an undulator beamline with a high heat-load double-crystal monochromator and large-offset monochromator to separate the beamline from the adjacent beamline. At the endstation a Kohzu 4S+2D type diffractometer is installed\cite{OSeeckP08}. A Mythen array detector\cite{Detektor} was used due to its higher dynamic range and the capability of creating reciprocal space maps (RSM) within a shorter period of time compared to a point detector.

\section{Results}

\subsection{$In-Situ$ surface characterization by LEED and XPS}
LEED experiments were performed at an electron energy of 135\,eV. Fig. \ref{LEED} shows exemplary for one sample the surface structure of an initial clean MgO substrate (a), with an additional 7\,nm NiO film (b) and the subsequently grown 56\,nm Fe$_{3}$O$_{4}$ film (c).
All bilayers show in each deposition step the same diffraction pattern.
Since MgO and NiO have the same rocksalt structure and similar lattice constants, the surface diffraction pattern is in either case a quadratic 1 $\times$ 1 structure.
The diffraction pattern of the magnetite film shows more spots due to the almost doubled lattice constant.
In addition, we always observe the typical ($\sqrt{2} \times \sqrt{2})$R45$^{\circ}$ superstructure.
This superstructure is only visible in the case of magnetite\cite{Cham1}, while maghemite has only an quadratic 1 $\times$ 1 surface structure.

\begin{figure}
	\centering
		\includegraphics{./LEED.eps}
	\caption{LEED pattern obtained at 135\,eV electron energy of a clean MgO(001) substrate (a), a NiO film on top of this substrate (b) and an Fe$_{3}$O$_{4}$ film on top of this NiO film. The small white square indicate the ($\sqrt{2} \times \sqrt{2})$R45$^{\circ}$ surface superstructure of the magnetite, while the bigger white squares indicate the 1 $\times$ 1 surface structures.}
	\label{LEED}
\end{figure}

The XP spectra of the Fe 2p peak region (a) and the Ni 2p region (b) are presented exemplarily in Fig.\ref{XPSCombo} for the same sample.
The Ni 2p spectra consists of the Ni 2p$_{3/2}$ peak at 854.6\,eV and the Ni 2p$_{1/2}$ peak at 872.6\,eV with their corresponding satellites at about 7\,eV higher binding energy. The measured Ni 2p spectra agree well with Ni 2p spectra for NiO reported in literature\cite{NiOXPS}. The XP spectra of the Fe 2p region of all samples exhibit the same behavior. The Fe 2p$_{3/2}$ is located at binding energy of 710.6\,eV, while the Fe 2p$_{1/2}$ is situated at binding energy of 723.6\,eV. Magnetite contains Fe$^{2+}$-ions as well as Fe$^{3+}$-ions at the ratio of 1:2. At this ratio the charge transfer satellites characteristic for maghemite (718.8\,eV\cite{Yamashita,Fuji}) or wuestite (714.7\,eV\cite{Yamashita,Fuji}) are not visible separately since both satellites overlap forming a flat plateau between the Fe 2p$_{3/2}$ and Fe 2p$_{1/2}$ peak. Hence, this spectrum is typical for stoichiometric Fe$_{3}$O$_{4}$. Therefore, combined with the LEED experiments it is safe that  crystalline and stoichiometric magnetite has been deposited on crystalline and stoichiometric NiO.

 \begin{figure}
	\centering
		\includegraphics{./XPScombo.eps}
	\caption{XP spectra of the Fe 2p (a) and the Ni 2p (b) of a 50\,nm iron oxide and a 7\,nm nickel oxide film, respectively.}
	\label{XPSCombo}
\end{figure}

\subsection{Film structure characterization by XRD}

The structures of the entire oxide bilayers were analyzed by X-ray diffraction experiments.
Hence, the 3D reciprocal space spanned by the MgO substrate is indexed lateral by the MgO(001) surface unit cell while the layer distance has been used for the direction perpendicular to the surface. Compared to the well-known cubic bulk unit cell this surface unit cell has half the size of the bulk unit cell of MgO in vertical direction due to the spacing between (001) crystal planes and is rotated by 45$^{\circ}$ in the (001) plane.
Thus, compared to the cubic bulk lattice, we use the base vectors $\vec{a}_{1}\,=\,\frac{1}{2}(1,1,0)$, $\vec{a}_{2}\,=\,\frac{1}{2}(-1,1,0)$ and $\vec{a}_{3}\,=\,\frac{1}{2}(0,0,1)$ to describe the lattice.
As a consequence the MgO(002)$_{B}$ rock salt bulk reflection is denoted by MgO(001)$_{S}$.
Since the magnetite and the maghemite spinel structures have almost doubled bulk lattice constants compared to MgO, the (004)$_{B}$ spinel bulk reflection is very close to the MgO(001)$_{S}$ reflection
NiO crystallizes like MgO in the rock salt structure with a slightly smaller lattice constant, so the NiO(002)$_{B}$ rock salt bulk reflection is also close to the MgO(001)$_{S}$ reflection.\\

\begin{figure}
	\centering
		\includegraphics{./RSMZus.eps}
	\caption{Reciprocal space map of a sample with a 24\,nm NiO and a 51\,nm Fe$_3$O$_4$ film (a) and of a sample with 29\,nm NiO and 10\,nm Fe$_3$O$_4$ film (b).}
	\label{SRSM}
\end{figure}

A reciprocal space ($K$,$L$) mapping (RSM) of one sample of the first series with 50\,nm Fe$_{3}$O$_{4}$ on 24\,nm NiO is shown in Fig.\ref{SRSM}(a). For comparison another RSM of a sample of the second series with a 28\,nm NiO film and a 10\,nm Fe$_{3}$O$_{4}$ film is depicted in Fig.\ref{SRSM}(b). Both RSMs show a sharp MgO substrate peak at $L$\,=\,2 due to diffraction at the MgO substrate. The sample of the first series in Fig.\ref{SRSM}(a) shows broad Bragg peaks and corresponding Laue oscillations of the deposited NiO and Fe$_{3}$O$_{4}$ films due to their finite film thickness. As opposed to this the sample of the second series in Fig.\ref{SRSM}(b) exhibits only the Bragg peak of the NiO film along with distinct Laue oscillations. Here, the diffraction signal of the iron oxide causes only weak modulations of the diffraction signal of the NiO since the Fe$_{3}$O$_{4}$ film is very thin.

\begin{figure}
	\centering
		\includegraphics{./XRDfit1.eps}
	\caption{XRD rod scans along the (00$L$) of the samples with constant Fe$_{3}$O$_{4}$ thickness and increasing NiO thickness. Circles show experimental data and solid lines calculations.}
	\label{fig:XRD1}
\end{figure}

The crystal truncation rod (CTR) scans along the (00$L$) direction for the series with the nearly constant magnetite film and variation of the NiO film thickness are depicted in Fig. \ref{fig:XRD1}.
All scans show a sharp MgO substrate peak at $L$ = 2 due to diffraction at the MgO substrate. The series with the constant magnetite film thickness in Fig. \ref{fig:XRD1} exhibits in all scans broad Bragg peaks of the deposited Fe$_{3}$O$_{4}$ films due to their finite film thickness.
In addition well-pronounced Laue oscillations with high periodicity can be observed, which indicate well ordered films with homogeneous thickness.
The Bragg peaks of NiO are also visible for NiO thicknesses higher than 7 \,nm. The increasing film thickness of the NiO films can be easily seen by comparing the periodicity of the oscillations and the FWHM of the corresponding Bragg peaks (Fig. \ref{fig:XRD1}). However, at film thicknesses smaller than 7\,nm no Bragg peaks and only Laue oscillations of the NiO modulating the diffraction signal of the magnetite can be observed. At a NiO film thickness of 24\,nm the Laue oscillations of the magnetite film becomes weaker and are nearly vanished at a NiO film thickness of 33 nm. This observation indicates an increasing roughness of the NiO/Fe$_{3}$O$_{4}$-interface.
Moreover, here the Bragg peak of the magnetite film is weaker than the Bragg of the NiO film at 33\,nm although the  Fe$_{3}$O$_{4}$ film has a film thickness of 43\,nm.\\

\begin{figure}
	\centering
		\includegraphics{./XRDfit2.eps}
	\caption{XRD rod scans along the (00$L$) of the samples with constant NiO thickness and increasing Fe$_{3}$O$_{4}$ thickness. Circles show experimental data and solid lines calculations.}
	\label{fig:XRD2}
\end{figure}

The specular rod scans of the second series of bilayers with a constant NiO film thickness of approximately 30\,nm are shown in Fig. \ref{fig:XRD2}. All films feature Laue fringes and broad Bragg peaks of the NiO film independent of the Fe$_{3}$O$_{4}$ film thickness.  In this series the Laue fringes for thin magnetite films cause very small modulations of the diffraction signal of the NiO. However, the thin magnetite films in this series modulate the diffraction signal of the NiO film much weaker than the thin NiO films modulate the thick magnetite films in series one. Another feature is that the Bragg peaks and fringes of the thicker magnetite films can hardly be seen. Even the Bragg peak of a 60\,nm thick magnetite film is almost not visible. One exception is the sample with a 37\,nm magnetite film, where some weak Laue fringes and a small Bragg peak are observable. However, overall the diffraction signal of the magnetite film is very weak compared to a well-ordered magnetite film. This observation indicates that the quality of the magnetite depends on the NiO film thickness. While small NiO thicknesses barely influence the crystal quality of the magnetite films, a NiO film thickness of 24\,nm increases the roughness of the NiO/Fe$_{3}$O$_{4}$-interface .\\

\begin{figure}
	\centering
		\includegraphics{./Modell.eps}
	\caption{Schematic cross section through a sample to explain the parameters used in the layer model. The different colored circles represent the different ions in the corresponding crystal lattice.}
	\label{ModellNiFeO}
\end{figure}

We have applied full kinematic diffraction theory for analysis of the diffraction data lines in Figs. \ref{fig:XRD1} and \ref{fig:XRD2} in order to determine the structural parameters and to understand deeper the observations described above.
The applied approach for the calculations shown in Fig.\ref{ModellNiFeO} consists of the MgO rock salt substrate, the on top grown NiO with rock salt structure and the subsequently deposited Fe$_{3}$O$_{4}$ with spinel structure.
In this approach oxygen, Ni and iron ions were primarily arranged in their respective bulk structures and the diffracted intensity was calculated using their atomic form factors.
In the calculation the unit cells of the respective films were homogeneously deformed perpendicular to the surface to obtain the vertical layer distance.
Further parameters of the calculation are the surface roughness of the Fe$_{3}$O$_{4}$ film and interface roughnesses as well as the Debye-Waller factors.
The vertical layer distances determined from the curve fitting calculations of the (00$L$)-rod plotted against the film thickness are shown in Fig.\ref{fig:Lattieserie1} and Fig.\ref{fig:Lattieserie2}.

\begin{figure}
	\centering
		\includegraphics{./LagenabstandS1.eps}
	\caption{Vertical layer distance of magnetite and nickel oxide of the samples with constant Fe$_{3}$O$_{4}$ film thickness and increasing NiO film thickness dependent on film thickness.}
	\label{fig:Lattieserie1}
\end{figure}

The vertical layer distances $c$ for completely strained pseudomorphic Fe$_{3}$O$_{4}$ and NiO were calculated using $\frac{\Delta c}{c} = \frac{2\nu}{\nu - 1} \frac{\Delta a}{a}$\cite{NiOPoisson} and assuming a Poisson number of $\nu$\,=\,0.356 for magnetite\cite{Poisson} and $\nu$\,=\,0.21 for NiO\cite{NiOPoisson}.
The areas between these calculated values (dotted lines) and their corresponding bulks values (solid lines) are marked in grey.
The vertical layer distances of NiO ($c_{1,NiO}$ ) and Fe$_{3}$O$_{4}$ ($c_{1,Fe_{3}O_{4}}$) for the series with increasing NiO film thickness are shown in Fig.\ref{fig:Lattieserie1}.
The vertical layer distance $c_{1,NiO}$ of the NiO (red dots) is completely strained (0.2079\,nm) and exhibits no dependence on the NiO film thickness.
Therefore, the NiO does not relax with increasing film thickness in the investigated range of film thicknesses. The vertical layer distances of magnetite is also strained and nearly constant at 0.2098\,nm and is consequently also independent of the NiO film thickness.

\begin{figure}
	\centering
		\includegraphics{./LagenabstandS2.eps}
	\caption{Vertical layer distance of magnetite and nickel oxide of the samples with constant NiO film thickness and increasing Fe$_{3}$O$_{4}$ film thickness dependent on film thickness.}
	\label{fig:Lattieserie2}
\end{figure}

A similar observation can be made in Fig.\ref{fig:Lattieserie2}, where the vertical layer distances $c_{2,NiO}$ and $c_{2,Fe_{3}O_{4}}$ of the second series are plotted against the film thickness.
In agreement with the first series of bilayers the vertical layer distances $c_{2,NiO}$ of the NiO films with constant film thickness are completely strained at approximately 0.2079\,nm.
The vertical layer distance $c_{2,Fe_{3}O_{4}}$ of Fe$_{3}$O$_{4}$ is heavily strained and relaxes distinctly from 0.2080\,nm at 5\,nm to 0.2092\,nm at 18\,nm and then slowlier to 0.2099\,nm for 60\,nm Fe$_{3}$O$_{4}$ film thickness.
Thus, magnetite reaches the vertical layer distance of bulk magnetite.
However, we have to admit that the vertical layer distance of the magnetite films in this series were more difficult to determine than in the other series since the intensity of the corresponding Bragg peaks and fringes were quite weak. The weak Fe$_{3}$O$_{4}$ Bragg peaks in this series confirms the observation for the first series that the quality of the magnetite films depends strongly on the NiO film thickness. Beyond 24\,nm NiO film thickness the magnetite film is not well-ordered.

\begin{figure}
	\centering
		\includegraphics{./FeNiOS1roughness.eps}
		\caption{Surface and interface roughness of the samples with constant Fe$_{3}$O$_{4}$ film thickness and increasing NiO film thickness dependent on film thickness. }
	\label{fig:FeNiOS1roughness}
\end{figure}

This finding is strongly supported by our results for the NiO/Fe$_{3}$O$_{4}$ interface roughness. First, we have to emphasize tha the MgO/NiO interface is very smooth. It's roughness is 0.2($\pm$ 0.1)\,nm
The roughness of the NiO/Fe$_{3}$O$_{4}$ interface and the Fe$_{3}$O$_{4}$ surface is plotted against film thickness in Fig.\ref{fig:FeNiOS1roughness}.
It can be seen that with increasing NiO film thickness the roughness of the interface is also continuously increasing from 0.1\,nm to 1\,nm. The surface of the magnetite films, however, exhibits a small roughness of 0.1\,nm independent of the film thickness with the exception of the Fe$_{3}$O$_{4}$ film with 33\,nm NiO underneath. Here, the magnetite film has also a roughness of 1\,nm.

\begin{figure}
	\centering
		\includegraphics{./FeNiOS2roughness.eps}
		\caption{Surface and interface roughness of the samples with constant NiO film thickness and increasing Fe$_{3}$O$_{4}$ film thickness dependent on film thickness. }
	\label{fig:FeNiOS2roughness}
\end{figure}

The interface and surface roughness of the NiO and Fe$_{3}$O$_{4}$ films of the second series of samples are shown in Fig. \ref{fig:FeNiOS2interface}. In agreement with the first series the roughness of the NiO/Fe$_{3}$O$_{4}$ interface  is 0.80 ($\pm$ 0.15)\,nm for the 30$\pm 2$\,nm NiO films, while the surface roughness of the magnetite films is 0.15($\pm$0.05)\,nm with the exception of the magnetite film with 60\,nm film thickness. Here, interface roughness is 1\,nm.

\begin{figure}
	\centering
		\includegraphics{./FeNiOS1interface.eps}
		\caption{Interface spacing of the samples with constant Fe$_{3}$O$_{4}$ film thickness and increasing NiO film thickness dependent on film thickness. }
	\label{fig:FeNiOS1interface}
\end{figure}

The spacings for the MgO/NiO and NiO/Fe$_{3}$O$_{4}$ interfaces (cf. Fig.\ref{ModellNiFeO}) are depicted dependent on film thickness in Fig. \ref{fig:FeNiOS1interface} for the first series.
The interface spacing MgO/NiO is slighty increasing with increasing film thickness from 0.2106\,nm to 0.2211\,nm, while interface spacing NiO/Fe$_{3}$O$_{4}$ is 0.202($\pm$0.008)\,nm and shows no dependence on film thickness.

\begin{figure}
	\centering
		\includegraphics{./FeNiOS2interface.eps}
		\caption{Interface spacing of the samples with constant NiO film thickness and increasing Fe$_{3}$O$_{4}$ film thickness dependent on film thickness. }
	\label{fig:FeNiOS2interface}
\end{figure}

The spacings of the MgO/NiO and NiO/Fe$_{3}$O$_{4}$ interfaces of the second series of samples are plotted versus film thickness in Fig. \ref{fig:FeNiOS2interface}. Both spacings show no dependence on film thickness and are 0.206($\pm$ 0.005)\,nm for the NiO/Fe$_{3}$O$_{4}$ interface while the MgO/NiO interface spacing is 0.217($\pm$ 0.014)\,nm.

\section{discussion}
After preparation of the nickel oxide and iron oxide films the photoelectron spectra of the Fe2p and Ni2p peak reveal that the surface near region of the films is Fe$_{3}$O$_{4}$ and NiO, respectively.
Both NiO and Fe$_{3}$O$_{4}$ films show LEED diffraction patterns with the expected surface structures. NiO films exhibit a (1 $\times$ 1) surface structure, since they crystallize like MgO in rock salt structure. Fe$_{3}$O$_{4}$ films have the the typical ($\sqrt{2}\times\sqrt{2}$)R45$^{\circ}$ superstructure of the surface.\\
The photoelectron spectra of the Fe2p and Ni2p peak reveal that the surface near region of the films is Fe$_{3}$O$_{4}$ and NiO, respectively. In summary, LEED and XPS prove that NiO and Fe$_{3}$O$_{4}$ films have the expected surface structure and surface near stoichiometry and there is no dependence on film thickness.\\
XRD specular rod scans were carried out to investigate the whole structure of the samples. The scans of all films reveal that all NiO films are crystalline and well-ordered.
In the first series where the initially NiO film thickness is 3\,nm only a weak broad Bragg peak can be observed, however, the strong Laue fringes of the NiO modulate the diffraction signal of the Fe$_{3}$O$_{4}$ film. A separate broad Bragg peak of the NiO film is observable at 14 \,nm and it gets more distinct with increasing NiO film thickness.
All NiO films in both series are fully strained with a vertical layer distance of 0.2079 nm and do not relax with increasing film thickness. The interlayer spacing of NiO normal to the surface has become smaller to compensate the tensile strain due to the lattice matching of the film with the surface unit cell of the MgO substrate. This strain should decrease rapidly with the stable formation of dislocation above the critical thickness $h_{c}$. The critical thickness $h_{c}$ for the formation of misfit dislocations can be calculated using the formula\cite{FormelcritThick}
\begin{align}
 \frac{h_{c}}{b}= \frac{1 - \nu \cdot \cos^{2}(\alpha) (ln(\frac{h_{c}}{b}) +1)}{2\pi f(1 + \nu) \cos(\lambda)} \,
\label{Gleichung} ,
\end{align}
where $b=\frac{a_{NiO}}{\sqrt{2}}$ is the magnitude of the Burgers vector, $f$ = 0.8\% is the misfit of NiO, $\alpha = 90^{\circ}$ is the angle between the dislocation line and the Burgers vector, $\lambda = 45^{\circ}$ is the angle between the Burgers vector and the direction that is both normal to the dislocation line and that lies within the plane of the interface and $\nu = 0.21$ is the Poisson ratio\cite{NiOPoisson}. We obtain a critical film thickness of $h_{c}$ = 39\,nm, which means that the NiO film grown for this study are all below this critical film thickness and it is reasonable to observe no strain relaxation at the vertical layer distance. In addition, we like to emphasize that the relaxation process is very slow also for reasonable thicker NiO films\cite{NiOPoisson}.\\
The determined interface spacings $g$ between the MgO substrate and the NiO film and between the NiO and the Fe$_{3}$O$_{4}$ (cf. Fig. \ref{ModellNiFeO}) show no interpretable dependence on the film thickness. Only the spacing of the MgO/NiO interface of the first film series increases slightly with increasing film thickness. While the Fe$_{3}$O$_{4}$/NiO interface thickness does not differ significantly from the interlayer spacings of these oxide films the NiO/MgO interface thickness is expanded compared to their interlayer spacings. This may be attributed to some covalent character of NiO - MgO interactions\cite{NiOMgOcovalent}. \\
The roughness of the NiO/Fe$_{3}$O$_{4}$ interface in series one is increasing with increasing NiO film thickness from 0.1\,nm to 1\,nm. In series two the NiO/Fe$_{3}$O$_{4}$ interface roughness is nearly constant at 0.80 ($\pm$ 0.15)\,nm. This is consistent with series one since the constant NiO film thickness in series two confirms approximately the NiO film thickness of the thickest NiO film in series one.\\
Gatel et al. have grown among others Fe$_{3}$O$_{4}$/NiO bilayers on MgO(001) with a constant NiO film thickness of 66\,nm and different Fe$_{3}$O$_{4}$ film thicknesses ranging from 5 - 100\,nm. NiO and magnetite films have been grown using RF-sputtering at 700$^{\circ}$C and at 400 $^{\circ}$C substrate temperature, respectively. Gatel et al. state a NiO/Fe$_{3}$O$_{4}$ interface roughness of 0.7\,nm of their bilayers on MgO(001)\cite{Fertbilayer}.
Thus, the obtained interface roughness is in good agreement with literature.
Growth studies of single NiO films on MgO(001) at different preparation temperatures ranging vom 500$^{\circ}$C to 900$^{\circ}$C have shown that the surface roughness of NiO films becomes higher with increasing growth temperature from 0.2\,nm to 5.0\,nm \cite{CoNiObilayer}. In both studies the NiO films were grown using sputter deposition. Thus, lower growth temperatures reduce the interface roughness. In another study James et al. have grown NiO films with different thickness (20\,nm - 162\,nm) on MgO(001) using NO$_{2}$ assisted RMBE. They obtain an average NiO surface roughness of 0.35\,nm.
The latter study confirms that our growth temperature should not be the reason for the rough NiO/Fe$_{3}$O$_{4}$ interface, since a growth temperature of 250$^{\circ}$ is sufficient to obtain smooth surfaces even at 162\,nm NiO film thickness.
One possible explanation is that the interface roughness is increasing during the deposition of magnetite leading to a high NiO/Fe$_{3}$O$_{4}$ interface roughness since intermixing effects may play an important role at least at higher temperatures. However, regarding the development of the roughness in the first series, this should not be the case since the interface roughness is increasing with growing NiO film thickness.\\
 While the structural quality of the NiO films is constantly high in both series, the structural quality of the Fe$_{3}$O$_{4}$ film gets worse with increasing NiO film thickness. Until 24\,nm NiO film thickness the Fe$_{3}$O$_{4}$ exhibits an obvious Bragg peak with corresponding Laue fringes.
Above this thickness only weak Fe$_{3}$O$_{4}$ Bragg peaks are visible and nearly no Laue fringes can be seen. This observation at the first series is confirmed by CTR analysis of the second series, where the film thickness of all NiO films is approximately 30\,nm. While at small Fe$_{3}$O$_{4}$ film thickness the Laue fringes of magnetite causes weak modulations of the NiO diffraction, no distinct Bragg peak corresponding to Fe$_{3}$O$_{4}$ appears between the NiO and MgO Bragg peaks with increasing Fe$_{3}$O$_{4}$ film thickness. The Laue fringes corresponding to magnetite do not reach a comparable strength to the Laue fringes of the first three samples of the first series. So we have to note that the NiO film thickness has an influence on the structural quality of the magnetite films. The reason for the bad structural ordering of the magnetite is obviously the high NiO/Fe$_{3}$O$_{4}$ interface roughness which is increasing with advancing NiO film thickness (Fig. \ref{fig:FeNiOS1roughness}).
Calculating the critical film thickness h$_{C}$ for the formation of misfit dislocations in magnetite using formula \ref{Gleichung} we obtain h$_{C}$ = 105\,nm ($b = 0.2969\,nm$, $f = 0.3\,\%$, $\nu = 0.356$, $\lambda = 45^{\circ}$, $\alpha = 90^{\circ}$ ), which is approximately twice the film thickness of magnetite in this study. Since NiO grow pseudomorph on MgO adapting its lateral lattice constant, the misfit $f$ is respective to the MgO. \\
In the first series of bilayers the vertical layer distance of magnetite features no dependence on NiO film thickness, which is reasonable since the magnetite film thickness of every bilayer is almost the same and the NiO films are pseudomorph to MgO. However, in the second series the vertical layer distance of Fe$_{3}$O$_{4}$ relaxes with increasing Fe$_{3}$O$_{4}$ film thickness until it reaches nearly the bulk value, although the magnetite have not reached the critical film thickness. Our previous studies on the growth of magnetite on MgO(001)\cite{BertiBernd,Berti2heizen,Berti1} confirm this observation. In these studies the strain of the magnetite films has relaxed with increasing film thickness and the critical film thickness is very small.\\
Although the structural ordering of the magnetite gets worse, the roughness of the magnetite surface is relative low ranging from 0.1\,nm to 0.2\,nm. Thus, magnetite films seem to compensate the interface roughness. Only the bilayer with 33\,nm NiO film thickness in series one and the bilayer with 60\,nm magnetite film thickness in series two have a distinct higher roughness with 1\,nm. This can be attributed to the great progression of the structural degradation of the magnetite films. Thus, in order to get structural better magnetite films on thick NiO films, the preparation of the Fe$_{3}$O$_{4}$/NiO bilayers has to be improved. Therefore, the influence of the growth temperatures of NiO and Fe$_{3}$O$_{4}$ on the Fe$_{3}$O$_{4}$-NiO interface roughness have to be investigated. As mentiond above a growth temperature of 500$^{\circ}$C leads to a smooth NiO film surface. Withal you have to keep in mind that a too high growth temperature may lead to an intermixing of the NiO and Fe$_{3}$O$_{4}$ films, which will also affect the magnetic properties of the bilayers.

\section{conclusion}
The detailed structural characterization of Fe$_{3}$O$_{4}$/NiO bilayers grown on MgO(001) substrates have shown that the quality of the NiO/Fe$_{3}$O$_{4}$ interface has a huge impact on the quality of the Fe$_{3}$O$_{4}$ films. While magnetite grows homogenously and smoothly on NiO films with up to 24\,nm thickness, the structural quality of the magnetite films gets distinctly worse with higher NiO film thickness. We attribute this to the fact that the interface roughness between NiO and Fe$_{3}$O$_{4}$ is increasing with increasing NiO film thickness. While the roughness of the 3\,nm NiO film is rather small, it is rising obviously with increasing NiO film thickness. As a result the structural quality of the magnetite films grown on 30\,nm NiO films is constantly reduced with increasing magnetite film thickness. \\

\section{acknowledgements}
Parts of this research were carried out at the light source PETRA III at DESY, a member of the Helmholtz Association (HGF).
We would like to thank O. H. Seeck for assistance in using beamline P08. Financial support by the DFG (KU2321/2-1) is gratefully acknowledged.

\clearpage