qmcpack/manual/hamiltonianobservable.tex

1425 lines
93 KiB
TeX

\chapter{Hamiltonian and Observables}
\label{chap:hamiltobs}
\qmcpack is capable of the simultaneous measurement of the Hamiltonian and many other quantum operators. The Hamiltonian attains a special status among the available operators (also referred to as observables) because it ultimately generates all available information regarding the quantum system. This is evident from an algorithmic standpoint as well since the Hamiltonian (embodied in the the projector) generates the imaginary time dynamics of the walkers in DMC and RMC.
This section covers how the Hamiltonian can be specified, component by component, by the user in the XML format native to \qmcpack. It also covers the input structure of statistical estimators corresponding to quantum observables such as the density, the static structure factor, and forces.
\section{The Hamiltonian}
The many-body Hamiltonian in Hartree units is given by
\begin{align}
\hat{H} = -\sum_i\frac{1}{2m_i}\nabla_i^2 + \sum_iv^{ext}(r_i) + \sum_{i<j}v^{qq}(r_i,r_j) + \sum_{i\ell}v^{qc}(r_i,r_\ell) + \sum_{\ell<m}v^{cc}(r_\ell,r_m).
\end{align}
Here, the sums indexed by $i/j$ are over quantum particles, while $\ell/m$ are reserved for classical particles. Often the quantum particles are electrons and the classical particles are ions, though \qmcpack is not limited in this way. The mass of each quantum particle is denoted $m_i$, $v^{qq}/v^{qc}/v^{cc}$ are pair potentials between quantum-quantum/quantum-classical/classical-classical particles, and $v^{ext}$ denotes a purely external potential.
\qmcpack is designed modularly so that any potential can be supported with minimal additions to the code base. Potentials currently supported include Coulomb interactions in open and periodic boundary conditions, the modified periodic coulomb (MPC) potential, non-local pseudopotentials, helium pair potentials, and various model potentials such as hard sphere, gaussian, and modified Poschl-Teller.
Reference information and examples for the \texttt{<hamiltonian/>} XML element is provided below. Detailed descriptions of the input for individual potentials is given in the sections that follow.
% hamiltonian element
% dev notes
% Hamiltonian element read
% HamiltonianPool::put
% reads attributes: id name role target
% id/name is passed to QMCHamiltonian
% role selects the primary hamiltonian
% target associates to quantum particleset
% HamiltonianFactory::build
% reads attributes: type source default
% HamiltonianFactory cloning may be flawed for non-electron systems
% see HamiltonianFactory::clone
% aCopy->renameProperty(``e'',qp->getName());
% aCopy->renameProperty(psiName,psi->getName());
% the renaming may not work if dynamic particleset.name!=''e''
% lots of xml inputs are simply ignored if do not explicitly match (fix! here and elsewhere in the build tree)
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{hamiltonian} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{simulation, qmcsystem}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\texttt{pairpot extpot estimator constant}(deprecated)}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{name/id}$^o$ & text & \textit{anything}& h0 & Unique id for this Hamiltonian instance \\
& \texttt{type}$^o$ & text & & generic & \textit{No current function} \\
& \texttt{role}$^o$ & text & primary/extra & extra & Designate as primary Hamiltonian or not \\
& \texttt{source}$^o$ & text & \texttt{particleset.name} & i & Identify classical particleset \\
& \texttt{target}$^o$ & text & \texttt{particleset.name} & e & Identify quantum particleset \\
& \texttt{default}$^o$ & boolean & yes/no & yes & Include kinetic energy term implicitly \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information:
\begin{itemize}
\item{\textbf{target:} Must be set to the name of the quantum particeset. The default value is typically sufficient. In normal usage, no other attributes are provided.}
\end{itemize}
% All-electron hamiltonian element
\begin{lstlisting}[caption=All electron Hamiltonian XML element.]
<hamiltonian target="e">
<pairpot name="ElecElec" type="coulomb" source="e" target="e"/>
<pairpot name="ElecIon" type="coulomb" source="i" target="e"/>
<pairpot name="IonIon" type="coulomb" source="i" target="i"/>
</hamiltonian>
\end{lstlisting}
% Pseudopotential hamiltonian element
\begin{lstlisting}[caption=Pseudopotential Hamiltonian XML element.]
<hamiltonian target="e">
<pairpot name="ElecElec" type="coulomb" source="e" target="e"/>
<pairpot name="PseudoPot" type="pseudo" source="i" wavefunction="psi0" format="xml">
<pseudo elementType="Li" href="Li.xml"/>
<pseudo elementType="H" href="H.xml"/>
</pairpot>
<pairpot name="IonIon" type="coulomb" source="i" target="i"/>
</hamiltonian>
\end{lstlisting}
\section{Pair potentials}
Many pair potentials are supported. Though only the most commonly used pair potentials are covered in detail in this section, all currently available potentials are listed briefly below. If a potential you desire is not covered below, or is not present at all, feel free to contact the developers.
% pairpot element
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{pairpot} factory element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian}}\\
\multicolumn{2}{l}{type selector:} & \multicolumn{4}{l}{\texttt{type} attribute}\\
\multicolumn{2}{l}{type options: } & \multicolumn{2}{l}{coulomb } & \multicolumn{2}{l}{Coulomb/Ewald potential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{pseudo } & \multicolumn{2}{l}{Semilocal pseudopotential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{mpc } & \multicolumn{2}{l}{Modified Periodic Coulomb interaction/correction}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{cpp } & \multicolumn{2}{l}{Core polarization potential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{numerical/*num* } & \multicolumn{2}{l}{Numerical radial potential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{skpot } & \multicolumn{2}{l}{\textit{Unknown}}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{vhxc } & \multicolumn{2}{l}{Exchange correlation potential (external)}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{jellium } & \multicolumn{2}{l}{Atom-centered spherical jellium potential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{hardsphere } & \multicolumn{2}{l}{Hard sphere potential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{gaussian } & \multicolumn{2}{l}{Gaussian potential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{modpostel } & \multicolumn{2}{l}{Modified Poschl-Teller potential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{huse } & \multicolumn{2}{l}{Huse quintic potential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{modInsKE } & \multicolumn{2}{l}{Model insulator kinetic energy}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{oscillatory } & \multicolumn{2}{l}{\textit{Unknown}}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{LJP\_smoothed } & \multicolumn{2}{l}{Helium pair potential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{HeSAPT\_smoothed } & \multicolumn{2}{l}{Helium pair potential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{HFDHE2\_Moroni1995} & \multicolumn{2}{l}{Helium pair potential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{HFDHE2 } & \multicolumn{2}{l}{Helium pair potential}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{eHe } & \multicolumn{2}{l}{Helium-electron pair potential}\\
\multicolumn{2}{l}{shared attributes:} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & \textit{See above} & 0 & Select pairpot type \\
& \texttt{name}$^r$ & text & \textit{anything} & any & Unique name for this pairpot\\
& \texttt{source}$^r$ & text & \texttt{particleset.name} &\texttt{hamiltonian.target}& Identify interacting particles\\
& \texttt{target}$^r$ & text & \texttt{particleset.name} &\texttt{hamiltonian.target}& Identify interacting particles \\
& \texttt{units}$^o$ & text & & hartree & \textit{No current function} \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information:
\begin{itemize}
\item{\textbf{type:} Used to select the desired pair potential. Must be selected from the list of type options above.}
\item{\textbf{name:} A unique name used to identify this pair potential. Block averaged output data will appear under this name in \texttt{scalar.dat} and/or \texttt{stat.h5} files.}
\item{\textbf{source/target:} These specify the particles involved in a pair interaction. If an interaction is between classical (e.g. ions) and quantum (e.g. electrons), \texttt{source}/\texttt{target} should be the name of the classical/quantum particleset.}
\item{Only \texttt{coulomb, pseudo, mpc} are described in detail below. The older or less used types (\texttt{cpp, numerical, jellium, hardsphere, gaussian, huse, modpostel, oscillatory, skpot, vhxc, modInsKE, LJP\_smoothed, HeSAPT\_smoothed, HFDHE2\_Moroni1995, eHe, HFDHE2}) are not covered.}
\dev{
\item{Available only if \texttt{QMC\_BUILD\_LEVEL>2} and \texttt{QMC\_CUDA} is not defined: \texttt{hardsphere, gaussian, huse, modpostel, oscillatory, skpot}.}
\item{Available only if \texttt{OHMMS\_DIM==3}: \texttt{mpc, vhxc, pseudo}.}
\item{Available only if \texttt{OHMMS\_DIM==3} and \texttt{QMC\_BUILD\_LEVEL>2} and \texttt{QMC\_CUDA} is not defined: \texttt{cpp, LJP\_smoothed, HeSAPT\_smoothed, HFDHE2\_Moroni1995, eHe, jellium, HFDHE2, modInsKE}.}
}
\end{itemize}
% physical read by coulomb potentials
% potential is only for pressure estimator
% pairpot instances
% do coulomb, pseudo, mpc
\subsection{Coulomb potentials}
The bare Coulomb potential is used in open boundary conditions:
\begin{align}
V_c^{open} = \sum_{i<j}\frac{q_iq_j}{\abs{r_i-r_j}}
\end{align}
When periodic boundary conditions are selected, Ewald summation is used automatically:
\begin{align}\label{eq:ewald}
V_c^{pbc} = \sum_{i<j}\frac{q_iq_j}{\abs{r_i-r_j}} + \frac{1}{2}\sum_{L\ne0}\sum_{i,j}\frac{q_iq_j}{\abs{r_i-r_j+L}}
\end{align}
The sum indexed by $L$ is over all non-zero simulation cell lattice vectors. In practice, the Ewald sum is broken into short and long ranged parts in a manner optimized for efficiency (see Ref. \cite{Natoli1995}) for details.
For information on how to set the boundary conditions, consult Sec. \ref{chap:simulationcell}.
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{pairpot type=coulomb} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & \textbf{coulomb} & & Must be coulomb \\
& \texttt{name/id}$^r$ & text & \textit{anything}& ElecElec & Unique name for interaction\\
& \texttt{source}$^r$ & text & \texttt{particleset.name} &\texttt{hamiltonian.target}& Identify interacting particles\\
& \texttt{target}$^r$ & text & \texttt{particleset.name} &\texttt{hamiltonian.target}& Identify interacting particles\\
& \texttt{pbc}$^o$ & boolean & yes/no & yes & Use Ewald summation \\
& \texttt{physical}$^o$& boolean & yes/no & yes & Hamiltonian(yes)/observable(no) \\
\dev{& \texttt{forces} & boolean & yes/no & no & \textit{Deprecated} \\ }
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information
\begin{itemize}
\item{\textbf{type/source/target} See description for the generic \texttt{pairpot} factory element above.}
\item{\textbf{name:} Traditional user-specified names for electron-electron, electron-ion, and ion-ion terms are \texttt{ElecElec}, \texttt{ElecIon}, and \texttt{IonIon}, respectively. While any choice can be used, the data analysis tools expect to find columns in \texttt{*.scalar.dat} with these names.}
\item{\textbf{pbc}: Ewald summation will not be performed if \texttt{simulationcell.bconds== n n n}, regardless of the value of \texttt{pbc}. Similarly, the \texttt{pbc} attribute can only be used to turn off Ewald summation if \texttt{simulationcell.bconds!= n n n}. The default value is recommended.}
\item{\textbf{physical}: If \texttt{physical==yes}, this pair potential is included in the Hamiltonian and will factor into the \texttt{LocalEnergy} reported by QMCPACK and also in the DMC branching weight. If \texttt{physical==no}, then the pair potential is treated as a passive observable but not as part of the Hamiltonian itself. As such it does not contribute to the outputted \texttt{LocalEnergy}. Regardless of the value of \texttt{physical} output data will appear in \texttt{scalar.dat} in a column headed by \texttt{name}.}
\end{itemize}
\begin{lstlisting}[caption=XML element for Coulomb interaction between electrons.]
<pairpot name="ElecElec" type="coulomb" source="e" target="e"/>
\end{lstlisting}
\begin{lstlisting}[caption=XML element for Coulomb interaction between electrons and ions (all-electron only).]
<pairpot name="ElecIon" type="coulomb" source="i" target="e"/>
\end{lstlisting}
\begin{lstlisting}[caption=XML element for Coulomb interaction between ions.]
<pairpot name="IonIon" type="coulomb" source="i" target="i"/>
\end{lstlisting}
\subsection{Pseudopotentials}
\qmcpack supports pseudopotentials in semilocal form, which is local in the radial coordinate and non-local in angular coordinates. When all angular momentum channels above a certain threshold ($\ell_{max}$) are well approximated by the same potential ($V_{\bar{\ell}}\equiv V_{loc}$), the pseudpotential separates into a fully local channel and an angularly-nonlocal component:
\begin{align}
V^{PP} = \sum_{ij}\Big(V_{\bar{\ell}}(\abs{r_i-\tilde{r}_j}) + \sum_{\ell\ne\bar{\ell}}^{\ell_{max}}\sum_{m=-\ell}^\ell \operator{Y_{\ell m}}{\big[V_\ell(\abs{r_i-\tilde{r}_j}) - V_{\bar{\ell}}(\abs{r_i-\tilde{r}_j}) \big]}{Y_{\ell m}} \Big)
\end{align}
Here the electron/ion index is $i/j$ and only one type of ion is shown for simplicity.
Evaluation of the localized pseudopotential energy $\Psi_T^{-1}V^{PP}\Psi_T$ requires additional angular integrals. These integrals are evaluated on a randomly shifted angular grid. The size of this grid is determined by $\ell_{max}$. See Ref. \cite{Mitas1991} for further detail.
\qmcpack uses the FSAtom pseudopotential file format associated with the ``Free Software Project for Atomic-scale Simulations'' initiated in 2002 (see \url{http://www.tddft.org/fsatom/manifest.php} for general information). The FSAtom format uses XML for structured data. Files in this format do not use a specific identifying file extension; they are simply suffixed with ``\texttt{.xml}''. The tabular data format of CASINO is also supported.
% FSAtom format links
% unfortunately none of the surviving links detail the format itself
% http://www.tddft.org/fsatom/index.php
% http://www.tddft.org/fsatom/programs.php
% http://www.tddft.org/fsatom/manifest.php
% http://163.13.111.58/cchu/reference/web/PseudoPotentials%20-%20FSAtom%20Wiki.htm
% http://departments.icmab.es/leem/alberto/xml/pseudo/index.html
% pseudopotential element
% dev notes
% attributes name, source, wavefunction, format are read in CoulombFactory.cpp HamiltonianFactory::addPseudoPotential
% format==''old'' refers to an old table format that is no longer supported
% read continues in ECPotentialBuilder::put()
% if format!=xml/old (i.e. table) qmcpack will attempt to read from *.psf files
% in this case, <pairpot type=''pseudo'' format=''table''/>, ie there are no elements
% if particlset groups are Li H (in order), then it looks for Li.psf and H.psf
% what is the psf format?
% if format==xml, normal read continues, i.e. <pseudo/> child elements are expected
% read is not sensitive to particleset group/species ordering
% child elements not named <pseudo/> are simply ignored (FIX!)
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{pairpot type=pseudo} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\texttt{pseudo}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & \textbf{pseudo} & & Must be pseudo \\
& \texttt{name/id}$^r$ & text & \textit{anything}& PseudoPot & \textit{No current function}\\
& \texttt{source}$^r$ & text & \texttt{particleset.name} & i & Ion particleset name\\
& \texttt{target}$^r$ & text & \texttt{particleset.name} &\texttt{hamiltonian.target}& Electron particleset name \\
& \texttt{pbc}$^o$ & boolean & yes/no & yes$^*$ & Use Ewald summation \\
& \texttt{forces} & boolean & yes/no & no & \textit{Deprecated} \\
&\texttt{wavefunction}$^r$ & text & \texttt{wavefunction.name}& invalid & Identify wavefunction \\
& \texttt{format}$^r$ & text & xml/table & table & Select file format \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information:
\begin{itemize}
\item{\textbf{type/source/target} See description for the generic \texttt{pairpot} factory element above.}
\item{\textbf{name:} Ignored. Instead default names will be present in \texttt{*scalar.dat} output files when pseudopotentials are used. The field \texttt{LocalECP} refers to the local part of the pseudopotential. If non-local channels are present, a \texttt{NonLocalECP} field will be added that contains the non-local energy summed over all angular momentum channels.}
\item{\textbf{pbc:} Ewald summation will not be performed if \texttt{simulationcell.bconds== n n n}, regardless of the value of \texttt{pbc}. Similarly, the \texttt{pbc} attribute can only be used to turn off Ewald summation if \texttt{simulationcell.bconds!= n n n}.}
\item{\textbf{format:} If \texttt{format}==table, QMCPACK looks for \texttt{*.psf} files containing pseudopotential data in a tabular format. The files must be named after the ionic species provided in \texttt{particleset} (\emph{e.g.} \texttt{Li.psf} and \texttt{H.psf}). If \texttt{format}==xml, additional \texttt{pseudo} child XML elements must be provided (see below). These elements specify individual file names and formats (both the FSAtom XML and CASINO tabular data formats are supported). }
\end{itemize}
\begin{lstlisting}[caption=XML element for pseudopotential electron-ion interaction (psf files).]
<pairpot name="PseudoPot" type="pseudo" source="i" wavefunction="psi0" format="psf"/>
\end{lstlisting}
\begin{lstlisting}[caption=XML element for pseudopotential electron-ion interaction (xml files).]
<pairpot name="PseudoPot" type="pseudo" source="i" wavefunction="psi0" format="xml">
<pseudo elementType="Li" href="Li.xml"/>
<pseudo elementType="H" href="H.xml"/>
</pairpot>
\end{lstlisting}
%\begin{lstlisting}[caption=XML element for pseudopotential electron-ion interaction (CASINO files).]
% <pairpot name="PseudoPot" type="pseudo" source="i" wavefunction="psi0" format="xml">
% <pseudo elementType="Li" href="Li.data"/>
% <pseudo elementType="H" href="H.data"/>
% </pairpot>
%\end{lstlisting}
Details of \texttt{<pseudo/>} input elements are given below. It is possible to include (or construct) a full pseudopotential directly in the input file without providing an external file via \texttt{href}. The full XML format for pseudopotentials is not yet covered.
% pseudo element
% dev notes
% initial read of href elementType/symbol attributes at ECPotentialBuilder::useXmlFormat()
% read continues in ECPComponentBuilder
% format==xml and href==none (not provided) => ECPComponentBuilder::put(cur)
% format==xml and href==a file => ECPComponentBuilder::parse(href,cur)
% format==casino => ECPComponentBuilder::parseCasino(href,cur)
% this reader is tucked away in ECPComponentBuilder.2.cpp
% nice demonstration of OhmmsAsciiParser here
% maximum cutoff defined by a 1.e-5 (Ha?) spread in the nonlocal potentials
% quadrature rules (1-7) set as in J. Chem. Phys. 95 (3467) (1991), see below
% Rule # points lexact
% 1 1 0
% 2 4 2
% 3 6 3
% 4 12 5
% 5 18 5
% 6 26 7
% 7 50 11
% looks like channels only go from s-g (see ECPComponentBuilder constructor)
% perhaps not, quadrature rules really do go up to 7 (lexact==11), see SetQuadratureRule()
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{pseudo} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{pairpot type=pseudo}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\texttt{header local grid}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{elementType/symbol}$^r$& text &\texttt{group.name}& none & Identify ionic species \\
& \texttt{href}$^r$ & text & \textit{filepath}& none & Pseudopotential file path\\
& \texttt{format}$^r$ & text & xml/casino & xml & Specify file format\\
& \texttt{cutoff}$^o$ & real & & & Non-local cutoff radius \\
& \texttt{lmax}$^o$ & integer & & & Largest angular momentum \\
& \texttt{nrule}$^o$ & integer & & & Integration grid order \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
\begin{lstlisting}[caption=XML element for pseudopotential of single ionic species.]
<pseudo elementType="Li" href="Li.xml"/>
\end{lstlisting}
\subsection{Modified periodic Coulomb interaction/correction}
The modified periodic Coulomb (MPC) interaction is an alternative to direct Ewald summation. The MPC corrects the exchange correlation hole to more closely match its thermodynamic limit. Because of this, the MPC exhibits smaller finite size errors than the bare Ewald interaction, though a few alternative and competitive finite size correction schemes now exist. The MPC is itself often used just as a finite size correction in postprocessing (set \texttt{physical=false} in the input).
% mpc element
% dev notes
% most attributes are read in CoulombPotentialFactory.cpp HamiltonianFactory::addMPCPotential()
% user input for the name attribute is ignored and the name is always MPC
% density G-vectors are stored in ParticleSet: Density_G and DensityReducedGvecs members
% check the Linear Extrap and Quadratic Extrap output in some real examples (see MPC::init_f_G())
% what are acceptable values for the discrepancies?
% check that these decrease as cutoff is increased
% commented out code for MPC.dat creation in MPC::initBreakup()
% short range part is 1/r, MPC::evalSR()
% long range part is on a spline (VlongSpline), MPC::evalLR()
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{pairpot type=mpc} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & \textbf{mpc} & & Must be mpc \\
& \texttt{name/id}$^r$ & text & \textit{anything}& MPC & Unique name for interaction \\
& \texttt{source}$^r$ & text & \texttt{particleset.name} &\texttt{hamiltonian.target}& Identify interacting particles\\
& \texttt{target}$^r$ & text & \texttt{particleset.name} &\texttt{hamiltonian.target}& Identify interacting particles \\
& \texttt{physical}$^o$& boolean & yes/no & no & Hamiltonian(yes)/observable(no) \\
& \texttt{cutoff} & real & $>0$ & 30.0 & Kinetic energy cutoff \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Remarks
\begin{itemize}
\item{\texttt{physical}: Typically set to \texttt{no}, meaning the standard Ewald interaction will be used during sampling and MPC will be measured as an observable for finite-size post correction. If \texttt{physical} is \texttt{yes}, the MPC interaction will be used during sampling. In this case an electron-electron Coulomb \texttt{pairpot} element should not be supplied.}
\item{Developer note: Currently the \texttt{name} attribute for the mpc interaction is ignored. The name is always reset to \texttt{MPC}.}
\end{itemize}
% MPC correction
\begin{lstlisting}[caption=Modified periodic coulomb for finite size post-correction.]
<pairpot type="MPC" name="MPC" source="e" target="e" ecut="60.0" physical="no"/>
\end{lstlisting}
% estimator element
\section{General estimators}
A broad range of estimators for physical observables are available in \qmcpack. The sections below contain input details for the total number density (\texttt{density}), number density resolved by particle spin (\texttt{spindensity}), spherically averaged pair correlation function (\texttt{gofr}), static structure factor (\texttt{sk}), energy density (\texttt{energydensity}), one body reduced density matrix (\texttt{dm1b}), $S(k)$ based kinetic energy correction (\texttt{chiesa}), forward walking (\texttt{ForwardWalking}), and force (\texttt{Force}) estimators. Other estimators are not yet covered.
When an \texttt{<estimator/>} element appears in \texttt{<hamiltonian/>}, it is evaluated for all applicable chained QMC runs (\emph{e.g.} VMC$\rightarrow$DMC$\rightarrow$DMC). Estimators are generally not accumulated during wavefunction optimization sections. If an \texttt{<estimator/>} element is instead provided in a particular \texttt{<qmc/>} element, that estimator is only evaluated for that specific section (\textit{e.g.} during VMC only).
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{estimator} factory element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
\multicolumn{2}{l}{type selector:} & \multicolumn{4}{l}{\texttt{type} attribute}\\
\multicolumn{2}{l}{type options: } & \multicolumn{2}{l}{density } & \multicolumn{2}{l}{Density on a grid}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{spindensity } & \multicolumn{2}{l}{Spin density on a grid}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{gofr } & \multicolumn{2}{l}{Pair correlation function (quantum species)}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{sk } & \multicolumn{2}{l}{Static structure factor}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{structurefactor } & \multicolumn{2}{l}{Species resolved structure factor}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{momentum } & \multicolumn{2}{l}{Momentum distribution}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{energydensity } & \multicolumn{2}{l}{Energy density on uniform or Voronoi grid}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{dm1b } & \multicolumn{2}{l}{One body density matrix in arbitrary basis}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{chiesa } & \multicolumn{2}{l}{Chiesa-Ceperley-Martin-Holzmann kinetic energy correction}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{Force } & \multicolumn{2}{l}{Family of ``force'' estimators (see \ref{sec:force_est})}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{ForwardWalking } & \multicolumn{2}{l}{Forward walking values for existing estimators}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{orbitalimages } & \multicolumn{2}{l}{Create image files for orbitals, then exit}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{flux } & \multicolumn{2}{l}{Checks sampling of kinetic energy}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{localmoment } & \multicolumn{2}{l}{Atomic spin polarization within cutoff radius}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{numberfluctuations} & \multicolumn{2}{l}{Spatial number fluctuations}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{HFDHE2 } & \multicolumn{2}{l}{Helium pressure}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{NearestNeighbors } & \multicolumn{2}{l}{Trace nearest neighbor indices}\\
\dev{
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{Kinetic } & \multicolumn{2}{l}{\textit{No current function}}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{Pressure } & \multicolumn{2}{l}{\textit{No current function}}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{ZeroVarObs } & \multicolumn{2}{l}{\textit{No current function}}\\
\multicolumn{2}{l}{ } & \multicolumn{2}{l}{DMCCorrection } & \multicolumn{2}{l}{\textit{No current function}}\\
\multicolumn{2}{l}{shared attributes:} & \multicolumn{4}{l}{}\\
}
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & \textit{See above} & 0 & Select estimator type \\
& \texttt{name}$^r$ & text & \textit{anything} & any & Unique name for this estimator\\
%& \texttt{source}$^r$ & text & \texttt{particleset.name} &\texttt{hamiltonian.target}& Identify interacting particles\\
%& \texttt{target}$^r$ & text & \texttt{particleset.name} &\texttt{hamiltonian.target}& Identify interacting particles \\
%& \texttt{units}$^o$ & text & & hartree & \textit{No current function} \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
% <estimator type="structurefactor" name="StructureFactor" report="yes"/>
% <estimator type="nofk" name="nofk" wavefunction="psi0"/>
%\dev{
%\FloatBarrier
%\begin{table}[h]
%\begin{center}
%\begin{tabularx}{\textwidth}{l l l l l l }
%\hline
%\multicolumn{6}{l}{\texttt{estimator type=X} element} \\
%\hline
%\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
%\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
%\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
% & \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
% & \texttt{type}$^r$ & text & \textbf{X} & & Must be X \\
% & \texttt{name}$^r$ & text & \textit{anything}& & Unique name for estimator \\
% & \texttt{source}$^o$ & text & \texttt{particleset.name} &\texttt{hamiltonian.target}& Identify particles\\
% & \texttt{target}$^o$ & text & \texttt{particleset.name} &\texttt{hamiltonian.target}& Identify particles \\
% \hline
%\end{tabularx}
%\end{center}
%\end{table}
%\FloatBarrier
%}
\subsection{Chiesa-Ceperley-Martin-Holzmann kinetic energy correction}
This estimator calculates a finite size correction to the kinetic energy following the formalism laid out in Ref. \cite{Chiesa2006}. The total energy can be corrected for finite size effects by using this estimator in conjuction with the MPC correction.
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{estimator type=chiesa} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & \textbf{chiesa} & & Must be chiesa \\
& \texttt{name}$^o$ & text & \textit{anything} & KEcorr & Always reset to KEcorr \\
& \texttt{source}$^o$ & text & \texttt{particleset.name} & e & Identify quantum particles\\
& \texttt{psi}$^o$ & text & \texttt{wavefunction.name} & psi0 & Identify wavefunction \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
% kinetic energy correction
\begin{lstlisting}[caption=``Chiesa'' kinetic energy finite size post-correction.]
<estimator name="KEcorr" type="chiesa" source="e" psi="psi0"/>
\end{lstlisting}
\subsection{Density estimator}
The particle number density operator is given by
\begin{align}
\hat{n}_r = \sum_i\delta(r-r_i)
\end{align}
The \texttt{density} estimator accumulates the number density on a uniform histogram grid over the simulation cell. The value obtained for a grid cell $c$ with volume $\Omega_c$ is then the average number of particles in that cell:
\begin{align}
n_c = \int dR \abs{\Psi}^2 \int_{\Omega_c}dr \sum_i\delta(r-r_i)
\end{align}
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{estimator type=density} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & \textbf{density} & & Must be density \\
& \texttt{name}$^r$ & text & \textit{anything} & any & Unique name for estimator \\
& \texttt{delta}$^o$ & real array(3) & $0\le v_i \le 1$ & 0.1 0.1 0.1 & Grid cell spacing, unit coords\\
& \texttt{x\_min}$^o$ & real & $>0$ & 0 & Grid starting point in x (Bohr)\\
& \texttt{x\_max}$^o$ & real & $>0$ &$|\texttt{lattice[0]}|$& Grid ending point in x (Bohr)\\
& \texttt{y\_min}$^o$ & real & $>0$ & 0 & Grid starting point in y (Bohr)\\
& \texttt{y\_max}$^o$ & real & $>0$ &$|\texttt{lattice[1]}|$& Grid ending point in y (Bohr)\\
& \texttt{z\_min}$^o$ & real & $>0$ & 0 & Grid starting point in z (Bohr)\\
& \texttt{z\_max}$^o$ & real & $>0$ &$|\texttt{lattice[2]}|$& Grid ending point in z (Bohr)\\
& \texttt{potential}$^o$ & boolean & yes/no & no & Accumulate local potential, \textit{Deprecated}\\
& \texttt{debug}$^o$ & boolean & yes/no & no & \textit{No current function}\\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information:
\begin{itemize}
\item{\texttt{name}: The name provided will be used as a label in the \texttt{stat.h5} file for the blocked output data. Post-processing tools expect \texttt{name="Density"}.}
\item{\texttt{delta}: This sets the histogram grid size used to accumulate the density: \texttt{delta="0.1 0.1 0.05"}$\rightarrow 10\times 10\times 20$ grid, \texttt{delta="0.01 0.01 0.01"}$\rightarrow 100\times 100\times 100$ grid. The density grid is written to a \texttt{stat.h5} file at the end of each Monte Carlo block. If you request many $blocks$ in a \texttt{<qmc/>} element, or select a large grid, the resulting \texttt{stat.h5} file may be many GB in size.}
\item{\texttt{*\_min/*\_max}: Can be used to select a subset of the simulation cell for the density histogram grid. For example if a (cubic) simulation cell is 20 Bohr on a side, setting \texttt{*\_min=5.0} and \texttt{*\_max=15.0} will result in a density histogram grid spanning a $10\times 10\times 10$ Bohr cube about the center of the box. Use of \texttt{x\_min, x\_max, y\_min, y\_max, z\_min, z\_max} is only appropriate for orthorhombic simulation cells with open boundary conditions.}
\item{When open boundary conditions are used, a \texttt{<simulationcell/>} element must be explicitly provided as the first sub-element of \texttt{<qmcsystem/>} for the density estimator to work. In this case the molecule should be centered around the middle of the simulation cell ($L/2$) and not the origin ($0$} since the space within the cell, and hence the density grid, is defined from $0$ to $L$.
\end{itemize}
% density estimator
\begin{lstlisting}[caption=Density estimator (uniform grid).]
<estimator name="Density" type="density" delta="0.05 0.05 0.05"/>
\end{lstlisting}
\subsection{Lattice deviation estimator}
Record deviation of a group of particles in one particle set (target) from a group of particles in another particle set (source).
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{estimator type=sk} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & latticedeviation & & Must be latticedeviation \\
& \texttt{name}$^r$ & text & \textit{anything} & any & Unique name for estimator \\
& \texttt{hdf5}$^o$ & boolean & yes/no & no & Output to \texttt{stat.h5} (yes) \\
& \texttt{per\_xyz}$^o$ & boolean & yes/no & no & Directional-resolved (yes) \\
& \texttt{source}$^r$ & text & e/ion0/\dots & no & source particle set \\
& \texttt{sgroup}$^r$ & text & u/d/\dots & no & source particle group \\
& \texttt{target}$^r$ & text & e/ion0/\dots & no & target particle set \\
& \texttt{tgroup}$^r$ & text & u/d/\dots & no & target particle group \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information:
\begin{itemize}
\item{\texttt{source}: The ``reference'' particle set to measure distances from, actual reference points are determined together with \verb|sgroup|.}
\item{\texttt{sgroup}: The ``reference'' particle group to measure distances from.}
\item{\texttt{source}: The ``target'' particle set to measure distances to.}
\item{\texttt{sgroup}: The ``target'' particle group to measure distances to. For example, in Listing~\ref{lst:latdev}, the distance from the up electron (``u'') to the origin of the coordinate system is recorded.}
\item{\texttt{per\_xyz}: Record direction-resolved distance. In Listing~\ref{lst:latdev}, the x,y,z coordinates of the up electron will be recorded separately if \texttt{per\_xyz=yes}.}
\item{\texttt{hdf5}: Record particle-resolved distances in the h5 file if \texttt{gdf5=yes}.}.
\end{itemize}
\begin{lstlisting}[caption={Lattice deviation estimator element.},label={lst:latdev}]
<particleset name="e" random="yes">
<group name="u" size="1" mass="1.0">
<parameter name="charge" > -1 </parameter>
<parameter name="mass" > 1.0 </parameter>
</group>
<group name="d" size="1" mass="1.0">
<parameter name="charge" > -1 </parameter>
<parameter name="mass" > 1.0 </parameter>
</group>
</particleset>
<particleset name="wf_center">
<group name="origin" size="1">
<attrib name="position" datatype="posArray" condition="0">
0.00000000 0.00000000 0.00000000
</attrib>
</group>
</particleset>
<estimator type="latticedeviation" name="latdev" hdf5="yes" per_xyz="yes"
source="wf_center" sgroup="origin" target="e" tgroup="u"/>
\end{lstlisting}
\subsection{Spin density estimator}
The spin density is similar to the total density described above. In this case, the sum over particles is performed independently for each spin component.
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{estimator type=spindensity} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & \textbf{spindensity} & & Must be spindensity \\
& \texttt{name}$^r$ & text & \textit{anything} & any & Unique name for estimator \\
& \texttt{report}$^o$ & boolean & yes/no & no & Write setup details to stdout \\
\multicolumn{2}{l}{parameters} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{grid}$^o$ & integer array(3) & $v_i>0$ & & Grid cell count \\
& \texttt{dr}$^o$ & real array(3) & $v_i>0$ & & Grid cell spacing (Bohr) \\
& \texttt{cell}$^o$ & real array(3,3) & \textit{anything} & & Volume grid exists in \\
& \texttt{corner}$^o$ & real array(3) & \textit{anything} & & Volume corner location \\
& \texttt{center}$^o$ & real array(3) & \textit{anything} & & Volume center/origin location \\
& \texttt{voronoi}$^o$ & text &\texttt{particleset.name}& & \textit{Under development}\\%Ion particleset for Voronoi centers\\
& \texttt{test\_moves}$^o$& integer & $>=0$ & 0 & Test estimator with random moves \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information:
\begin{itemize}
\item{\texttt{name}: The name provided will be used as a label in the \texttt{stat.h5} file for the blocked output data. Post-processing tools expect \texttt{name="SpinDensity"}.}
\item{\texttt{grid}: Sets the dimension of the histogram grid. Input like \texttt{<parameter name="grid"> 40 40 40 </parameter>} requests a $40 \times 40\times 40$ grid. The shape of individual grid cells is commensurate with the supercell shape.}
\item{\texttt{dr}: Real space dimensions of grid cell edges (Bohr units). Input like \texttt{<parameter name="dr"> 0.5 0.5 0.5 </parameter>} in a supercell with axes of length 10 Bohr each (but of arbitrary shape) will produce a $20\times 20\times 20$ grid. The inputted \texttt{dr} values are rounded to produce an integer number of grid cells along each supercell axis. Either \texttt{grid} or \texttt{dr} must be provided, but not both.}
\item{\texttt{cell}: When \texttt{cell} is provided, a user defined grid volume is used instead of the global supercell. This must be provided if open boundary conditions are used. Additionally, if \texttt{cell} is provided, the user must specify where the volume is located in space in addition to its size/shape (\texttt{cell}) using either the \texttt{corner} or \texttt{center} parameters.}
\item{\texttt{corner}:The grid volume is defined as $corner+\sum_{d=1}^3u_dcell_d$ with $0<u_d<1$ (``cell'' refers to either the supercell or user provided cell).}
\item{\texttt{center}:The grid volume is defined as $center+\sum_{d=1}^3u_dcell_d$ with $-1/2<u_d<1/2$ (``cell'' refers to either the supercell or user provided cell). \texttt{corner/center} can be used to shift the grid even if \texttt{cell} is not specified. Simultaneous use of \texttt{corner} and \texttt{center} will cause QMCPACK to abort.}
\end{itemize}
% spin density estimators
\begin{lstlisting}[caption=Spin density estimator (uniform grid).]
<estimator type="spindensity" name="SpinDensity" report="yes">
<parameter name="grid"> 40 40 40 </parameter>
</estimator>
\end{lstlisting}
\begin{lstlisting}[caption=Spin density estimator (uniform grid centered about origin).]
<estimator type="spindensity" name="SpinDensity" report="yes">
<parameter name="grid">
20 20 20
</parameter>
<parameter name="center">
0.0 0.0 0.0
</parameter>
<parameter name="cell">
10.0 0.0 0.0
0.0 10.0 0.0
0.0 0.0 10.0
</parameter>
</estimator>
\end{lstlisting}
\subsection{Pair correlation function, $g(r)$}
The functional form of the species resolved radial pair correlation function operator is
\begin{align}
g_{ss'}(r) = \frac{V}{4\pi r^2N_sN_{s'}}\sum_{i_s=1}^{N_s}\sum_{j_{s'}=1}^{N_{s'}}\delta(r-|r_{i_s}-r_{j_{s'}}|).
\end{align}
Here $N_s$ is the number of particles of species $s$ and $V$ is the supercell volume. If $s=s'$, then the sum is restricted so that $i_s\ne j_s$.
In QMCPACK, an estimate of $g_{ss'}(r)$ is obtained as a radial histogram with a set of $N_b$ uniform bins of width $\delta r$. This can be expressed analytically as
\begin{align}
\tilde{g}_{ss'}(r) = \frac{V}{4\pi r^2N_sN_{s'}}\sum_{i=1}^{N_s}\sum_{j=1}^{N_{s'}}\frac{1}{\delta r}\int_{r-\delta r/2}^{r+\delta r/2}dr'\delta(r'-|r_{si}-r_{s'j}|),
\end{align}
where the radial coordinate $r$ is restricted to reside at the bin centers, $\delta r/2, 3 \delta r/2, 5 \delta r/2, \ldots$.
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{estimator type=gofr} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & \textbf{gofr} & & Must be gofr \\
& \texttt{name}$^o$ & text & \textit{anything} & any & \textit{No current function} \\
& \texttt{num\_bin}$^r$& integer & $>1$ & 20 & \# of histogram bins \\
& \texttt{rmax}$^o$ & real & $>0$ & 10 & Histogram extent (Bohr) \\
& \texttt{dr}$^o$ & real & $>0$ & 0.5 & \textit{No current function} \\%Histogram bin width (Bohr) \\
& \texttt{debug}$^o$ & boolean & yes/no & no & \textit{No current function} \\
& \texttt{target}$^o$ & text &\texttt{particleset.name}&\texttt{hamiltonian.target}& Quantum particles \\
& \texttt{source/sources}$^o$& text array &\texttt{particleset.name}&\texttt{hamiltonian.target}& Classical particles\\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information:
\begin{itemize}
\item{\textbf{num\_bin:} The number of bins in each species pair radial histogram.}
\item{\textbf{rmax:} Maximum pair distance included in the histogram. The uniform bin width is $\delta r=\texttt{rmax/num\_bin}$. If periodic boundary conditions are used for any dimension of the simulation cell, then the default value of \texttt{rmax} is the simulation cell radius instead of 10 Bohr. For open boundary conditions the volume ($V$) used is 1.0 Bohr$^3$.}
\item{\textbf{source/sources:} If unspecified, only pair correlations between each species of quantum particle will be measured. For each classical particleset specified by \texttt{source/sources}, additional pair correlations between each quantum and classical species will be measured. Typically there is only one classical particleset (\textit{e.g.} \texttt{source="ion0"}), but there can be several in principle (\textit{e.g.} \texttt{sources="ion0 ion1 ion2"}).}
\item{\textbf{target:} The default value is the preferred usage (\textit{i.e.} \texttt{target} does not need to be provided).}
\item{Data is outputted to the \texttt{stat.h5} for each QMC sub-run. Individual histograms are named according to the quantum particleset and index of the pair. For example, if the quantum particleset is named "e" and there are two species (up and down electrons, say), then there will be three sets of histogram data in each \texttt{stat.h5} file named \texttt{gofr\_e\_0\_0}, \texttt{gofr\_e\_0\_1}, and \texttt{gofr\_e\_1\_1} for up-up, up-down, and down-down correlations, respectively.}
\end{itemize}
\begin{lstlisting}[caption=Pair correlation function estimator element.]
<estimator type="gofr" name="gofr" num_bin="200" rmax="3.0" />
\end{lstlisting}
\begin{lstlisting}[caption=Pair correlation function estimator element with additional electron-ion correlations.]
<estimator type="gofr" name="gofr" num_bin="200" rmax="3.0" source="ion0" />
\end{lstlisting}
\subsection{Species kinetic energy}
Record species-resolved kinetic energy instead of the total kinetic energy in the \verb|Kinetic| column of scalar.dat. \verb|SpeciesKineticEnergy| is arguable the simplest estimator in QMCPACK. The implementation of this estimator is detailed in \verb|manual/estimator/estimator_implementation.pdf|.
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{estimator type=sk} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & specieskinetic & & Must be specieskinetic \\
& \texttt{name}$^r$ & text & \textit{anything} & any & Unique name for estimator \\
& \texttt{hdf5}$^o$ & boolean & yes/no & no & Output to \texttt{stat.h5} (yes) \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
\begin{lstlisting}[caption=Species kinetic energy estimator element.]
<estimator type="specieskinetic" name="skinetic" hdf5="no"/>
\end{lstlisting}
\subsection{Static structure factor, $S(k)$}
Let $\rho^e_{\mathbf{k}}=\sum_j e^{i \mathbf{k}\cdot\mathbf{r}_j^e}$ be the Fourier space electron density, with $\mathbf{r}^e_j$ being the coordinate of the j-th electron. $\mathbf{k}$ is a wavevector commensurate with the simulation cell. QMCPACK allows the user to accumulate the static electron structure factor $S(\mathbf{k})$ at all commensurate $\mathbf{k}$ such that $|\mathbf{k}| \leq (LR\_DIM\_CUTOFF) r_c$. $N^e$ is the number of electrons, \texttt{LR\_DIM\_CUTOFF} is the optimized breakup parameter, and $r_c$ is the Wigner-Seitz radius. It is defined as follows:
\begin{equation}
S(\mathbf{k}) = \frac{1}{N^e}\langle \rho^e_{-\mathbf{k}} \rho^e_{\mathbf{k}} \rangle
\end{equation}
% has a CUDA counterpart, may be useful to understand difference between cpu and gpu estimators
% see HamiltonianFactory.cpp
% SkEstimator_CUDA* apot=new SkEstimator_CUDA(*targetPtcl);
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{estimator type=sk} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & sk & & Must be sk \\
& \texttt{name}$^r$ & text & \textit{anything} & any & Unique name for estimator \\
& \texttt{hdf5}$^o$ & boolean & yes/no & no & Output to \texttt{stat.h5} (yes) or \texttt{scalar.dat} (no) \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information:
\begin{itemize}
\item{\textbf{name:} Unique name for estimator instance. A data structure of the same name will appear in \texttt{stat.h5} output files.}
\item{\textbf{hdf5:} If \texttt{hdf5==yes} output data for $S(k)$ is directed to the \texttt{stat.h5} file (recommended usage). If \texttt{hdf5==no}, the data is instead routed to the \texttt{scalar.dat} file resulting in many columns of data with headings prefixed by \texttt{name} and postfixed by the k-point index (\textit{e.g.} \texttt{sk\_0 sk\_1 \ldots sk\_1037 \ldots}).}
\item{This estimator only works in periodic boundary conditions. Its presence in the input file is ignored otherwise.}
\item{This is not a species resolved structure factor. Additionally, for $\mathbf{k}$ vectors commensurate with the unit cell, $S(\mathbf{k})$ will include contributions from the static electronic density, thus meaning it won't accurately measure the electron-electron density response. }
\end{itemize}
\begin{lstlisting}[caption=Static structure factor estimator element.]
<estimator type="sk" name="sk" hdf5="yes"/>
\end{lstlisting}
\subsection{Energy density estimator}
An energy density operator, $\hat{\mathcal{E}}_r$, satisfies
\begin{align}
\int dr \hat{\mathcal{E}}_r = \hat{H},
\end{align}
where the integral is over all space and $\hat{H}$ is the Hamiltonian. In \qmcpack, the energy density is split into kinetic and potential components
\begin{align}
\hat{\mathcal{E}}_r = \hat{\mathcal{T}}_r + \hat{\mathcal{V}}_r
\end{align}
with each component given by
\begin{align}
\hat{\mathcal{T}}_r &= \frac{1}{2}\sum_i\delta(r-r_i)\hat{p}_i^2 \\
\hat{\mathcal{V}}_r &= \sum_{i<j}\frac{\delta(r-r_i)+\delta(r-r_j)}{2}\hat{v}^{ee}(r_i,r_j)
+ \sum_{i\ell}\frac{\delta(r-r_i)+\delta(r-\tilde{r}_\ell)}{2}\hat{v}^{eI}(r_i,\tilde{r}_\ell) \nonumber\\
&\qquad + \sum_{\ell< m}\frac{\delta(r-\tilde{r}_\ell)+\delta(r-\tilde{r}_m)}{2}\hat{v}^{II}(\tilde{r}_\ell,\tilde{r}_m).\nonumber
\end{align}
Here $r_i$ and $\tilde{r}_\ell$ represent electon and ion positions, respectively, $\hat{p}_i$ is a single electron momentum operator, and $\hat{v}^{ee}(r_i,r_j)$, $\hat{v}^{eI}(r_i,\tilde{r}_\ell)$, $\hat{v}^{II}(\tilde{r}_\ell,\tilde{r}_m)$ are the electron-electron, electron-ion, and ion-ion pair potential operators (including non-local pseudopotentials, if present). This form of the energy density is size consistent, \textit{i.e.} the partially integrated energy density operators of well separated atoms gives the isolated Hamiltonians of the respective atoms. For periodic systems with twist averaged boundary conditions, the energy density is formally correct only for either a set of supercell k-points that correspond to real valued wavefunctions, or a k-point set that has inversion symmetry around a k-point having a real valued wavefunction. For more information about the energy density, see Ref. \cite{Krogel2013}.
In \qmcpack, the energy density can be accumulated on piecewise uniform three dimensional grids in generalized cartesian, cylindrical, or spherical coordinates. The energy density integrated within Voronoi volumes centered on ion positions is also available. The total particle number density is also accumulated on the same grids by the energy density estimator for convenience so that related quantities, such as the regional energy per particle, can be computed easily.
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{estimator type=EnergyDensity} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\texttt{reference\_points, spacegrid}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & \textbf{EnergyDensity} & & Must be EnergyDensity \\
& \texttt{name}$^r$ & text & \textit{anything} & & Unique name for estimator \\
& \texttt{dynamic}$^r$ & text & \texttt{particleset.name} & & Identify electrons \\
& \texttt{static}$^o$ & text & \texttt{particleset.name} & & Identify ions \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information:
\begin{itemize}
\item{\texttt{name:} Must be unique. A dataset with blocked statistical data for the energy density will appear in the \texttt{stat.h5} files labeled as \texttt{name}.}
\end{itemize}
\begin{lstlisting}[caption=Energy density estimator accumulated on a 20x10x10 grid over the simulation cell.]
<estimator type="EnergyDensity" name="EDcell" dynamic="e" static="ion0">
<spacegrid coord="cartesian">
<origin p1="zero"/>
<axis p1="a1" scale=".5" label="x" grid="-1 (.05) 1"/>
<axis p1="a2" scale=".5" label="y" grid="-1 (.1) 1"/>
<axis p1="a3" scale=".5" label="z" grid="-1 (.1) 1"/>
</spacegrid>
</estimator>
\end{lstlisting}
\begin{lstlisting}[caption=Energy density estimator accumulated within spheres of radius 6.9 Bohr centered on the first and second atoms in the ion0 particleset.]
<estimator type="EnergyDensity" name="EDatom" dynamic="e" static="ion0">
<reference_points coord="cartesian">
r1 1 0 0
r2 0 1 0
r3 0 0 1
</reference_points>
<spacegrid coord="spherical">
<origin p1="ion01"/>
<axis p1="r1" scale="6.9" label="r" grid="0 1"/>
<axis p1="r2" scale="6.9" label="phi" grid="0 1"/>
<axis p1="r3" scale="6.9" label="theta" grid="0 1"/>
</spacegrid>
<spacegrid coord="spherical">
<origin p1="ion02"/>
<axis p1="r1" scale="6.9" label="r" grid="0 1"/>
<axis p1="r2" scale="6.9" label="phi" grid="0 1"/>
<axis p1="r3" scale="6.9" label="theta" grid="0 1"/>
</spacegrid>
</estimator>
\end{lstlisting}
\begin{lstlisting}[caption=Energy density estimator accumulated within Voronoi polyhedra centered on the ions.]
<estimator type="EnergyDensity" name="EDvoronoi" dynamic="e" static="ion0">
<spacegrid coord="voronoi"/>
</estimator>
\end{lstlisting}
The \texttt{<reference\_points/>} element provides a set of points for later use in specifying the origin and coordinate axes needed to construct a spatial histogramming grid. Several reference points on the surface of the simulation cell (see Table \ref{tab:ref_points}) as well as the positions of the ions (see the \texttt{energydensity.static} attribute) are made available by default. The reference points can be used, for example, to construct a cylindrical grid along a bond with the origin on the bond center.
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{reference\_points} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{estimator type=EnergyDensity}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{coord}$^r$ & text & cartesian/cell & & Specify coordinate system \\
\multicolumn{2}{l}{body text} & \multicolumn{4}{l}{}\\
& & \multicolumn{4}{l}{The body text is a line formatted list of points with labels} \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information
\begin{itemize}
\item{\textbf{coord:} If \texttt{coord=cartesian}, labeled points are in cartesian (x,y,z) format in units of Bohr. If \texttt{coord=cell}, then labeled points are in units of the simulation cell axes.}
\item{\textbf{body text:} The list of points provided in the body text are line formatted, with four entries per line (\textit{label} \textit{coor1} \textit{coor2} \textit{coor3}}). A set of points referenced to the simulation cell are available by default (see table \ref{tab:ref_points}). If \texttt{energydensity.static} is provided, the location of each individual ion is also available (\textit{e.g.} if \texttt{energydensity.static=ion0}, then the location of the first atom is available with label ion01, the second with ion02, etc.). All points can be used by label when constructing spatial histogramming grids (see the \texttt{spacegrid} element below) used to collect energy densities.
\end{itemize}
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabular}{l l l}
\hline
\texttt{label} & \texttt{point} & \texttt{description} \\
\hline
\texttt{zero} & 0 0 0 & Cell center \\
\texttt{a1} & $a_1$ & Cell axis 1 \\
\texttt{a2} & $a_2$ & Cell axis 2 \\
\texttt{a3} & $a_3$ & Cell axis 3 \\
\texttt{f1p} & $a_1$/2 & Cell face 1+ \\
\texttt{f1m} & -$a_1$/2 & Cell face 1- \\
\texttt{f2p} & $a_2$/2 & Cell face 2+ \\
\texttt{f2m} & -$a_2$/2 & Cell face 2- \\
\texttt{f3p} & $a_3$/2 & Cell face 3+ \\
\texttt{f3m} & -$a_3$/2 & Cell face 3- \\
\texttt{cppp} & $(a_1+a_2+a_3)/2$ & Cell corner +,+,+ \\
\texttt{cppm} & $(a_1+a_2-a_3)/2$ & Cell corner +,+,- \\
\texttt{cpmp} & $(a_1-a_2+a_3)/2$ & Cell corner +,-,+ \\
\texttt{cmpp} & $(-a_1+a_2+a_3)/2$ & Cell corner -,+,+ \\
\texttt{cpmm} & $(a_1-a_2-a_3)/2$ & Cell corner +,-,- \\
\texttt{cmpm} & $(-a_1+a_2-a_3)/2$ & Cell corner -,+,- \\
\texttt{cmmp} & $(-a_1-a_2+a_3)/2$ & Cell corner -,-,+ \\
\texttt{cmmm} & $(-a_1-a_2-a_3)/2$ & Cell corner -,-,- \\
\hline
\end{tabular}
\end{center}
\caption{Reference points available by default. The vectors $a_1$, $a_2$, and $a_3$ refer to the simulation cell axes. The representation of the cell is centered around \texttt{zero}. \label{tab:ref_points}}
\end{table}
\FloatBarrier
The \texttt{<spacegrid/>} element is used to specify a spatial histogramming grid for the energy density. Grids are constructed based on a set of, potentially non-orthogonal, user provided coordinate axes. The axes are based on information available from \texttt{reference\_points}. Voronoi grids are based only on nearest neighbor distances between electrons and ions. Any number of space grids can be provided to a single energy density estimator.
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{spacegrid} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{estimator type=EnergyDensity}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\texttt{origin, axis}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{coord}$^r$ & text & cartesian & & Specify coordinate system \\
& & & cylindrical & & \\
& & & spherical & & \\
& & & voronoi & & \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
The \texttt{<origin/>} element gives the location of the origin for a non-Voronoi grid.
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{origin} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{spacegrid}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{p1}$^r$ & text & \texttt{reference\_point.label} & & Select end point \\
& \texttt{p2}$^o$ & text & \texttt{reference\_point.label} & & Select end point \\
& \texttt{fraction}$^o$& real & & 0 & Interpolation fraction \\
\hline
\end{tabularx}
\end{center}
\end{table}
Additional information:
\begin{itemize}
\item{\textbf{p1/p2/fraction:} The location of the origin is set to \texttt{p1+fraction*(p2-p1)}. If only \texttt{p1} is provided, the origin is at \texttt{p1}.}
\end{itemize}
\FloatBarrier
The \texttt{<axis/>} element represents a coordinate axis used to construct the, possibly curved, coordinate system for the histogramming grid. Three \texttt{<axis/>} elements must be provided to a non-Voronoi \texttt{<spacegrid/>} element.
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{axis} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{spacegrid}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{label}$^r$ & text & \textit{See below}& & Axis/dimension label \\
& \texttt{grid}$^r$ & text & & "0 1" & Grid ranges/intervals \\
& \texttt{p1}$^r$ & text & \texttt{reference\_point.label} & & Select end point \\
& \texttt{p2}$^o$ & text & \texttt{reference\_point.label} & & Select end point \\
& \texttt{scale}$^o$ & real & & & Interpolation fraction\\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information:
\begin{itemize}
\item{\textbf{label:} The allowed set of axis labels depends on the coordinate system (\textit{i.e.} \texttt{spacegrid.coord}). Labels are \texttt{x/y/z} for \texttt{coord=cartesian}, \texttt{r/phi/z} for \texttt{coord=cylindrical}, \texttt{r/phi/theta} for \texttt{coord=spherical}.}
\item{\textbf{p1/p2/scale:} The axis vector is set to \texttt{p1+scale*(p2-p1)}. If only \texttt{p1} is provided, the axis vector is \texttt{p1}.}
\item{\textbf{grid:} Specifies the histogram grid along the direction specified by \texttt{label}. The allowed grid points fall in the range [-1,1] for \texttt{label=x/y/z} or [0,1] for \texttt{r/phi/theta}. A grid of 10 evenly spaced points between 0 and 1 can be requested equivalently by \texttt{grid="0 (0.1) 1"} or \texttt{grid="0 (10) 1"}. Piecewise uniform grids covering portions of the range are supported, \textit{e.g.} \texttt{grid="-0.7 (10) 0.0 (20) 0.5"}. }
\item{Note that \texttt{grid} specifies the histogram grid along the (curved) coordinate given by \texttt{label}. The axis specified by \texttt{p1/p2/scale} does not correspond one-to-one with \texttt{label} unless \texttt{label=x/y/z}, but the full set of axes provided define the (sheared) space on top of which the curved (\textit{e.g.} spherical) coordinate system is built. }
\end{itemize}
\subsection{One body density matrix}
The N-body density matrix in DMC is $\hat{\rho}_N=\operator{\Psi_{T}}{}{\Psi_{FN}}$ (for VMC, substitute $\Psi_T$ for $\Psi_{FN}$). The one body reduced density matrix (1RDM) is obtained by tracing out all particle coordinates but one:
\begin{align}
\hat{n}_1 &= \sum_nTr_{R_n}\operator{\Psi_{T}}{}{\Psi_{FN}}
\end{align}
In the formula above, the sum is over all electron indices and $Tr_{R_n}(*)\equiv\int dR_n\expval{R_n}{*}{R_n}$ with $R_n=[r_1,...,r_{n-1},r_{n+1},...,r_N]$. When the sum is restricted over spin up or down electrons, one obtains a density matrix for each spin species. The 1RDM computed by \qmcpack is partitioned in this way.
In real space, the matrix elements of the 1RDM are
\begin{align}
n_1(r,r') &= \expval{r}{\hat{n}_1}{r'} = \sum_n\int dR_n \Psi_T(r,R_n)\Psi_{FN}^*(r',R_n)
\end{align}
A more efficient and compact representation of the 1RDM is obtained by expanding in the single particle orbitals obtained from a Hartree-Fock or DFT calculation, $\{\phi_i\}$:
\begin{align}\label{eq:dm1b_direct}
n_1(i,j) &= \expval{\phi_i}{\hat{n}_1}{\phi_j} \nonumber \\
&= \int dR \Psi_{FN}^*(R)\Psi_{T}(R) \sum_n\int dr'_n \frac{\Psi_T(r_n',R_n)}{\Psi_T(r_n,R_n)}\phi_i(r_n')^* \phi_j(r_n)
\end{align}
The integration over $r'$ in Eq. \ref{eq:dm1b_direct} is inefficient when one is also interested in obtaining matrices involving energetic quantities, such as the energy density matrix of Ref. \cite{Krogel2014} or the related (and more well known) Generalized Fock matrix. For this reason, an approximation is introduced as follows:
\begin{align}
n_1(i,j) \approx \int dR \Psi_{FN}(R)^*\Psi_T(R) \sum_n \int dr_n' \frac{\Psi_T(r_n',R_n)^*}{\Psi_T(r_n,R_n)^*}\phi_i(r_n)^* \phi_j(r_n')
\end{align}
For VMC, FN-DMC, FP-DMC, and RN-DMC the formula above represents an exact sampling of the 1RDM corresponding to $\hat{\rho}_N^\dagger$ (see appendix A of Ref. \cite{Krogel2014} for more detail).
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{estimator type=dm1b} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{none}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & \textbf{dm1b} & & Must be dm1b \\
& \texttt{name}$^r$ & text & \textit{anything}& & Unique name for estimator \\
\multicolumn{2}{l}{parameters} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
&\texttt{basis}$^r$ & text array & sposet.name(s) & & Orbital basis \\
&\texttt{integrator}$^o$ & text & uniform\_grid & uniform\_grid & Integration method \\
& & & uniform & & \\
& & & density & & \\
&\texttt{evaluator}$^o$ & text & loop/matrix & loop & Evaluation method \\
&\texttt{scale}$^o$ & real & $0<scale<1$ & 1.0 & Scale integration cell\\
&\texttt{center}$^o$ & real array(3)&\textit{any point}& & Center of cell \\
&\texttt{points}$^o$ & integer & $>0$ & 10 & Grid points in each dim\\
&\texttt{samples}$^o$ & integer & $>0$ & 10 & MC samples \\
&\texttt{warmup}$^o$ & integer & $>0$ & 30 & MC warmup \\
&\texttt{timestep}$^o$ & real & $>0$ & 0.5 & MC time step \\
&\texttt{use\_drift}$^o$ & boolean & yes/no & no & Use drift in VMC \\
&\texttt{check\_overlap}$^o$& boolean & yes/no & no & Print overlap matrix \\
&\texttt{check\_derivatives}$^o$& boolean & yes/no & no & Check density derivatives \\
&\texttt{acceptance\_ratio}$^o$& boolean & yes/no & no & Print accept ratio \\
&\texttt{rstats}$^o$ & boolean & yes/no & no & Print spatial stats \\
&\texttt{normalized}$^o$ & boolean & yes/no & no & \texttt{basis} comes norm'ed \\
&\texttt{energy\_matrix}$^o$& boolean & yes/no & no & Energy density matrix \\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information
\begin{itemize}
\item{\texttt{name:} Density matrix results appear in \texttt{stat.h5} files labeled according to \texttt{name}.}
\item{\texttt{basis:} List of \texttt{sposet.name}'s. The total set of orbitals contained in all \texttt{sposet}'s comprises the basis (subspace) the one body density matrix is projected onto. This set of orbitals generally includes many virtual orbitals that are not occupied in a single reference Slater determinant.}
\item{\texttt{integrator:} This selects the method used to perform the additional single particle integration. Options are \texttt{uniform\_grid} (uniform grid of points over the cell), \texttt{uniform} (uniform random sampling over the cell), and \texttt{density} (Metropolis sampling of approximate density: $\sum_{b\in \texttt{basis}}\abs{\phi_b}^2$, not well tested, please check results carefully!)}. Depending on the integrator selected, different subsets of the other input parameters are active.
\item{\texttt{evaluator:} Select for-loop or matrix multiply implementations. Matrix is preferred for speed. Both implementations should give the same results, but please check as this has not been exhaustively tested.}
\item{\texttt{scale:} Resize the simulation cell by scale for use as an integration volume (active for \texttt{integrator=uniform/uniform\_grid}).}
\item{\texttt{center:} Translate the integration volume to center at this point (active for \texttt{integrator=uniform/uniform\_grid}). If \texttt{center} is not provided, the scaled simulation cell is used as is. }
\item{\texttt{points:} The number of grid points in each dimension for \texttt{integrator=uniform\_grid}. For example, \texttt{points=10} results in a uniform 10x10x10 grid over the cell.}
\item{\texttt{samples:} Sets the number of Monte Carlo samples collected each step (active for \texttt{integrator=uniform/density}). }
\item{\texttt{warmup:} Number of warmup Metropolis steps at the start of the run, prior to data collection (active for \texttt{integrator=density}). }
\item{\texttt{timestep:} Drift-diffusion timestep used in Metropolis sampling (active for \texttt{integrator=density}).}
\item{\texttt{use\_drift:} Enable drift in Metropolis sampling (active for \texttt{integrator=density}).}
\item{\texttt{check\_overlap:} Print the overlap matrix (computed via simple Riemann sums) to the log and then abort. Note that subsequent analysis based on the 1RDM is simplest if the input orbitals are orthogonal.}
\item{\texttt{check\_derivatives:} Print analytic and numerical derivatives of the approximate (sampled) density for several sample points, then abort. }
\item{\texttt{acceptance\_ratio:} Print the acceptance ratio of the density sampling to the log each step.}
\item{\texttt{rstats:} Print statistical information about the spatial motion of the sampled points to the log each step.}
\item{\texttt{normalized:} Declare whether the inputted orbitals are normalized or not. If \texttt{normalized=no}, direct Riemann integration over a 200x200x200 grid will be used to compute the normalizations prior to use.}
\item{\texttt{energy\_matrix:} Also accumulate the one body reduced energy density matrix and write it to \texttt{stat.h5}. This matrix is not covered in any detail here; the interested reader is referred to Ref. \cite{Krogel2014}.}
\end{itemize}
\begin{lstlisting}[caption=One body density matrix with uniform grid integration.]
<estimator type="dm1b" name="DensityMatrices">
<parameter name="basis" > spo_u spo_uv </parameter>
<parameter name="evaluator" > matrix </parameter>
<parameter name="integrator" > uniform_grid </parameter>
<parameter name="points" > 4 </parameter>
<parameter name="scale" > 1.0 </parameter>
<parameter name="center" > 0 0 0 </parameter>
</estimator>
\end{lstlisting}
\begin{lstlisting}[caption=One body density matrix with uniform sampling.]
<estimator type="dm1b" name="DensityMatrices">
<parameter name="basis" > spo_u spo_uv </parameter>
<parameter name="evaluator" > matrix </parameter>
<parameter name="integrator" > uniform </parameter>
<parameter name="samples" > 64 </parameter>
<parameter name="scale" > 1.0 </parameter>
<parameter name="center" > 0 0 0 </parameter>
</estimator>
\end{lstlisting}
\begin{lstlisting}[caption=One body density matrix with density sampling.]
<estimator type="dm1b" name="DensityMatrices">
<parameter name="basis" > spo_u spo_uv </parameter>
<parameter name="evaluator" > matrix </parameter>
<parameter name="integrator" > density </parameter>
<parameter name="samples" > 64 </parameter>
<parameter name="timestep" > 0.5 </parameter>
<parameter name="use_drift" > no </parameter>
</estimator>
\end{lstlisting}
\begin{lstlisting}[caption={Example sposet initialization for density matrix use. Occupied and virtual orbital sets are created separately, then joined (\texttt{basis="spo\_u spo\_uv"}).}]
<sposet_builder type="bspline" href="../dft/pwscf_output/pwscf.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" meshfactor="1.0" gpu="no" precision="single">
<sposet type="bspline" name="spo_u" group="0" size="4"/>
<sposet type="bspline" name="spo_d" group="0" size="2"/>
<sposet type="bspline" name="spo_uv" group="0" index_min="4" index_max="10"/>
</sposet_builder>
\end{lstlisting}
\begin{lstlisting}[caption={Example sposet initialization for density matrix use. Density matrix orbital basis created separately (\texttt{basis="dm\_basis"}).}]
<sposet_builder type="bspline" href="../dft/pwscf_output/pwscf.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" meshfactor="1.0" gpu="no" precision="single">
<sposet type="bspline" name="spo_u" group="0" size="4"/>
<sposet type="bspline" name="spo_d" group="0" size="2"/>
<sposet type="bspline" name="dm_basis" size="50" spindataset="0"/>
</sposet_builder>
\end{lstlisting}
% <estimator type="dm1b" name="DensityMatrices">
% <parameter name="energy_matrix" > yes </parameter>
% <parameter name="integrator" > uniform_grid </parameter>
% <parameter name="points" > 6 </parameter>
% <parameter name="scale" > 1.0 </parameter>
% <parameter name="basis" >
% spo_dm
% </parameter>
% <parameter name="evaluator" > matrix </parameter>
% <parameter name="center">
% 0 0 0
% </parameter>
% <parameter name="check_overlap" > no </parameter>
% </estimator>
%
% <sposet_builder type="bspline" href="./dft/pwscf_output/pwscf.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" meshfactor="1.0" gpu="no" precision="single" sort="0">
% <sposet type="bspline" name="spo_u" size="4" spindataset="0"/>
% <sposet type="bspline" name="spo_d" size="2" spindataset="1"/>
% <sposet type="bspline" name="dm_basis" size="50" spindataset="0"/>
% </sposet_builder>
% <estimator type="dm1b" name="DensityMatrices">
% <parameter name="energy_matrix" > yes </parameter>
% <parameter name="integrator" > uniform_grid </parameter>
% <parameter name="points" > 10 </parameter>
% <parameter name="scale" > 1.0 </parameter>
% <parameter name="basis" > dm_basis </parameter>
% <parameter name="normalized" > no </parameter>
% <parameter name="evaluator" > matrix </parameter>
% <parameter name="center" > 0 0 0 </parameter>
% <parameter name="check_overlap" > no </parameter>
% <parameter name="rstats" > no </parameter>
% </estimator>
%
%
% found at /psi2/home/development/qmcpack/energy_density_matrix/tests/r6080_edm/02_atoms/runs/O/qmc/vmc.in.xml
%
% <sposet_builder type="bspline" href="../dft/pwscf_output/pwscf.pwscf.h5" tilematrix="1 0 0 0 1 0 0 0 1" twistnum="0" meshfactor="1.0" gpu="no" precision="single">
% <sposet type="bspline" name="spo_u" group="0" size="4"/>
% <sposet type="bspline" name="spo_d" group="0" size="2"/>
% <sposet type="bspline" name="spo_uv" group="0" index_min="4" index_max="10"/>
% </sposet_builder>
% <estimator type="dm1b" name="DensityMatrices">
% <parameter name="basis" > spo_u spo_uv </parameter>
% <parameter name="energy_matrix"> yes </parameter>
% <parameter name="evaluator" > matrix </parameter>
% <parameter name="center" > 0 0 0 </parameter>
% <parameter name="rstats" > no </parameter>
% <parameter name="acceptance_ratio" > no </parameter>
% <parameter name="check_overlap" > no </parameter>
% <parameter name="check_derivatives"> no </parameter>
%
% <parameter name="integrator" > uniform_grid </parameter>
% <parameter name="points" > 20 </parameter>
% <parameter name="scale" > 1.0 </parameter>
%
% <!--
% <parameter name="integrator" > uniform </parameter>
% <parameter name="samples" > 14 </parameter>
% <parameter name="scale" > 1.0 </parameter>
% -->
%
% <!--
% <parameter name="integrator" > density </parameter>
% <parameter name="timestep" > 1.0 </parameter>
% <parameter name="use_drift" > no </parameter>
% <parameter name="samples" > 1000 </parameter>
% -->
%
% <!--
% <parameter name="integrator" > density </parameter>
% <parameter name="timestep" > 1.0 </parameter>
% <parameter name="use_drift" > yes </parameter>
% <parameter name="samples" > 1000 </parameter>
% -->
% </estimator>
\section{Forward Walking Estimators} \label{sec:forward_walking}
Forward walking is a method by which one can sample the pure fixed-node distribution $\langle \Phi_0 | \Phi_0\rangle$. Specifically, one multiplies each walker's DMC mixed estimate for the observable $\mathcal{O}$, $\frac{\mathcal{O}(\mathbf{R})\Psi_T(\mathbf{R})}{\Psi_T(\mathbf{R})}$, by the weighting factor $\frac{\Phi_0(\mathbf{R})}{\Psi_T(\mathbf{R})}$. As it turns out, this weighting factor for any walker $\mathbf{R}$ is proportional to the total number of descendants the walker will have after a sufficiently long projection time $\beta$.
To forward walk on an observable, one declares a generic forward walking estimator within a \texttt{<hamiltonian>} block, and then specifies the observables to forward walk on and forward walking parameters. Here is a summary.
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{estimator type=ForwardWalking} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\texttt{Observable}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type}$^r$ & text & \textbf{ForwardWalking}& & Must be ``ForwardWalking" \\
& \texttt{name}$^r$ & text & \textit{anything} & any & Unique name for estimator \\
\hline
\end{tabularx}
\end{center}
\end{table}
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{Observable} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{estimator, hamiltonian, qmc}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\textit{None}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{name}$^r$ & text & \textit{anything} & any & Registered name of existing estimator on which to forward walk. \\
& \texttt{max}$^r$ & integer & $ > 0$ & & The maximum projection time in steps (\texttt{max}$=\beta/\tau$). \\
& \texttt{frequency}$^r$ & text & $\geq 1$ & & Dump data only for every \texttt{frequency}-th \\
& & & & & to \texttt{scalar.dat} file \\
\hline
\end{tabularx}
\end{center}
\end{table}
Additional information:
\begin{itemize}
\item{\textbf{Cost}: Due to having to store histories of observables up to \texttt{max} time-steps, one should multiply the memory cost of storing the non-forward walked observables variables by $\texttt{max}$. Not an issue for things like the potential energy, but can be prohibitive for observables like density, forces, etc. }
\item{\textbf{Naming Convention}: Forward walked observables are automatically named \texttt{FWE\_name\_i}, where \texttt{i} is the forward walked expectation value at time step \texttt{i}, and \texttt{name} is whatever name appears in the \texttt{<Observable>} block. This is also how it will appear in the \texttt{scalar.dat} file. }
\end{itemize}
In the following example case, QMCPACK forward walks on the potential energy for 300 time steps, and dumps the forward walked value at every time step.
\begin{lstlisting}[caption=Forward walking estimator element.]
<estimator name="fw" type="ForwardWalking">
<Observable name="LocalPotential" max="300" frequency="1"/>
<!--- Additional Observable blocks go here -->
</estimator>
\end{lstlisting}
\section{``Force'' estimators} \label{sec:force_est}
% Force estimators added in CoulombPotentialFactory.cpp, HamiltonianFactory::addForceHam
QMCPACK supports force estimation by use of the Chiesa-Ceperly-Zhang (CCZ) estimator. Currently, open and periodic boundary conditions are supported, but for all-electron calculations only.
Without loss of generality, the CCZ estimator for the z-component of the force on an ion centered at the origin is given by the following expression:
\begin{equation}
F_z = -Z \sum_{i=1}^{N_e}\frac{z_i}{r_i^3}[\theta(r_i-\mathcal{R}) + \theta(\mathcal{R}-r_i)\sum_{\ell=1}^{M}c_\ell r_i^\ell]
\end{equation}
Z is the ionic charge, $M$ is the degree of the smoothing polynomial, $\mathcal{R}$ is a real-space cutoff of the sphere within which the bare-force estimator is smoothed, and $c_\ell$ are predetermined coefficients. These coefficients are chosen to minimize the weighted mean square error between the bare force estimate and the s-wave filtered estimator. Specifically,
\begin{equation}
\chi^2 = \int_0^\mathcal{R}dr\,r^m\,[f_z(r) - \tilde{f}_z(r)]^2
\end{equation}
Here, $m$ is the weighting exponent, $f_z(r)$ is the unfiltered radial force density for the z force component, and $\tilde{f}_z(r)$ smoothed polynomial function for the same force density. The reader is invited to refer to the original paper for a more thorough explanation of the methodology, but with the notation in hand, QMCPACK takes the following parameters.
\FloatBarrier
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{estimator type=Force} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{hamiltonian, qmc}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\texttt{parameter}}\\
\multicolumn{2}{l}{attributes} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{mode}$^o$ & text & \textit{See above} & bare & Select estimator type\\
& \texttt{type}$^r$ & text & Force & & Must be ``Force" \\
& \texttt{name}$^o$ & text & \textit{anything} & ForceBase & Unique name for this estimator\\
% & \texttt{psi}$^o$ & text & \texttt{wavefunction.name}& psi0 & Identify wavefunction\\
& \texttt{pbc}$^o$ & boolean & yes/no & yes & Using periodic BC's or not\\
& \texttt{addionion}$^o$ & boolean & yes/no & no & Add the ion-ion force contribution to output force estimate. \\
\multicolumn{2}{l}{parameters} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{rcut}$^o$ & real & $> 0$ & 1.0 & Real space cutoff $\mathcal{R}$ in bohr.\\
& \texttt{nbasis}$^o$ & integer & $> 0 $ & 2 & Degree of smoothing polynomial $M$ \\
& \texttt{weightexp}$^o$ & integer &$ > 0$ & 2 & $\chi^2$ weighting exponent $m$.\\
\hline
\end{tabularx}
\end{center}
\end{table}
\FloatBarrier
Additional information:
\begin{itemize}
\item{\textbf{Naming Convention}: The unique identifier \texttt{name} is appended with \texttt{name\_X\_Y} in the \texttt{scalar.dat} file, where \texttt{X} is the ion ID number, and \texttt{Y} is the component ID (an integer with x=0, y=1, z=2). All force components for all ions are computed and dumped to the \texttt{scalar.dat} file.}
\item{\textbf{Miscellaneous}: Usually, the default choice of \texttt{weightexp} is sufficient. Different combinations of \texttt{rcut} and \texttt{nbasis} should be tested though to minimize variance and bias. There is of course a tradeoff, with larger \texttt{nbasis} and smaller \texttt{rcut} leading to smaller biases and larger variances. }
\end{itemize}
The following is an example use case.
\begin{lstlisting}
<estimator name="myforce" type="Force" mode="cep" addionion="yes">
<parameter name="rcut">0.1</parameter>
<parameter name="nbasis">4</parameter>
<parameter name="weightexp">2</parameter>
</estimator>
\end{lstlisting}