%\documentclass[12pt]{article}
%\setlength{\textwidth}{167mm}
%\setlength{\headsep}{0mm}
%\setlength{\headheight}{0mm}
%\setlength{\textheight}{230mm}
%\setlength{\oddsidemargin}{1.6mm}
%\setlength{\evensidemargin}{1.6mm}
%\setlength{\topmargin}{4.6mm}
%
%\usepackage{chngcntr}
%\usepackage{xspace}
%\usepackage{graphicx}
%\usepackage{amsmath}	% Advanced maths commands
%\usepackage{amssymb}	% Extra maths symbols
%\usepackage[ ]{hyperref}
%\graphicspath{{Images/}}
%%\usepackage[symbol]{footmisc}
%
%
%% Astronomical abbreviations (thanks to Dan Huber)
%\newcommand{\numax}{\mbox{$\nu_{\rm max}$}\xspace}
%\newcommand{\dnu}{\mbox{$\Delta \nu$}\xspace}
%\newcommand{\muHz}{\mbox{$\mu$Hz}\xspace}
%\newcommand{\teff}{\mbox{$T_{\rm eff}$}\xspace}
%\newcommand{\logg}{\mbox{$\log(g)$}\xspace}
%\newcommand{\feh}{\mbox{$\rm{[Fe/H]}$}\xspace}
%\newcommand{\msun}{\mbox{$\mathrm{M}_{\odot}$}\xspace}
%\newcommand{\lsun}{\mbox{$\mathrm{L}_{\odot}$}\xspace}
%\newcommand{\mearth}{\mbox{$\mathrm{M}_{\oplus}$}\xspace}
%\newcommand{\rsun}{\mbox{$\mathrm{R}_{\odot}$}\xspace}
%\newcommand{\kepler}{\emph{Kepler}\xspace}
%\newcommand{\tess}{\emph{TESS}\xspace}
%\newcommand{\ktwo}{K2\xspace}
%\newcommand{\gaia}{\emph{Gaia}\xspace}
%
%\begin{document}

\section*{\underline{Methods}}
\setcounter{tocdepth}{2}
\tableofcontents
\section{Asteroseismic Methods}
\subsection{Asteroseismic Data}
For our asteroseismic power spectrum data we used the unweighted power spectra from the KASOC pipeline \cite{m_handberg+lund2014}\footnote{Obtainable from the \href{http://kasoc.phys.au.dk/}{KASOC} webpage.}. We did not apply any additional treatment to these data. For 16 Cyg A \& B (KIC 12069424 and KIC 12069449) we used the KEPSEISMIC lightcurves \cite{m_garcia+2011}\footnote{Obtainable from \href{https://archive.
		stsci.edu/prepds/kepseismic/}{MAST}.}, which have significantly better signal-to-noise for these two stars.

For our asteroseismic ages, we used the ages obtained by \texttt{BASTA} \cite[BAyesian STellar Algorithm]{m_silvaaguirre+2015} in the `Kages' and LEGACY catalogues. These ages have been obtained by comparisons of measured oscillation properties to stellar models, accounting for an expanded range of metallicities. \texttt{BASTA} is thoroughly compared to four other seismic modelling techniques in \cite{m_silvaaguirre+2017}. While uncertainties found through \texttt{BASTA} are typically higher than for other techniques, only \texttt{BASTA} and \texttt{ASTFIT} \cite[Aarhus STellar Evolution Code]{m_christensen-dalsgaard2008} recover the radius, mass and age of the Sun, when applied to solar data. Although the uncertainties on \texttt{ASTFIT} ages are overall lower, they are not published for the `Kages' sample. In order to maintain an internally consistent stellar age sample, we used age results from \texttt{BASTA} for both the `Kages' and LEGACY samples.

For our stellar masses we used asteroseismic model masses obtained by \texttt{BASTA} reported in `Kages' and LEGACY, in order to maintain internal consistency with the age measurements. We note that age and mass posteriors from \texttt{BASTA} are correlated, but chose not to account for the unpublished correlations in this work.

As described in the catalogue papers, for `Kages' stars atmospheric properties (\teff and \feh) were measured through high-resolution spectroscopy \cite{m_huber+2013a}. For LEGACY stars, atmospheric properties were similarly taken from one study \cite{m_buchhave+latham2015} for most stars in the catalogue, and complemented by other values from the literature for the remaining stars \cite[see Table 3]{m_silvaaguirre+2017}.

Other asteroseismic properties used in this study, such as those used as first guesses on the free parameters in our asteroseismic model, were taken from the `Kages' and LEGACY catalogues \cite{m_astropycollaboration+2013, m_astropycollaboration+2018, m_ginsburg+2019}. In cases where both catalogues contained the same target, we used the stellar parameters reported in LEGACY \cite{m_mckinney2010}. This is also the case for the masses and ages described above.

\subsection{Mode Frequency Fitting}

In order to extract signatures of stellar rotation from the asteroseismic mode frequencies, we built a model that simultaneously treats the convective background, modes of oscillation, and white noise, while accounting for rotational splitting. The foundations of this approach follows best-practices in asteroseismology \cite{m_davies+2015}, fitting Harvey profiles for the background \cite{m_harvey1985} and expressing the frequencies of the modes using an asymptotic expression \cite{m_tassoul1980, m_vrard+2016}.

The first core improvement in this work is the use of hierarchical latent variable models \cite{m_hogg+2010, m_hall+2019}, which account for small-scale deviations in mode frequencies due to effects not explicitly accounted for in our model (such as acoustic glitches \cite{m_mazumdar+2014}). By improving the inference of mode frequencies in this way, we also improve the ability to resolve the rotational splitting. The second improvement comes in the form of priors on our parameters, and in particular the rotational inclination, which more accurately reflects the true distribution of angles than previous techniques \cite{m_chaplin+basu2017}. A step-by-step breakdown of the model and all priors can be found in \textbf{Supplementary Materials}.\\

We separated our model fitting into two parts. First, we fit a model for the convective background and white noise only, to the region of the power spectra that did not contain modes of oscillation. This was done using \texttt{PyStan} \cite{m_vanhoey+2013, m_carpenter+2017}, for 10,000 iterations on each star\footnote{These \texttt{PyStan} runs were initiated with a random seed of 11, as were all other random processes in this work.}. Second, we fit our full model (including the convective background) to the region containing the modes of oscillation. The results of the first fit to the convective background were used as extremely informative priors on the background parameters in this second fit. This was done using \texttt{PyMC3} \cite{m_vanderwalt+2011,m_salvatier+2016, m_thetheanodevelopmentteam+2016} for 2500 iterations each on 4 chains.

From this asteroseismic analysis, we report inclination angle ($i$), rotational splitting ($\nu_{\rm s}$), and rotation period ($P$) in \textbf{Extended Data} Table \ref{tab:results}. The summary statistics on these parameters were taken as the median of the posterior distribution, with uncertainties being the $15.9^{\rm th}$ and $84.1^{\rm st}$ percentiles. For inclination angle ($i = \arccos(\cos(i))$) and rotation ($P = 1/\nu_{\rm s}$), the full posterior samples were transformed before taking the summary statistics, as our model sampled in $\cos(i)$ and $\nu_{\rm s}$.

We flagged any sub-optimal conditions of the final fit. We flagged 5 for which the Gelman-Rubin convergence metric, $\hat{R}$, was greater than 1.01 and 2 stars for which it was greater than 1.1 on inclination angle or rotation, where a $\hat{R} = 1$ indicates a converged result \cite{m_gelman+rubin1992}. We also performed visual checks of the sampled chains on all hyperparameters and of the best-fit model compared to both the raw and smoothed asteroseismic data. We found no issues in the visual investigation of 94 stars. KIC 8478994 is not reported due to both a poor unconverged fit as well as high $\hat{R}$ on rotational parameters. KICs 6603624, 8760414 and 8938364 are reported in \textbf{Extended Data} Table \ref{tab:results}, but were excluded from the gyrochronology analysis due to strong disagreement with multiple studies in the literature (see main body of paper). Finally, we flagged any stars with fewer than 1000 effective samples ($n_{\rm eff}$) of $\nu_s$.

\section{Gyrochronology Methods}\label{s:gyro}
\subsection{Stellar Models}\label{ssec:models}
The braking models used in this work have several parameters that inform the rotational evolution. These are: a normalization factor to reproduce the solar rotation ($f_k$); a disk locking timescale ($T_{\rm disk}$) and period ($P_{\rm disk}$) which together regulate the stellar angular velocity during the pre-main sequence; the critical angular velocity that marks the transition from saturated (rapidly rotating) to unsaturated (slowly rotating) regimes ($\omega_{\rm crit}$), and the critical Rossby number, above which stars conserve angular momentum ($Ro_{\rm crit}$), mentioned above. $T_{\rm disk}$, $P_{\rm disk}$ and $\omega_{\rm crit}$ are calibrated to match the behavior in young open clusters, but have little impact on the rotational evolution beyond $\approx 1\, \rm{Gyr}$ in solar-mass stars. Both $f_k$ and $Ro_{\rm crit}$ affect the late-time evolution. Both models adopt $\omega_{\rm crit} = 3.4  \times 10^{-5}\, \rm{s}^{-1}$, $P_{\rm disk} = 8.1$, $T_{\rm disk} = 0.28$ and $f_k = 6.6$. In the weakened magnetic braking model, $Ro_{\rm crit} = 1.97$. \rtwo{This Rossby number is based on model comparisons to catalogues of spot rotation rates \cite{m_vansaders+2019}. Its exact value is not critical in our analysis, as any similar value would create a model population significantly different from the standard case. In the model, the Rossby number is defined as the rotation period divided by the convective turnover timescale, which in turn is defined as $\tau_{\rm cz} = H_p / v_{\rm conv}$, where $H_p$ is the pressure scale height at the base of the convection zone, and $v_{\rm conv}$ is the convetive velocity evaluated one pressure scale height above the base in a mixing length theory of convection. Solid body rotation is assumed \cite{m_nielsen+2015}.} For further details, see \cite{m_vansaders+pinsonneault2013} and \cite{m_vansaders+2016, m_vansaders+2019} for the standard and weakened magnetic braking cases respectively.

To construct a synthetic population of rotating stars, we expanded upon previous forward-models of the \textit{Kepler} field with the purpose of studying weakened magnetic braking \cite{m_vansaders+2019}, with some important improvements. We started with a TRILEGAL \cite{m_girardi+2012} Milky-Way simulation of the \kepler field, using the simulation's standard population values intended for this purpose. In order to replicate the \kepler selection effect, the TRILEGAL simulation was matched to the largest current catalogue of temperatures, luminosities and 2MASS $K$-band magnitudes of stars in the \kepler field \cite{m_berger+2020}. This was done using a nearest-neighbours approach, based on the density of stars on the HR diagram. This ensured that the TRILEGAL population matched the density of stars actually observed by \kepler, replicating its selection effects, and improved upon previous efforts \cite{m_vansaders+2019} by incorporating contemporary \textit{Gaia} mission data \cite{m_gaiacollaboration+2018}.

We made further changes to account for possible binarity in the the matching sample \cite{m_berger+2020}. If the first step is performed blindly, blended binaries in the sample cause an overestimation of the number of old stars. In order to overcome this, we:

\begin{enumerate}
	\item blended the TRILEGAL stars with binary companions drawn from a flat mass-ratio distribution, using a known binary fraction \cite{m_raghavan+2010},
	\item recalculated the `observed' luminosities and magnitudes assuming that each binary pair was blended, and
	\item shifted these stars' temperatures following a $g$-$K$ magnitude relation \cite{m_berger+2020}.
\end{enumerate}

This new distribution was used for the nearest-neighbour matching. Once drawn we dropped the binary companion and used the true TRILEGAL properties of those stars. For stars where the mass of the companion was $M < 0.4\, M_\odot$, binary contributions were ignored. Every binary was assumed to result in a blend, regardless of separation. This results in slightly more young stars than reality, because young, blended binary systems contaminate regions of the HR diagram where one expects to find old stars, and the number of blends is overestimated by assuming every binary system is a blend.

Our asteroseismic sample of stars with short cadence observations are subject to additional selection functions not included in the creation of the model populations above. We did \textit{not} explicitly account for these asteroseismic selection functions in our model, by design. Both the standard and WMB models contain stars with the same fundamental parameters (mass, radius, effective temperature, metallicity) but a different period based on the choice of rotational evolution prescription. Applying an asteroseismic selection function that depends on these fundamental parameters would have an identical effect on both models, therefore providing no net effect on our posterior distribution \cite{m_chaplin+2011}.  Additionally, we expected any seismic selection function to be relatively flat (and therefore uninformative) on a star-by-star scale, on which we run our model analysis.

\subsection{Bayesian Mixture Model}
In order to determine whether weakened magnetic braking occurs on the main sequence, we compared our sample of seismic age and rotation, along with temperature, metallicity and mass, to the two stellar population models of the \kepler field \cite{m_vansaders+2019}, discussed above. Both stellar models were evaluated in a Bayesian framework, with the rationale of determining which of the two models (standard or WMB) is most likely to reproduce our observed data. Each model sample contained temperature (\teff), mass ($M$), age ($t$), metallicity ($\rm{[Fe/H]}$) and rotation ($P$) information.

In order to draw probabilistic inference about the models, we built a five-dimensional Kernel Density Estimate (KDE) of both model populations using the \texttt{statsmodels} package \cite{m_seabold+perktold2010}. We used a band-width (setting the resolution of the KDE) of $0.02\, M_\odot$ in mass, $10\, \rm K$ in \teff, $0.01\, \rm{dex}$ in $\ln(t)$, $0.01\, \rm{dex}$ in $\rm{[Fe/H]}$ and $0.01\, \rm{dex}$ in $\ln(P)$. Note that age and rotation were treated in log space, where the posterior estimates from asteroseismology more closely resemble normal distributions. This approach translates the population models to a probability distribution we can use in a Bayesian framework.

We evaluated our data against both models simultaneously by treating the data as being drawn from a mixture of both model KDEs. In this mixture model structure, the two KDEs were modulated by a weighting factor, $Q_{\rm WMB}$. In the limit $Q_{\rm WMB} \rightarrow 1$, the data are most likely drawn from the WMB model. In the limit $Q_{\rm WMB} \rightarrow 0$, the data are most likely drawn from the standard model.

The posterior probability of obtaining $Q_{\rm WMB}$ and additional parameters $\theta$ given our data $\mathcal{D}$ is $p(Q_{\rm{WMB}}, \theta | \mathcal{D})$. Using Bayes equation, we can express this as:

\begin{equation}\label{eq:modelll}
	p(Q_{\rm{WMB}}, \theta | \mathcal{D}) \propto p(\mathcal{D} | \theta)\ p(\theta | Q_{\rm{WMB}}, \kappa_{\rm{s}}, \kappa_{\rm{WMB}})\ p(Q_{\rm{WMB}})\, ,
\end{equation}

\noindent where $\kappa_{\rm{s}}$ and $\kappa_{\rm{WMB}}$ are the KDE functions for the standard and WMB models respectively, and $\theta$ here are parameters, $\theta = \{M, \teff, \ln(t), \feh, \ln(P)\}$. The parameters $\theta$ may be referred to as latent parameters, as they form a step between the parameter we want to infer ($Q_{\rm{WMB}}$) and our data. Using this approach allowed our model to properly take into account the observational uncertainties on the data \rtwo{in five dimensions.}

The second component on the right hand side of Equation \ref{eq:modelll} describes the probability of obtaining our latent parameters $\theta$ given our KDEs and the mixture model weighting parameter $Q_{\rm WMB}$, and is described by the mixture model

\begin{equation}\label{eq:mixturell}
	p(\theta | Q_{\rm{WMB}}, \kappa_{\rm{WMB}}, \kappa_{\rm{s}}) = Q_{\rm WMB} \times \kappa_{\rm WMB}(\theta) + (1 - Q_{\rm WMB}) \times \kappa_{\rm s}(\theta)\, ,
\end{equation}

\noindent where all parameters are as described above. This probability function describes a distribution that is a mixture of both KDEs. While the KDEs are constant, $Q_{\rm WMB}$ is a free parameter, and so the shape of this distribution can vary. The latent parameters $\theta$ are drawn from this distribution, and therefore from some combination of the two stellar models.

The first component in Equation \ref{eq:modelll} describes the likelihood of obtaining the parameters $\theta$ given our data and their observational uncertainty. It takes the form

\begin{equation}
	p(\mathcal{D} | \theta) = \mathcal{N}(\mathcal{D} | \theta, \sigma_{\mathcal{D}})\, ,
\end{equation}

\noindent a normal distribution evaluating the latent parameters $\theta$ against the observations, with observational uncertainty $\sigma_{\mathcal{D}}$. This approach means that in each parameter space (such as age), the age drawn from the stellar model mixture is entered into the likelihood equation with our static observations. The value of this equation (and thus the likelihood) will increase if $\theta$ is closer to the observations, and the mixture model will be modulated in a manner that maximises this probability, inferring whether one stellar model is more likely to produce our data than the other.

The final term, $p(Q_{\rm WMB})$, represents the prior on the mixture model weight, which is uniform between 0 and 1. A visual representation of our model is shown in \textbf{Extended Data} Figure \ref{fig:pgm}.

Typically, this model would evaluate all stars in our sample against the stellar models simultaneously for a single posterior estimate of $Q_{\rm WMB}$. At 95 stars, in 5 parameter spaces, this totals 476 free parameters to marginalise over. This is not an issue for Hamiltonian Monte Carlo \cite[HMC]{m_betancourt+girolami2013}, however the use of KDE functions, over which a probabilistic gradient can not be measured, reduces HMCs effectiveness. Alternative Markov Chain Monte Carlo techniques \cite[MCMC]{m_foreman-mackey+2013} can more efficiently sample the KDE functions, but can not treat the large number of hierarchical parameters. To overcome this, we fit our model to each star to obtain an independent individual posterior distribution for $Q_{\rm WMB}$, and multiplied these post hoc to obtain a combined posterior. This comes with the benefit of easily allowing us to calculate the combined posterior for different stellar classifications, at the expense of the ability to marginalise for a single value of $Q_{\rm WMB}$ directly.\\

The parameter space of the stellar model populations were reduced before calculating the KDEs. These cuts were made in $M$, $\teff$, $\ln(t)$ and \feh, removing any stars in the models that fell more than $3 \times \sigma_{\mathcal{D}}$ outside the observations. Our observables $M$, $t$ and $P$ have asymmetric uncertainties from the Bayesian asteroseismic analysis. We used the larger of the reported uncertainties on each parameter as $\sigma_{\mathcal{D}}$ in each parameter space.

KIC 6278762 was excluded from this stellar model analysis, because its age fell more than $3\sigma$ outside of the highest age in the stellar models\footnote{This is a metallicity issue, as the oldest stars have metallicities outside the range of the rotational model grids.}, and KICs 7106245 and 8760414 were excluded for the same reason due to low metallicities outside the functional range of the stellar models (-0.99 and -0.92 respectively). We also excluded any stars with $n_{\rm eff} < 1000$ for rotational splitting, and those with $\hat{R} > 1.1$. The remaining sample of 73 stars contained 4 sub-giants, 22 `hot' stars, and 47 main sequence stars.

We fit our model Equation \ref{eq:modelll} using \texttt{emcee} \cite{m_foreman-mackey+2013, m_foreman-mackey2016}, using 32 walkers for a total of 7500 samples per walker, of which the first 2500 were discarded as a burn-in.

After fitting, we took a normalised histogram of the posterior estimate of $Q_{\rm WMB}$ for each star, using 100 bins. In this histogram, each bin approximated the value of the posterior function for $Q_{\rm WMB}$. The array of 100 bins for all stars were multiplied, resulting in an approximation of the joint posterior probability function for $Q_{\rm WMB}$ given all stars in the ensemble.

\section{Verifying asteroseismic results}
\subsection{Priors on rotational parameters}
In our Bayesian analysis, we have placed weakly informative priors on our sampled rotational parameters, $\nu_{\rm s}\sin(i)$ and $\cos(i)$. The prior is especially important for the angle of inclination, which is hardest to infer from the data. We are able to validate the robustness of our asteroseismic results by confirming that their posterior distributions are data-dominated, and not prior-dominated. We can do so by comparing the $68\%$ credible regions of the posterior estimates of $\nu_{\rm s}\sin(i)$ and $i$ against the $68\%$ credible regions of their priors.

A comparison between prior and posterior is shown for 94 stars in $\nu_{\rm s}\sin(i)$, $i$ and $P$ in \textbf{Extended Data} Figure \ref{fig:priors}, arranged by age. \rtwo{In the Figure, results with means (symbols) and $68\%$ credible regions (error bars) that are close to those same values for the prior distribution (where the horizontal line is the mean, and the shaded area is the credible region) can be interpreted as prior-dominated (i.e. poorly informed by the data). Cases where the means differ or the credible regions are smaller than the prior distribution are data-dominated.} The projected splitting, $\nu_{\rm s}\sin(i)$, is overall well constrained, with only one star \rtwo{being} prior dominated. This is expected, as the projected splitting is what we observe on the star before decoupling inclination and rotation. The angle of inclination $i$, sampled as $\cos(i)$, more closely follows the prior distribution in most cases. Combining the two, the rotation period $P$ has no stars directly corresponding to the effective prior on period, and globally follows a trend with increasing age. The three outliers with fast rotation at late ages (KICs 6603624, 8760414 and 8938364) are discussed in more detail in below.

The rotation rates as presented in this work are a product of our Bayesian sampling of both projected splitting and angle of inclination. As seen in the Figure there are instances where $i$ or $\nu_{\rm s}\sin(i)$ closely resemble the prior (and are therefore prior-dominated). There are no cases of this when looking at the resulting period measurements, as they will have been informed by at least one strongly data-driven parameter (commonly $\nu_{\rm s}\sin(i)$). From this, we concluded that our ensemble of asteroseismic rotation is not strongly dominated by the priors imposed on projected splitting and inclination in our Bayesian analysis.

\subsection{Comparisons to previous studies}\label{ssec:litcomp}
In order to validate our results, we compared our rotational parameters to those obtained in the literature, as well as those resulting from the work presented in LEGACY and `Kages', which were unreported and received through private communication by the authors of the catalogue papers.

Comparisons with LEGACY and `Kages' are shown in \textbf{Extended Data} Figure \ref{fig:legacykages} for projected splitting, inclination angle, and rotation period. In all three cases we show the fractional difference between the values obtained in this work and those from LEGACY and `Kages'. On the right of the Figure, we show the distribution of the fractional differences for the three parameters.
The projected splitting is in good agreement with both studies, however LEGACY finds slightly lower $\nu_{\rm s}\sin(i)$ for the faster rotators, deviating from our work by over $1\sigma$. Neither LEGACY nor `Kages' used a spatially isotropic prior for the inclination angle in their analyses, instead opting for a uniform prior. As posterior estimates of inclination angle are only loosely data-driven, the introduction of an isotropic prior should result in our analysis reporting globally higher inclination angles. This effect is seen in the comparisons of both inclination angles and rotation rates for the LEGACY stars, where we find overall lower rotation rates compared to LEGACY for stars at very similar $\nu_{\rm s}\sin(i)$.

A number of stars are excluded from \textbf{Extended Data} Figure \ref{fig:legacykages} and compared individually as extreme outliers: KICs 5094751, 6196457, 8349582, 8494142, 8554498, 105114430 and 11133306 all have fast rotation rates ($<5\, \rm days$) in `Kages', but are found to have a broader spread of rotation rates in this work. At similar values for $\nu_{\rm s}\sin(i)$, `Kages' found much lower inclination angles with highly asymmetrical uncertainties. Based on a comparison between the summary statistics of these stars, we concluded that the results found in this work have better marginalised over inclination angle, improving our measure of rotation.

Conversely, KICs 6603624, 8760414 and 8938364 have extremely slow rotation periods in LEGACY, but extremely \textit{fast} ($<3\, \rm {days}$) in this work. KICs 8760414 and 8938364 are excluded from the gyrochronology analysis below based on checks for $\hat{R}$ and the number of effective samples. Both stars have ages greater than $10\, \rm Gyr$, making their fast rotation rates highly unlikely under any model of rotational evolution. The posterior estimate of $P$ for KIC 6603624 is well-defined in our analysis, but with an age of $7.8\, \rm Gyr$, its measured rotation of $1.2\, \rm days$ is also highly unlikely under any model of rotational evolution. The LEGACY estimate of rotation is similarly extreme at $378\, \rm days$. These three stars have the lowest inclination angles in our sample ($< 10^\circ$), at which point the power in the split components of the seismic modes is so low that it becomes difficult to probe the measure of splitting. The split components for these stars will have a height roughly 3\% of the central mode. For comparison, for the next lowest inclined star at $17^\circ$, this rises to $10\%$. In cases such as these with lower signal-to-noise, spurious peaks may be interpreted as split components.\\

We also compared our asteroseismic estimates of stellar rotation with similar studies in the literature, shown in \textbf{Extended Data} Figure \ref{fig:literaturecomp}. These included: a study of the binary solar analogues 16 Cyg A \& B \cite{m_davies+2015}, ; a study of surface and seismic rotation which our catalogue shares 5 stars with \cite{m_nielsen+2015}, ; and an asteroseismic study of differential rotation with which our catalogue shares 40 targets \cite{m_benomar+2018}. For the latter, we used their reported splitting value $a_1$, which is equivalent to $\nu_{\rm s}$.

Overall,  \textbf{Extended Data} Figure \ref{fig:literaturecomp} shows no strong disagreements between our asteroseismic measurements for stellar rotation and those from the literature. The scatter of the fractional differences lies cleanly around the zero line, with a mean and spread of $0.0_{-15.6}^{+16.4}\, \%$. The increase in uncertainty with period is due to more slowly rotating stars being more difficult to constrain using asteroseismology.

It is of note that 16 Cyg A was found to be rotating slightly faster in our analysis compared to the literature \cite{m_davies+2015} (deviating within $2\sigma$), despite the fit being performed on the same data. We found an inclination angle that is slightly lower for 16 Cyg A but at a similar projected splitting, which would explain finding a lower value of rotation.

There are three outliers at low period in  \textbf{Extended Data} Figure \ref{fig:literaturecomp}: KICs 6603624, 8760414 and 8938364. These are the same targets found to be outliers in a comparison to the LEGACY and `Kages' measurements (see above), with anomalously fast rotation rates and low inclination angles. As these stars represent the lowest inclination angles in our sample, and were found to disagree with two independent studies, we opted to exclude them from the gyrochronology analysis, and to flag the rotation measurements for these three stars presented in this work.

\subsection{\rtwo{Seismic vs Surface rotation}}
As described in the main body of the paper, we compared a subsample of our asteroesismic rotation rates to surface rotation rates from spot rotation, where available. Both the surface ($P_{\rm surf}$) and seismic ($P_{\rm seis}$) rotation rates have associated uncertainties. Instead of fitting the slope between these two values directly, we instead fit the distribution

\begin{equation}
	p(\frac{P_{\rm seis}}{P_{\rm surf}}\, |\, m) = \mathcal{N}(m, \sigma_\frac{P_{\rm seis}}{P_{\rm surf}})\, ,
\end{equation}

\noindent where $m$ is the slope, and $\sigma_\frac{P_{\rm seis}}{P_{\rm surf}}$ is the uncertainty corresponding to $\frac{P_{\rm seis}}{P_{\rm surf}}$, following the propagation of the errors on both values. We used the larger of the asymmetrical uncertainties on asteroseismic rotation from our analysis. The model was fit using \texttt{PyMC3} for 2000 iterations each on 4 chains. Five stars for which both surface and seismic rotation were available, but which had a surface rotation above the 1.8:1 line, were excluded from this analysis. This was to exclude likely multiples of the true rotation rate skewing the fit, as measurements of double the true rotation may occur in spot rotation measurements.

Our fit found a value of $m = 0.96 \pm 0.03$ using 48 stars. We reran this analysis using the 21 stars in this sample for which the median of their posterior probability for $Q_{\rm WMB}$ was greater than $0.5$ in our stellar model analysis, preferring the WMB model. A fit to these stars alone found a value of $m = 0.96 \pm 0.04$.

\subsection{Seismic vs spectroscopic rotation}
A distinct difference between rotation rates obtained through different techniques may hold information about differential rotation (both latitudinal and radial) of near-surface layers, such as those we observe in the Sun \cite{m_beck2000}.  A previous comparison of spectroscopic and seismic rotation rates, performed on a sample of 22 stars, found no significant radial differential rotation \cite{m_benomar+2018}. In this work they not only considered rotation rates from spots, but also spectroscopic measures of the projected surface rotation $\textrm{v}\sin(i)$, which they found to be more reliable.

With our expanded sample of asteroseismic rotation we can perform a similar analysis, to both validate our sample and probe radial differential rotation.  \textbf{Extended Data} Figure \ref{fig:vsinilit} shows a comparison between spectroscopic $\textrm{v}\sin(i)$ measurements as listed in LEGACY and `Kages' (left) and Benomar et al. (2015) \cite{m_benomar+2015} (right). In these cases the asteroseismic $\textrm{v}\sin(i)$ has been calculated using our measure of asteroseismic $\nu_s\sin(i)$ and the known asteroseismic radii. Three stars (KICs 6603624, 8760414 and 8938364) have been excluded from this figure due to strong disagreements of measured rotation rates with the literature (see above).

For the LEGACY and `Kages' sample, we find no strong deviation from the 1:1 line except at very low velocities, which is likely due to biases inherent to spectroscopic line broadening measurements \cite{m_doyle+2014, m_tayar+2015}. For the Benomar et al. (2015) sample stars lie a lot closer to the 1:1 line.

Overall, there appears to be a global offset where spectroscopic measurements of projected rotation appear faster than asteroseismic measures. Based on the LEGACY and `Kages' $v\sin(i)$ values, this offset is roughly $18\%$ (i.e. spectroscopic projected rotation rates are faster than asteroseismic rates). This offset is much smaller ($\sim5\%$) for the \cite{m_benomar+2015} sample, albeit for far fewer stars. These offsets are within the typical disagreement between spectroscopic methods, based on comparisons of projected rotation measurements for red giant stars \cite[see Figure 2]{m_tayar+2015}, especially at $< 5\, \rm{km\,s^{-1}}$.

It is worth addressing the impact this comparison would have on our conclusions for gyrochronology, were we to take the spectroscopic rotation rates as if they were the truth, even at velocities of $< 5\, \rm{km\,s^{-1}}$. For the majority of cases, the seismic velocities are slower than the spectroscopic velocities, which would bias our ensemble towards favouring a standard evolution over a weakened magnetic braking scenario (as stars would overall appear to be rotating slower at late ages). Based on the comparison to spot rotation presented in the main body of this paper, and given known issues comparing seismic and spectroscopic rotation at low velocities, we concluded that the divergence seen in  \textbf{Extended Data} Figure \ref{fig:vsinilit} does not undermine our results.

\subsection{Asteroseismic detection biases}

Stars that are rotating very slowly will show small rotational splittings, which may be indistinguishable from a non-rotating case, wheras stars that are spinning very fast may find that their splitting is so wide that they cross over with split modes at different radial orders ($n$). Asteroseismic selection techniques may also introduce additional biases on a population level. We consider the limitations this places on our asteroseismic method.

\begin{itemize}
	\item \textit{Fast rotating stars:} In prinicple, a star could rotate fast enough that the highest-frequency peak in a split dipole ($\ell = 2$) mode would overlap with the radial ($\ell = 0$) mode. This would occur if $2\nu_{\rm s} > \delta\nu_{02}$, the small separation. For the star in our sample with the smallest $\delta\nu_{02}$ (so the highest risk of this happening), this would occur at a rotation of 8.8 days or faster. For the star with the largest $\delta\nu_{02}$, this limit was roughly 2 days.

	In practice, the model still properly fits a spectrum where this kind of mode-overlapping occurs, as the $\ell = 0$ modes don't split, meaning that there are no degenerate solutions in this regime, and further constraints can be obtained from the other modes and split components in the spectrum. A more serious issue may be when the $\ell = 1$ mode at lower frequencies overlaps with the $\ell = 2$ mode as well, which would only occur at a rotation rate of 2 days or faster for the star with the smallest $\delta\nu_{01}$.

	\item \textit{Slow rotating stars:} Except for the most rapidly rotating cases, asteroseismic mode splitting is detected by a change in the distribution of the power of mode frequencies as the split components begin to separate from the central mode. If there is to be hard limit at which this measurement is not possible, it should be in the case that $\nu_{\rm s} < 2/T$, where $T$ is the observation time, and $1/T$ is the frequency bin width. For the star in our sample with the shortest observing time, this limit would be $\sim 89$ days, which quickly rises for longer observing baselines. While this constitutes a hard limit, slower rotation rates will become harder and harder to constrain as the rate of splitting becomes smaller. A benefit of the Bayesian approach used in this paper is that it should accurately reflect the increased uncertainty associated with the small rotational splitting.
\end{itemize}

While these two limits cause concern when studying the most extreme rotators, the results presented in this work are driven by stars with rotation rates in the regime of 5 to 30 days. Above, we demonstrated that results on period for these stars were data-driven (i.e. do not reflect the priors), indicating that the splitting is well resolved in this regime, and so we do not expect these limits to bias our conclusions.

Finally, we also consider bias in asteroseismic detections. The probability of an asteroseismic detection with \kepler scales with temperature and radius (i.e. scales inversely with \logg, and therefore main sequence age), \rtwo{and detections are unlikely below roughly $5200\, K$} \cite{m_chaplin+2011, m_schofield+2019}. \rtwo{Very young ($\lesssim 2\, \rm{Gyr}$), very magnetically active stars may also suppress their oscillation modes. \cite{m_mathur+2019}. Though these two effects impose a bias on asteroseismic populations, they do so outside the parameter range on which our comparison takes place. As it is older stars, undergoing magnetic braking, that are required to drive the distinction between stellar models, we conclude that our seismic sample can be assumed to be complete for the purposes of this work.}

\section{Verifying consequences for gyrochronology}
\subsection{Limits of our stellar models}\label{ssec:limits}
The rotational stellar models used in this work \cite{m_vansaders+2019} are constructed for metallicities of $-0.4 < \rm{[Fe/H]} < 0.4\, \rm{dex}$, in steps of $0.1\, \rm {dex}$. Our sample of 91 stars contained 4 stars with metallicities below $-0.4\, \rm{dex}$, which are shown as shaded symbols in Figure \ref{fig:fullsample}. Of these, 3 were included in our final sample of 73 stars used to evaluate our stellar models: KICs 7970740, 8684723 and KIC 9965715. All three are classed as MS stars, with metallicities of $-0.54 \pm 0.10$, $-0.42 \pm 0.10$ and $-0.44 \pm 0.18\, \rm {dex}$ respectively, placing them within $3\sigma$ of the metallicity limits of our stellar models. KICs 8684723 and 9965715 strongly agree with the WMB model, whereas KIC 7970740 weakly prefers the standard model. Excluding these stars was not found to significantly alter the joint posterior distribution shown in Figure \ref{fig:gyroresults}.

A recent study \cite{m_amard+matt2020} compared different rotational evolution models \cite[of which we use the former in this work]{m_vansaders+pinsonneault2013,m_matt+2015} while studying the effect metallicity has on rotation. They found that metal-rich stars spin down significantly more effectively than metal poor stars. The population of 73 stars used in our stellar model comparisons is roughly centered on a $\rm{[Fe/H]}$ of 0 $\rm dex$, with a spread of $~0.16\, \rm dex$, with no stars significantly above or below $\pm 0.4\, \rm dex$ (as discussed above). While differences in stellar rotational evolution as a function of metallicity in this region are still somewhat pronounced, they are much less so than for more metal-rich or poor stars \cite[see Figure 2]{m_amard+matt2020}. However, for stars with $\feh < 0$, the alternative model prescription \cite{m_matt+2015} sees stars spin down more slowly than the models used in this work (i.e. they will rotate faster at later ages). This work only explores the presence of weakened magnetic braking for a single braking law, and a comparison to alternative braking model will be explored in a future paper.

When constructing KDEs from our stellar model samples (see Section \ref{s:gyro}), we selected fixed resolutions (or band-widths) for the KDEs. In mass, the band-width of $0.02\, M_\odot$, was larger than the uncertainties of 24 of 73 stars used to construct our joint posterior. For the stars with the smallest uncertainties, this significantly limits the size of the KDE being evaluated (as subsections of the full stellar models are used to evaluate individual stars, for computational efficiency). In order to confirm that these stars do not significantly affect the ensemble's preference towards the WMB model, we recalculated the joint posterior distribution for $Q_{\rm WMB}$, excluding stars with an uncertainty on mass smaller than the KDE band-width. While the 24 stars with small uncertainties do favour the WMB model, they do so very weakly, whereas the remaining 49 stars with larger uncertainties strongly favour the WMB model. Their removal from the total joint posterior probability does not significantly alter it from the distribution shown in Figure \ref{fig:gyroresults}.

\subsection{Systematic uncertainties from asteroseismology}
In our model analysis, we used asteroseismic mass and age obtained using \texttt{BASTA}, as reported in LEGACY and Kages. Asteroseismic properties obtained through stellar models can be subject to systematic errors arising from differences in input physics and choice of stellar models not included in the reported statistical uncertainties. A quantification of these different systematic effects can be found in the `Kages' catalogue paper \cite{m_silvaaguirre+2015}. Combining their reported median systematic uncertainties due to input physics results in median uncertainties of $20\%$ (up from $14\%)$ on age and $5\%$ (up from $3\%$) on mass for the `Kages' sample. For LEGACY, the median uncertainties are $18\%$ (up from $10\%)$ and $5.6\%$ (up from $4\%$) for age and mass respectively.

We re-ran our model analysis after inflating uncertainties on mass and age. We increased uncertainties by the fractional difference between the \texttt{BASTA} statistical uncertainties and the median full statistical and systematic uncertainties described above. For example, a LEGACY star with a mass of $2.0 \pm 0.5\, M_\odot$ would have its uncertainty inflated by $1.6\%$ of its mass, to $0.53\, M_\odot$.

To further test the limits of this analysis, we also reran our mixture model fit, this time only shifting the asteroseismic ages younger by the systematic uncertainty, and retaining the statistical uncertainty (i.e. the ages of LEGACY and `Kages' stars were reduced by $8\%$ and $6\%$ respectively). In this scenario where all asteroseismic ages are overestimated, `true' fast rotators at young ages would have been mistaken for fast rotators at old ages, suggesting the presence of weakened magnetic braking where none existed.

The results of these tests are discussed further in the main body of the paper.

\subsection{Binaries and Planet Hosts}
For stars to be good probes of existing gyrochronology relations, their rotational evolution must occur in isolation. If a star interacts with a close binary companion (through tides, or a merger) the natural angular momentum loss can be disturbed, causing gyrochronology to mispredict ages \cite{m_leiner+2019, m_fleming+2019}. Between LEGACY and Kages, we have 8 known binaries.

First, KIC 8379927, KIC 7510397, KIC 10454113 and KIC 9025370 are spectroscopic binaries. This does not affect the asteroseismic analysis, but may affect their rotational evolution. Of these, KICs 8379927, 7510397 and 9025370 were included in the gyrochronology analysis. None of them preferred one model strongly over the other, with all three finding flat posteriors for $Q_{\rm WMB}$.

Second, the binary pairs of KIC 9139151 \& 9139163 and 16 Cyg A \& B are individually observed binary components with wide orbital separations, so we do not expect their binarity to have affected their rotational evolution \cite{m_halbwachs1986, m_white+2013}.

While we chose not to account for star-planet tidal interactions in this work, we note that this may disturb the natural stellar rotational evolution when tidal forces are at play \cite{m_maxted+2015,m_gallet+delorme2019, m_benbakoura+2019}, although this has been disputed by observations of asteroseismic planet hosts \cite{m_ceillier+2016}.\\

\textbf{Data availability statement:} The core input data and results are summarised in \textbf{Extended Data} Table \ref{tab:results}, which is published with this article, and is also available on Vizier. Larger data files, such as stellar model populations and individual posterior distribution chains from the asteroseismic and gyrochronology model fitting are fully available on request.

This work made use of publicly available data described in the text, and reiterated here. \kepler power spectral density  were obtained from the \href{http://kasoc.phys.au.dk/}{KASOC} webpages for the majority of stars, and from the \href{https://archive.
		stsci.edu/prepds/kepseismic/}{MAST} for 16 Cyg A and B. This work used asteroseismic data from Silva Aguirre et al. (2015, 2017), Davies et al. (2016) and Lund et al. (2017) \cite{m_silvaaguirre+2015, m_silvaaguirre+2017,m_davies+2016, m_lund+2017}. Parameter distributions of the \kepler field used to alter our stellar population models were taken from Berger et al. (2020) \cite{m_berger+2020}.\\

\textbf{Code availability statement:} The code required to replicate our results has been placed in a curated online repository found here: \url{www.github.com/ojhall94/halletal2021a}.

All code written in the duration of this project, along with a full commit history, can be found in an un-curated online repository here: \url{www.github.com/ojhall94/malatium}.

The code used to construct the stellar population models used in this work is available upon request.

\input{bblmethods.tex}

%\end{document}


\section{Shear Wave in a Bar}

This suite of examples focuses on the dynamics of a shear wave propagating
down an 8 km-long bar with a 400 m-wide cross-section. Motion is limited
to shear deformation by fixing the longitudinal degree of freedom.
For each cell type (tri3, quad4, tet4, and hex8) we generate a shear
wave using a kinematic fault rupture with simultaneous slip over the
fault surface, which we place at the center of the bar. The discretization
size is 200 m in all cases. The slip-time histories follow the integral
of Brune's far-field time function with slip initiating at 0.1 s,
a left-lateral final slip of 1.0 m, and a rise time of 2.0 s. The
shear wave speed in the bar is 1.0 km/s, so the shear wave reaches
each end of the bar at 4.1 s. Absorbing boundaries on the ends of
the bar prevent significant reflections. The bar comes to a rest with
a static offset.

\begin{figure}
  \includegraphics{examples/figs/shearwave_bar}
  \caption{Domain for shear wave propagation in a 8.0 km bar with 400
    m cross-section.  We generate a shear wave via slip on a fault
    located in the middle of the bar while limiting deformation to the
    transverse direction.}
  \label{fig:shearwave:domain}
\end{figure}

For the bar discretized with quad4 cells we also consider the fault
subjected to frictional sliding controlled by static friction, linear
slip-weakening friction, and rate- and state-friction. We use initial
tractions applied to the fault to drive the dislocation and generate
the shear wave. Because the fault tractions are constant in time, they
continue to drive the motion even after the shear wave reaches the
absorbing boundary, leading to a steady state solution with uniform
shear deformation in the bar and a constant slip rate on the fault.

\section{2D Bar Discretized with Triangles}
\label{sec:example:shearwave:tri3}

PyLith features discussed in this example:
\begin{itemize}
\item Dynamic solution
\item CUBIT format
\item Absorbing dampers boundary conditions
\item Kinematic fault interface conditions
\item Plane strain linearly elastic material
\item VTK output
\item Linear triangular cells
\item SimpleDB spatial database
\item ZeroDispDB spatial database
\end{itemize}
All of the files necessary to run the examples are contained in the
directory \filename{examples/bar\_shearwave/tri3.}

\subsection{Mesh Generation}

The mesh is a simple rectangle 8 km by 400 m (Figure
\vref{fig:shearwave:tet4:mesh}).  This mesh could be generated via a
simple script, but it is even easier to generate this mesh using
CUBIT. We provide documented journal files in
\filename{examples/bar\_shearwave/tri3.} We first create the geometry,
mesh the domain using triangular cells, and then create blocks and
nodesets to associate the cells and vertices with materials and
boundary conditions. See Section \vref{sec:example:3dhex8} for more
information on using CUBIT to generate meshes.

\begin{figure}
  \includegraphics[scale=0.5]{examples/figs/shearwave_tri3mesh}
  \caption{Mesh composed of triangular cells generated by CUBIT used for the
    example problem.}
\label{fig:shearwave:tri3:mesh}
\end{figure}

\subsection{Simulation Parameters}

All of the parameters are set in the \filename{pylithapp.cfg} file.
The structure of the file follows the same pattern as in all of the
other examples. We set the parameters for the journal information
followed by the mesh reader, problem, materials, boundary conditions,
fault, and output. We change the time-stepping formulation from the
default value of implicit time stepping to explicit time stepping
with a lumped Jacobian matrix by setting the formulation object via
\begin{cfg}
<f>formulation</f> = pylith.problems.Explicit
\end{cfg}
Using the Explicit object automatically triggers lumping of the
Jacobian cell matrices and assembly into a vector rather than a sparse
matrix.  Lumping the Jacobian decouples the equations, so we can use a
very simple direct solver. Use of this simple solver is also triggered
by the selection of any of the Explicit formulation objects.

For dynamic problems we use the NondimElasticDynamic object to
nondimensionalize the equations. This object provides scales
associated with wave propagation for nondimensionalization, including
the minimum wave period, the shear wave speed, and mass density. In
this example we use the default values of a minimum wave period of 1.0
s, a shear wave speed of 3 km/s, and a mass density of 3000
kg/m$^{3}$. We simulate 12.0 s of motion with a time step of 1/30
s. This time step must follow the Courant-Friedrichs-Lewy condition;
that is, the time step must be smaller than the time it takes the P
wave to propagate across the shortest edge of a cell.

The boundary conditions include the absorbing dampers at the ends of
the bar and a Dirichlet boundary condition to prevent longitudinal
motion. Because we cannot overlap the Dirichlet BC with the fault, we
use the nodeset associated with all vertices except the fault.  For
the output over the entire domain, we request both displacement and
velocity fields:
\begin{cfg}
<h>[pylithapp.timedependent.output]</h>

vertex_data_fields
 = [displacement, velocity]
\end{cfg}
To run the problem, simply run PyLith without any command line arguments:
\begin{shell}
$ pylith
\end{shell}
The VTK files will be written to the \filename{output} directory. The
output includes the displacement and velocity fields over the entire
domain at every 3rd time step (0.10 s), the slip and change in traction
vectors on the fault surface in along-strike and normal directions
at every 3rd time step (0.10 s), and the strain and stress tensors
for each cell at every 30th time step (1.0 s). If the problem ran
correctly, you should be able to generate a figure such as Figure
\vref{fig:shearwave:tri3:deform}, which was generated using ParaView.

\begin{figure}
  \includegraphics[scale=0.5]{examples/figs/shearwave_tri3deform30}
  \caption{Displacement field in the bar at 3.0 s. Deformation has been exaggerated
    by a factor of 800.}
  \label{fig:shearwave:tri3:deform}
\end{figure}

\section{3D Bar Discretized with Quadrilaterals}
\label{sec:example:shearwave:quad4}

PyLith features discussed in this example:
\begin{itemize}
\item Dynamic solution
\item CUBIT mesh format
\item Absorbing dampers boundary conditions
\item Kinematic fault interface conditions
\item Dynamic fault interface conditions
\item Plane strain linearly elastic material
\item VTK output
\item Linear quadrilateral cells
\item SimpleDB spatial database
\item ZeroDispDB spatial database
\item UniformDB spatial database
\end{itemize}
All of the files necessary to run the examples are contained in the
directory \filename{examples/bar\_shearwave/quad4.}

\subsection{Mesh Generation}

The mesh is a simple rectangular prism 8 km by 400 m by 400 m (Figure
\vref{fig:shearwave:quad4:mesh}). We provide documented CUBIT journal
files in \filename{examples/bar\_shearwave/quad4.} We first create the
geometry, mesh the domain using quadrilateral cells, and then create
blocks and nodesets associated with the materials and boundary conditions.

\begin{figure}
  \includegraphics[scale=0.5]{examples/figs/shearwave_quad4mesh}
  \caption{Mesh composed of hexahedral cells generated by CUBIT used for the
    example problem.}
  \label{fig:shearwave:quad4:mesh}
\end{figure}

\subsection{Kinematic Fault (Prescribed Slip)}

The simulation parameters match those in the tri3, tet4, and hex8
examples. Using four-point quadrature permits use of a time step of
1/20 s, which is slightly larger than the time step of 1/30 s used in
the tri3 and tet4 simulations. In contrast to the tri3, tet4, and hex8
shear wave examples which only contained a single simulation in a
directory, in this example we consider several different simulations.
Consequently, we separate the parameters into multiple \filename{cfg}
files. The common parameters are placed in \filename{pylithapp.cfg}
with the parameters specific to the kinematic fault (prescribed
rupture) example in \filename{prescribedrup.cfg}. To run the problem,
simply run PyLith via:
\begin{shell}
$ pylith prescribedrup.cfg
\end{shell}
The VTK files will be written to the \filename{output} directory with
the prefix \filename{prescribedrup}. The output includes the
displacement field over the entire domain at every other time step
(0.10 s), the slip and traction vectors on the fault surface in
along-strike and normal directions at every other time step (0.10 s),
and the strain and stress tensors for each cell at every 20th time
step (1.0 s).  If the problem ran correctly, you should be able to
generate a figure such as Figure \vref{fig:shearwave:quad4:kinematic},
which was generated using ParaView.

\begin{figure}
  \includegraphics[scale=0.5]{examples/figs/shearwave_quad4kinematic30}
  \caption{Displacement field in the bar at 3.0 s. Deformation has been exaggerated
    by a factor of 800.}
  \label{fig:shearwave:quad4:kinematic}
\end{figure}

\subsection{Dynamic Fault (Spontaneous Rupture)}

In this set of examples we replace the kinematic fault interface with
the dynamic fault interface, resulting in fault slip controlled by
a fault-constitutive model. See Section \vref{sec:fault:constitutive:models}
for detailed information about the fault constitutive models available
in PyLith. Because this is a dynamic simulation we want the generated
shear wave to continue to be absorbed at the ends of the bar, so we
drive the fault by imposing initial tractions directly on the fault
surface rather than through deformation within the bar. We impose
initial tractions (75 MPa of right-lateral shear and 120 MPa of compression)
plus a temporal variation (smoothly increasing from 0 to 25 MPa of
right-lateral shear) similar to what would be used in a 2-D or 3-D
version. While the magnitude of these stresses is reasonable for tectonic
problems, they give rise to very large slip rates in this 1-D bar.
The temporal variation, as specified via the \filename{traction\_change.timedb}
file, has the functional form:
\begin{equation}
f(t)=\begin{cases}
\exp\left(\frac{\left(t-t_{n}\right)^{2}}{t\left(t-2t_{n}\right)}\right), & 0<t\le t_{n}\\
1, & t>t_{n}
\end{cases}
\end{equation}
where $t_{n}$ = 1.0 s. We request that the fault output include the
initial traction value and the slip, slip rate, and traction fields:
\begin{cfg}
<h>[pylithapp.timedependent.interfaces.fault.output]</h>

vertex_info_fields
 = [traction_initial_value]

vertex_data_fields
 = [slip, slip_rate, traction]
\end{cfg}
The steady-state solution for this problem is constant velocity and
slip rate with uniform strain within the bar. A Python script,
\filename{analytical\_soln.py}, is included for computing values
related to the steady-state solution.

\subsubsection{Dynamic Fault with Static Friction}

The parameters specific to this example involve the static friction
fault constitutive model. We set the fault constitutive model via
\begin{cfg}
<h>[pylithapp.timedependent.interfaces.fault]</h>
<f>friction</f> = pylith.friction.StaticFriction
\end{cfg}
and use a UniformDB to set the static friction parameters. We use
a coefficient of friction of 0.6 and no cohesion (0 MPa). The parameters
specific to this example are in \filename{spontaneousrup\_staticfriction.cfg},
so we run the problem via:
\begin{shell}
$ pylith spontaneousrup.cfg spontaneousrup_staticfriction.cfg
\end{shell}
The VTK files will be written to the \filename{output} directory with
the prefix \filename{staticfriction}. The output includes the displacement
and velocity fields over the entire domain at every other time step
(0.10 s), the slip, slip rate, and traction vectors on the fault surface
in along-strike and normal directions at every other time step (0.10
s), and the strain and stress tensors for each cell at every 20th
time step (1.0 s). If the problem ran correctly, you should be able
to generate a figure such as Figure \vref{fig:shearwave:quad4:staticfriction},
which was generated using ParaView. The steady-state solution is a
constant slip rate of 22.4 m/s, a shear traction of 72.0 MPa on the
fault surface, a uniform shear strain of 5.6e-3 in the bar with uniform,
and constant velocities in the y-direction of +11.2 m/s and -11.2
m/s on the -x and +x sides of the fault, respectively.

\begin{figure}
  \includegraphics[scale=0.5]{examples/figs/shearwave_quad4staticfriction30}
  \caption{Velocity field in the bar at 3.0 s for the static friction fault constitutive
    model. Deformation has been exaggerated by a factor of 20.}
  \label{fig:shearwave:quad4:staticfriction}
\end{figure}

\subsubsection{Dynamic Fault with Slip-Weakening Friction}

The parameters specific to this example are related to the use of
the slip-weakening friction fault constitutive model (see Section
\vref{sec:fault:constitutive:models}). We set the fault constitutive
model via
\begin{cfg}
<h>[pylithapp.timedependent.interfaces.fault]</h>
<f>friction</f> = pylith.friction.SlipWeakening
\end{cfg}
and use a UniformDB to set the slip-weakening friction parameters.
We use a static coefficient of friction of 0.6, a dynamic coefficient
of friction of 0.5, a slip-weakening parameter of 0.2 m, and no cohesion
(0 MPa). The fault constitutive model is associated with the fault,
so we can append the fault constitutive model parameters to the vertex
information fields:
\begin{cfg}
<h>[pylithapp.timedependent.interfaces.fault.output]</h>

vertex_info_fields
 = [strike_dir, normal_dir, initial_traction, static_coefficient, dynamic_coefficient, slip_weakening_parameter, cohesion]
\end{cfg}
The parameters specific to this example are in \filename{spontaneousrup\_slipweakening.cfg},
so we run the problem via:
\begin{shell}
$ pylith spontaneousrup.cfg spontaneousrup_slipweakening.cfg
\end{shell}
The VTK files will be written to the \filename{output} directory with
the prefix \filename{slipweakening}. If the problem ran correctly, you
should be able to generate a figure such as Figure \vref{fig:shearwave:quad4:slipweakening},
which was generated using ParaView. The steady-state solution is a
constant slip rate of 32.0 m/s and shear traction of 60.0 MPa on the
fault surface, a uniform shear strain of 8.0e-3 in the bar with uniform,
constant velocities in the y-direction of +16.0 m/s and -46.0 m/s
on the -x and +x sides of the fault, respectively.

\begin{figure}
  \includegraphics[scale=0.5]{examples/figs/shearwave_quad4slipweakening30}
  \caption{Velocity field in the bar at 3.0 s for the slip-weakening friction
    fault constitutive model. Deformation has been exaggerated by a factor
    of 20.}
  \label{fig:shearwave:quad4:slipweakening}
\end{figure}

\subsubsection{Dynamic Fault with Rate-State Friction}

The parameters specific to this example are related to the use of
the rate- and state-friction fault constitutive model (see Section
\vref{sec:fault:constitutive:models}). The evolution of the state
variable uses the ageing law. We set the fault constitutive model
and add the state variable to the output via
\begin{cfg}
<h>[pylithapp.timedependent.interfaces.fault]</h>
<f>friction</f> = pylith.friction.RateStateAgeing

<h>[pylithapp.timedependent.interfaces.fault.output]</h>

vertex_data_fields
 = [slip, slip_rate, traction, state_variable]
\end{cfg}
and use a \object{UniformDB} to set the rate-state friction parameters. We
use a reference coefficient of friction of 0.6, reference slip rate
of 1.0e-6 m/s, characteristic slip distance of 0.02 m, coefficients
a and b of 0.008 and 0.012, and no cohesion (0 MPa). We set the initial
value of the state variable so that the fault is in equilibrium for
the initial tractions. The parameters specific to this example are
in \filename{spontaneousrup\_ratestateageing.cfg}, so we run the problem
via:
\begin{shell}
$ pylith spontaneousrup.cfg spontaneousrup_ratestateageing.cfg
\end{shell}
The VTK files will be written to the \filename{output} directory with
the prefix \filename{ratestateageing}. If the problem ran correctly,
you should be able to generate a figure such as Figure
\vref{fig:shearwave:quad4:ratestateageing}, which was generated using
ParaView. The steady-state solution is a constant slip rate of 30.0
m/s and shear traction of 63.7 MPa on the fault surface, a uniform
shear strain of 7.25e-3 in the bar with uniform, constant velocities
in the y-direction of +15.0 m/s and -15.0 m/s on the -x and +x sides
of the fault, respectively.

\begin{figure}
  \includegraphics[scale=0.5]{examples/figs/shearwave_quad4ratestateageing30}
  \caption{Velocity field in the bar at 3.0 s for the rate- and state-friction
    fault constitutive model. Deformation has been exaggerated by a factor
    of 20.}
  \label{fig:shearwave:quad4:ratestateageing}
\end{figure}

\section{3D Bar Discretized with Tetrahedra}
\label{sec:example:shearwave:tet4}

PyLith features discussed in this example:
\begin{itemize}
\item Dynamic solution
\item LaGriT mesh format
\item Absorbing dampers boundary conditions
\item Kinematic fault interface conditions
\item Elastic isotropic linearly elastic material
\item VTK output
\item Linear tetrahedral cells
\item SimpleDB spatial database
\item ZeroDispDB spatial database
\end{itemize}
All of the files necessary to run the examples are contained in the
directory \filename{examples/bar\_shearwave/tet4.}

\subsection{Mesh Generation}

The mesh is a simple rectangular prism 8 km by 400 m by 400m (Figure
\vref{fig:shearwave:tet4:mesh}). This mesh could be generated via
a simple script, but it is even easier to generate this mesh using
LaGriT. We provide documented LaGriT files in \filename{examples/bar\_shearwave/tet4.}
We first create the geometry and regions, mesh the domain using tetrahedral
cells, and then create point sets associated with boundary conditions.

\begin{figure}
  \includegraphics[scale=0.5]{examples/figs/shearwave_tet4mesh}
  \caption{Mesh composed of tetrahedral cells generated by LaGriT used for the
    example problem.}
  \label{fig:shearwave:tet4:mesh}
\end{figure}

\subsection{Simulation Parameters}

The simulation parameters match those in the tri3 example with the
exception of using the LaGriT mesh reader and switching from a
two-dimensional problem to a three-dimensional problem. In addition to
fixing the longitudinal degree of freedom, we also fix the
out-of-plane transverse degree of freedom. Because the fault separates
two material regions in LaGriT, we use two materials in PyLith. All of
the parameters are set in the \filename{pylithapp.cfg} file. To run
the problem, simply run PyLith without any command line arguments:
\begin{shell}
$ pylith
\end{shell}
The VTK files will be written to the \filename{output} directory. The
output includes the displacement and velocity fields over the entire
domain at every 3rd time step (0.10 s), the slip and change in
traction vectors on the fault surface in along-strike and normal
directions at every 3rd time step (0.10 s), and the strain and stress
tensors for each cell at every 30th time step (1.0 s). If the problem
ran correctly, you should be able to generate a figure such as Figure
\vref{fig:shearwave:tet4:deform}, which was generated using ParaView.

\begin{figure}
  \includegraphics[scale=0.5]{examples/figs/shearwave_tet4deform30}
  \caption{Displacement field in the bar at 3.0 s. Deformation has been exaggerated
    by a factor of 800.}
  \label{fig:shearwave:tet4:deform}
\end{figure}

\section{3D Bar Discretized with Hexahedra}
\label{sec:example:shearwave:hex8}

PyLith features discussed in this example:
\begin{itemize}
\item Dynamic solution
\item CUBIT mesh format
\item Absorbing dampers boundary conditions
\item Kinematic fault interface conditions
\item Elastic isotropic linearly elastic material
\item VTK output
\item Linear hexahedral cells
\item SimpleDB spatial database
\item ZeroDispDB spatial database
\end{itemize}
All of the files necessary to run the examples are contained in the
directory \filename{examples/bar\_shearwave/hex8.}

\subsection{Mesh Generation}

The mesh is a simple rectangular prism 8 km by 400 m by 400 m (Figure
\vref{fig:shearwave:hex8:mesh}). This mesh could be generated via
a simple script, but it is even easier to generate this mesh using
CUBIT. We provide documented CUBIT journal files in \filename{examples/bar\_shearwave/hex8.}
We first create the geometry, mesh the domain using hexahedral cells,
and then create blocks and nodesets associated with the materials
and boundary conditions.

\begin{figure}
  \includegraphics[scale=0.5]{examples/figs/shearwave_hex8mesh}
  \caption{Mesh composed of hexahedral cells generated by CUBIT used for the
    example problem.}
  \label{fig:shearwave:hex8:mesh}
\end{figure}

\subsection{Simulation Parameters}

The simulation parameters match those in the tri3 and tet4 examples.
As in the tet4 example, we fix both the longitudinal degree of freedom
and the out-of-plane transverse degree of freedom. Using eight-point
quadrature permits use of a time step of 1/20 s, which is slightly
larger than the time step of 1/30 s used in the tri3 and tet4 simulations.
All of the parameters are set in the \filename{pylithapp.cfg} file.
To run the problem, simply run PyLith without any command line arguments:
\begin{shell}
$ pylith
\end{shell}
The VTK files will be written to the \filename{output} directory. The
output includes the displacement and velocity fields over the entire
domain at every other time step (0.10 s), the slip and change in traction
vectors on the fault surface in along-strike and normal directions
at every other time step (0.10 s), and the strain and stress tensors
for each cell at every 20th time step (1.0 s). If the problem ran
correctly, you should be able to generate a figure such as Figure
\vref{fig:shearwave:hex8:deform}, which was generated using ParaView.

\begin{figure}
  \includegraphics[scale=0.5]{examples/figs/shearwave_hex8deform30}
  \caption{Displacement field in the bar at 3.0 s. Deformation has been exaggerated
    by a factor of 800.}
  \label{fig:shearwave:hex8:deform}
\end{figure}

% End of file


\chapter{Auxiliary-Field Quantum Monte Carlo}
\label{chap:afqmc}
The AFQMC method is an orbital-space formulation of the imaginary-time propagation algorithm. We refer the reader to one of the review articles on the method \cite{AFQMC_review,PhysRevLett.90.136401,PhysRevE.70.056702} for a detailed description of the algorithm. It uses the Hubbard-Stratonovich transformation to express the imaginary-time propagator, which is inherently a 2-body operator, as an integral over 1-body propagators, which can be efficiently applied to an arbitrary Slater determinant. This transformation allows us to represent the interacting many-body system as an average over a noninteracting system (e.g., Slater determinants) in a time-dependent fluctuating external field (the Auxiliary fields). The walkers in this case represent nonorthogonal Slater determinants, whose time average represents the desired quantum state. QMCPACK currently implements the phaseless AFQMC algorithm of Zhang and Krakauer \cite{PhysRevLett.90.136401}, where a trial wavefunction is used to project the simulation to the real axis, controlling the fermionic sign problem at the expense of a bias. This approximation is similar in spirit to the fixed-node approximation in real-space DMC but applied in the Hilbert space where the AFQMC random walk occurs.

\section{Theoretical Background}
... Coming Soon ...

\section{Input}

The input for an AFQMC calculation is fundamentally different to the input for other real-space algorithms in QMCPACK. The main source of input comes from the Hamiltonian matrix elements in an appropriate single particle basis. This must be evaluated by an external code and saved in a format that QMCPACK can read. More details about file formats follow. The input file has six basic xml-blocks: \texttt{AFQMCInfo}, \texttt{Hamiltonian}, \texttt{Wavefunction}, \texttt{WalkerSet}, \texttt{Propagator}, and \texttt{execute}. The first five define input structures required for various types of calculations. The \texttt{execute} block represents actual calculations and takes as input the other blocks.
Nonexecution blocks are parsed first, followed by a second pass where execution blocks are parsed (and executed) in order. Listing 15.1 shows an example of a minimal input file for an AFQMC calculation. Table~\ref{table:afqmc_basic} shows a brief description of the most important parameters in the calculation. All xml sections contain a ``name'' argument used to identify the resulting object within QMCPACK. For example, in the example, multiple Hamiltonian objects with different names can be defined. The one actually used in the calculation is the one passed to ``execute'' as ham.

\begin{lstlisting}[style=QMCPXML,caption=Sample input file for AFQMC.]
<?xml version="1.0"?>
<simulation method="afqmc">
  <project id="Carbon" series="0"/>

  <AFQMCInfo name="info0">
    <parameter name="NMO">32</parameter>
    <parameter name="NAEA">16</parameter>
    <parameter name="NAEB">16</parameter>
  </AFQMCInfo>

  <Hamiltonian name="ham0" info="info0">
    <parameter name="filename">../fcidump.h5</parameter>
  </Hamiltonian>

  <Wavefunction name="wfn0" type="MSD" info="info0">
    <parameter name="filetype">ascii</parameter>
    <parameter name="filename">wfn.dat</parameter>
  </Wavefunction>

  <WalkerSet name="wset0">
    <parameter name="walker_type">closed</parameter>
  </WalkerSet>

  <Propagator name="prop0" info="info0">
  </Propagator>

  <execute wset="wset0" ham="ham0" wfn="wfn0" prop="prop0" info="info0">
    <parameter name="timestep">0.005</parameter>
    <parameter name="blocks">10000</parameter>
    <parameter name="nWalkers">20</parameter>
  </execute>

</simulation>
\end{lstlisting}

%The following table lists some of the most practical parameters in the \texttt{execute} block
%The following table lists some of the practical parameters
\begin{table}[h]
\begin{center}
\caption{Input options for AFQMC in QMCPACK.\label{table:afqmc_basic}}
\begin{tabularx}{\textwidth}{l l l l l X }
\hline
\multicolumn{6}{l}{\texttt{afqmc} method} \\
\hline
\multicolumn{6}{l}{parameters in \texttt{AFQMCInfo}} \\
   &   \bfseries name     & \bfseries datatype & \bfseries values & \bfseries default   & \bfseries description \\
   &   \texttt{NMO             } &  integer     & $\ge 0$ & no & Number of molecular orbitals \\
   &   \texttt{NAEA            } &  integer     & $\ge 0$ & no & Number of active electrons of spin-up \\
   &   \texttt{NAEB            } &  integer     & $\ge 0$ & no & Number of active electrons of spin-down \\
\multicolumn{6}{l}{parameters in \texttt{Hamiltonian}}  \\
   &   \texttt{info            } &  argument   &               &      & Name of \texttt{AFQMCInfo} block \\\\
   &   \texttt{filename        } &  string     &               & no   & Name of file with the hamiltonian \\
   &   \texttt{filetype        } &  string     & hdf5          & yes  & Native HDF5-based format of QMCPACK  \\
\multicolumn{6}{l}{parameters in \texttt{Wavefunction}}\\
   &   \texttt{info            } &  argument   &             &      & Name of \texttt{AFQMCInfo} block \\
   &   \texttt{type            } &  argument & MSD      & no   & Linear combination of (assumed non-orthogonal) Slater determinants \\
   &   \texttt{                } &           & PHMSD &    & CI-type multi-determinant wave function  \\
   &   \texttt{filetype        } &  string  & ascii       & no   & ASCII data file type \\
   &   \texttt{                } &          & hdf5        &      & HDF5 data file type \\
\multicolumn{6}{l}{parameters in \texttt{WalkerSet}} \\
   &   \texttt{walker$\_$type       } &  string    & collinear  & yes  & Request a collinear walker set. \\
   &   \texttt{       } &     & closed  & no  & Request a closed shell (doubly-occupied) walker set. \\
\multicolumn{6}{l}{parameters in \texttt{Propagator}} \\
   &   \texttt{type            } &  argument   & afqmc & afqmc & Type of propagator \\
   &   \texttt{info            } &  argument   &       &       & Name of \texttt{AFQMCInfo} block \\
   &   \texttt{hybrid   } &  string   & yes  & yes  & Use hybrid propagation algorithm. \\
   &   \texttt{   } &     & no  &  & Use local energy based propagation algorithm. \\
\multicolumn{6}{l}{parameters in \texttt{execute}} \\
   &   \texttt{wset            } &  argument    &         &      &  \\
   &   \texttt{ham             } & argument     &         &      &  \\
   &   \texttt{wfn             } & argument     &         &      &  \\
   &   \texttt{prop            } & argument     &         &      &  \\
   &   \texttt{info            } &  argument    &         &      & Name of \texttt{AFQMCInfo} block \\
   &   \texttt{nWalkers        } &  integer     & $\ge 0$ & 5    & Initial number of walkers per task group   \\
   &   \texttt{timestep        } &  real        & $> 0$   & 0.01 & Time step in 1/a.u. \\
   &   \texttt{blocks          } &  integer     & $\ge 0$ & 100  & Number of blocks            \\
   &   \texttt{step            } &  integer     & $> 0$   & 1    & Number of steps within a block \\
   &   \texttt{substep         } &  integer     & $> 0$   & 1    & Number of substeps within a step \\
   &   \texttt{ortho           } &  integer     & $> 0$   & 1    & Number of steps between walker orthogonalization. \\
  \hline
\end{tabularx}
\end{center}
\end{table}

The following list includes all input sections for AFQMC calculations, along with a detailed explanation of accepted parameters. Since the code is under active development, the list of parameters and their interpretation might change in the future.\\

\texttt{AFQMCInfo}: Input block that defines basic information about the calculation. It is passed to all other input blocks to propagate the basic information:
\texttt{<AFQMCInfo name="info0">}
\begin{itemize}
\item \textbf{NMO}. Number of molecular orbitals, i.e., number of states in the single particle basis.
\item \textbf{NAEA}. Number of active electrons-alpha, i.e., number of spin-up electrons.
\item \textbf{NAEB}. Number of active electrons-beta, i.e., number of spin-down electrons.
\end{itemize}

\texttt{Hamiltonian}: Controls the object that reads, stores, and manages the \texttt{hamiltonian}.
  \texttt{<Hamiltonian name="ham0" type="SparseGeneral" info="info0">}
\begin{itemize}
\item \textbf{filename}. Name of file with the \texttt{Hamiltonian}. This is a required parameter.
\item \textbf{cutoff\_1bar}. Cutoff applied to integrals during reading. Any term in the Hamiltonian smaller than this value is set to zero. (For filetype=``hdf5'', the cutoff is applied only to the 2-electron integrals). Default: 1e-8
\item \textbf{cutoff\_decomposition}. Cutoff used to stop the iterative cycle in the generation of the Cholesky decomposition of the 2-electron integrals. The generation of Cholesky vectors is stopped when the maximum error in the diagonal reaches this value. In case of an eigenvalue factorization, this becomes the cutoff applied to the eigenvalues. Only eigenvalues above this value are kept. Default: 1e-6
\item \textbf{nblocks}. This parameter controls the distribution of the 2-electron integrals among processors. In the default behavior (nblocks=1), all nodes contain the entire list of integrals. If nblocks $>$ 1, the of nodes in the calculation will be split in nblocks groups. Each node in a given group contains the same subset of integrals and subsequently operates on this subset during  any further operation that requires the hamiltonian. The maximum number of groups is NMO. Currently only works for filetype=``hdf5'' and the file must contain integrals.  Not yet implemented for input hamiltonians in the form of Cholesky vectors or for ASCII input. Coming soon!
    Default: No distribution
\item \textbf{printEig}. If ``yes'', prints additional information during the Cholesky decomposition.
    Default: no
\item \textbf{fix\_2eint}.  If this is set to ``yes'', orbital pairs that are found not to be positive definite are ignored in the generation of the Cholesky factorization. This is necessary if the 2-electron integrals are not positive definite because of round-off errors in their generation.
    Default: no \\
\end{itemize}

\texttt{Wavefunction}: controls the object that manages the trial wavefunctions. This block expects a list of xml-blocks defining actual trial wavefunctions for various roles.
\texttt{<Wavefunction name="wfn0" type="MSD/PHMSD" info="info0">}
\begin{itemize}
\item \textbf{filename}. Name of file with wavefunction information.
\item \textbf{cutoff}. cutoff applied to the terms in the calculation of the local energy. Only terms in the Hamiltonian above this cutoff are included in the evaluation of the energy.
      Default: 1e-6
\item \textbf{nnodes}. Defines the parallelization of the local energy evaluation and the distribution of the \texttt{Hamiltonian} matrix (not to be confused with the list of 2-electron integrals managed by \texttt{Hamiltonian}. These are not the same.) If nnodes $>$ 1, the nodes in the simulation are split into groups of nnodes, each group works collectively in the evaluation of the local energy of their walkers. This helps distribute the effort involved in the evaluation of the local energy among the nodes in the group, but also distributes the memory associated with the wavefunction among the nodes in the group.
      Default: No distribution
\item \textbf{ndet}. Number of determinants to read from file.
      Default: Read all determinants.
\item \textbf{cutoff}. For sparse hamiltoniants, this defines the cutoff applied to the half-rotated 2-electron integrals.
      Default: 0.0
\item \textbf{nbatch}. This turns on(>=1)/off(==0) batched calculation of density matrices and overlaps. -1 means all the walkers in the batch.
      Default: 0 (CPU) / -1 (GPU)
\item \textbf{nbatch\_qr}. This turns on(>=1)/off(==0) batched QR calculation. -1 means all the walkers in the batch.
      Default: 0 (CPU) / -1 (GPU)
\end{itemize}

\texttt{WalkerSet}: Controls the object that handles the set of walkers.
\texttt{<WalkerSet name="wset0">}
\begin{itemize}
\item \textbf{walker\_type}. Type of walker set: closed or collinear.
      Default: collinear
\item \textbf{pop\_control}. Population control algorithm. Options: ``simple'': Uses a simple branching scheme with a fluctuating population. Walkers with weight above max\_weight are split into multiple walkers of weight reset\_weight. Walkers with weight below min\_weight are killed with probability (weight/min\_weight); ``pair'': Fixed-population branching algorithm, based on QWalk's branching algorithm. Pairs of walkers with weight above/below max\_weight/min\_weight are combined into 2 walkers with weights equal to $(w_1+w_2)/2$. The probability of replicating walker w1 (larger weight) occurs with probability $w_1/(w_1+w_2)$, otherwise walker w2 (lower weight) is replicated; ``comb'': Fixed-population branching algorithm based on the Comb method. Will be available in the next release. Default: ``pair''
\item \textbf{min\_weight}. Weight at which walkers are possibly killed (with probability weight/min\_weight). Default: 0.05
\item \textbf{max\_weight}. Weight at which walkers are replicated. Default: 4.0
\item \textbf{reset\_weight}. Weight to which replicated walkers are reset to. Default: 1.0
\end{itemize}

\texttt{Propagator}: Controls the object that manages the propagators.
\texttt{<Propagator name="prop0" info="info0">}
\begin{itemize}
\item \textbf{cutoff}. Cutoff applied to Cholesky vectors. Elements of the Cholesky vectors below this value are set to zero. Only meaningful with sparse hamiltonians.
    Default: 1e-6
\item \textbf{substractMF}. If ``yes'', apply mean-field subtraction based on the ImpSamp trial wavefunction. Must set to ``no'' to turn it off.
    Default: yes
\item \textbf{vbias\_bound}. Upper bound applied to the vias potential. Components of the vias potential above this value are truncated there. The bound is currently applied to $\sqrt{\tau} v_{bias}$, so a larger value must be used as either the time step or the fluctuations increase (e.g. from running a larger system or using a poor trial wavefunction).
    Default: 3.0
\item \textbf{apply\_constrain}. If ``yes'', apply the phaseless constrain to the walker propagation. Currently, setting this to ``no'' produces unknown behavior, since free propagation algorithm has not been tested.
    Default: yes
\item \textbf{hybrid}. If ``yes'', use hybrid propagation algorithm. This propagation scheme doesn't use the local energy during propagation, leading to significant speed ups when its evaluation  cost is high. The local energy of the ImpSamp trial wavefunction is never evaluated. To obtain energy estimates in this case, you must define an Estimator xml-block with the \texttt{Wavefunction} block. The local energy of this trial wavefunction is evaluated and printed. It is possible to use a previously defined trial wavefunction in the Estimator block, just set its ``name'' argument to the name of a previously defined wavefunction. In this case, the same object is used for both roles.
    Default: no
\item \textbf{nnodes}. Controls the parallel propagation algorithm. If nnodes $>$ 1, the nodes in the simulation are split into groups of nnodes nodes, each group working collectively to propagate their walkers.
    Default: 1 (Serial algorithm)
\item \textbf{nbatch}. This turns on(>=1)/off(==0) batched calculation of density matrices and overlaps. -1 means all the walkers in the batch.
      Default: 0 (CPU) / -1 (GPU)
\item \textbf{nbatch$\_$qr}. This turns on(>=1)/off(==0) batched QR calculation. -1 means all the walkers in the batch.
      Default: 0 (CPU) / -1 (GPU)
\end{itemize}

\texttt{execute}: Defines an execution region.
\texttt{<execute wset="wset0" ham="ham0" wfn="wfn0" prop="prop0" info="info0">}
\begin{itemize}
\item \textbf{nWalkers}. Initial number of walkers per core group (see ncores). This sets the number of walkers for a given gorup of ``ncores" on a node; the total number of walkers in the simulation depends on the total number of nodes and on the total number of cores on a node in the following way: $ \#_walkers_total = nWalkers * \#_nodes * \#_cores_total / ncores $. \\
    Default: 5
\item \textbf{timestep}. Time step in 1/a.u. \\
    Default: 0.01
\item \textbf{blocks}. Number of blocks. Slow operations occur once per block (e.g., write to file, slow observables, checkpoints), \\
    Default: 100
\item \textbf{step}. Number of steps within a block. Operations that occur at the step level include load balance, orthogonalization, branching, etc. \\
    Default: 1
\item \textbf{substep}. Number of substeps within a step. Only walker propagation occurs in a substep. \\
    Default: 1
\item \textbf{ortho}. Number of steps between orthogonalization.
    Default: 1
\item \textbf{ncores}. Number of nodes in a task group. This number defines the number of cores on a node that share the parallel work associated with a distributed task. This number is used in the \texttt{Wavefunction} and \texttt{Propagator} task groups. The walker sets are shares by the ncores on a given node in the task group.
\item \textbf{checkpoint}. Number of blocks between checkpoint files are generated. If a value smaller than 1 is given, no file is generated. If \textbf{hdf\_write\_file} is not set, a default name is used. \textbf{Default: 0}
%\item \textbf{samplePeriod}. Number of blocks between sample collection. \textbf{Default: 0}
\item \textbf{hdf\_write\_file}. If set (and checkpoint>0), a checkpoint file with this name will be written.
\item \textbf{hdf\_read\_file}. If set, the simulation will be restarted from the given file.\\
\end{itemize}

Within the \texttt{Estimators} xml block has an argument \textbf{name}: the type of estimator we want to measure. Currently available estimators include: ``basic'', ``energy'', ``mixed\_one\_rdm'', and ``back\_propagation''.

The basic estimator has the following optional parameters:
\begin{itemize}
\item \textbf{timers}. print timing information. Default: true
\end{itemize}

The back\_propagation estimator has the following parameters:
\begin{itemize}
\item \textbf{ortho}. Number of back-propagation steps between orthogonalization.
    Default: 10
\item \textbf{nsteps}. Maximum number of back-propagation steps.
    Default: 10
\item \textbf{naverages}. Number of back propagation calculations to perform. The number of steps will be chosed equally distributed in the range {0,nsteps}.
    Default: 1
\item \textbf{block\_size}. Number of blocks to use in the internal average of the back propagated estimator. This is used to block data and reduce the size of the output.
    Default: 1
\item \textbf{nskip}. Number of blocks to skip at the start of the calculation for equilibration purposes.
    Default: 0
\end{itemize}

\section{File formats}
... Coming Soon ...

\section{Advice/Useful Information}

AFQMC calculations are computationally expensive and require some care to obtain reasonable performance.
The following is a growing list of useful advice for new users, followed by a sample input for a large calculation.
\begin{itemize}
\item Generate Cholesky-decomposed integrals with external codes instead of the 2-electron integrals directly. The generation of the Cholesky factorization is faster and consumes less memory.
\item Use the hybrid algorithm for walker propagation. Set steps/substeps to adequate values to reduce the number of energy evaluations. This is essential when using large multideterminant expansions.
\item Adjust cutoffs in the wavefunction and propagator bloxks until desired accuracy is reached. The cost of the calculation will depend on these cutoffs.
\item Adjust ncores/nWalkers to obtain better efficiency. Larger nWalkers will lead to more efficient linear algebra operations but will increase the time per step. Larger ncores will reduce the time per step but will reduce efficiency because of inefficiencies in the parallel implementation. For large calculations, values between 6--12 for both quantities should be reasonable, depending on architecture.
\end{itemize}

\begin{lstlisting}[style=QMCPXML,caption=Example of sections of an AFQMC input file for a large calculation.]
...

  <Hamiltonian name="ham0" type="SparseGeneral" info="info0">
    <parameter name="filename">fcidump.h5</parameter>
    <parameter name="cutoff_1bar">1e-6</parameter>
    <parameter name="cutoff_decomposition">1e-5</parameter>
  </Hamiltonian>

  <Wavefunction name="wfn0" type="MSD" info="info0">
    <parameter name="filetype">ascii</parameter>
    <parameter name="filename">wfn.dat</parameter>
  </Wavefunction>

  <WalkerSet name="wset0">
    <parameter name="walker_type">closed</parameter>
  </WalkerSet>

  <Propagator name="prop0" info="info0">
    <parameter name="hybrid">yes</parameter>
  </Propagator>

  <execute wset="wset0" ham="ham0" wfn="wfn0" prop="prop0" info="info0">
    <parameter name="ncores">8</parameter>
    <parameter name="timestep">0.01</parameter>
    <parameter name="blocks">10000</parameter>
    <parameter name="steps">10</parameter>
    <parameter name="substeps">5</parameter>
    <parameter name="nWalkers">8</parameter>
    <parameter name="ortho">5</parameter>
  </execute>
\end{lstlisting}


% ml.tex
%
% machine learning section
%
% Samuel Rohrer

\subsection{Training \& Testing, validation, data labeling (Mechanical Turk)}

\subsection{Bias-Variance tradeoff}

\subsection{Regression: linear, logistical, quadratic}

\subsection{Classification}

\subsection{Sparse Linear Models}

\subsection{Sparse Coding}

\subsection{Nearest neighbor, Bayesian models}

\subsection{Naive Bayes}

\subsection{Support Vector Machine}

\subsection{Decision Trees}

\subsection{Ensemble Learning (bagging, boosted tree, random forests)}

\subsection{Affinity Analysis}

\subsection{Clustering (k-means, hierarchical, expectation maximization)}

\subsection{Association Rules}

\subsection{Structured Prediction (Bayes Net, Hidden Markov Models)}

\subsection{Dimensionality Reduction (LDA, PCA, Kernel PCA, Factor Analysis)}

\subsection{Perceptron, Multilayer Perceptron}

\subsection{Artificial Neural Networks}

\subsection{Restricted Boltzmann Machine, Generative networks}

\subsection{Instance based learning}

\subsection{Association learning}

\subsection{Deep Learning, Autoencoder}

\subsection{Deep belief network}

\subsection{Representation Learning}

\subsection{Sequence Learning}

\subsection{Convolutional Neural Nets}

\subsection{Recurrent Neural nets (LTSM, GRU)}

\subsection{Online Learning}

\subsection{Reinforcement Learning (Q-learning, Temporal Difference)}

\subsection{Monte Carlo methods}

\subsection{Solving Black Scholes}


\subsection{Memlets} \label{section:memlet}
Memlets are represented by using \codeword{sdir.memlet}, which extends the builtin \codeword{memref} to allow for attributes. See Figure \ref{fig:state_in_out}. Using index and layout maps on \codeword{sdir.memlets} any subregion of the underlying array can be selected. Transient arrays get constructed using \codeword{sdir.alloc_transient()} as opposed to \codeword{sdir.alloc()} for global arrays. Arrays created inside of a state are only accessible by the same state whereas arrays created outside of all states are accessible by all states. See Figure \ref{fig:transient_array}.
\smc{transient_array}{Transient arrays}
\\

\subsubsection{Parameterized sizes}
 One can also pass parameters to \codeword{sdir.alloc()} to define the size at runtime as seen on here:\codeword{\%A = sdir.alloc(\%n) : !sdir.array<?xi32>}. In this case the question mark \codeword{?} gets replaced by the value of \codeword{\%n}.