qmcpack/manual/spo_spline.tex

111 lines
6.4 KiB
TeX

\subsection{Spline basis sets}
In this section we describe the use of spline basis sets to expand the \texttt{sposet}.
Spline basis sets are designed to work seamless with plane wave DFT code, e.g.\ Quantum ESPRESSO as a trial wavefunction generator.
In QMC algorithms, all the SPOs $\{\phi(\vec{r})\}$ need to be updated every time a single electron moves.
Evaluating SPOs takes very large portion of computation time.
In principle, PW basis set can be used to express SPOs directly in QMC like in DFT.
but it introduces an unfavorable scaling due to the fact
that the basis set size increases linearly as the system size.
For this reason, it is efficient to use a localized basis with compact
support and a good transferability from plane wave basis.
In particular, 3D tricubic B-splines provide a basis in which only
64 elements are nonzero at any given point in space~\cite{blips4QMC}.
The one-dimensional cubic B-spline is given by,
\begin{equation}
f(x) = \sum_{i'=i-1}^{i+2} b^{i'\!,3}(x)\,\, p_{i'},
\label{eq:SplineFunc}
\end{equation}
where $b^{i}(x)$ are the piecewise cubic polynomial basis functions
and $i = \text{floor}(\Delta^{-1} x)$ is the index of
the first grid point $\le x$. Constructing a tensor product in each Cartesian
direction, we can represent a 3D orbital as
\begin{equation}
\phi_n(x,y,z) =
\!\!\!\!\sum_{i'=i-1}^{i+2} \!\! b_x^{i'\!,3}(x)
\!\!\!\!\sum_{j'=j-1}^{j+2} \!\! b_y^{j'\!,3}(y)
\!\!\!\!\sum_{k'=k-1}^{k+2} \!\! b_z^{k'\!,3}(z) \,\, p_{i', j', k',n}.
\label{eq:TricubicValue}
\end{equation}
This allows the rapid evaluation of each orbital in constant time.
Furthermore, this basis is systematically improvable with a single spacing
parameter, so that accuracy is not compromised compared with plane wave basis.
The use of 3D tricubic B-splines greatly improves the computational efficiency.
The gain in computation time from plane wave basis set to an equivalent B-spline basis set
becomes increasingly large as the system size grows.
On the downside, this computational efficiency comes at
the expense of increased memory use, which is easily overcome by the large
aggregate memory available per node through OpenMP/MPI hybrid QMC.
The input xml block for the spline SPOs is give in Listing~\ref{listing:splineSPOs}. A list of options is given in
Table~\ref{table:splineSPOs}. \texttt{QMCPACK} has a very useful command line option \texttt{--save\_wfs} which allows to dump
the real space B-spline coefficient table into a h5 file on the disk.
When the orbital transformation from k space to B-spline requires more than available amount of scratch memory on the compute nodes,
users can perform this step on fat nodes and transfer back the h5 file for QMC calculations.
\begin{table}[h]
\begin{center}
\begin{tabularx}{\textwidth}{l l l l l l }
\hline
\multicolumn{6}{l}{\texttt{determinantset} element} \\
\hline
\multicolumn{2}{l}{parent elements:} & \multicolumn{4}{l}{\texttt{wavefunction}}\\
\multicolumn{2}{l}{child elements:} & \multicolumn{4}{l}{\texttt{slaterdeterminant}}\\
\multicolumn{2}{l}{attribute :} & \multicolumn{4}{l}{}\\
& \bfseries name & \bfseries datatype & \bfseries values & \bfseries default & \bfseries description \\
& \texttt{type} & text & bspline & & Type of \texttt{sposet}. \\
& \texttt{href} & text & & & Path to the h5 file generated by pw2qmcpack.x. \\
& \texttt{tilematrix} & 9 integers & & & Tiling matrix used to expand supercell. \\
& \texttt{twistnum} & integer & & & Index of the super twist. \\
& \texttt{twist} & 3 floats & & & Super twist. \\
& \texttt{meshfactor} & float & $\le 1.0$ & & Grid spacing ratio. \\
& \texttt{precision} & text & single/double & & Precision of spline coefficients. \\
& \texttt{gpu} & text & yes/no & & GPU switch. \\
& \texttt{source} & text & \textit{any} & ion0 & Particle set with the position of atom centers. \\
\hline
\end{tabularx}
\end{center}
\caption{Options for the \texttt{determinantset} xml-block associated with B-spline single particle orbital sets.}
\label{table:splineSPOs}
\end{table}
%%\begin{lstlisting}[caption=.]
%%<sposet_builder type="bspline" href="pwscf.h5" tilematrix="2 0 0 0 2 0 0 0 2" twistnum="0"
%% source="i" meshfactor="1.0" precision="float" truncate="no">
%% <sposet type="bspline" name="spo_ud" size="208" spindataset="0"/>
%%</sposet_builder>
%%<determinantset>
%% <slaterdeterminant>
%% <determinant id="updet" group="u" sposet="spo_ud" size="208"/>
%% <determinant id="downdet" group="d" sposet="spo_ud" size="208"/>
%% </slaterdeterminant>
%%</determinantset>
%%\end{lstlisting}
\begin{lstlisting}[caption=All electron Hamiltonian XML element.\label{listing:splineSPOs}]
<determinantset type="bspline" source="i" href="pwscf.h5"
tilematrix="1 1 3 1 2 -1 -2 1 0" twistnum="-1" gpu="yes" meshfactor="0.8"
twist="0 0 0" precision="double">
<slaterdeterminant>
<determinant id="updet" size="208">
<occupation mode="ground" spindataset="0">
</occupation>
</determinant>
<determinant id="downdet" size="208">
<occupation mode="ground" spindataset="0">
</occupation>
</determinant>
</slaterdeterminant>
</determinantset>
\end{lstlisting}
Additional information:
\begin{itemize}
\item \texttt{precision}. Using single precision not only saves memory usage but also speeds up the B-spline evaluation. It is recommended to use single precision since we saw little chance of really compromising the accuracy of calculation.
\item \texttt{meshfactor}. It is the ratio of actual grid spacing of B-splines used in QMC calculation with respect to the original one calculated from h5. Smaller meshfactor saves memory usage but reduces accuracy. The effects are similar to reducing plane wave cutoff in DFT calculation. Use with caution!
\item \texttt{twistnum}. If positive, it is the index. It is recommended not to take this way since the indexing may show some uncertainty. If negative, the super twist is referred by \texttt{twist}.
\end{itemize}
\label{sec:splinebasis}