1.. _hamiltobs:
2
3Hamiltonian and Observables
4===========================
5
6QMCPACK 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 projector) generates the imaginary time dynamics of the walkers in DMC and reptation Monte Carlo (RMC).
7
8This 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, static structure factor, and forces.
9
10The Hamiltonian
11---------------
12
13The many-body Hamiltonian in Hartree units is given by
14
15.. math::
16  :label: eq28
17
18  \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)\:.
19
20Here, the sums indexed by :math:`i/j` are over quantum particles, while
21:math:`\ell/m` are reserved for classical particles. Often the quantum
22particles are electrons, and the classical particles are ions, though is
23not limited in this way. The mass of each quantum particle is denoted
24:math:`m_i`, :math:`v^{qq}/v^{qc}/v^{cc}` are pair potentials between
25quantum-quantum/quantum-classical/classical-classical particles, and
26:math:`v^{ext}` denotes a purely external potential.
27
28QMCPACK is designed modularly so that any potential can be supported with
29minimal additions to the code base. Potentials currently supported
30include Coulomb interactions in open and periodic boundary conditions,
31the MPC potential, nonlocal pseudopotentials, helium pair potentials,
32and various model potentials such as hard sphere, Gaussian, and modified
33Poschl-Teller.
34
35Reference information and examples for the ``<hamiltonian/>`` XML
36element are provided subsequently. Detailed descriptions of the input
37for individual potentials is given in the sections that follow.
38
39``hamiltonian`` element:
40
41  +------------------+----------------------------------------------------+
42  | parent elements: | ``simulation, qmcsystem``                          |
43  +------------------+----------------------------------------------------+
44  | child elements:  | ``pairpot extpot estimator constant`` (deprecated) |
45  +------------------+----------------------------------------------------+
46
47attributes:
48
49  +------------------------+--------------+----------------------+-------------+------------------------------------------+
50  | **Name**               | **Datatype** | **Values**           | **Default** | **Description**                          |
51  +========================+==============+======================+=============+==========================================+
52  | ``name/id``:math:`^o`  | text         | *anything*           | h0          | Unique id for this Hamiltonian instance  |
53  +------------------------+--------------+----------------------+-------------+------------------------------------------+
54  | ``type``:math:`^o`     | text         |                      | generic     | *No current function*                    |
55  +------------------------+--------------+----------------------+-------------+------------------------------------------+
56  | ``role``:math:`^o`     | text         | primary/extra        | extra       | Designate as Hamiltonian or not          |
57  +------------------------+--------------+----------------------+-------------+------------------------------------------+
58  | ``source``:math:`^o`   | text         | ``particleset.name`` | i           | Identify classical ``particleset``       |
59  +------------------------+--------------+----------------------+-------------+------------------------------------------+
60  | ``target``:math:`^o`   | text         | ``particleset.name`` | e           | Identify quantum ``particleset``         |
61  +------------------------+--------------+----------------------+-------------+------------------------------------------+
62  | ``default``:math:`^o`  | boolean      | yes/no               | yes         | Include kinetic energy term implicitly   |
63  +------------------------+--------------+----------------------+-------------+------------------------------------------+
64
65Additional information:
66
67-  **target:** Must be set to the name of the quantum ``particleset``.
68   The default value is typically sufficient. In normal usage, no other
69   attributes are provided.
70
71.. code-block::
72  :caption: All electron Hamiltonian XML element.
73  :name: Listing 14
74
75  <hamiltonian target="e">
76    <pairpot name="ElecElec" type="coulomb" source="e" target="e"/>
77    <pairpot name="ElecIon"  type="coulomb" source="i" target="e"/>
78    <pairpot name="IonIon"   type="coulomb" source="i" target="i"/>
79  </hamiltonian>
80
81
82.. code-block::
83  :caption: Pseudopotential Hamiltonian XML element.
84  :name: Listing 15
85
86  <hamiltonian target="e">
87    <pairpot name="ElecElec"  type="coulomb" source="e" target="e"/>
88    <pairpot name="PseudoPot" type="pseudo"  source="i" wavefunction="psi0" format="xml">
89      <pseudo elementType="Li" href="Li.xml"/>
90      <pseudo elementType="H" href="H.xml"/>
91    </pairpot>
92    <pairpot name="IonIon"    type="coulomb" source="i" target="i"/>
93  </hamiltonian>
94
95Pair potentials
96---------------
97
98Many 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 subsequently.  If a potential you desire is not listed, or is not present at all, feel free to contact the developers.
99
100``pairpot`` factory element:
101
102  +------------------+--------------------+
103  | parent elements: | ``hamiltonian``    |
104  +------------------+--------------------+
105  | child elements:  | ``type`` attribute |
106  +------------------+--------------------+
107
108  +------------------+---------+-----------------------------------------------+
109  | **type options** | coulomb | Coulomb/Ewald potential                       |
110  +------------------+---------+-----------------------------------------------+
111  |                  | pseudo  | Semilocal pseudopotential                     |
112  +------------------+---------+-----------------------------------------------+
113  |                  | mpc     | Model periodic Coulomb interaction/correction |
114  +------------------+---------+-----------------------------------------------+
115  |                  | cpp     | Core polarization potential                   |
116  +------------------+---------+-----------------------------------------------+
117  |                  | skpot   | *Unknown*                                     |
118  +------------------+---------+-----------------------------------------------+
119
120shared attributes:
121
122  +-----------------------+--------------+----------------------+------------------------+---------------------------------+
123  | **Name**              | **Datatype** | **Values**           | **Default**            | **Description**                 |
124  +=======================+==============+======================+========================+=================================+
125  | ``type``:math:`^r`    | text         | *See above*          | 0                      | Select pairpot type             |
126  +-----------------------+--------------+----------------------+------------------------+---------------------------------+
127  | ``name``:math:`^r`    | text         | *Anything*           | any                    | Unique name for this pairpot    |
128  +-----------------------+--------------+----------------------+------------------------+---------------------------------+
129  | ``source``:math:`^r`  | text         | ``particleset.name`` | ``hamiltonian.target`` | Identify interacting particles  |
130  +-----------------------+--------------+----------------------+------------------------+---------------------------------+
131  | ``target``:math:`^r`  | text         | ``particleset.name`` | ``hamiltonian.target`` | Identify interacting particles  |
132  +-----------------------+--------------+----------------------+------------------------+---------------------------------+
133  | ``units``:math:`^o`   | text         |                      | hartree                | *No current function*           |
134  +-----------------------+--------------+----------------------+------------------------+---------------------------------+
135
136Additional information:
137
138-  **type:** Used to select the desired pair potential. Must be selected
139   from the list of type options.
140
141-  **name:** A unique name used to identify this pair potential. Block
142   averaged output data will appear under this name in ``scalar.dat``
143   and/or ``stat.h5`` files.
144
145-  **source/target:** These specify the particles involved in a pair
146   interaction. If an interaction is between classical (e.g., ions) and
147   quantum (e.g., electrons), ``source``/``target`` should be the name
148   of the classical/quantum ``particleset``.
149
150-  Only ``Coulomb, pseudo``, and ``mpc`` are described in detail in the
151   following subsections. The older or less-used types (``cpp, skpot``)
152   are not covered.
153
154-  Available only if ``QMC_CUDA`` is not defined: ``skpot``.
155
156-  Available only if ``OHMMS_DIM==3``: ``mpc, vhxc, pseudo``.
157
158-  Available only if ``OHMMS_DIM==3`` and ``QMC_CUDA`` is not defined:
159   ``cpp``.
160
161Coulomb potentials
162~~~~~~~~~~~~~~~~~~
163
164The bare Coulomb potential is used in open boundary conditions:
165
166.. math::
167  :label: eq29
168
169  V_c^{open} = \sum_{i<j}\frac{q_iq_j}{\left|{r_i-r_j}\right|}\:.
170
171When periodic boundary conditions are selected, Ewald summation is used automatically:
172
173.. math::
174  :label: eq30
175
176  V_c^{pbc} = \sum_{i<j}\frac{q_iq_j}{\left|{r_i-r_j}\right|} + \frac{1}{2}\sum_{L\ne0}\sum_{i,j}\frac{q_iq_j}{\left|{r_i-r_j+L}\right|}\:.
177
178The sum indexed by :math:`L` is over all nonzero simulation cell lattice vectors.  In practice, the Ewald sum is broken into short- and long-range parts in a manner optimized for efficiency (see :cite:`Natoli1995`) for details.
179
180For information on how to set the boundary conditions, consult :ref:`simulationcell`.
181
182``pairpot type=coulomb`` element:
183
184  +------------------+-----------------+
185  | parent elements: | ``hamiltonian`` |
186  +------------------+-----------------+
187  | child elements:  | *None*          |
188  +------------------+-----------------+
189
190attributes:
191
192  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
193  | **Name**                | **Datatype** | **Values**           | **Default**            | **Description**                 |
194  +=========================+==============+======================+========================+=================================+
195  | ``type``:math:`^r`      | text         | **coulomb**          |                        | Must be coulomb                 |
196  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
197  | ``name/id``:math:`^r`   | text         | *anything*           | ElecElec               | Unique name for interaction     |
198  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
199  | ``source``:math:`^r`    | text         | ``particleset.name`` | ``hamiltonian.target`` | Identify interacting particles  |
200  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
201  | ``target``:math:`^r`    | text         | ``particleset.name`` | ``hamiltonian.target`` | Identify interacting particles  |
202  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
203  | ``pbc``:math:`^o`       | boolean      | yes/no               | yes                    | Use Ewald summation             |
204  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
205  | ``physical``:math:`^o`  | boolean      | yes/no               | yes                    | Hamiltonian(yes)/Observable(no) |
206  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
207  | ``forces``              | boolean      | yes/no               | no                     | *Deprecated*                    |
208  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
209
210Additional information:
211
212-  **type/source/target:** See description for the previous generic
213   ``pairpot`` factory element.
214
215-  **name:** Traditional user-specified names for electron-electron,
216   electron-ion, and ion-ion terms are ``ElecElec``, ``ElecIon``, and
217   ``IonIon``, respectively. Although any choice can be used, the data
218   analysis tools expect to find columns in ``*.scalar.dat`` with these
219   names.
220
221-  **pbc**: Ewald summation will not be performed if
222   ``simulationcell.bconds== n n n``, regardless of the value of
223   ``pbc``. Similarly, the ``pbc`` attribute can only be used to turn
224   off Ewald summation if ``simulationcell.bconds!= n n n``. The default
225   value is recommended.
226
227-  **physical**: If ``physical==yes``, this pair potential is included
228   in the Hamiltonian and will factor into the ``LocalEnergy`` reported
229   by QMCPACK and also in the DMC branching weight. If ``physical==no``,
230   then the pair potential is treated as a passive observable but not as
231   part of the Hamiltonian itself. As such it does not contribute to the
232   outputted ``LocalEnergy``. Regardless of the value of ``physical``
233   output data will appear in ``scalar.dat`` in a column headed by
234   ``name``.
235
236.. code-block::
237  :caption: QMCPXML element for Coulomb interaction between electrons.
238  :name: Listing 16
239
240  <pairpot name="ElecElec" type="coulomb" source="e" target="e"/>
241
242.. code-block::
243  :caption: QMCPXML element for Coulomb interaction between electrons and ions (all-electron only).
244  :name: Listing 17
245
246  <pairpot name="ElecIon"  type="coulomb" source="i" target="e"/>
247
248.. code-block::
249  :caption: QMCPXML element for Coulomb interaction between ions.
250  :name: Listing 18
251
252  <pairpot name="IonIon"   type="coulomb" source="i" target="i"/>
253
254.. _nlpp:
255
256Pseudopotentials
257~~~~~~~~~~~~~~~~
258
259QMCPACK supports pseudopotentials in semilocal form, which is local in the
260radial coordinate and nonlocal in angular coordinates. When all angular
261momentum channels above a certain threshold (:math:`\ell_{max}`) are
262well approximated by the same potential
263(:math:`V_{\bar{\ell}}\equiv V_{loc}`), the pseudopotential separates
264into a fully local channel and an angularly nonlocal component:
265
266.. math::
267  :label: eq31
268
269  V^{PP} = \sum_{ij}\Big(V_{\bar{\ell}}(\left|{r_i-\tilde{r}_j}\right|) + \sum_{\ell\ne\bar{\ell}}^{\ell_{max}}\sum_{m=-\ell}^\ell |{Y_{\ell m}}\rangle{\big[V_\ell(\left|{r_i-\tilde{r}_j}\right|) - V_{\bar{\ell}}(\left|{r_i-\tilde{r}_j}\right|) \big]}\langle{Y_{\ell m}}| \Big)\:.
270
271Here the electron/ion index is :math:`i/j`, and only one type of ion is
272shown for simplicity.
273
274Evaluation of the localized pseudopotential energy
275:math:`\Psi_T^{-1}V^{PP}\Psi_T` requires additional angular integrals.
276These integrals are evaluated on a randomly shifted angular grid. The
277size of this grid is determined by :math:`\ell_{max}`. See
278:cite:`Mitas1991` for further detail.
279
280uses the FSAtom pseudopotential file format associated with the “Free
281Software Project for Atomic-scale Simulations” initiated in 2002. See
282http://www.tddft.org/fsatom/manifest.php for more information. The
283FSAtom format uses XML for structured data. Files in this format do not
284use a specific identifying file extension; instead they are simply
285suffixed with “``.xml``.” The tabular data format of CASINO is also
286supported.
287
288In addition to the semilocal pseudopotential above, spin-orbit
289interactions can also be included through the use of spin-orbit
290pseudopotentials. The spin-orbit contribution can be written as
291
292.. math::
293  :label: eqn32
294
295  V^{\rm SO} = \sum_{ij} \left(\sum_{\ell = 1}^{\ell_{max}-1} \frac{2}{2\ell+1} V^{\rm SO}_\ell \left( \left|r_i - \tilde{r}_j \right| \right) \sum_{m,m'=-\ell}^{\ell} | Y_{\ell m} \rangle  \langle Y_{\ell m} | \vec{\ell} \cdot \vec{s} | Y_{\ell m'}\rangle\langle Y_{\ell m'}|\right)\:.
296
297Here, :math:`\vec{s}` is the spin operator. For each atom with a spin-orbit contribution,
298the radial functions :math:`V_{\ell}^{\rm SO}` can be included in the pseudopotential
299“``.xml``” file.
300
301``pairpot type=pseudo`` element:
302
303  +------------------+-----------------+
304  | parent elements: | ``hamiltonian`` |
305  +------------------+-----------------+
306  | child elements:  | ``pseudo``      |
307  +------------------+-----------------+
308
309attributes:
310
311  +-----------------------------+--------------+-----------------------+------------------------+--------------------------------------------------+
312  | **Name**                    | **Datatype** | **Values**            | **Default**            | **Description**                                  |
313  +=============================+==============+=======================+========================+==================================================+
314  | ``type``:math:`^r`          | text         | **pseudo**            |                        | Must be pseudo                                   |
315  +-----------------------------+--------------+-----------------------+------------------------+--------------------------------------------------+
316  | ``name/id``:math:`^r`       | text         | *anything*            | PseudoPot              | *No current function*                            |
317  +-----------------------------+--------------+-----------------------+------------------------+--------------------------------------------------+
318  | ``source``:math:`^r`        | text         | ``particleset.name``  | i                      | Ion ``particleset`` name                         |
319  +-----------------------------+--------------+-----------------------+------------------------+--------------------------------------------------+
320  | ``target``:math:`^r`        | text         | ``particleset.name``  | ``hamiltonian.target`` | Electron ``particleset`` name                    |
321  +-----------------------------+--------------+-----------------------+------------------------+--------------------------------------------------+
322  | ``pbc``:math:`^o`           | boolean      | yes/no                | yes*                   | Use Ewald summation                              |
323  +-----------------------------+--------------+-----------------------+------------------------+--------------------------------------------------+
324  | ``forces``                  | boolean      | yes/no                | no                     | *Deprecated*                                     |
325  +-----------------------------+--------------+-----------------------+------------------------+--------------------------------------------------+
326  | ``wavefunction``:math:`^r`  | text         | ``wavefunction.name`` | invalid                | Identify wavefunction                            |
327  +-----------------------------+--------------+-----------------------+------------------------+--------------------------------------------------+
328  | ``format``:math:`^r`        | text         | xml/table             | table                  | Select file format                               |
329  +-----------------------------+--------------+-----------------------+------------------------+--------------------------------------------------+
330  | ``algorithm``:math:`^o`     | text         | batched/default       | default                | Choose NLPP algorithm                            |
331  +-----------------------------+--------------+-----------------------+------------------------+--------------------------------------------------+
332  | ``DLA``:math:`^o`           | text         | yes/no                | no                     | Use determinant localization approximation       |
333  +-----------------------------+--------------+-----------------------+------------------------+--------------------------------------------------+
334  | ``physicalSO``:math:`^o`    | boolean      | yes/no                | no                     | Include the SO contribution in the local energy  |
335  +-----------------------------+--------------+-----------------------+------------------------+--------------------------------------------------+
336
337Additional information:
338
339-  **type/source/target** See description for the generic ``pairpot``
340   factory element.
341
342-  **name:** Ignored. Instead, default names will be present in
343   ``*scalar.dat`` output files when pseudopotentials are used. The
344   field ``LocalECP`` refers to the local part of the pseudopotential.
345   If nonlocal channels are present, a ``NonLocalECP`` field will be
346   added that contains the nonlocal energy summed over all angular
347   momentum channels.
348
349-  **pbc:** Ewald summation will not be performed if
350   ``simulationcell.bconds== n n n``, regardless of the value of
351   ``pbc``. Similarly, the ``pbc`` attribute can only be used to turn
352   off Ewald summation if ``simulationcell.bconds!= n n n``.
353
354-  **format:** If ``format``\ ==table, QMCPACK looks for ``*.psf`` files
355   containing pseudopotential data in a tabular format. The files must
356   be named after the ionic species provided in ``particleset`` (e.g.,
357   ``Li.psf`` and ``H.psf``). If ``format``\ ==xml, additional
358   ``pseudo`` child XML elements must be provided (see the following).
359   These elements specify individual file names and formats (both the
360   FSAtom XML and CASINO tabular data formats are supported).
361
362-  **algorithm** The default algorithm evaluates the ratios of
363   wavefunction components together for each quadrature point and then
364   one point after another. The batched algorithm evaluates the ratios
365   of quadrature points together for each wavefunction component and
366   then one component after another. Internally, it uses
367   ``VirtualParticleSet`` for quadrature points. Hybrid orbital
368   representation has an extra optimization enabled when using the
369   batched algorithm.
370
371-  **DLA** Determinant localization approximation
372   (DLA) :cite:`Zen2019DLA` uses only the fermionic part of
373   the wavefunction when calculating NLPP.
374
375-  **physicalSO** If the spin-orbit components are included in the
376   ``.xml`` file, this flag allows control over whether the SO contribution
377   is included in the local energy.
378
379.. code-block::
380  :caption: QMCPXML element for pseudopotential electron-ion interaction (psf files).
381  :name: Listing 19
382
383    <pairpot name="PseudoPot" type="pseudo"  source="i" wavefunction="psi0" format="psf"/>
384
385.. code-block::
386  :caption: QMCPXML element for pseudopotential electron-ion interaction (xml files).
387  :name: Listing 20
388
389    <pairpot name="PseudoPot" type="pseudo"  source="i" wavefunction="psi0" format="xml">
390      <pseudo elementType="Li" href="Li.xml"/>
391      <pseudo elementType="H" href="H.xml"/>
392    </pairpot>
393
394.. code-block::
395  :caption: QMCPXML element for pseudopotential including the spin-orbit interaction.
396  :name: Listing 21
397
398    <pairpot name="PseudoPot" type="pseudo" source="i" wavefunction="psi0" format="xml" physicalSO="yes">
399      <pseudo elementType="Pb" href="Pb.xml"/>
400    </pairpot>
401
402Details of ``<pseudo/>`` input elements are shown in the following. It
403is possible to include (or construct) a full pseudopotential directly in
404the input file without providing an external file via ``href``. The full
405XML format for pseudopotentials is not yet covered.
406
407``pseudo`` element:
408
409  +------------------+-----------------------------+
410  | parent elements: | ``pairpot type=pseudo``     |
411  +------------------+-----------------------------+
412  | child elements:  | ``header local grid``       |
413  +------------------+-----------------------------+
414
415attributes:
416
417  +-----------------------------------+--------------+-----------------+-------------+---------------------------+
418  | **Name**                          | **Datatype** | **Values**      | **Default** | **Description**           |
419  +===================================+==============+=================+=============+===========================+
420  | ``elementType/symbol``:math:`^r`  | text         | ``groupe.name`` | none        | Identify ionic species    |
421  +-----------------------------------+--------------+-----------------+-------------+---------------------------+
422  | ``href``:math:`^r`                | text         | *filepath*      | none        | Pseudopotential file path |
423  +-----------------------------------+--------------+-----------------+-------------+---------------------------+
424  | ``format``:math:`^r`              | text         | xml/casino      | xml         | Specify file format       |
425  +-----------------------------------+--------------+-----------------+-------------+---------------------------+
426  | ``cutoff``:math:`^o`              | real         |                 |             | Nonlocal cutoff radius    |
427  +-----------------------------------+--------------+-----------------+-------------+---------------------------+
428  | ``lmax``:math:`^o`                | integer      |                 |             | Largest angular momentum  |
429  +-----------------------------------+--------------+-----------------+-------------+---------------------------+
430  | ``nrule``:math:`^o`               | integer      |                 |             | Integration grid order    |
431  +-----------------------------------+--------------+-----------------+-------------+---------------------------+
432
433.. code-block::
434  :caption: QMCPXML element for pseudopotential of single ionic species.
435  :name: Listing 21
436
437    <pseudo elementType="Li" href="Li.xml"/>
438
439MPC Interaction/correction
440~~~~~~~~~~~~~~~~~~~~~~~~~~
441
442The MPC interaction is an alternative to direct Ewald summation. The MPC
443corrects the exchange correlation hole to more closely match its
444thermodynamic limit. Because of this, the MPC exhibits smaller
445finite-size errors than the bare Ewald interaction, though a few
446alternative and competitive finite-size correction schemes now exist.
447The MPC is itself often used just as a finite-size correction in
448post-processing (set ``physical=false`` in the input).
449
450``pairpot type=mpc`` element:
451
452  +------------------+-----------------+
453  | parent elements: | ``hamiltonian`` |
454  +------------------+-----------------+
455  | child elements:  | *None*          |
456  +------------------+-----------------+
457
458attributes:
459
460  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
461  | **Name**                | **Datatype** | **Values**           | **Default**            | **Description**                 |
462  +=========================+==============+======================+========================+=================================+
463  | ``type``:math:`^r`      | text         | **mpc**              |                        | Must be MPC                     |
464  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
465  | ``name/id``:math:`^r`   | text         | *anything*           | MPC                    | Unique name for interaction     |
466  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
467  | ``source``:math:`^r`    | text         | ``particleset.name`` | ``hamiltonian.target`` | Identify interacting particles  |
468  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
469  | ``target``:math:`^r`    | text         | ``particleset.name`` | ``hamiltonian.target`` | Identify interacting particles  |
470  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
471  | ``physical``:math:`^o`  | boolean      | yes/no               | no                     | Hamiltonian(yes)/observable(no) |
472  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
473  | ``cutoff``              | real         | :math:`>0`           | 30.0                   | Kinetic energy cutoff           |
474  +-------------------------+--------------+----------------------+------------------------+---------------------------------+
475
476Remarks:
477
478-  ``physical``: Typically set to ``no``, meaning the standard Ewald
479   interaction will be used during sampling and MPC will be measured as
480   an observable for finite-size post-correction. If ``physical`` is
481   ``yes``, the MPC interaction will be used during sampling. In this
482   case an electron-electron Coulomb ``pairpot`` element should not be
483   supplied.
484
485-  **Developer note:** Currently the ``name`` attribute for the MPC
486   interaction is ignored. The name is always reset to ``MPC``.
487
488.. code-block::
489  :caption: MPC for finite-size postcorrection.
490  :name: Listing 22
491
492    <pairpot type="MPC" name="MPC" source="e" target="e" ecut="60.0" physical="no"/>
493
494General estimators
495------------------
496
497A broad range of estimators for physical observables are available in QMCPACK.
498The following sections contain input details for the total number
499density (``density``), number density resolved by particle spin
500(``spindensity``), spherically averaged pair correlation function
501(``gofr``), static structure factor (``sk``), static structure factor
502(``skall``), energy density (``energydensity``), one body reduced
503density matrix (``dm1b``), :math:`S(k)` based kinetic energy correction
504(``chiesa``), forward walking (``ForwardWalking``), and force
505(``Force``) estimators. Other estimators are not yet covered.
506
507When an ``<estimator/>`` element appears in ``<hamiltonian/>``, it is
508evaluated for all applicable chained QMC runs (e.g.,
509VMC\ :math:`\rightarrow`\ DMC\ :math:`\rightarrow`\ DMC). Estimators are
510generally not accumulated during wavefunction optimization sections. If
511an ``<estimator/>`` element is instead provided in a particular
512``<qmc/>`` element, that estimator is only evaluated for that specific
513section (e.g., during VMC only).
514
515``estimator`` factory element:
516
517  +------------------+----------------------+
518  | parent elements: | ``hamiltonian, qmc`` |
519  +------------------+----------------------+
520  | type selector:   | ``type`` attribute   |
521  +------------------+----------------------+
522
523  +------------------+------------------+-----------------------------------------------------------+
524  | **type options** | density          | Density on a grid                                         |
525  +------------------+------------------+-----------------------------------------------------------+
526  |                  | spindensity      | Spin density on a grid                                    |
527  +------------------+------------------+-----------------------------------------------------------+
528  |                  | gofr             | Pair correlation function (quantum species)               |
529  +------------------+------------------+-----------------------------------------------------------+
530  |                  | sk               | Static structure factor                                   |
531  +------------------+------------------+-----------------------------------------------------------+
532  |                  | SkAll            | Static structure factor needed for finite size correction |
533  +------------------+------------------+-----------------------------------------------------------+
534  |                  | structurefactor  | Species resolved structure factor                         |
535  +------------------+------------------+-----------------------------------------------------------+
536  |                  | species kinetic  | Species resolved kinetic energy                           |
537  +------------------+------------------+-----------------------------------------------------------+
538  |                  | latticedeviation | Spatial deviation between two particlesets                |
539  +------------------+------------------+-----------------------------------------------------------+
540  |                  | momentum         | Momentum distribution                                     |
541  +------------------+------------------+-----------------------------------------------------------+
542  |                  | energydensity    | Energy density on uniform or Voronoi grid                 |
543  +------------------+------------------+-----------------------------------------------------------+
544  |                  | dm1b             | One body density matrix in arbitrary basis                |
545  +------------------+------------------+-----------------------------------------------------------+
546  |                  | chiesa           | Chiesa-Ceperley-Martin-Holzmann kinetic energy correction |
547  +------------------+------------------+-----------------------------------------------------------+
548  |                  | Force            | Family of "force" estimators (see :ref:`force-est`)       |
549  +------------------+------------------+-----------------------------------------------------------+
550  |                  | ForwardWalking   | Forward walking values for existing estimators            |
551  +------------------+------------------+-----------------------------------------------------------+
552  |                  | orbitalimages    | Create image files for orbitals, then exit                |
553  +------------------+------------------+-----------------------------------------------------------+
554  |                  | flux             | Checks sampling of kinetic energy                         |
555  +------------------+------------------+-----------------------------------------------------------+
556  |                  | localmoment      | Atomic spin polarization within cutoff radius             |
557  +------------------+------------------+-----------------------------------------------------------+
558  |                  | Pressure         | *No current function*                                     |
559  +------------------+------------------+-----------------------------------------------------------+
560
561shared attributes:
562
563  +---------------------+--------------+-------------+-------------+--------------------------------+
564  | **Name**            | **Datatype** | **Values**  | **Default** | **Description**                |
565  +=====================+==============+=============+=============+================================+
566  | ``type``:math:`^r`  | text         | *See above* | 0           | Select estimator type          |
567  +---------------------+--------------+-------------+-------------+--------------------------------+
568  | ``name``:math:`^r`  | text         | *anything*  | any         | Unique name for this estimator |
569  +---------------------+--------------+-------------+-------------+--------------------------------+
570
571Chiesa-Ceperley-Martin-Holzmann kinetic energy correction
572~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
573
574This estimator calculates a finite-size correction to the kinetic energy following the formalism laid out in :cite:`Chiesa2006`.  The total energy can be corrected for finite-size effects by using this estimator in conjunction with the MPC correction.
575
576``estimator type=chiesa`` element:
577
578  +------------------+----------------------+
579  | parent elements: | ``hamiltonian, qmc`` |
580  +------------------+----------------------+
581  | child elements:  | *None*               |
582  +------------------+----------------------+
583
584attributes:
585
586  +-----------------------+--------------+------------------------+-------------+----------------------------+
587  | **Name**              | **Datatype** | **Values**             | **Default** | **Description**            |
588  +=======================+==============+========================+=============+============================+
589  | ``type``:math:`^r`    | text         | **chiesa**             |             | Must be chiesa             |
590  +-----------------------+--------------+------------------------+-------------+----------------------------+
591  | ``name``:math:`^o`    | text         | *anything*             | KEcorr      | Always reset to KEcorr     |
592  +-----------------------+--------------+------------------------+-------------+----------------------------+
593  | ``source``:math:`^o`  | text         | ``particleset.name``   | e           | Identify quantum particles |
594  +-----------------------+--------------+------------------------+-------------+----------------------------+
595  | ``psi``:math:`^o`     | text         | ``wavefunction.name``  | psi0        | Identify wavefunction      |
596  +-----------------------+--------------+------------------------+-------------+----------------------------+
597
598.. code-block::
599  :caption: "Chiesa" kinetic energy finite-size postcorrection.
600  :name: Listing 23
601
602     <estimator name="KEcorr" type="chiesa" source="e" psi="psi0"/>
603
604Density estimator
605~~~~~~~~~~~~~~~~~
606
607The particle number density operator is given by
608
609.. math::
610  :label: eq32
611
612  \hat{n}_r = \sum_i\delta(r-r_i)\:.
613
614The ``density`` estimator accumulates the number density on a uniform
615histogram grid over the simulation cell. The value obtained for a grid
616cell :math:`c` with volume :math:`\Omega_c` is then the average number
617of particles in that cell:
618
619.. math::
620  :label: eq33
621
622  n_c = \int dR \left|{\Psi}\right|^2 \int_{\Omega_c}dr \sum_i\delta(r-r_i)\:.
623
624``estimator type=density`` element:
625
626  +------------------+----------------------+
627  | parent elements: | ``hamiltonian, qmc`` |
628  +------------------+----------------------+
629  | child elements:  | *None*               |
630  +------------------+----------------------+
631
632attributes:
633
634  +--------------------------+---------------+-------------------------------------------+------------------------------------------+------------------------------------------+
635  | **Name**                 | **Datatype**  | **Values**                                | **Default**                              | **Description**                          |
636  +==========================+===============+===========================================+==========================================+==========================================+
637  | ``type``:math:`^r`       | text          | **density**                               |                                          | Must be density                          |
638  +--------------------------+---------------+-------------------------------------------+------------------------------------------+------------------------------------------+
639  | ``name``:math:`^r`       | text          | *anything*                                | any                                      | Unique name for estimator                |
640  +--------------------------+---------------+-------------------------------------------+------------------------------------------+------------------------------------------+
641  | ``delta``:math:`^o`      | real array(3) | :math:`0\le v_i \le 1`                    | 0.1 0.1 0.1                              | Grid cell spacing, unit coords           |
642  +--------------------------+---------------+-------------------------------------------+------------------------------------------+------------------------------------------+
643  | ``x_min``:math:`^o`      | real          | :math:`>0`                                | 0                                        | Grid starting point in x (Bohr)          |
644  +--------------------------+---------------+-------------------------------------------+------------------------------------------+------------------------------------------+
645  | ``x_max``:math:`^o`      | real          | :math:`>0`                                | :math:`|` ``lattice[0]`` :math:`|`       | Grid ending point in x (Bohr)            |
646  +--------------------------+---------------+-------------------------------------------+------------------------------------------+------------------------------------------+
647  | ``y_min``:math:`^o`      | real          | :math:`>0`                                | 0                                        | Grid starting point in y (Bohr)          |
648  +--------------------------+---------------+-------------------------------------------+------------------------------------------+------------------------------------------+
649  | ``y_max``:math:`^o`      | real          | :math:`>0`                                | :math:`|` ``lattice[1]`` :math:`|`       | Grid ending point in y (Bohr)            |
650  +--------------------------+---------------+-------------------------------------------+------------------------------------------+------------------------------------------+
651  | ``z_min``:math:`^o`      | real          | :math:`>0`                                | 0                                        | Grid starting point in z (Bohr)          |
652  +--------------------------+---------------+-------------------------------------------+------------------------------------------+------------------------------------------+
653  | ``z_max``:math:`^o`      | real          | :math:`>0`                                | :math:`|` ``lattice[2]`` :math:`|`       | Grid ending point in z (Bohr)            |
654  +--------------------------+---------------+-------------------------------------------+------------------------------------------+------------------------------------------+
655  | ``potential``:math:`^o`  | boolean       | yes/no                                    | no                                       | Accumulate local potential, *deprecated* |
656  +--------------------------+---------------+-------------------------------------------+------------------------------------------+------------------------------------------+
657  | ``debug``:math:`^o`      | boolean       | yes/no                                    | no                                       | *No current function*                    |
658  +--------------------------+---------------+-------------------------------------------+------------------------------------------+------------------------------------------+
659
660Additional information:
661
662-  ``name``: The name provided will be used as a label in the
663   ``stat.h5`` file for the blocked output data. Postprocessing tools
664   expect ``name="Density."``
665
666-  ``delta``: This sets the histogram grid size used to accumulate the
667   density:
668   ``delta="0.1 0.1 0.05"``\ :math:`\rightarrow 10\times 10\times 20`
669   grid,
670   ``delta="0.01 0.01 0.01"``\ :math:`\rightarrow 100\times 100\times 100`
671   grid. The density grid is written to a ``stat.h5`` file at the end of
672   each MC block. If you request many :math:`blocks` in a ``<qmc/>``
673   element, or select a large grid, the resulting ``stat.h5`` file could
674   be many gigabytes in size.
675
676-  ``*_min/*_max``: Can be used to select a subset of the simulation
677   cell for the density histogram grid. For example if a (cubic)
678   simulation cell is 20 Bohr on a side, setting ``*_min=5.0`` and
679   ``*_max=15.0`` will result in a density histogram grid spanning a
680   :math:`10\times 10\times 10` Bohr cube about the center of the box.
681   Use of ``x_min, x_max, y_min, y_max, z_min, z_max`` is only
682   appropriate for orthorhombic simulation cells with open boundary
683   conditions.
684
685-  When open boundary conditions are used, a ``<simulationcell/>``
686   element must be explicitly provided as the first subelement of
687   ``<qmcsystem/>`` for the density estimator to work. In this case the
688   molecule should be centered around the middle of the simulation cell
689   (:math:`L/2`) and not the origin (:math:`0` since the space within
690   the cell, and hence the density grid, is defined from :math:`0` to
691   :math:`L`).
692
693.. code-block::
694  :caption: QMCPXML,caption=Density estimator (uniform grid).
695  :name: Listing 24
696
697     <estimator name="Density" type="density" delta="0.05 0.05 0.05"/>
698
699Spin density estimator
700~~~~~~~~~~~~~~~~~~~~~~
701
702The spin density is similar to the total density described previously.  In this case, the sum over particles is performed independently for each spin component.
703
704``estimator type=spindensity`` element:
705
706  +------------------+----------------------+
707  | parent elements: | ``hamiltonian, qmc`` |
708  +------------------+----------------------+
709  | child elements:  | *None*               |
710  +------------------+----------------------+
711
712attributes:
713
714  +-----------------------+--------------+-----------------+-------------+-------------------------------+
715  | **Name**              | **Datatype** | **Values**      | **Default** | **Description**               |
716  +=======================+==============+=================+=============+===============================+
717  | ``type``:math:`^r`    | text         | **spindensity** |             | Must be spindensity           |
718  +-----------------------+--------------+-----------------+-------------+-------------------------------+
719  | ``name``:math:`^r`    | text         | *anything*      | any         | Unique name for estimator     |
720  +-----------------------+--------------+-----------------+-------------+-------------------------------+
721  | ``report``:math:`^o`  | boolean      | yes/no          | no          | Write setup details to stdout |
722  +-----------------------+--------------+-----------------+-------------+-------------------------------+
723
724parameters:
725
726  +----------------------------+------------------+----------------------+-------------+----------------------------------+
727  | **Name**                   | **Datatype**     | **Values**           | **Default** | **Description**                  |
728  +============================+==================+======================+=============+==================================+
729  | ``grid``:math:`^o`         | integer array(3) | :math:`v_i>`         |             | Grid cell count                  |
730  +----------------------------+------------------+----------------------+-------------+----------------------------------+
731  | ``dr``:math:`^o`           | real array(3)    | :math:`v_i>`         |             | Grid cell spacing (Bohr)         |
732  +----------------------------+------------------+----------------------+-------------+----------------------------------+
733  | ``cell``:math:`^o`         | real array(3,3)  | *anything*           |             | Volume grid exists in            |
734  +----------------------------+------------------+----------------------+-------------+----------------------------------+
735  | ``corner``:math:`^o`       | real array(3)    | *anything*           |             | Volume corner location           |
736  +----------------------------+------------------+----------------------+-------------+----------------------------------+
737  | ``center``:math:`^o`       | real array (3)   | *anything*           |             | Volume center/origin location    |
738  +----------------------------+------------------+----------------------+-------------+----------------------------------+
739  | ``voronoi``:math:`^o`      | text             | ``particleset.name`` |             | *Under development*              |
740  +----------------------------+------------------+----------------------+-------------+----------------------------------+
741  | ``test_moves``:math:`^o`   | integer          | :math:`>=0`          | 0           | Test estimator with random moves |
742  +----------------------------+------------------+----------------------+-------------+----------------------------------+
743
744Additional information:
745
746-  ``name``: The name provided will be used as a label in the
747   ``stat.h5`` file for the blocked output data. Postprocessing tools
748   expect ``name="SpinDensity."``
749
750-  ``grid``: The grid sets the dimension of the histogram grid. Input
751   like ``<parameter name="grid"> 40 40 40 </parameter>`` requests a
752   :math:`40 \times 40\times 40` grid. The shape of individual grid
753   cells is commensurate with the supercell shape.
754
755-  ``dr``: The ``dr`` sets the real-space dimensions of grid cell edges
756   (Bohr units). Input like
757   ``<parameter name="dr"> 0.5 0.5 0.5 </parameter>`` in a supercell
758   with axes of length 10 Bohr each (but of arbitrary shape) will
759   produce a :math:`20\times 20\times 20` grid. The inputted ``dr``
760   values are rounded to produce an integer number of grid cells along
761   each supercell axis. Either ``grid`` or ``dr`` must be provided, but
762   not both.
763
764-  ``cell``: When ``cell`` is provided, a user-defined grid volume is
765   used instead of the global supercell. This must be provided if open
766   boundary conditions are used. Additionally, if ``cell`` is provided,
767   the user must specify where the volume is located in space in
768   addition to its size/shape (``cell``) using either the ``corner`` or
769   ``center`` parameters.
770
771-  ``corner``: The grid volume is defined as
772   :math:`corner+\sum_{d=1}^3u_dcell_d` with :math:`0<u_d<1` (“cell”
773   refers to either the supercell or user-provided cell).
774
775-  ``center``: The grid volume is defined as
776   :math:`center+\sum_{d=1}^3u_dcell_d` with :math:`-1/2<u_d<1/2`
777   (“cell” refers to either the supercell or user-provided cell).
778   ``corner/center`` can be used to shift the grid even if ``cell`` is
779   not specified. Simultaneous use of ``corner`` and ``center`` will
780   cause QMCPACK to abort.
781
782.. code-block::
783  :caption: Spin density estimator (uniform grid).
784  :name: Listing 25
785
786  <estimator type="spindensity" name="SpinDensity" report="yes">
787    <parameter name="grid"> 40 40 40 </parameter>
788  </estimator>
789
790.. code-block::
791  :caption: Spin density estimator (uniform grid centered about origin).
792  :name: Listing 26
793
794  <estimator type="spindensity" name="SpinDensity" report="yes">
795    <parameter name="grid">
796      20 20 20
797    </parameter>
798    <parameter name="center">
799      0.0 0.0 0.0
800    </parameter>
801    <parameter name="cell">
802      10.0  0.0  0.0
803       0.0 10.0  0.0
804       0.0  0.0 10.0
805    </parameter>
806  </estimator>
807
808Pair correlation function, :math:`g(r)`
809~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
810
811The functional form of the species-resolved radial pair correlation function operator is
812
813.. math::
814  :label: eq34
815
816  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'}}|)\:,
817
818where :math:`N_s` is the number of particles of species :math:`s` and
819:math:`V` is the supercell volume. If :math:`s=s'`, then the sum is
820restricted so that :math:`i_s\ne j_s`.
821
822In QMCPACK, an estimate of :math:`g_{ss'}(r)` is obtained as a radial
823histogram with a set of :math:`N_b` uniform bins of width
824:math:`\delta r`. This can be expressed analytically as
825
826.. math::
827  :label: eq35
828
829  \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}|)\:,
830
831where the radial coordinate :math:`r` is restricted to reside at the bin
832centers, :math:`\delta r/2, 3 \delta r/2, 5 \delta r/2, \ldots`.
833
834``estimator type=gofr`` element:
835
836  +------------------+----------------------+
837  | parent elements: | ``hamiltonian, qmc`` |
838  +------------------+----------------------+
839  | child elements:  | *None*               |
840  +------------------+----------------------+
841
842attributes:
843
844  +-------------------------------+--------------+----------------------+------------------------+-------------------------+
845  | **Name**                      | **Datatype** | **Values**           | **Default**            | **Description**         |
846  +===============================+==============+======================+========================+=========================+
847  | ``type``:math:`^r`            | text         | **gofr**             |                        | Must be gofr            |
848  +-------------------------------+--------------+----------------------+------------------------+-------------------------+
849  | ``name``:math:`^o`            | text         | *anything*           | any                    | *No current function*   |
850  +-------------------------------+--------------+----------------------+------------------------+-------------------------+
851  | ``num_bin``:math:`^r`         | integer      | :math:`>1`           | 20                     | # of histogram bins     |
852  +-------------------------------+--------------+----------------------+------------------------+-------------------------+
853  | ``rmax``:math:`^o`            | real         | :math:`>0`           | 10                     | Histogram extent (Bohr) |
854  +-------------------------------+--------------+----------------------+------------------------+-------------------------+
855  | ``dr``:math:`^o`              | real         | :math:`0`            | 0.5                    | *No current function*   |
856  +-------------------------------+--------------+----------------------+------------------------+-------------------------+
857  | ``debug``:math:`^o`           | boolean      | yes/no               | no                     | *No current function*   |
858  +-------------------------------+--------------+----------------------+------------------------+-------------------------+
859  | ``target``:math:`^o`          | text         | ``particleset.name`` | ``hamiltonian.target`` | Quantum particles       |
860  +-------------------------------+--------------+----------------------+------------------------+-------------------------+
861  | ``source/sources``:math:`^o`  | text array   | ``particleset.name`` | ``hamiltonian.target`` | Classical particles     |
862  +-------------------------------+--------------+----------------------+------------------------+-------------------------+
863
864Additional information:
865
866-  ``num_bin:`` This is the number of bins in each species pair radial
867   histogram.
868
869-  ``rmax:`` This is the maximum pair distance included in the
870   histogram. The uniform bin width is
871   :math:`\delta r=\texttt{rmax/num\_bin}`. If periodic boundary
872   conditions are used for any dimension of the simulation cell, then
873   the default value of ``rmax`` is the simulation cell radius instead
874   of 10 Bohr. For open boundary conditions, the volume (:math:`V`) used
875   is 1.0 Bohr\ :math:`^3`.
876
877-  ``source/sources:`` If unspecified, only pair correlations between
878   each species of quantum particle will be measured. For each classical
879   particleset specified by ``source/sources``, additional pair
880   correlations between each quantum and classical species will be
881   measured. Typically there is only one classical particleset (e.g.,
882   ``source="ion0"``), but there can be several in principle (e.g.,
883   ``sources="ion0 ion1 ion2"``).
884
885-  ``target:`` The default value is the preferred usage (i.e.,
886   ``target`` does not need to be provided).
887
888-  Data is output to the ``stat.h5`` for each QMC subrun. Individual
889   histograms are named according to the quantum particleset and index
890   of the pair. For example, if the quantum particleset is named “e" and
891   there are two species (up and down electrons, say), then there will
892   be three sets of histogram data in each ``stat.h5`` file named
893   ``gofr_e_0_0``, ``gofr_e_0_1``, and ``gofr_e_1_1`` for up-up,
894   up-down, and down-down correlations, respectively.
895
896.. code-block::
897  :caption: Pair correlation function estimator element.
898  :name: Listing 27
899
900  <estimator type="gofr" name="gofr" num_bin="200" rmax="3.0" />
901
902.. code-block::
903  :caption: Pair correlation function estimator element with additional electron-ion correlations.
904  :name: Listing 28
905
906  <estimator type="gofr" name="gofr" num_bin="200" rmax="3.0" source="ion0" />
907
908Static structure factor, :math:`S(k)`
909~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
910
911Let
912:math:`\rho^e_{\mathbf{k}}=\sum_j e^{i \mathbf{k}\cdot\mathbf{r}_j^e}`
913be the Fourier space electron density, with :math:`\mathbf{r}^e_j` being
914the coordinate of the j-th electron. :math:`\mathbf{k}` is a wavevector
915commensurate with the simulation cell. QMCPACK allows the user to
916accumulate the static electron structure factor :math:`S(\mathbf{k})` at
917all commensurate :math:`\mathbf{k}` such that
918:math:`|\mathbf{k}| \leq (LR\_DIM\_CUTOFF) r_c`. :math:`N^e` is the
919number of electrons, ``LR_DIM_CUTOFF`` is the optimized breakup
920parameter, and :math:`r_c` is the Wigner-Seitz radius. It is defined as
921follows:
922
923.. math::
924  :label: eq36
925
926  S(\mathbf{k}) = \frac{1}{N^e}\langle \rho^e_{-\mathbf{k}} \rho^e_{\mathbf{k}} \rangle\:.
927
928``estimator type=sk`` element:
929
930  +------------------+----------------------+
931  | parent elements: | ``hamiltonian, qmc`` |
932  +------------------+----------------------+
933  | child elements:  | *None*               |
934  +------------------+----------------------+
935
936attributes:
937
938  +---------------------+--------------+------------+-------------+-----------------------------------------------------+
939  | **Name**            | **Datatype** | **Values** | **Default** | **Description**                                     |
940  +=====================+==============+============+=============+=====================================================+
941  | ``type``:math:`^r`  | text         | sk         |             | Must sk                                             |
942  +---------------------+--------------+------------+-------------+-----------------------------------------------------+
943  | ``name``:math:`^r`  | text         | *anything* | any         | Unique name for estimator                           |
944  +---------------------+--------------+------------+-------------+-----------------------------------------------------+
945  | ``hdf5``:math:`^o`  | boolean      | yes/no     | no          |  Output to ``stat.h5`` (yes) or ``scalar.dat`` (no) |
946  +---------------------+--------------+------------+-------------+-----------------------------------------------------+
947
948Additional information:
949
950-  ``name:`` This is the unique name for estimator instance. A data
951   structure of the same name will appear in ``stat.h5`` output files.
952
953-  ``hdf5:`` If ``hdf5==yes``, output data for :math:`S(k)` is directed
954   to the ``stat.h5`` file (recommended usage). If ``hdf5==no``, the
955   data is instead routed to the ``scalar.dat`` file, resulting in many
956   columns of data with headings prefixed by ``name`` and postfixed by
957   the k-point index (e.g., ``sk_0 sk_1 …sk_1037 …``).
958
959-  This estimator only works in periodic boundary conditions. Its
960   presence in the input file is ignored otherwise.
961
962-  This is not a species-resolved structure factor. Additionally, for
963   :math:`\mathbf{k}` vectors commensurate with the unit cell,
964   :math:`S(\mathbf{k})` will include contributions from the static
965   electronic density, thus meaning it will not accurately measure the
966   electron-electron density response.
967
968.. code-block::
969  :caption: Static structure factor estimator element.
970  :name: Listing 29
971
972    <estimator type="sk" name="sk" hdf5="yes"/>
973
974Static structure factor, ``SkAll``
975~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
976
977In order to compute the finite size correction to the potential energy,
978records of :math:`\rho(\mathbf{k})` is required. What sets ``SkAll``
979apart from ``sk`` is that ``SkAll`` records :math:`\rho(\mathbf{k})` in
980addition to :math:`s(\mathbf{k})`.
981
982``estimator type=SkAll`` element:
983
984  +------------------+----------------------+
985  | parent elements: | ``hamiltonian, qmc`` |
986  +------------------+----------------------+
987  | child elements:  | *None*               |
988  +------------------+----------------------+
989
990attributes:
991
992  +----------------------------+--------------+---------------------------+-------------+-------------------------------------------------------------------------------------------------+
993  | **Name**                   | **Datatype** | **Values**                | **Default** | **Description**                                                                                 |
994  +============================+==============+===========================+=============+=================================================================================================+
995  | ``type``:math:`^r`         | text         | sk                        |             | Must be sk                                                                                      |
996  +----------------------------+--------------+---------------------------+-------------+-------------------------------------------------------------------------------------------------+
997  | ``name``:math:`^r`         | text         | *anything*                | any         | Unique name for estimator                                                                       |
998  +----------------------------+--------------+---------------------------+-------------+-------------------------------------------------------------------------------------------------+
999  | ``source``:math:`^r`       | text         | Ion ParticleSet name      | None        | `-`                                                                                             |
1000  +----------------------------+--------------+---------------------------+-------------+-------------------------------------------------------------------------------------------------+
1001  | ``target``:math:`^r`       | text         | Electron ParticleSet name | None        | `-`                                                                                             |
1002  +----------------------------+--------------+---------------------------+-------------+-------------------------------------------------------------------------------------------------+
1003  | ``hdf5``:math:`^o`         | boolean      | yes/no                    | no          | Output to ``stat.h5`` (yes) or ``scalar.dat`` (no)                                              |
1004  +----------------------------+--------------+---------------------------+-------------+-------------------------------------------------------------------------------------------------+
1005  | ``writeionion``:math:`^o`  | boolean      | yes/no                    | no          | Writes file rhok_IonIon.dat containing :math:`s(\mathbf{k})` for the ions                       |
1006  +----------------------------+--------------+---------------------------+-------------+-------------------------------------------------------------------------------------------------+
1007
1008Additional information:
1009
1010-  ``name:`` This is the unique name for estimator instance. A data
1011   structure of the same name will appear in ``stat.h5`` output files.
1012
1013-  ``hdf5:`` If ``hdf5==yes``, output data is directed to the
1014   ``stat.h5`` file (recommended usage). If ``hdf5==no``, the data is
1015   instead routed to the ``scalar.dat`` file, resulting in many columns
1016   of data with headings prefixed by ``rhok`` and postfixed by the
1017   k-point index.
1018
1019-  This estimator only works in periodic boundary conditions. Its
1020   presence in the input file is ignored otherwise.
1021
1022-  This is not a species-resolved structure factor. Additionally, for
1023   :math:`\mathbf{k}` vectors commensurate with the unit cell,
1024   :math:`S(\mathbf{k})` will include contributions from the static
1025   electronic density, thus meaning it wil not accurately measure the
1026   electron-electron density response.
1027
1028.. code-block::
1029  :caption: SkAll estimator element.
1030  :name: Listing 30
1031
1032    <estimator type="skall" name="SkAll" source="ion0" target="e" hdf5="yes"/>
1033
1034Species kinetic energy
1035~~~~~~~~~~~~~~~~~~~~~~
1036
1037Record species-resolved kinetic energy instead of the total kinetic
1038energy in the ``Kinetic`` column of scalar.dat. ``SpeciesKineticEnergy``
1039is arguably the simplest estimator in QMCPACK. The implementation of
1040this estimator is detailed in
1041``manual/estimator/estimator_implementation.pdf``.
1042
1043``estimator type=specieskinetic`` element:
1044
1045  +------------------+----------------------+
1046  | parent elements: | ``hamiltonian, qmc`` |
1047  +------------------+----------------------+
1048  | child elements:  | *None*               |
1049  +------------------+----------------------+
1050
1051attributes:
1052
1053  +---------------------+--------------+----------------+-------------+-----------------------------+
1054  | **Name**            | **Datatype** | **Values**     | **Default** | **Description**             |
1055  +=====================+==============+================+=============+=============================+
1056  | ``type``:math:`^r`  | text         | specieskinetic |             | Must be specieskinetic      |
1057  +---------------------+--------------+----------------+-------------+-----------------------------+
1058  | ``name``:math:`^r`  | text         | *anything*     | any         | Unique name for estimator   |
1059  +---------------------+--------------+----------------+-------------+-----------------------------+
1060  | ``hdf5``:math:`^o`  | boolean      | yes/no         | no          | Output to ``stat.h5`` (yes) |
1061  +---------------------+--------------+----------------+-------------+-----------------------------+
1062
1063.. code-block::
1064  :caption: Species kinetic energy estimator element.
1065  :name: Listing 31
1066
1067    <estimator type="specieskinetic" name="skinetic" hdf5="no"/>
1068
1069Lattice deviation estimator
1070~~~~~~~~~~~~~~~~~~~~~~~~~~~
1071
1072Record deviation of a group of particles in one particle set (target) from a group of particles in another particle set (source).
1073
1074``estimator type=latticedeviation`` element:
1075
1076  +------------------+----------------------+
1077  | parent elements: | ``hamiltonian, qmc`` |
1078  +------------------+----------------------+
1079  | child elements:  | *None*               |
1080  +------------------+----------------------+
1081
1082attributes:
1083
1084  +-------------------------+--------------+------------------+-------------+------------------------------+
1085  | **Name**                | **Datatype** | **Values**       | **Default** | **Description**              |
1086  +=========================+==============+==================+=============+==============================+
1087  | ``type``:math:`^r`      | text         | latticedeviation |             | Must be latticedeviation     |
1088  +-------------------------+--------------+------------------+-------------+------------------------------+
1089  | ``name``:math:`^r`      | text         | *anything*       | any         | Unique name for estimator    |
1090  +-------------------------+--------------+------------------+-------------+------------------------------+
1091  | ``hdf5``:math:`^o`      | boolean      | yes/no           | no          | Output to ``stat.h5`` (yes)  |
1092  +-------------------------+--------------+------------------+-------------+------------------------------+
1093  | ``per_xyz``:math:`^o`   | boolean      | yes/no           | no          | Directionally resolved (yes) |
1094  +-------------------------+--------------+------------------+-------------+------------------------------+
1095  | ``source``:math:`^r`    | text         | e/ion0/...       | no          | source particleset           |
1096  +-------------------------+--------------+------------------+-------------+------------------------------+
1097  | ``sgroup``:math:`^r`    | text         | u/d/...          | no          | source particle group        |
1098  +-------------------------+--------------+------------------+-------------+------------------------------+
1099  | ``target``:math:`^r`    | text         | e/ion0/...       | no          | target particleset           |
1100  +-------------------------+--------------+------------------+-------------+------------------------------+
1101  | ``tgroup``:math:`^r`    | text         | u/d/...          | no          | target particle group        |
1102  +-------------------------+--------------+------------------+-------------+------------------------------+
1103
1104Additional information:
1105
1106-  ``source``: The “reference” particleset to measure distances from;
1107   actual reference points are determined together with ``sgroup``.
1108
1109-  ``sgroup``: The “reference” particle group to measure distances from.
1110
1111-  ``source``: The “target” particleset to measure distances to.
1112
1113-  ``sgroup``: The “target” particle group to measure distances to. For
1114   example, in :ref:`Listing 32 <Listing 32>` the distance from the up
1115   electron (“u”) to the origin of the coordinate system is recorded.
1116
1117-  ``per_xyz``: Used to record direction-resolved distance. In
1118   :ref:`Listing 32 <Listing 32>`, the x,y,z coordinates of the up electron
1119   will be recorded separately if ``per_xyz=yes``.
1120
1121-  ``hdf5``: Used to record particle-resolved distances in the h5 file
1122   if ``gdf5=yes``.
1123
1124.. code-block::
1125  :caption: Lattice deviation estimator element.
1126  :name: Listing 32
1127
1128  <particleset name="e" random="yes">
1129    <group name="u" size="1" mass="1.0">
1130       <parameter name="charge"              >    -1                    </parameter>
1131       <parameter name="mass"                >    1.0                   </parameter>
1132    </group>
1133    <group name="d" size="1" mass="1.0">
1134       <parameter name="charge"              >    -1                    </parameter>
1135       <parameter name="mass"                >    1.0                   </parameter>
1136    </group>
1137  </particleset>
1138
1139  <particleset name="wf_center">
1140    <group name="origin" size="1">
1141      <attrib name="position" datatype="posArray" condition="0">
1142               0.00000000        0.00000000        0.00000000
1143      </attrib>
1144    </group>
1145  </particleset>
1146
1147  <estimator type="latticedeviation" name="latdev" hdf5="yes" per_xyz="yes"
1148    source="wf_center" sgroup="origin" target="e" tgroup="u"/>
1149
1150Energy density estimator
1151~~~~~~~~~~~~~~~~~~~~~~~~
1152
1153An energy density operator, :math:`\hat{\mathcal{E}}_r`, satisfies
1154
1155.. math::
1156  :label: eq37
1157
1158  \int dr \hat{\mathcal{E}}_r = \hat{H},
1159
1160where the integral is over all space and :math:`\hat{H}` is the
1161Hamiltonian. In QMCPACK, the energy density is split into kinetic and potential
1162components
1163
1164.. math::
1165  :label: eq38
1166
1167  \hat{\mathcal{E}}_r = \hat{\mathcal{T}}_r + \hat{\mathcal{V}}_r\:,
1168
1169with each component given by
1170
1171.. math::
1172  :label: eq39
1173
1174  \begin{aligned}
1175      \hat{\mathcal{T}}_r &=  \frac{1}{2}\sum_i\delta(r-r_i)\hat{p}_i^2 \\
1176      \hat{\mathcal{V}}_r &=  \sum_{i<j}\frac{\delta(r-r_i)+\delta(r-r_j)}{2}\hat{v}^{ee}(r_i,r_j)
1177                 + \sum_{i\ell}\frac{\delta(r-r_i)+\delta(r-\tilde{r}_\ell)}{2}\hat{v}^{eI}(r_i,\tilde{r}_\ell) \nonumber\\
1178       &\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{aligned}
1179
1180Here, :math:`r_i` and :math:`\tilde{r}_\ell` represent electron and ion
1181positions, respectively; :math:`\hat{p}_i` is a single electron momentum
1182operator; and :math:`\hat{v}^{ee}(r_i,r_j)`,
1183:math:`\hat{v}^{eI}(r_i,\tilde{r}_\ell)`, and
1184:math:`\hat{v}^{II}(\tilde{r}_\ell,\tilde{r}_m)` are the
1185electron-electron, electron-ion, and ion-ion pair potential operators
1186(including nonlocal pseudopotentials, if present). This form of the
1187energy density is size consistent; that is, the partially integrated
1188energy density operators of well-separated atoms gives the isolated
1189Hamiltonians of the respective atoms. For periodic systems with
1190twist-averaged boundary conditions, the energy density is formally
1191correct only for either a set of supercell k-points that correspond to
1192real-valued wavefunctions or a k-point set that has inversion symmetry
1193around a k-point having a real-valued wavefunction. For more information
1194about the energy density, see :cite:`Krogel2013`.
1195
1196In QMCPACK, the energy density can be accumulated on piecewise uniform 3D 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.
1197
1198``estimator type=EnergyDensity`` element:
1199
1200  +------------------+---------------------------------+
1201  | parent elements: | ``hamiltonian, qmc``            |
1202  +------------------+---------------------------------+
1203  | child elements:  | ``reference_points, spacegrid`` |
1204  +------------------+---------------------------------+
1205
1206attributes:
1207
1208  +----------------------------+--------------+----------------------+-------------+----------------------------------------------+
1209  | **Name**                   | **Datatype** | **Values**           | **Default** | **Description**                              |
1210  +============================+==============+======================+=============+==============================================+
1211  | ``type``:math:`^r`         | text         | **EnergyDensity**    |             | Must be EnergyDensity                        |
1212  +----------------------------+--------------+----------------------+-------------+----------------------------------------------+
1213  | ``name``:math:`^r`         | text         | *anything*           |             | Unique name for estimator                    |
1214  +----------------------------+--------------+----------------------+-------------+----------------------------------------------+
1215  | ``dynamic``:math:`^r`      | text         | ``particleset.name`` |             | Identify electrons                           |
1216  +----------------------------+--------------+----------------------+-------------+----------------------------------------------+
1217  | ``static``:math:`^o`       | text         | ``particleset.name`` |             | Identify ions                                |
1218  +----------------------------+--------------+----------------------+-------------+----------------------------------------------+
1219  | ``ion_points``:math:`^o`   | text         | yes/no               |  no         | Separate ion energy density onto point field |
1220  +----------------------------+--------------+----------------------+-------------+----------------------------------------------+
1221
1222Additional information:
1223
1224-  ``name:`` Must be unique. A dataset with blocked statistical data for
1225   the energy density will appear in the ``stat.h5`` files labeled as
1226   ``name``.
1227- **Important:** in order for the estimator to work, a traces XML input element (<traces array="yes" write="no"/>) must appear following the <qmcsystem/> element and prior to any <qmc/> element.
1228
1229.. code-block::
1230  :caption: Energy density estimator accumulated on a :math:`20 \times  10 \times 10` grid over the simulation cell.
1231  :name: Listing 33
1232
1233  <estimator type="EnergyDensity" name="EDcell" dynamic="e" static="ion0">
1234     <spacegrid coord="cartesian">
1235       <origin p1="zero"/>
1236       <axis p1="a1" scale=".5" label="x" grid="-1 (.05) 1"/>
1237       <axis p1="a2" scale=".5" label="y" grid="-1 (.1) 1"/>
1238       <axis p1="a3" scale=".5" label="z" grid="-1 (.1) 1"/>
1239     </spacegrid>
1240  </estimator>
1241
1242.. code-block::
1243  :caption: Energy density estimator accumulated within spheres of radius 6.9 Bohr centered on the first and second atoms in the ion0 particleset.
1244  :name: Listing 34
1245
1246  <estimator type="EnergyDensity" name="EDatom" dynamic="e" static="ion0">
1247    <reference_points coord="cartesian">
1248      r1 1 0 0
1249      r2 0 1 0
1250      r3 0 0 1
1251    </reference_points>
1252    <spacegrid coord="spherical">
1253      <origin p1="ion01"/>
1254      <axis p1="r1" scale="6.9" label="r"     grid="0 1"/>
1255      <axis p1="r2" scale="6.9" label="phi"   grid="0 1"/>
1256      <axis p1="r3" scale="6.9" label="theta" grid="0 1"/>
1257    </spacegrid>
1258    <spacegrid coord="spherical">
1259      <origin p1="ion02"/>
1260      <axis p1="r1" scale="6.9" label="r"     grid="0 1"/>
1261      <axis p1="r2" scale="6.9" label="phi"   grid="0 1"/>
1262      <axis p1="r3" scale="6.9" label="theta" grid="0 1"/>
1263    </spacegrid>
1264  </estimator>
1265
1266.. code-block::
1267  :caption: Energy density estimator accumulated within Voronoi polyhedra centered on the ions.
1268  :name: Listing 35
1269
1270  <estimator type="EnergyDensity" name="EDvoronoi" dynamic="e" static="ion0">
1271    <spacegrid coord="voronoi"/>
1272  </estimator>
1273
1274The ``<reference_points/>`` element provides a set of points for later
1275use in specifying the origin and coordinate axes needed to construct a
1276spatial histogramming grid. Several reference points on the surface of
1277the simulation cell (see :numref:`table8`), as well as the
1278positions of the ions (see the ``energydensity.static`` attribute), are
1279made available by default. The reference points can be used, for
1280example, to construct a cylindrical grid along a bond with the origin on
1281the bond center.
1282
1283  ``reference_points`` element:
1284
1285    +------------------+---------------------------------+
1286    | parent elements: | ``estimator type=EnergyDensity``|
1287    +------------------+---------------------------------+
1288    | child elements:  | *None*                          |
1289    +------------------+---------------------------------+
1290
1291  attributes:
1292
1293    +----------------------+--------------+----------------+-------------+---------------------------+
1294    | **Name**             | **Datatype** | **Values**     | **Default** | **Description**           |
1295    +======================+==============+================+=============+===========================+
1296    | ``coord``:math:`^r`  | text         | Cartesian/cell |             | Specify coordinate system |
1297    +----------------------+--------------+----------------+-------------+---------------------------+
1298
1299  body text: The body text is a line formatted list of points with labels
1300
1301Additional information:
1302
1303-  ``coord:`` If ``coord=cartesian``, labeled points are in Cartesian
1304   (x,y,z) format in units of Bohr. If ``coord=cell``, then labeled
1305   points are in units of the simulation cell axes.
1306
1307-  ``body text:`` The list of points provided in the body text are line
1308   formatted, with four entries per line (*label* *coor1* *coor2*
1309   *coor3*). A set of points referenced to the simulation cell is
1310   available by default (see :numref:`table8`). If
1311   ``energydensity.static`` is provided, the location of each individual
1312   ion is also available (e.g., if ``energydensity.static=ion0``, then
1313   the location of the first atom is available with label ion01, the
1314   second with ion02, etc.). All points can be used by label when
1315   constructing spatial histogramming grids (see the following
1316   ``spacegrid`` element) used to collect energy densities.
1317
1318.. _table8:
1319.. table::
1320
1321     ========= ======================== =================
1322     ``label`` ``point``                ``description``
1323     ========= ======================== =================
1324     ``zero``  0 0 0                    Cell center
1325     ``a1``    :math:`a_1`              Cell axis 1
1326     ``a2``    :math:`a_2`              Cell axis 2
1327     ``a3``    :math:`a_3`              Cell axis 3
1328     ``f1p``   :math:`a_1`/2            Cell face 1+
1329     ``f1m``   -:math:`a_1`/2           Cell face 1-
1330     ``f2p``   :math:`a_2`/2            Cell face 2+
1331     ``f2m``   -:math:`a_2`/2           Cell face 2-
1332     ``f3p``   :math:`a_3`/2            Cell face 3+
1333     ``f3m``   -:math:`a_3`/2           Cell face 3-
1334     ``cppp``  :math:`(a_1+a_2+a_3)/2`  Cell corner +,+,+
1335     ``cppm``  :math:`(a_1+a_2-a_3)/2`  Cell corner +,+,-
1336     ``cpmp``  :math:`(a_1-a_2+a_3)/2`  Cell corner +,-,+
1337     ``cmpp``  :math:`(-a_1+a_2+a_3)/2` Cell corner -,+,+
1338     ``cpmm``  :math:`(a_1-a_2-a_3)/2`  Cell corner +,-,-
1339     ``cmpm``  :math:`(-a_1+a_2-a_3)/2` Cell corner -,+,-
1340     ``cmmp``  :math:`(-a_1-a_2+a_3)/2` Cell corner -,-,+
1341     ``cmmm``  :math:`(-a_1-a_2-a_3)/2` Cell corner -,-,-
1342     ========= ======================== =================
1343
1344.. centered:: Table 8 Reference points available by default. Vectors :math:`a_1`, :math:`a_2`, and :math:`a_3` refer to the simulation cell axes. The representation of the cell is centered around ``zero``.
1345
1346The ``<spacegrid/>`` element is used to specify a spatial histogramming
1347grid for the energy density. Grids are constructed based on a set of,
1348potentially nonorthogonal, user-provided coordinate axes. The axes are
1349based on information available from ``reference_points``. Voronoi grids
1350are based only on nearest neighbor distances between electrons and ions.
1351Any number of space grids can be provided to a single energy density
1352estimator.
1353
1354``spacegrid`` element:
1355
1356  +------------------+---------------------------------+
1357  | parent elements: | ``estimator type=EnergyDensity``|
1358  +------------------+---------------------------------+
1359  | child elements:  | ``origin, axis``                |
1360  +------------------+---------------------------------+
1361
1362attributes:
1363
1364  +----------------------+--------------+--------------+-------------+---------------------------+
1365  | **Name**             | **Datatype** | **Values**   | **Default** | **Description**           |
1366  +======================+==============+==============+=============+===========================+
1367  | ``coord``:math:`^r`  | text         | Cartesian    |             | Specify coordinate system |
1368  +----------------------+--------------+--------------+-------------+---------------------------+
1369  |                      |              | cylindrical  |             |                           |
1370  +----------------------+--------------+--------------+-------------+---------------------------+
1371  |                      |              | spherical    |             |                           |
1372  +----------------------+--------------+--------------+-------------+---------------------------+
1373  |                      |              | Voronoi      |             |                           |
1374  +----------------------+--------------+--------------+-------------+---------------------------+
1375
1376The ``<origin/>`` element gives the location of the origin for a
1377non-Voronoi grid.
1378
1379Additional information:
1380
1381-  ``p1/p2/fraction:`` The location of the origin is set to
1382   ``p1+fraction*(p2-p1)``. If only ``p1`` is provided, the origin is at
1383   ``p1``.
1384
1385``origin`` element:
1386
1387  +------------------+---------------------------------+
1388  | parent elements: | ``spacegrid``                   |
1389  +------------------+---------------------------------+
1390  | child elements:  | *None*                          |
1391  +------------------+---------------------------------+
1392
1393attributes:
1394
1395  +-------------------------+--------------+----------------------------+-------------+------------------------+
1396  | **Name**                | **Datatype** | **Values**                 | **Default** | **Description**        |
1397  +=========================+==============+============================+=============+========================+
1398  | ``p1``:math:`^r`        | text         | ``reference_point.label``  |             | Select end point       |
1399  +-------------------------+--------------+----------------------------+-------------+------------------------+
1400  | ``p2``:math:`^o`        | text         | ``reference_point.label``  |             | Select end point       |
1401  +-------------------------+--------------+----------------------------+-------------+------------------------+
1402  | ``fraction``:math:`^o`  | real         |                            | 0           | Interpolation fraction |
1403  +-------------------------+--------------+----------------------------+-------------+------------------------+
1404
1405The ``<axis/>`` element represents a coordinate axis used to construct the, possibly curved, coordinate system for the histogramming grid.  Three ``<axis/>`` elements must be provided to a non-Voronoi ``<spacegrid/>`` element.
1406
1407``axis`` element:
1408
1409  +------------------+---------------------------------+
1410  | parent elements: | ``spacegrid``                   |
1411  +------------------+---------------------------------+
1412  | child elements:  | *None*                          |
1413  +------------------+---------------------------------+
1414
1415attributes:
1416
1417  +----------------------+--------------+----------------------------+-------------+------------------------+
1418  | **Name**             | **Datatype** | **Values**                 | **Default** | **Description**        |
1419  +======================+==============+============================+=============+========================+
1420  | ``label``:math:`^r`  | text         | *See below*                |             | Axis/dimension label   |
1421  +----------------------+--------------+----------------------------+-------------+------------------------+
1422  | ``grid``:math:`^r`   | text         |                            | "0 1"       | Grid ranges/intervals  |
1423  +----------------------+--------------+----------------------------+-------------+------------------------+
1424  | ``p1``:math:`^r`     | text         | ``reference_point.label``  |             | Select end point       |
1425  +----------------------+--------------+----------------------------+-------------+------------------------+
1426  | ``p2``:math:`^o`     | text         | ``reference_point.label``  |             | Select end point       |
1427  +----------------------+--------------+----------------------------+-------------+------------------------+
1428  | ``scale``:math:`^o`  | real         |                            |             | Interpolation fraction |
1429  +----------------------+--------------+----------------------------+-------------+------------------------+
1430
1431Additional information:
1432
1433-  ``label:`` The allowed set of axis labels depends on the coordinate
1434   system (i.e., ``spacegrid.coord``). Labels are ``x/y/z`` for
1435   ``coord=cartesian``, ``r/phi/z`` for ``coord=cylindrical``,
1436   ``r/phi/theta`` for ``coord=spherical``.
1437
1438-  ``p1/p2/scale:`` The axis vector is set to ``p1+scale*(p2-p1)``. If
1439   only ``p1`` is provided, the axis vector is ``p1``.
1440
1441-  ``grid:`` The grid specifies the histogram grid along the direction
1442   specified by ``label``. The allowed grid points fall in the range
1443   [-1,1] for ``label=x/y/z`` or [0,1] for ``r/phi/theta``. A grid of 10
1444   evenly spaced points between 0 and 1 can be requested equivalently by
1445   ``grid="0 (0.1) 1"`` or ``grid="0 (10) 1."`` Piecewise uniform grids
1446   covering portions of the range are supported, e.g.,
1447   ``grid="-0.7 (10) 0.0 (20) 0.5."``
1448
1449-  Note that ``grid`` specifies the histogram grid along the (curved)
1450   coordinate given by ``label``. The axis specified by ``p1/p2/scale``
1451   does not correspond one-to-one with ``label`` unless ``label=x/y/z``,
1452   but the full set of axes provided defines the (sheared) space on top
1453   of which the curved (e.g., spherical) coordinate system is built.
1454
1455One body density matrix
1456~~~~~~~~~~~~~~~~~~~~~~~
1457
1458The N-body density matrix in DMC is
1459:math:`\hat{\rho}_N=\left|{\Psi_{T}}\rangle{}\langle{\Psi_{FN}}\right|` (for VMC,
1460substitute :math:`\Psi_T` for :math:`\Psi_{FN}`). The one body reduced
1461density matrix (1RDM) is obtained by tracing out all particle
1462coordinates but one:
1463
1464.. math::
1465  :label: eq40
1466
1467  \hat{n}_1 = \sum_nTr_{R_n}\left|{\Psi_{T}}\rangle{}\langle{\Psi_{FN}}\right|
1468
1469In this formula, the sum is over all electron indices and
1470:math:`Tr_{R_n}(*)\equiv\int dR_n\langle{R_n}\left|{*}\right|{R_n}\rangle` with
1471:math:`R_n=[r_1,...,r_{n-1},r_{n+1},...,r_N]`. When the sum is
1472restricted over spin-up or spin-down electrons, one obtains a density
1473matrix for each spin species. The 1RDM computed by is partitioned in
1474this way.
1475
1476In real space, the matrix elements of the 1RDM are
1477
1478.. math::
1479  :label: eq41
1480
1481  \begin{aligned}
1482     n_1(r,r') &= \langle{r}\left|{\hat{n}_1}\right|{r'}\rangle = \sum_n\int dR_n \Psi_T(r,R_n)\Psi_{FN}^*(r',R_n)\:. \end{aligned}
1483
1484A more efficient and compact representation of the 1RDM is obtained by
1485expanding in the SPOs obtained from a Hartree-Fock or DFT calculation,
1486:math:`\{\phi_i\}`:
1487
1488.. math::
1489  :label: eq42
1490
1491  n_1(i,j) &= \langle{\phi_i}\left|{\hat{n}_1}\right|{\phi_j}\rangle \nonumber \\
1492           &= \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)\:.
1493
1494The integration over :math:`r'` in :eq:`eq42` is inefficient when one is also interested in obtaining matrices involving energetic quantities, such as the energy density matrix of :cite:`Krogel2014` or the related (and more well known) generalized Fock matrix.  For this reason, an approximation is introduced as follows:
1495
1496.. math::
1497  :label: eq43
1498
1499  \begin{aligned}
1500      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{aligned}
1501
1502For VMC, FN-DMC, FP-DMC, and RN-DMC this formula represents an exact
1503sampling of the 1RDM corresponding to :math:`\hat{\rho}_N^\dagger` (see
1504appendix A of :cite:`Krogel2014` for more detail).
1505
1506``estimtor type=dm1b`` element:
1507
1508  +------------------+----------------------+
1509  | parent elements: | ``hamiltonian, qmc`` |
1510  +------------------+----------------------+
1511  | child elements:  | *None*               |
1512  +------------------+----------------------+
1513
1514attributes:
1515
1516  +---------------------+--------------+------------+-------------+---------------------------+
1517  | **Name**            | **Datatype** | **Values** | **Default** | **Description**           |
1518  +=====================+==============+============+=============+===========================+
1519  | ``type``:math:`^r`  | text         | **dm1b**   |             | Must be dm1b              |
1520  +---------------------+--------------+------------+-------------+---------------------------+
1521  | ``name``:math:`^r`  | text         | *anything* |             | Unique name for estimator |
1522  +---------------------+--------------+------------+-------------+---------------------------+
1523
1524parameters:
1525
1526  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1527  | **Name**                          | **Datatype**  | **Values**                    | **Default**   | **Description**           |
1528  +===================================+===============+===============================+===============+===========================+
1529  | ``basis``:math:`^r`               | text array    | sposet.name(s)                |               | Orbital basis             |
1530  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1531  | ``integrator``:math:`^o`          | text          | uniform_grid uniform density  | uniform_grid  | Integration method        |
1532  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1533  | ``evaluator``:math:`^o`           | text          | loop/matrix                   | loop          | Evaluation method         |
1534  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1535  | ``scale``:math:`^o`               | real          | :math:`0<scale<1`             | 1.0           | Scale integration cell    |
1536  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1537  | ``center``:math:`^o`              | real array(3) | *any point*                   |               | Center of cell            |
1538  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1539  | ``points``:math:`^o`              | integer       | :math:`>0`                    | 10            | Grid points in each dim   |
1540  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1541  | ``samples``:math:`^o`             | integer       | :math:`>0`                    | 10            | MC samples                |
1542  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1543  | ``warmup``:math:`^o`              | integer       | :math:`>0`                    | 30            | MC warmup                 |
1544  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1545  | ``timestep``:math:`^o`            | real          | :math:`>0`                    | 0.5           | MC time step              |
1546  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1547  | ``use_drift``:math:`^o`           | boolean       | yes/no                        | no            | Use drift in VMC          |
1548  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1549  | ``check_overlap``:math:`^o`       | boolean       | yes/no                        | no            | Print overlap matrix      |
1550  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1551  | ``check_derivatives``:math:`^o`   | boolean       | yes/no                        | no            | Check density derivatives |
1552  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1553  | ``acceptance_ratio``:math:`^o`    | boolean       | yes/no                        | no            | Print accept ratio        |
1554  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1555  | ``rstats``:math:`^o`              | boolean       | yes/no                        | no            | Print spatial stats       |
1556  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1557  | ``normalized``:math:`^o`          | boolean       | yes/no                        | yes           | ``basis`` comes norm'ed   |
1558  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1559  | ``volume_normed``:math:`^o`       | boolean       | yes/no                        | yes           | ``basis`` norm is volume  |
1560  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1561  | ``energy_matrix``:math:`^o`       | boolean       | yes/no                        | no            | Energy density matrix     |
1562  +-----------------------------------+---------------+-------------------------------+---------------+---------------------------+
1563
1564Additional information:
1565
1566-  ``name:`` Density matrix results appear in ``stat.h5`` files labeled
1567   according to ``name``.
1568
1569-  ``basis:`` List ``sposet.name``\ ’s. The total set of orbitals
1570   contained in all ``sposet``\ ’s comprises the basis (subspace) onto
1571   which the one body density matrix is projected. This set of orbitals
1572   generally includes many virtual orbitals that are not occupied in a
1573   single reference Slater determinant.
1574
1575-  ``integrator:`` Select the method used to perform the additional
1576   single particle integration. Options are ``uniform_grid`` (uniform
1577   grid of points over the cell), ``uniform`` (uniform random sampling
1578   over the cell), and ``density`` (Metropolis sampling of approximate
1579   density, :math:`\sum_{b\in \texttt{basis}}\left|{\phi_b}\right|^2`, is not
1580   well tested, please check results carefully!). Depending on the
1581   integrator selected, different subsets of the other input parameters
1582   are active.
1583
1584-  ``evaluator:`` Select for-loop or matrix multiply implementations.
1585   Matrix is preferred for speed. Both implementations should give the
1586   same results, but please check as this has not been exhaustively
1587   tested.
1588
1589-  ``scale:`` Resize the simulation cell by scale for use as an
1590   integration volume (active for ``integrator=uniform/uniform_grid``).
1591
1592-  ``center:`` Translate the integration volume to center at this point
1593   (active for ``integrator=uniform/ uniform_grid``). If ``center`` is
1594   not provided, the scaled simulation cell is used as is.
1595
1596-  ``points:`` Number of grid points in each dimension for
1597   ``integrator=uniform_grid``. For example, ``points=10`` results in a
1598   uniform :math:`10 \times 10 \times 10` grid over the cell.
1599
1600-  ``samples:`` Sets the number of MC samples collected for each step
1601   (active for ``integrator=uniform/ density``).
1602
1603-  ``warmup:`` Number of warmup Metropolis steps at the start of the run
1604   before data collection (active for ``integrator=density``).
1605
1606-  ``timestep:`` Drift-diffusion time step used in Metropolis sampling
1607   (active for ``integrator=density``).
1608
1609-  ``use_drift:`` Enable drift in Metropolis sampling (active for
1610   ``integrator=density``).
1611
1612-  ``check_overlap:`` Print the overlap matrix (computed via simple
1613   Riemann sums) to the log, then abort. Note that subsequent analysis
1614   based on the 1RDM is simplest if the input orbitals are orthogonal.
1615
1616-  ``check_derivatives:`` Print analytic and numerical derivatives of
1617   the approximate (sampled) density for several sample points, then
1618   abort.
1619
1620-  ``acceptance_ratio:`` Print the acceptance ratio of the density
1621   sampling to the log for each step.
1622
1623-  ``rstats:`` Print statistical information about the spatial motion of
1624   the sampled points to the log for each step.
1625
1626-  ``normalized:`` Declare whether the inputted orbitals are normalized
1627   or not. If ``normalized=no``, direct Riemann integration over a
1628   :math:`200 \times 200 \times 200` grid will be used to compute the
1629   normalizations before use.
1630
1631-  ``volume_normed:`` Declare whether the inputted orbitals are
1632   normalized to the cell volume (default) or not (a norm of 1.0 is
1633   assumed in this case). Currently, B-spline orbitals coming from QE
1634   and HEG planewave orbitals native to QMCPACK are known to be volume
1635   normalized.
1636
1637-  ``energy_matrix:`` Accumulate the one body reduced energy density
1638   matrix, and write it to ``stat.h5``. This matrix is not covered in
1639   any detail here; the interested reader is referred to
1640   :cite:`Krogel2014`.
1641
1642.. code-block::
1643  :caption: One body density matrix with uniform grid integration.
1644  :name: Listing 36
1645
1646  <estimator type="dm1b" name="DensityMatrices">
1647    <parameter name="basis"        >  spo_u spo_uv  </parameter>
1648    <parameter name="evaluator"    >  matrix        </parameter>
1649    <parameter name="integrator"   >  uniform_grid  </parameter>
1650    <parameter name="points"       >  4             </parameter>
1651    <parameter name="scale"        >  1.0           </parameter>
1652    <parameter name="center"       >  0 0 0         </parameter>
1653  </estimator>
1654
1655.. code-block::
1656  :caption: One body density matrix with uniform sampling.
1657  :name: Listing 37
1658
1659  <estimator type="dm1b" name="DensityMatrices">
1660    <parameter name="basis"        >  spo_u spo_uv  </parameter>
1661    <parameter name="evaluator"    >  matrix        </parameter>
1662    <parameter name="integrator"   >  uniform       </parameter>
1663    <parameter name="samples"      >  64            </parameter>
1664    <parameter name="scale"        >  1.0           </parameter>
1665    <parameter name="center"       >  0 0 0         </parameter>
1666  </estimator>
1667
1668.. code-block::
1669  :caption: One body density matrix with density sampling.
1670  :name: Listing 38
1671
1672  <estimator type="dm1b" name="DensityMatrices">
1673    <parameter name="basis"        >  spo_u spo_uv  </parameter>
1674    <parameter name="evaluator"    >  matrix        </parameter>
1675    <parameter name="integrator"   >  density       </parameter>
1676    <parameter name="samples"      >  64            </parameter>
1677    <parameter name="timestep"     >  0.5           </parameter>
1678    <parameter name="use_drift"    >  no            </parameter>
1679  </estimator>
1680
1681.. code-block::
1682  :caption: Example ``sposet`` initialization for density matrix use.  Occupied and virtual orbital sets are created separately, then joined (``basis="spo_u spo_uv"``).
1683  :name: Listing 39
1684
1685  <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">
1686    <sposet type="bspline" name="spo_u"  group="0" size="4"/>
1687    <sposet type="bspline" name="spo_d"  group="0" size="2"/>
1688    <sposet type="bspline" name="spo_uv" group="0" index_min="4" index_max="10"/>
1689  </sposet_builder>
1690
1691.. code-block::
1692  :caption: Example ``sposet`` initialization for density matrix use. Density matrix orbital basis created separately (``basis="dm_basis"``).
1693  :name: Listing 40
1694
1695  <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">
1696    <sposet type="bspline" name="spo_u"  group="0" size="4"/>
1697    <sposet type="bspline" name="spo_d"  group="0" size="2"/>
1698    <sposet type="bspline" name="dm_basis" size="50" spindataset="0"/>
1699  </sposet_builder>
1700
1701.. _forward-walking:
1702
1703Forward-Walking Estimators
1704--------------------------
1705
1706Forward walking is a method for sampling the pure fixed-node
1707distribution :math:`\langle \Phi_0 | \Phi_0\rangle`. Specifically, one
1708multiplies each walker’s DMC mixed estimate for the observable
1709:math:`\mathcal{O}`,
1710:math:`\frac{\mathcal{O}(\mathbf{R})\Psi_T(\mathbf{R})}{\Psi_T(\mathbf{R})}`,
1711by the weighting factor
1712:math:`\frac{\Phi_0(\mathbf{R})}{\Psi_T(\mathbf{R})}`. As it turns out,
1713this weighting factor for any walker :math:`\mathbf{R}` is proportional
1714to the total number of descendants the walker will have after a
1715sufficiently long projection time :math:`\beta`.
1716
1717To forward walk on an observable, declare a generic forward-walking
1718estimator within a ``<hamiltonian>`` block, and then specify the
1719observables to forward walk on and the forward-walking parameters. Here
1720is a summary.
1721
1722``estimator type=ForwardWalking`` element:
1723
1724  +------------------+----------------------+
1725  | parent elements: | ``hamiltonian, qmc`` |
1726  +------------------+----------------------+
1727  | child elements:  | ``Observable``       |
1728  +------------------+----------------------+
1729
1730  attributes:
1731
1732    +---------------------+--------------+--------------------+-------------+---------------------------+
1733    | **Name**            | **Datatype** | **Values**         | **Default** | **Description**           |
1734    +=====================+==============+====================+=============+===========================+
1735    | ``type``:math:`^r`  | text         | **ForwardWalking** |             | Must be "ForwardWalking"  |
1736    +---------------------+--------------+--------------------+-------------+---------------------------+
1737    | ``name``:math:`^r`  | text         | *anything*         | any         | Unique name for estimator |
1738    +---------------------+--------------+--------------------+-------------+---------------------------+
1739
1740``Observable`` element:
1741
1742  +------------------+---------------------------------+
1743  | parent elements: | ``estimator, hamiltonian, qmc`` |
1744  +------------------+---------------------------------+
1745  | child elements:  | *None*                          |
1746  +------------------+---------------------------------+
1747
1748    +--------------------------+--------------+---------------+-------------+---------------------------------------------------------------------------------+
1749    | **Name**                 | **Datatype** | **Values**    | **Default** | **Description**                                                                 |
1750    +==========================+==============+===============+=============+=================================================================================+
1751    | ``name``:math:`^r`       | text         | *anything*    | any         | Registered name of existing estimator on which to forward walk                  |
1752    +--------------------------+--------------+---------------+-------------+---------------------------------------------------------------------------------+
1753    | ``max``:math:`^r`        | integer      | :math:`>0`    |             | Maximum projection time in steps (``max``:math:`=\beta/\tau`)                   |
1754    +--------------------------+--------------+---------------+-------------+---------------------------------------------------------------------------------+
1755    | ``frequency``:math:`^r`  | text         | :math:`\geq 1`|             | Dump data only for every ``frequency``-th to ``scalar.dat`` file                |
1756    +--------------------------+--------------+---------------+-------------+---------------------------------------------------------------------------------+
1757
1758Additional information:
1759
1760-  **Cost**: Because histories of observables up to ``max`` time steps
1761   have to be stored, the memory cost of storing the nonforward-walked
1762   observables variables should be multiplied by :math:`\texttt{max}`.
1763   Although this is not an issue for items such as potential energy, it
1764   could be prohibitive for observables such as density, forces, etc.
1765
1766-  **Naming Convention**: Forward-walked observables are automatically
1767   named ``FWE_name_i``, where ``i`` is the forward-walked expectation
1768   value at time step ``i``, and ``name`` is whatever name appears in
1769   the ``<Observable>`` block. This is also how it will appear in the
1770   ``scalar.dat`` file.
1771
1772In the following example case, QMCPACK forward walks on the potential
1773energy for 300 time steps and dumps the forward-walked value at every
1774time step.
1775
1776.. code-block::
1777  :caption: Forward-walking estimator element.
1778  :name: Listing 41
1779
1780  <estimator name="fw" type="ForwardWalking">
1781      <Observable name="LocalPotential" max="300" frequency="1"/>
1782       <!--- Additional Observable blocks go here -->
1783   </estimator>
1784
1785.. _force-est:
1786
1787"Force" estimators
1788------------------
1789
1790QMCPACK supports force estimation by use of the Chiesa-Ceperly-Zhang
1791(CCZ) estimator. Currently, open and periodic boundary conditions are
1792supported but for all-electron calculations only.
1793
1794Without loss of generality, the CCZ estimator for the z-component of the
1795force on an ion centered at the origin is given by the following
1796expression:
1797
1798.. math::
1799  :label: eq44
1800
1801  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]\:.
1802
1803Z is the ionic charge, :math:`M` is the degree of the smoothing
1804polynomial, :math:`\mathcal{R}` is a real-space cutoff of the sphere
1805within which the bare-force estimator is smoothed, and :math:`c_\ell`
1806are predetermined coefficients. These coefficients are chosen to
1807minimize the weighted mean square error between the bare force estimate
1808and the s-wave filtered estimator. Specifically,
1809
1810.. math::
1811  :label: eq45
1812
1813  \chi^2 = \int_0^\mathcal{R}dr\,r^m\,[f_z(r) - \tilde{f}_z(r)]^2\:.
1814
1815Here, :math:`m` is the weighting exponent, :math:`f_z(r)` is the
1816unfiltered radial force density for the z force component, and
1817:math:`\tilde{f}_z(r)` is the smoothed polynomial function for the same
1818force density. The reader is invited to refer to the original paper for
1819a more thorough explanation of the methodology, but with the notation in
1820hand, QMCPACK takes the following parameters.
1821
1822``estimator type=Force`` element:
1823
1824  +------------------+----------------------+
1825  | parent elements: | ``hamiltonian, qmc`` |
1826  +------------------+----------------------+
1827  | child elements:  | ``parameter``        |
1828  +------------------+----------------------+
1829
1830  attributes:
1831
1832    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1833    | **Name**                 | **Datatype** | **Values**      | **Default** | **Description**                                              |
1834    +==========================+==============+=================+=============+==============================================================+
1835    | ``mode``:math:`^o`       | text         | *See above*     | bare        | Select estimator type                                        |
1836    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1837    | ``lrmethod``:math:`^o`   | text         | ewald or srcoul | ewald       | Select long-range potential breakup method                   |
1838    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1839    | ``type``:math:`^r`       | text         | Force           |             | Must be "Force"                                              |
1840    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1841    | ``name``:math:`^o`       | text         | *Anything*      | ForceBase   | Unique name for this estimator                               |
1842    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1843    | ``pbc``:math:`^o`        | boolean      | yes/no          | yes         | Using periodic BCs or not                                    |
1844    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1845    | ``addionion``:math:`^o`  | boolean      | yes/no          | no          | Add the ion-ion force contribution to output force estimate  |
1846    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1847
1848  parameters:
1849
1850    +--------------------------+--------------+------------+-------------+----------------------------------------------------------+
1851    | **Name**                 | **Datatype** | **Values** | **Default** | **Description**                                          |
1852    +==========================+==============+============+=============+==========================================================+
1853    | ``rcut``:math:`^o`       | real         | :math:`>0` | 1.0         | Real-space cutoff :math:`\mathcal{R}` in bohr            |
1854    +--------------------------+--------------+------------+-------------+----------------------------------------------------------+
1855    | ``nbasis``:math:`^o`     | integer      | :math:`>0` | 2           | Degree of smoothing polynomial :math:`M`                 |
1856    +--------------------------+--------------+------------+-------------+----------------------------------------------------------+
1857    | ``weightexp``:math:`^o`  | integer      | :math:`>0` | 2           | :math:`\chi^2` weighting exponent :math`m`               |
1858    +--------------------------+--------------+------------+-------------+----------------------------------------------------------+
1859
1860Additional information:
1861
1862-  **Naming Convention**: The unique identifier ``name`` is appended
1863   with ``name_X_Y`` in the ``scalar.dat`` file, where ``X`` is the ion
1864   ID number and ``Y`` is the component ID (an integer with x=0, y=1,
1865   z=2). All force components for all ions are computed and dumped to
1866   the ``scalar.dat`` file.
1867
1868-  **Long-range breakup**: With periodic boundary conditions, it is
1869   important to converge the lattice sum when calculating Coulomb
1870   contribution to the forces. As a quick test, increase the
1871   ``LR_dim_cutoff`` parameter until ion-ion forces are converged. The
1872   Ewald method converges more slowly than optimized method, but the
1873   optimized method can break down in edge cases, eg. too large
1874   ``LR_dim_cutoff``.
1875
1876-  **Miscellaneous**: Usually, the default choice of ``weightexp`` is
1877   sufficient. Different combinations of ``rcut`` and ``nbasis`` should
1878   be tested though to minimize variance and bias. There is, of course,
1879   a tradeoff, with larger ``nbasis`` and smaller ``rcut`` leading to
1880   smaller biases and larger variances.
1881
1882The following is an example use case.
1883
1884::
1885
1886  <simulationcell>
1887    ...
1888    <parameter name="LR_handler">  opt_breakup_original  </parameter>
1889    <parameter name="LR_dim_cutoff">  20  </parameter>
1890  </simulationcell>
1891  <hamiltonian>
1892    <estimator name="F" type="Force" mode="cep" addionion="yes">
1893      <parameter name="rcut">0.1</parameter>
1894      <parameter name="nbasis">4</parameter>
1895      <parameter name="weightexp">2</parameter>
1896    </estimator>
1897  </hamiltonian>
1898
1899.. _stress-est:
1900
1901Stress estimators
1902------------------
1903
1904QMCPACK takes the following parameters.
1905
1906  +------------------+----------------------+
1907  | parent elements: | ``hamiltonian``      |
1908  +------------------+----------------------+
1909
1910  attributes:
1911
1912    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1913    | **Name**                 | **Datatype** | **Values**      | **Default** | **Description**                                              |
1914    +==========================+==============+=================+=============+==============================================================+
1915    | ``mode``:math:`^r`       | text         | stress          | bare        | Must be "stress"                                             |
1916    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1917    | ``type``:math:`^r`       | text         | Force           |             | Must be "Force"                                              |
1918    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1919    | ``source``:math:`^r`     | text         | ion0            |             | Name of ion particleset                                      |
1920    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1921    | ``name``:math:`^o`       | text         | *Anything*      | ForceBase   | Unique name for this estimator                               |
1922    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1923    | ``addionion``:math:`^o`  | boolean      | yes/no          | no          | Add the ion-ion stress contribution to output                |
1924    +--------------------------+--------------+-----------------+-------------+--------------------------------------------------------------+
1925
1926Additional information:
1927
1928-  **Naming Convention**: The unique identifier ``name`` is appended
1929   with ``name_X_Y`` in the ``scalar.dat`` file, where ``X`` and ``Y``
1930   are the component IDs (an integer with x=0, y=1, z=2).
1931
1932-  **Long-range breakup**: With periodic boundary conditions, it is
1933   important to converge the lattice sum when calculating Coulomb
1934   contribution to the forces. As a quick test, increase the
1935   ``LR_dim_cutoff`` parameter until ion-ion stresses are converged.
1936   Check using QE "Ewald contribution", for example. The stress
1937   estimator is implemented only with the Ewald method.
1938
1939The following is an example use case.
1940
1941::
1942
1943  <simulationcell>
1944    ...
1945    <parameter name="LR_handler">  ewald  </parameter>
1946    <parameter name="LR_dim_cutoff">  45  </parameter>
1947  </simulationcell>
1948  <hamiltonian>
1949    <estimator name="S" type="Force" mode="stress" source="ion0"/>
1950  </hamiltonian>
1951
1952.. bibliography:: /bibs/hamiltonianobservable.bib
1953