1.. _lab-advanced-molecules:
2
3Lab 3: Advanced molecular calculations
4======================================
5
6Topics covered in this lab
7--------------------------
8
9This lab covers molecular QMC calculations with wavefunctions of increasing sophistication.  All of the trial wavefunctions are initially generated with the GAMESS code.  Topics covered include:
10
11-  Generating single-determinant trial wavefunctions with GAMESS (HF and
12   DFT)
13
14-  Generating multideterminant trial wavefunctions with GAMESS (CISD,
15   CASCI, and SOCI)
16
17-  Optimizing wavefunctions (Jastrow factors and CSF coefficients) with
18   QMC
19
20-  DMC time step and walker population convergence studies
21
22-  Systematic progressions of Jastrow factors in VMC
23
24-  Systematic convergence of DMC energies with multideterminant
25   wavefunctions
26
27-  Influence of orbitals basis choice on DMC energy
28
29Lab directories and files
30-------------------------
31
32::
33
34  abs/lab3_advanced_molecules/exercises
3536  ├── ex1_first-run-hartree-fock    - basic work flow from Hatree-Fock to DMC
37  │   ├── gms                        - Hatree-Fock calculation using GAMESS
38  │   │   ├── h2o.hf.inp               - GAMESS input
39  │   │   ├── h2o.hf.dat               - GAMESS punch file containing orbitals
40  │   │   └── h2o.hf.out               - GAMESS output with orbitals and other info
41  │   ├── convert                    - Convert GAMESS wavefunction to QMCPACK format
42  │   │   ├── h2o.hf.out               - GAMESS output
43  │   │   ├── h2o.ptcl.xml             - converted particle positions
44  │   │   └── h2o.wfs.xml              - converted wave function
45  │   ├── opt                        - VMC optimization
46  │   │   └── optm.xml                 - QMCPACK VMC optimization input
47  │   ├── dmc_timestep               - Check DMC timestep bias
48  │   │   └── dmc_ts.xml               - QMCPACK DMC input
49  │   └── dmc_walkers                - Check DMC population control bias
50  │       └── dmc_wk.xml               - QMCPACK DMC input template
5152  ├── ex2_slater-jastrow-wf-options - explore jastrow and orbital options
53  │   ├── jastrow                    - Jastrow options
54  │   │   ├── 12j                      - no 3-body Jastrow
55  │   │   ├── 1j                       - only 1-body Jastrow
56  │   │   └── 2j                       - only 2-body Jastrow
57  │   └── orbitals                   - Orbital options
58  │       ├── pbe                      - PBE orbitals
59  │       │   └── gms                    - DFT calculation using GAMESS
60  │       │      └── h2o.pbe.inp          - GAMESS DFT input
61  │       ├── pbe0                     - PBE0  orbitals
62  │       ├── blyp                     - BLYP  orbitals
63  │       └── b3lyp                    - B3LYP orbitals
6465  ├── ex3_multi-slater-jastrow
66  │   ├── cisd                      - CISD wave function
67  │   │   ├── gms                     - CISD calculation using GAMESS
68  │   │   │   ├── h2o.cisd.inp           - GAMESS input
69  │   │   │   ├── h2o.cisd.dat           - GAMESS punch file containing orbitals
70  │   │   │   └── h2o.cisd.out           - GAMESS output with orbitals and other info
71  │   │   └── convert                 - Convert GAMESS wavefunction to QMCPACK format
72  │   │      └── h2o.hf.out             - GAMESS output
73  │   ├── casci                     - CASCI wave function
74  │   │   └── gms                     - CASCI calculation using GAMESS
75  │   └── soci                      - SOCI wave function
76  │       ├── gms                     - SOCI calculation using GAMESS
77  │       ├── thres0.01               - VMC optimization with few determinants
78  │       └── thres0.0075             - VMC optimization with more determinants
7980  └── pseudo
81      ├── H.BFD.gamess             - BFD pseudopotential for H in GAMESS format
82      ├── O.BFD.CCT.gamess         - BFD pseudopotential for O in GAMESS format
83      ├── H.xml                    - BFD pseudopotential for H in QMCPACK format
84      └── O.xml                    - BFD pseudopotential for H in QMCPACK format
85
86Exercise #1: Basics
87-------------------
88
89The purpose of this exercise is to show how to generate wavefunctions for QMCPACK
90using GAMESS and to optimize the resulting wavefunctions using VMC. This will be
91followed by a study of the time step and walker population dependence of DMC energies.
92The exercise will be performed on a water molecule at the equilibrium geometry.
93
94Generation of a Hartree-Fock wavefunction with GAMESS
95-----------------------------------------------------
96
97From the top directory, go to “``ex1_first-run-hartree-fock/gms``.” This
98directory contains an input file for a HF calculation of a water
99molecule using BFD ECPs and the corresponding cc-pVTZ basis set. The
100input file should be named: “h2o.hf.inp.” Study the input file. See
101Section :ref:`lab-adv-mol-gamess` for a
102more detailed description of the GAMESS input syntax. However, there
103will be a better time to do this soon, so we recommend continuing with
104the exercise at this point. After you are done, execute GAMESS with this
105input and store the standard output in a file named “h2o.hf.output.106Finally, in the “convert” folder, use ``convert4qmc`` to generate the
107QMCPACK ``particleset`` and ``wavefunction`` files. It is always useful
108to rename the files generated by ``convert4qmc`` to something meaningful
109since by default they are called ``sample.Gaussian-G2.xml`` and
110``sample.Gaussian-G2.ptcl.xml``. In a standard computer (without
111cross-compilation), these tasks can be accomplished by the following
112commands.
113
114::
115
116  cd ${TRAINING TOP}/ex1_first-run-hartree-fock/gms
117  jobrun_vesta rungms h2o.hf
118  cd ../convert
119  cp ../gms/h2o.hf.output
120  jobrun_vesta convert4qmc -gamess h2o.hf.output -add3BodyJ
121  mv sample.Gaussian-G2.xml h2o.wfs.xml
122  mv sample.Gaussian-G2.ptcl.xml h2o.ptcl.xml
123
124The HF energy of the
125system is -16.9600590022 Ha. To search for the energy in the output file quickly, you can
126use
127
128::
129
130  grep "TOTAL ENERGY =" h2o.hf.output
131
132As the job runs on VESTA, it is a good time to review
133Section :ref`lab-adv-mol-convert4qmc`, “Appendix B: convert4qmc,"
134which contains a description on the use of the converter.
135
136Optimize the wavefunction
137~~~~~~~~~~~~~~~~~~~~~~~~~
138
139When execution of the previous steps is completed, there should be two
140new files called ``h2o.wfs.xml`` and ``h2o.ptcl.xml``. Now we will use
141VMC to optimize the Jastrow parameters in the wavefunction. From the top
142directory, go to “``ex1_first-run-hartree-fock/opt``.” Copy the xml
143files generated in the previous step to the current directory. This
144directory should already contain a basic QMCPACK input file for an
145optimization calculation (``optm.xml``) Open ``optm.xml`` with your
146favorite text editor and modify the name of the files that contain the
147``wavefunction`` and ``particleset`` XML blocks. These files are
148included with the commands:
149
150::
151
152  <include href=ptcl.xml/>
153  <include href=wfs.xml/>
154
155(the particle set must be defined before the wavefunction). The name of
156the particle set and wavefunction files should now be ``h2o.ptcl.xml``
157and ``h2o.wfs.xml``, respectively. Study both files and submit when you
158are ready. Notice that the location of the ECPs has been set for you; in
159your own calculations you have to make sure you obtain the ECPs from the
160appropriate libraries and convert them to QMCPACK format using
161ppconvert. While these calculations finish is a good time to study
162:ref:`lab-adv-mol-opt-appendix`, which contains a review of the main parameters
163in the optimization XML block. The previous steps can be accomplished by
164the following commands:
165
166::
167
168  cd ${TRAINING TOP}/ex1_first-run-hartree-fock/opt
169  cp ../convert/h2o.wfs.xml ./
170  cp ../convert/h2o.ptcl.xml ./
171  # edit optm.xml to include the correct ptcl.xml and wfs.xml
172  jobrun_vesta qmcpack optm.xml
173
174Use the analysis tool ``qmca`` to analyze the results of the
175calculation. Obtain the VMC energy and variance for each step in the
176optimization and plot it using your favorite program. Remember that
177``qmca`` has built-in functions to plot the analyzed data.
178
179::
180
181  qmca -q e *scalar.dat -p
182
183The resulting energy as a function of the optimization step should look
184qualitatively similar to :numref:`fig17`. The energy should
185decrease quickly as a function of the number of optimization steps.
186After 6–8 steps, the energy should be converged to :math:`\sim`\ 2–3
187mHa. To improve convergence, we would need to increase the number of
188samples used during optimization (You can check this for yourself
189later.). With optimized wavefunctions, we are in a position to perform
190VMC and DMC calculations. The modified wavefunction files after each
191step are written in a file named ``ID.sNNN.opt.xml``, where ID is the
192identifier of the calculation defined in the input file (this is defined
193in the project XML block with parameter “id”) and NNN is a series number
194that increases with every executable xml block in the input file.
195
196.. _fig17:
197.. figure:: /figs/lab_advanced_molecules_opt_conv.png
198  :width: 500
199  :align: center
200
201  VMC energy as a function of optimization step.
202
203Time-step study
204~~~~~~~~~~~~~~~
205
206Now we will study the dependence of the DMC energy with time step. From
207the top directory, go to “``ex1_first-run-hartree-fock/dmc_timestep``.”
208This folder contains a basic XML input file (``dmc_ts.xml``) that
209performs a short VMC calculation and three DMC calculations with varying
210time steps (0.1, 0.05, 0.01). Link the ``particleset`` and the last
211``optimization`` file from the previous folder (the file called
212``jopt-h2o.sNNN.opt.xml`` with the largest value of NNN). Rename the
213optimized ``wavefunction`` file to any suitable name if you wish (for
214example, ``h2o.opt.xml``) and change the name of the ``particleset`` and
215``wavefunction`` files in the input file. An optimized wavefunction can
216be found in the reference files (same location) in case it is needed.
217
218The main steps needed to perform this exercise are:
219
220::
221
222  cd \$\{TRAINING TOP\}/ex1_first-run-hartree-fock/dmc_timestep
223  cp ../opt/h2o.ptcl.xml ./
224  cp ../opt/jopt-h2o.s007.opt.xml h2o.opt.wfs.xml
225  # edit dmc_ts.xml to include the correct ptcl.xml and wfs.xml
226  jobrun_vesta qmcpack dmc_ts.xml
227
228While these runs complete, go to
229:ref:`lab-adv-mol-vmcdmc-appendix`  and review the basic VMC and DMC input blocks. Notice that
230in the current DMC blocks the time step is decreased as the number of
231blocks is increased. Why is this?
232
233When the simulations are finished, use ``qmca`` to analyze the output
234files and plot the DMC energy as a function of time step. Results should
235be qualitatively similar to those presented in
236:numref:`fig18`; in this case we present more time
237steps with well converged results to better illustrate the time step
238dependence. In realistic calculations, the time step must be chosen
239small enough so that the resulting error is below the desired accuracy.
240Alternatively, various calculations can be performed and the results
241extrapolated to the zero time-step limit.
242
243.. _fig18:
244.. figure:: /figs/lab_advanced_molecules_dmc_timestep.png
245  :width: 500
246  :align: center
247
248  DMC energy as a function of time step.
249
250Walker population study
251~~~~~~~~~~~~~~~~~~~~~~~
252
253Now we will study the dependence of the DMC energy with the number of
254walkers in the simulation. Remember that, in principle, the DMC
255distribution is reached in the limit of an infinite number of walkers.
256In practice, the energy and most properties converge to high accuracy
257with :math:`\sim`\ 100–1,000 walkers. The actual number of walkers
258needed in a calculation will depend on the accuracy of the VMC
259wavefunction and on the complexity and size of the system. Also notice
260that using too many walkers is not a problem; at worse it will be
261inefficient since it will cost more computer time than necessary. In
262fact, this is the strategy used when running QMC calculations on large
263parallel computers since we can reduce the statistical error bars
264efficiently by running with large walker populations distributed across
265all processors.
266
267From the top directory, go to
268“``ex1_first-run-hartree-fock/dmc_walkers``.” Copy the optimized
269``wavefunction`` and ``particleset`` files used in the previous
270calculations to the current folder; these are the files generated during
271step 2 of this exercise. An optimized ``wavefunction`` file can be found
272in the reference files (same location) in case it is needed. The
273directory contains a sample DMC input file and submission script. Create
274three directories named NWx, with x values of 120,240,480, and copy the
275input file to each one. Go to “NW120,” and, in the input file, change
276the name of the ``wavefunction`` and ``particleset`` files (in this case
277they will be located one directory above, so use
278“``../dmc_timestep/h2.opt.xml``,” for example); change the PP directory
279so that it points to one directory above; change “targetWalkers” to 120;
280and change the number of steps to 100, the time step to 0.01, and the
281number of blocks to 400. Notice that “targetWalkers” is one way to set
282the desired (average) number of walkers in a DMC calculation. One can
283alternatively set “samples” in the ``<qmc method="vmc"`` block to carry over de-correlated VMC
284configurations as DMC walkers. For your own simulations, we generally
285recommend setting :math:`\sim`\ 2*(#threads) walkers per node (slightly
286smaller than this value).
287
288The main steps needed to perform this exercise are
289
290::
291
292  cd ${TRAINING TOP}/ex1_first-run-hartree-fock/dmc_walkers
293  cp ../opt/h2o.ptcl.xml ./
294  cp ../opt/jopt-h2o.s007.opt.xml h2o.opt.wfs.xml
295  # edit dmc_wk.xml to include the correct ptcl.xml and wfs.xml and
296  #  use the correct pseudopotential directory
297  mkdir NW120
298  cp dmc_wk.xml NW120
299  # edit dmc_wk.xml to use the desired number of walkers,
300  #  and collect the desired amount of statistics
301  jobrun_vesta qmcpack dmc_wk.xml
302  # repeat for NW240, NW480
303
304Repeat the same procedure in the other folders by setting
305(targetWalkers=240, steps=100, timestep=0.01, blocks=200) in NW240 and
306(targetWalkers=480, steps=100, timestep=0.01, blocks=100) in NW480. When
307the simulations complete, use ``qmca`` to analyze and plot the energy as
308a function of the number of walkers in the calculation. As always,
309:numref:`fig19` shows representative results of the
310energy dependence on the number of walkers for a single water molecule.
311As shown, less than 240 walkers are needed to obtain an accuracy of 0.1
312mHa.
313
314.. _fig19:
315.. figure:: /figs/lab_advanced_molecules_dmc_popcont.png
316  :width: 500
317  :align: center
318
319  DMC energy as a function of the average number of walkers.
320
321Exercise #2: Slater-Jastrow wavefunction options
322------------------------------------------------
323
324From this point on in the tutorial we assume familiarity with the basic
325parameters in the optimization, VMC, and DMC XML input blocks of
326QMCPACK. In addition, we assume familiarity with the submission system.
327As a result, the folder structure will not contain any prepared input or
328submission files, so you will need to generate them using input files
329from exercise 1. In the case of QMCPACK sample files, you will find
330``optm.xml``, ``vmc dmc.xml``, and ``submit.csh files``. Some of the
331options in these files can be left unaltered, but many of them will need
332to be tailored to the particular calculation.
333
334In this exercise we will study the dependence of the DMC energy on the
335choices made in the wavefunction ansatz. In particular, we will study
336the influence/dependence of the VMC energy with the various terms in the
337Jastrow. We will also study the influence of the VMC and DMC energies on
338the SPOs used to form the Slater determinant in single-determinant
339wavefunctions. For this we will use wavefunctions generated with various
340exchange-correlation functionals in DFT. Finally, we will optimize a
341simple multideterminant wavefunction and study the dependence of the
342energy on the number of configurations used in the expansion. All of
343these exercises will be performed on the water molecule at equilibrium.
344
345Influence of Jastrow on VMC energy with HF wavefunction
346~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
347
348In this section we will study the dependence of the VMC energy on the
349various Jastrow terms (e.g., 1-body, 2-body and 3-body. From the top
350directory, go to “\ ``ex2_slater-jastrow-wf-options/jastrow.”`` We will
351compare the single-determinant VMC energy using a 2-body Jastrow term,
352both 1- and 2-body terms, and finally 1-, 2- and 3-body terms. Since we
353are interested in the influence of the Jastrow, we will use the HF
354orbitals calculated in exercise #1. Make three folders named 2j, 12j,
355and 123j. For both 2j and 12j, copy the input file ``optm.xml`` from
356“``ex1_first-run-hartree-fock/opt.``” This input file performs both
357wavefunction optimization and a VMC calculation. Remember to correct
358relative paths to the PP directory. Copy the un-optimized HF
359``wavefunction`` and ``particleset`` files from
360“``ex1_first-run-hartree-fock/convert``”; if you followed the
361instructions in exercise #1 these should be named ``h2o.wfs.xml`` and
362``h2o.ptcl.xml``. Otherwise, you can obtained them from the REFERENCE
363files. Modify the ``h2o.wfs.xml`` file to remove the appropriate Jastrow
364blocks. For example, for a 2-body Jastrow (only), you need to eliminate
365the Jastrow blocks named ``<jastrow name="J1"`` and ``<jastrow name="J3."`` In
366the case of 12j, remove only ``<jastrow name="J3."`` Recommended settings
367for the optimization run are nodes=32, threads=16, blocks=250,
368samples=128000, time-step=0.5, 8 optimization loops. Recommended
369settings in the VMC section are walkers=16, blocks=1000, steps=1,
370substeps=100. Notice that samples should always be set to blocks*threads
371per node*nodes = 32*16*250=128000. Repeat the process in both 2j and 12j
372cases. For the 123j case, the wavefunction has already been optimized in
373the previous exercise. Copy the optimized HF wavefunction and the
374particleset from “``ex1_first-run-hartree-fock/opt.``” Copy the input
375file from any of the previous runs and remove the optimization block
376from the input, just leave the VMC step. In all three cases, modify the
377submission script and submit the run.
378
379Because these simulations will take several minutes to complete, this is
380an excellent opportunity to go to
381:ref:`lab-adv-mol-wf-appendix` and review the wavefunction XML block used by QMCPACK. When the
382simulations are completed, use ``qmca`` to analyze the output files.
383Using your favorite plotting program (e.g., gnu plot), plot the energy
384and variance as a function of the Jastrow form.
385:numref:`fig20` shows a typical result for this
386calculation. As can be seen, the VMC energy and variance depends
387strongly on the form of the Jastrow. Since the DMC error bar is directly
388related to the variance of the VMC energy, improving the Jastrow will
389always lead to a reduction in the DMC effort. In addition, systematic
390approximations (time step, number of walkers, etc.) are also reduced
391with improved wavefunctions.
392
393.. _fig20:
394.. figure:: /figs/lab_advanced_molecules_vmc_jastrow.png
395  :width: 500
396  :align: center
397
398  VMC energy as a function of Jastrow type.
399
400Generation of wavefunctions from DFT using GAMESS
401~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
402
403In this section we will use GAMESS to generate wavefunctions for QMCPACK
404from DFT calculations. From the top folder, go to
405“``ex2_slater-jastrow-wf-options/orbitals``.” To demonstrate the
406variation in DMC energies with the choice of DFT orbitals, we will
407choose the following set of exchange-correlation functionals (PBE, PBE0,
408BLYP, B3LYP). For each functional, make a directory using your preferred
409naming convention (e.g., the name of the functional). Go into each
410folder and copy a GAMESS input file from
411“``ex1_first-run-hartree-fock/gms``.” Rename the file with your
412preferred naming convention; we suggest using ``h2o.[dft].inp``, where
413[dft] is the name of the functional used in the calculation. At this
414point, this input file should be identical to the one used to generate
415the HF wavefunction in exercise #1. To perform a DFT calculation we only
416need to add “DFTTYP” to the ``$CONTRL ... $END`` section and set it to the desired functional
417type, for example, “DFTTYP=PBE” for a PBE functional. This variable must
418be set to (PBE, PBE0, BLYP, B3LYP) to obtain the appropriate functional
419in GAMESS. For a complete list of implemented functionals, see the
420GAMESS input manual.
421
422Optimization and DMC calculations with DFT wavefunctions
423~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
424
425In this section we will optimize the wavefunction generated in the
426previous step and perform DMC calculations. From the top directory, go
427to “``ex2_slater-jastrow-wf-options/orbitals``.” The steps required to
428achieve this are identical to those used to optimize the wavefunction
429with HF orbitals. Make individual folders for each calculation and
430obtain the necessary files to perform optimization, for example, VMC and
431DMC calculations from “for ``ex1_first-run-hartree-fock/opt``” and
432“``ex1_first-run-hartree-fock/dmc_ts``.” For each functional, make the
433appropriate modifications to the input files and copy the
434``particleset`` and ``wavefunction`` files from the appropriate
435directory in “``ex2_slater-jastrow-wf-options/orbitals/[dft]``.” We
436recommend the following settings: nodes=32, threads=16, (in
437optimization) blocks=250, samples=128000, timestep=0.5, 8 optimization
438loops, (in VMC) walkers=16, blocks=100, steps=1, substeps=100, (in DMC)
439blocks 400, targetWalkers=960, and timestep=0.01. Submit the runs and
440analyze the results using ``qmca``.
441
442How do the energies compare against each other? How do they compare
443against DMC energies with HF orbitals?
444
445Exercise #3: Multideterminant wavefunctions
446-------------------------------------------
447
448In this exercise we will study the dependence of the DMC energy on the set of orbitals
449and the type of configurations included in a multideterminant wavefunction.
450
451Generation of a CISD wavefunctions using GAMESS
452~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
453
454In this section we will use GAMESS to generate a multideterminant
455wavefunction with configuration interaction with single and double
456excitations (CISD). In CISD, the Schrodinger equation is solved exactly
457on a basis of determinants including the HF determinant and all its
458single and double excitations.
459
460Go to “``ex3_multi-slater-jastrow/cisd/gms``” and you will see input and
461output files named ``h2o.cisd.inp`` and ``h2o.cisd.out``. Because of
462technical problems with GAMESS in the BGQ architecture of VESTA, we are
463unable to use CISD properly in GAMESS. Consequently, the output of the
464calculation is already provided in the directory.
465
466There will be time in the next step to study the GAMESS input files and
467the description in :ref:`lab-adv-mol-gamess`. Since the output is already provided, the only action
468needed is to use the converter to generate the appropriate QMCPACK
469files.
470
471::
472
473  jobrun_vesta convert4qmc h2o.cisd.out -ci h2o.cisd.out \
474  -readInitialGuess 57 -threshold 0.0075
475
476We used the PRTMO=.T. flag in the GUESS section to include orbitals in
477the output file. You should read these orbitals from the output
478(-readInitialGuess 40). The highest occupied orbital in any determinant
479should be 34, so reading 40 orbitals is a safe choice. In this case, it
480is important to rename the XML files with meaningful names, for example,
481``h2o.cisd.wfs.xml``. A threshold of 0.0075 is sufficient for the
482calculations in the training.
483
484Optimization of a multideterminant wavefunction
485~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
486
487In this section we will optimize the wavefunction generated in the
488previous step. There is no difference in the optimization steps if a
489single determinant and a multideterminant wavefunction. QMCPACK will
490recognize the presence of a multideterminant wavefunction and will
491automatically optimize the linear coefficients by default. Go to
492“``ex3_multi-slater-jastrow/cisd``” and make a folder called
493``thres0.01``. Copy the ``particleset`` and ``wavefunction`` files
494created in the previous step to the current directory. With your
495favorite text editor, open the ``wavefunction`` file ``h2o.wfs.xml``.
496Look for the multideterminant XML block and change the “cutoff”
497parameter in detlist to 0.01. Then follow the same steps used in Section
4989.4.3, “Optimization and DMC calculations with DFT wavefunctions” to
499optimize the wavefunction. Similar to this case, design a QMCPACK input
500file that performs wavefunction optimization followed by VMC and DMC
501calculations. Submit the calculation.
502
503This is a good time to review the GAMESS input file description in
504:ref:`lab-adv-mol-gamess`, go to the previous directory and make a new folder
505named ``thres0.0075``. Repeat the previous steps to optimize the
506wavefunction with a cutoff of 0.01, but use a cutoff of 0.0075 this
507time. This will increase the number of determinants used in the
508calculation. Notice that the “cutoff” parameter in the XML should be
509less than the “-threshold 0.0075” flag passed to the converted, which is
510further bounded by the PRTTOL flag in the GAMESS input.
511
512After the wavefunction is generated, we are ready to optimize. Instead of starting from an un-optimized wavefunction, we can start from the optimized wavefunction from thres0.01 to speed up convergence. You will need to modify the file and change the cutoff in detlist to 0.0075 with a text editor. Repeat the optimization steps and submit the calculation.
513
514When you are done, use ``qmca`` to analyze the results. Compare the energies at these two
515coefficient cutoffs with the energies obtained with DFT orbitals. Because of the time limitations of this tutorial, it is not practical to optimize the wavefunctions with a smaller cutoff since this would require more samples and longer runs due to the larger number of optimizable parameters. :numref:`fig21` shows the results of such exercise: the DMC energy as a function of the cutoff in the wavefunction. As can be seen, a large improvement in the energy is obtained as the number of configurations is increased.
516
517
518.. _fig21:
519.. figure:: /figs/lab_advanced_molecules_dmc_ci_cisd.png
520  :width: 500
521  :align: center
522
523  DMC energy as a function of the sum of the square of CI coefficients from CISD.
524
525CISD, CASCI, and SOCI
526~~~~~~~~~~~~~~~~~~~~~
527
528Go to “``ex3_multi-slater-jastrow``” and inspect the folders for the
529remaining wavefunction types: CASCI and SOCI. Follow the steps in the
530previous exercise and obtain the optimized wavefunctions for these
531determinant choices. Notice that the SOCI GAMESS output is not included
532because it is large. Already converted XML inputs can be found in
533“``ex3_multi-slater-jastrow/soci/thres*``.”
534
535A CASCI wavefunction is produced from a CI calculation that includes all
536the determinants in a complete active space (CAS) calculation, in this
537case using the orbitals from a previous CASSCF calculation. In this case
538we used a CAS(8,8) active space that includes all determinants generated
539by distributing 8 electrons in the lowest 8 orbitals. A SOCI calculation
540is similar to the CAS-CI calculation, but in addition to the
541determinants in the CAS it also includes all single and double
542excitations from all of them, leading to a much larger determinant set.
543Since you now have considerable experience optimizing wavefunctions and
544calculating DMC energies, we will leave it to you to complete the
545remaining tasks on your own. If you need help, refer to previous
546exercises in the tutorial. Perform optimizations for both wavefunctions
547using cutoffs in the CI expansion of 0.01 an 0.0075. If you have time,
548try to optimize the wavefunctions with a cutoff of 0.005. Analyze the
549results and plot the energy as a function of cutoff for all three cases:
550CISD, CAS-CI, and SOCI.
551
552:numref:`fig21` shows the result of similar calculations using more samples and smaller cutoffs.
553The results should be similar to those produced in the tutorial. For reference, the exact
554energy of the water molecule with ECPs is approximately -17.276 Ha. From the results of the
555tutorial, how does the selection of determinants relate to the expected DMC energy?
556What about the choice in the set of orbitals?
557
558.. _lab-adv-mol-gamess:
559
560Appendix A: GAMESS input
561------------------------
562
563In this section we provide a brief description of the GAMESS input needed to produce
564trial wavefunction for QMC calculations with QMCPACK. We assume basic familiarity
565with GAMESS input structure, particularly regarding the input of atomic coordinates and
566the definition of Gaussian basis sets. This section focuses on generation of the output
567files needed by the converter tool, ``convert4qmc``. For a description of the converter, see :ref:`lab-adv-mol-convert4qmc`.
568
569Only a subset of the methods available in GAMESS can be used to generate
570wavefunctions for QMCPACK, and we restrict our description to these. For
571a complete description of all the options and methods available in
572GAMESS, please refer to the official documentation at
573http://www.msg.ameslab.gov/gamess/documentation.html.”
574
575Currently, ``convert4qmc`` can process output for the following methods in GAMESS (in
576SCFTYP): RHF, ROHF, and MCSCF. Both HF and DFT calculations (any DFT
577type) can be used in combination with RHF and ROHF calculations. For MCSCF and CI
578calculations, ALDET, ORMAS, and GUGA drivers can be used (details follow).
579
580HF input
581~~~~~~~~
582
583The following input will perform a restricted HF calculation on a closed-shell singlet
584(multiplicity=1). This will generate RHF orbitals for any molecular system defined in
585``$DATA ... $END``.
586
587::
588
589  $CONTRL SCFTYP=RHF RUNTYP=ENERGY MULT=1
590  ISPHER=1 EXETYP=RUN COORD=UNIQUE MAXIT=200 $END
591  $SYSTEM MEMORY=150000000 $END
592  $GUESS GUESS=HUCKEL $END
593  $SCF DIRSCF=.TRUE. $END
594  $DATA
595  ...
596  Atomic Coordinates and basis set
597  ...
598  $END
599
600Main options:
601
602#. SCFTYP: Type of SCF method, options: RHF, ROHF, MCSCF, UHF and NONE.
603
604#. RUNTYP: Type of run. For QMCPACK wavefunction generation this should
605   always be ENERGY.
606
607#. MULT: Multiplicity of the molecule.
608
609#. ISPHER: Use spherical harmonics (1) or Cartesian basis functions
610   (-1).
611
612#. COORD: Input structure for the atomic coordinates in $DATA.
613
614DFT calculations
615~~~~~~~~~~~~~~~~
616
617The main difference between the input for a RHF/ROHF calculation and a DFT calculation
618is the definition of the DFTTYP parameter. If this is set in the $CONTROL
619section, a DFT calculation will be performed with the appropriate functional. Notice that
620although the default values are usually adequate, DFT calculations have many options involving
621the integration grids and accuracy settings. Make sure you study the input manual to be
622aware of these. Refer to the input manual for a list of the implemented exchange-correlation
623functionals.
624
625MCSCF
626~~~~~
627
628MCSCF calculations are performed by setting SCFTYP=MCSCF in the CONTROL
629section. If this option is set, an MCSCF section must be added to the input file with the
630options for the calculation. An example section for the water molecule used in the tutorial
631follows.
632
633::
634
635  $MCSCF CISTEP=GUGA MAXIT=1000 FULLNR=.TRUE. ACURCY=1.0D-5 $END
636
637The most important parameter is CISTEP, which defines the CI package used. The only
638options compatible with QMCPACK are: ALDET, GUGA, and ORMAS. Depending on the
639package used, additional input sections are needed.
640
641CI
642~~
643
644Configuration interaction (full CI, truncated CI, CAS-CI, etc) calculations are performed
645by setting ``SCFTYP=NONE`` and ``CITYP=GUGA,ALDET,ORMAS``. Each one of these packages
646requires further input sections, which are typically slightly different from the input sections
647needed for MCSCF runs.
648
649GUGA: Unitary group CI package
650~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
651
652The GUGA package is the only alternative if one wants CSFs with GAMESS. We subsequently provide a very brief description of the input sections needed to perform MCSCF, CASCI,
653truncated CI, and SOCI with this package. For a complete description of these methods and
654all the options available, please refer to the GAMESS input manual.
655
656GUGA-MCSCF
657^^^^^^^^^^
658
659The following input section performs a CASCI calculation with a CAS that includes 8
660electrons in 8 orbitals (4 DOC and 4 VAL), for example, CAS(8,8). NMCC is the number of frozen
661orbitals (doubly occupied orbitals in all determinants), NDOC is the number of double
662occupied orbitals in the reference determinant, NVAL is the number of singly occupied
663orbitals in the reference (for spin polarized cases), and NVAL is the number of orbitals in
664the active space. Since FORS is set to .TRUE., all configurations in the active space will
665be included. ISTSYM defines the symmetry of the desired state.
666
667::
668
669  $MCSCF CISTEP=GUGA MAXIT=1000 FULLNR=.TRUE. ACURCY=1.0D-5 $END
670  $DRT GROUP=C2v NMCC=0 NDOC=4 NALP=0 NVAL=4 ISTSYM=1 MXNINT= 500000 FORS=.TRUE. $END
671
672GUGA-CASCI
673^^^^^^^^^^
674
675The following input section performs a CASCI calculation with a CAS that includes 8
676electrons in 8 orbitals (4 DOC and 4 VAL), for example, CAS(8,8). NFZC is the number of frozen
677orbitals (doubly occupied orbitals in all determinants). All other parameters are identical
678to those in the MCSCF input section.
679
680::
681
682  $CIDRT GROUP=C2v NFZC=0 NDOC=4 NALP=0 NVAL=4 NPRT=2 ISTSYM=1 FORS=.TRUE. MXNINT= 500000 $END
683  $GUGDIA PRTTOL=0.001 CVGTOL=1.0E-5 ITERMX=1000 $END
684
685GUGA-truncated CI
686^^^^^^^^^^^^^^^^^
687
688The following input sections will lead to a truncated CI calculation. In this particular case
689it will perform a CISD calculation since IEXCIT is set to 2. Other values in IEXCIT will lead
690to different CI truncations; for example, IEXCIT=4 will lead to CISDTQ. Notice that only
691the lowest 30 orbitals will be included in the generation of the excited determinants in this
692case. For a full CISD calculation, NVAL should be set to the total number of virtual orbitals.
693
694::
695
696  $CIDRT GROUP=C2v NFZC=0 NDOC=4 NALP=0 NVAL=30 NPRT=2 ISTSYM=1 IEXCIT=2 MXNINT= 500000 $END
697  $GUGDIA PRTTOL=0.001 CVGTOL=1.0E-5 ITERMX=1000 $END
698
699GUGA-SOCI
700^^^^^^^^^
701
702The following input section performs a SOCI calculation with a CAS that includes 8
703electrons in 8 orbitals (4 DOC and 4 VAL), for example, CAS(8,8). Since SOCI is set to .TRUE.,
704all single and double determinants from all determinants in the CAS(8,8) will be included.
705
706::
707
708  $CIDRT GROUP=C2v NFZC=0 NDOC=4 NALP=0 NVAL=4 NPRT=2 ISTSYM=1 SOCI=.TRUE. NEXT=30 MXNINT= 500000 $END
709  $GUGDIA PRTTOL=0.001 CVGTOL=1.0E-5 ITERMX=1000 $END
710
711ECP
712~~~
713
714To use ECPs in GAMESS, you must define a ``{$ECP ... $END}``
715block. There must be a definition of a potential for every atom in the system, including
716symmetry equivalent ones. In addition, they must appear in the particular order expected
717by GAMESS. The following example shows an ECP input block for a single water molecule using
718BFD ECPs. To turn on the use of ECPs, the option “ECP=READ” must be added to the
719CONTROL input block.
720
721::
722
723  $ECP
724  O-QMC GEN 2 1
725  3
726  6.00000000 1 9.29793903
727  55.78763416 3 8.86492204
728  -38.81978498 2 8.62925665
729  1
730  38.41914135 2 8.71924452
731  H-QMC GEN 0 0
732  3
733  1.000000000000 1 25.000000000000
734  25.000000000000 3 10.821821902641
735  -8.228005709676 2 9.368618758833
736  H-QMC
737  $END
738
739.. _lab-adv-mol-convert4qmc:
740
741Appendix B: convert4qmc
742-----------------------
743
744To generate the particleset and wavefunction XML blocks required by QMCPACK in
745calculations with molecular systems, the converter ``convert4qmc`` must be used. The converter
746will read the standard output from the appropriate quantum chemistry calculation and will
747generate all the necessary input for QMCPACK. In the following, we describe the main options of the
748converter for GAMESS output. In general, there are three ways to use the converter depending
749on the type of calculation performed. The minimum syntax for each option is shown subsequently.
750For a description of the XML files produced by the converter, see :ref:`lab-adv-mol-wf-appendix`.
751
752#. For all single-determinant calculations (HF and DFT with any DFTTYP):
753
754    ::
755
756          convert4qmc -gamess single det.out
757
758   -  single det.out is the standard output generated by GAMESS.
759
760#. *(This option is not recommended. Use the following option to avoid
761   mistakes.)* For multideterminant calculations where the orbitals and
762   configurations are read from different files (e.g., when using
763   orbitals from a MCSCF run and configurations from a subsequent CI
764   run):
765
766    ::
767
768      convert4qmc -gamess orbitals multidet.out -ci cicoeff
769      multidet.out
770
771   -  orbitals_multidet.out is the standard output from the calculation
772      that generates the orbitals. cicoeff multidet.out is the standard
773      output from the calculation that calculates the CI expansion.
774
775#. For multideterminant calculations where the orbitals and
776   configurations are read from the same file, using PRTMO=.T. in the
777   GUESS input block:
778
779   ::
780
781     convert4qmc -gamess multi det.out -ci multi det.out
782     -readInitialGuess Norb
783
784   -  multi_det.out is the standard output from the calculation that
785      calculates the CI expansion.
786
787Options:
788
789-  **-gamess file.out**: Standard output of GAMESS calculation.
790   With the exception of determinant configurations and coefficients in
791   multideterminant calculations, everything else is read from this file
792   including atom coordinates, basis sets, SPOs, ECPs, number of
793   electrons, multiplicity, etc.
794
795-  **-ci file.out**: In multideterminant calculations, determinant
796   configurations and coefficients are read from this file. Notice that
797   SPOs are NOT read from this file. Recognized CI packages are ALDET,
798   GUGA, and ORMAS. Output produced with the GUGA package MUST have the
799   option “NPRT=2” in the CIDRT or DRT input blocks.
800
801-  **-threshold cutoff**: Cutoff in multideterminant expansion. Only
802   configurations with coefficients above this value are printed.
803
804-  **-zeroCI**: Sets to zero the CI coefficients of all determinants,
805   with the exception of the first one.
806
807-  **-readInitialGuess Norb**: Reads Norb initial orbitals (“INITIAL
808   GUESS ORBITALS”) from GAMESS output. These are orbitals generated by
809   the GUESS input block and printed with the option “PRTMO=.T.”. Notice
810   that this is useful only in combination with the option
811   “GUESS=MOREAD” and in cases where the orbitals are not modified in
812   the GAMESS calculation, e.g. CI runs. This is the recommended option
813   in all CI calculations.
814
815-  **-NaturalOrbitals Norb**: Read Norb “NATURAL ORBITALS” from GAMESS
816   output. The natural orbitals must exists in the output, otherwise the
817   code aborts.
818
819-  **-add3BodyJ**: Adds 3-body Jastrow terms (e-e-I) between electron
820   pairs (both same spin and opposite spin terms) and all ion species in
821   the system. The radial function is initialized to zero, and the
822   default cutoff is 10.0 bohr. The converter will add a 1- and 2-body
823   Jastrow to the wavefunction block by default.
824
825Useful notes
826~~~~~~~~~~~~
827
828-  The type of SPOs read by the converter depends on the type of
829   calculation and on the options used. By default, when neither
830   -readInitialGuess nor -NaturalOrbitals are used, the following
831   orbitals are read in each case (notice that -readInitialGuess or
832   -NaturalOrbitals are mutually exclusive):
833
834   -  RHF and ROHF: “EIGENVECTORS”
835
836   -  MCSCF: “MCSCF OPTIMIZED ORBITALS”
837
838   -  GUGA, ALDET, ORMAS: Cannot read orbitals without -readInitialGuess
839      or -NaturalOrbitals options.
840
841-  The SPOs and printed CI coefficients in MCSCF calculations are not
842   consistent in GAMESS. The printed CI coefficients correspond to the
843   next-to-last iteration; they are not recalculated with the final
844   orbitals. So to get appropriate CI coefficients from MCSCF
845   calculations, a subsequent CI (no SCF) calculation is needed to
846   produce consistent orbitals. In principle, it is possible to read the
847   orbitals from the MCSCF output and the CI coefficients and
848   configurations from the output of the following CI calculations. This
849   could lead to problems in principle since GAMESS will rotate initial
850   orbitals by default to obtain an initial guess consistent with the
851   symmetry of the molecule. This last step is done by default and can
852   change the orbitals reported in the MCSCF calculation before the CI
853   is performed. To avoid this problem, we highly recommend using the
854   preceding option #3 to read all the information from the output of
855   the CI calculation; this requires the use of “PRTMO=.T.” in the GUESS
856   input block. Since the orbitals are printed after any symmetry
857   rotation, the resulting output will always be consistent.
858
859.. _lab-adv-mol-opt-appendix:
860
861Appendix C: Wavefunction optimization XML block
862-----------------------------------------------
863
864.. code-block::
865  :caption: Sample XML optimization block.
866  :name: Listing 60
867
868    <loop max="10">
869      <qmc method="linear" move="pbyp" checkpoint="-1" gpu="no">
870      <parameter name="blocks">     10  </parameter>
871        <parameter name="warmupsteps"> 25 </parameter>
872        <parameter name="steps"> 1 </parameter>
873        <parameter name="substeps"> 20 </parameter>
874        <parameter name="timestep"> 0.5 </parameter>
875        <parameter name="samples"> 10240  </parameter>
876        <cost name="energy">                   0.95 </cost>
877        <cost name="unreweightedvariance">     0.0 </cost>
878        <cost name="reweightedvariance">       0.05 </cost>
879        <parameter name="useDrift">  yes </parameter>
880        <parameter name="bigchange">10.0</parameter>
881        <estimator name="LocalEnergy" hdf5="no"/>
882        <parameter name="usebuffer"> yes </parameter>
883        <parameter name="nonlocalpp"> yes </parameter>
884        <parameter name="MinMethod">quartic</parameter>
885        <parameter name="exp0">-6</parameter>
886        <parameter name="alloweddifference"> 1.0e-5 </parameter>
887        <parameter name="stepsize">  0.15 </parameter>
888        <parameter name="nstabilizers"> 1 </parameter>
889      </qmc>
890    </loop>
891
892Options:
893
894-  bigchange: (default 50.0) Largest parameter change allowed
895
896-  usebuffer: (default no) Save useful information during VMC
897
898-  nonlocalpp: (default no) Include nonlocal energy on 1-D min
899
900-  MinMethod: (default quartic) Method to calculate magnitude of
901   parameter change quartic: fit quartic polynomial to four values of
902   the cost function obtained using reweighting along chosen direction
903   linemin: direct line minimization using reweighting rescale: no 1-D
904   minimization. Uses Umrigars suggestions.
905
906-  stepsize: (default 0.25) Step size in either quartic or linemin
907   methods.
908
909-  alloweddifference: (default 1e-4) Allowed increase in energy
910
911-  exp0: (default -16.0) Initial value for stabilizer (shift to diagonal
912   of H). Actual value of stabilizer is 10 exp0
913
914-  nstabilizers: (default 3) Number of stabilizers to try
915
916-  stabilizaterScale: (default 2.0) Increase in value of exp0 between
917   iterations.
918
919-  max its: (default 1) Number of inner loops with same sample
920
921-  minwalkers: (default 0.3) Minimum value allowed for the ratio of
922   effective samples to actual number of walkers in a reweighting step.
923   The optimization will stop if the effective number of walkers in any
924   reweighting calculation drops below this value. Last set of
925   acceptable parameters are kept.
926
927-  maxWeight: (defaul 1e6) Maximum weight allowed in reweighting. Any
928   weight above this value will be reset to this value.
929
930
931Recommendations:
932
933-  Set samples to equal to (#threads)*blocks.
934
935-  Set steps to 1. Use substeps to control correlation between samples.
936
937-  For cases where equilibration is slow, increase both substeps and
938   warmupsteps.
939
940-  For hard cases (e.g., simultaneous optimization of long MSD and
941   3-Body J), set exp0 to 0 and do a single inner iteration (max its=1)
942   per sample of configurations.
943
944.. _lab-adv-mol-vmcdmc-appendix:
945
946Appendix D: VMC and DMC XML block
947---------------------------------
948
949.. code-block::
950  :caption: Sample XML blocks for VMC and DMC calculations.
951  :name: Listing 61
952
953    <qmc method="vmc" move="pbyp" checkpoint="-1">
954      <parameter name="useDrift">yes</parameter>
955      <parameter name="warmupsteps">100</parameter>
956      <parameter name="blocks">100</parameter>
957      <parameter name="steps">1</parameter>
958      <parameter name="substeps">20</parameter>
959      <parameter name="walkers">30</parameter>
960      <parameter name="timestep">0.3</parameter>
961      <estimator name="LocalEnergy" hdf5="no"/>
962    </qmc>
963    <qmc method="dmc" move="pbyp" checkpoint="-1">
964      <parameter name="nonlocalmoves">yes</parameter>
965      <parameter name="targetWalkers">1920</parameter>
966      <parameter name="blocks">100</parameter>
967      <parameter name="steps">100</parameter>
968      <parameter name="timestep">0.1</parameter>
969      <estimator name="LocalEnergy" hdf5="no"/>
970    </qmc>
971
972General Options:
973
974-  **move**: (default “walker”) Type of electron move. Options: “pbyp”
975   and “walker.”
976
977-  **checkpoint**: (default “-1”) (If > 0) Generate checkpoint files
978   with given frequency. The calculations can be restarted/continued
979   with the produced checkpoint files.
980
981-  **useDrift**: (default “yes”) Defines the sampling mode. useDrift =
982   “yes” will use Langevin acceleration to sample the VMC and DMC
983   distributions, while useDrift=“no” will use random displacements in a
984   box.
985
986-  **warmupSteps**: (default 0) Number of steps warmup steps at the
987   beginning of the calculation. No output is produced for these steps.
988
989-  **blocks**: (default 1) Number of blocks (outer loop).
990
991-  **steps**: (default 1) Number of steps per blocks (middle loop).
992
993-  **sub steps**: (default 1) Number of substeps per step (inner loop).
994   During substeps, the local energy is not evaluated in VMC
995   calculations, which leads to faster execution. In VMC calculations,
996   set substeps to the average autocorrelation time of the desired
997   quantity.
998
999-  **time step**: (default 0.1) Electronic time step in bohr.
1000
1001-  **samples**: (default 0) Number of walker configurations saved during
1002   the current calculation.
1003
1004-  **walkers**: (default #threads) In VMC, sets the number of walkers
1005   per node. The total number of walkers in the calculation will be
1006   equal to walkers*(# nodes).
1007
1008Options unique to DMC:
1009
1010-  **targetWalkers**: (default #walkers from previous calculation, e.g.,
1011   VMC). Sets the target number of walkers. The actual population of
1012   walkers will fluctuate around this value. The walkers will be
1013   distributed across all the nodes in the calculation. On a given node,
1014   the walkers are split across all the threads in the system.
1015
1016-  **nonlocalmoves**: (default “no”) Set to “yes” to turns on the use of
1017   Casula’s T-moves.
1018
1019.. _lab-adv-mol-wf-appendix:
1020
1021Appendix E: Wavefunction XML block
1022----------------------------------
1023
1024.. code-block::
1025  :caption: Basic framework for a single-determinant determinantset XML block.
1026  :name: Listing 62
1027
1028    <wavefunction name="psi0" target="e">
1029      <determinantset type="MolecularOrbital" name="LCAOBSet"
1030       source="ion0" transform="yes">
1031        <basisset name="LCAOBSet">
1032          <atomicBasisSet name="Gaussian-G2" angular="cartesian" type="Gaussian" elementType="O" normalized="no">
1033          ...
1034          </atomicBasisSet>
1035        </basisset>
1036        <slaterdeterminant>
1037          <determinant id="updet" size="4">
1038            <occupation mode="ground"/>
1039            <coefficient size="57" id="updetC">
1040            ...
1041            </coefficient>
1042          </determinant>
1043          <determinant id="downdet" size="4">
1044            <occupation mode="ground"/>
1045            <coefficient size="57" id="downdetC">
1046            ...
1047            </coefficient>
1048          </determinant>
1049        </slaterdeterminant>
1050
1051      </determinantset>
1052
1053      <jastrow name="J2" type="Two-Body" function="Bspline" print="yes">
1054      ...
1055      </jastrow>
1056
1057    </wavefunction>
1058
1059In this section we describe the basic format of a QMCPACK wavefunction XML block.
1060Everything listed in this section is generated by the appropriate converter tools. Little to
1061no modification is needed when performing standard QMC calculations. As a result, this
1062section is meant mainly for illustration purposes. Only experts should attempt to modify
1063these files (with very few exceptions like the cutoff of CI coefficients and the cutoff in Jastrow
1064functions) since changes can lead to unexpected results.
1065
1066A QMCPACK wavefunction XML block is a combination of a determinantset,
1067which contains the antisymmetric part of the wavefunction and one or
1068more Jastrow blocks. The syntax of the antisymmetric block depends on
1069whether the wavefunction is a single determinant or a multideterminant
1070expansion. :ref:`Listing 62 <Listing 62>` shows the general
1071structure of the single-determinant case. The determinantset block is
1072composed of a basisset block, which defines the atomic orbital basis
1073set, and a slaterdeterminant block, which defines the SPOs and
1074occupation numbers of the Slater determinant.
1075:ref:`Listing 63 <Listing 63>` shows a (piece of a) sample
1076of a slaterdeterminant block. The slaterdeterminant block consists of
1077two determinant blocks, one for each electron spin. The parameter “size”
1078in the determinant block refers to the number of SPOs present while the
1079“size” parameter in the coefficient block refers to the number of atomic
1080basis functions per SPO.
1081
1082.. code-block::
1083  :caption: Sample XML block for the single Slater determinant case.
1084  :name: Listing 63
1085
1086      <slaterdeterminant>
1087        <determinant id="updet" size="5">
1088          <occupation mode="ground"/>
1089          <coefficient size="134" id="updetC">
1090    9.55471000000000e-01 -3.87000000000000e-04  6.51140000000000e-02  2.17700000000000e-03
1091    1.43900000000000e-03  4.00000000000000e-06 -4.58000000000000e-04 -5.20000000000000e-05
1092    -2.40000000000000e-05  6.00000000000000e-06 -0.00000000000000e+00 -0.00000000000000e+00
1093    -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00
1094    -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00
1095    -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00
1096    -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00
1097    -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00
1098    -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00
1099    -0.00000000000000e+00 -5.26000000000000e-04  2.63000000000000e-04  2.63000000000000e-04
1100    -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00 -1.27000000000000e-04
1101    6.30000000000000e-05  6.30000000000000e-05 -0.00000000000000e+00 -0.00000000000000e+00
1102    -0.00000000000000e+00 -3.20000000000000e-05  1.60000000000000e-05  1.60000000000000e-05
1103    -0.00000000000000e+00 -0.00000000000000e+00 -0.00000000000000e+00  7.00000000000000e-06
1104
1105:ref:`Listing 64 <Listing 64>` shows the general structure of the multideterminant case.
1106Similar to the
1107single-determinant case, the determinantset must contain a basisset block. This definition is
1108identical to the one described previously. In this case, the definition of the SPOs
1109must be done independently from the definition of the determinant configurations; the latter
1110is done in the sposet block, while the former is done on the multideterminant block. Notice
1111that two sposet sets must be defined, one for each electron spin. The name of each sposet set
1112is required in the definition of the multideterminant block. The determinants are defined in
1113terms of occupation numbers based on these orbitals.
1114
1115.. code-block::
1116  :caption: Basic framework for a multideterminant determinantset XML block.
1117  :name: Listing 64
1118
1119    <wavefunction id="psi0" target="e">
1120      <determinantset name="LCAOBSet" type="MolecularOrbital" transform="yes" source="ion0">
1121        <basisset name="LCAOBSet">
1122          <atomicBasisSet name="Gaussian-G2" angular="cartesian" type="Gaussian" elementType="O" normalized="no">
1123          ...
1124          </atomicBasisSet>
1125          ...
1126        </basisset>
1127        <sposet basisset="LCAOBSet" name="spo-up" size="8">
1128          <occupation mode="ground"/>
1129          <coefficient size="40" id="updetC">
1130          ...
1131  </coefficient>
1132        </sposet>
1133        <sposet basisset="LCAOBSet" name="spo-dn" size="8">
1134          <occupation mode="ground"/>
1135          <coefficient size="40" id="downdetC">
1136          ...
1137        </coefficient>
1138        </sposet>
1139        <multideterminant optimize="yes" spo_up="spo-up" spo_dn="spo-dn">
1140          <detlist size="97" type="CSF" nca="0" ncb="0" nea="4" neb="4" nstates="8" cutoff="0.001">
1141            <csf id="CSFcoeff_0" exctLvl="0" coeff="0.984378" qchem_coeff="0.984378" occ="22220000">
1142              <det id="csf_0-0" coeff="1" alpha="11110000" beta="11110000"/>
1143            </csf>
1144            ...
1145          </detlist>
1146        </multideterminant>
1147      </determinantset>
1148      <jastrow name="J2" type="Two-Body" function="Bspline" print="yes">
1149      ...
1150      </jastrow>
1151    </wavefunction>
1152
1153There are various options in the multideterminant block that users
1154should be aware of.
1155
1156-  cutoff: (IMPORTANT! ) Only configurations with (absolute value)
1157   “qchem coeff” larger than this value will be read by QMCPACK.
1158
1159-  optimize: Turn on/off the optimization of linear CI coefficients.
1160
1161-  coeff: (in csf ) Current coefficient of given configuration. Gets
1162   updated during wavefunction optimization.
1163
1164-  qchem coeff: (in csf ) Original coefficient of given configuration
1165   from GAMESS calculation. This is used when applying a cutoff to the
1166   configurations read from the file. The cutoff is applied on this
1167   parameter and not on the optimized coefficient.
1168
1169-  nca and nab: Number of core orbitals for up/down electrons. A core
1170   orbital is an orbital that is doubly occupied in all determinant
1171   configurations, not to be confused with core electrons. These are not
1172   explicitly listed on the definition of configurations.
1173
1174-  nea and neb: Number of up/down active electrons (those being
1175   explicitly correlated).
1176
1177-  nstates: Number of correlated orbitals.
1178
1179-  size (in detlist ): Contains the number of configurations in the
1180   list.
1181
1182The remaining part of the determinantset block is the definition of Jastrow factor. Any
1183number of these can be defined. :ref:`Listing 65 <Listing 65>` shows a sample Jastrow
1184block including 1-, 2- and 3-body terms. This is the standard block produced by
1185``convert4qmc`` with the option -add3BodyJ (this particular example is for a water molecule).
1186Optimization of individual radial functions can be turned on/off using the “optimize”
1187parameter. It can be added to any coefficients block, even though it is currently not
1188present in the J1 and J2 blocks.
1189
1190.. code-block::
1191  :caption: Sample Jastrow XML block.
1192  :name: Listing 65
1193
1194  <jastrow name="J2" type="Two-Body" function="Bspline" print="yes">
1195        <correlation rcut="10" size="10" speciesA="u" speciesB="u">
1196          <coefficients id="uu" type="Array">0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0</coefficients>
1197        </correlation>
1198        <correlation rcut="10" size="10" speciesA="u" speciesB="d">
1199          <coefficients id="ud" type="Array">0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0</coefficients>
1200        </correlation>
1201      </jastrow>
1202      <jastrow name="J1" type="One-Body" function="Bspline" source="ion0" print="yes">
1203        <correlation rcut="10" size="10" cusp="0" elementType="O">
1204          <coefficients id="eO" type="Array">0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0</coefficients>
1205        </correlation>
1206        <correlation rcut="10" size="10" cusp="0" elementType="H">
1207          <coefficients id="eH" type="Array">0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0</coefficients>
1208        </correlation>
1209      </jastrow>
1210      <jastrow name="J3" type="eeI" function="polynomial" source="ion0" print="yes">
1211        <correlation ispecies="O" especies="u" isize="3" esize="3" rcut="10">
1212          <coefficients id="uuO" type="Array" optimize="yes">
1213          </coefficients>
1214        </correlation>
1215        <correlation ispecies="O" especies1="u" especies2="d" isize="3" esize="3" rcut="10">
1216          <coefficients id="udO" type="Array" optimize="yes">
1217          </coefficients>
1218        </correlation>
1219        <correlation ispecies="H" especies="u" isize="3" esize="3" rcut="10">
1220          <coefficients id="uuH" type="Array" optimize="yes">
1221          </coefficients>
1222        </correlation>
1223        <correlation ispecies="H" especies1="u" especies2="d" isize="3" esize="3" rcut="10">
1224          <coefficients id="udH" type="Array" optimize="yes">
1225          </coefficients>
1226        </correlation>
1227        </jastrow>
1228
1229This training assumes basic familiarity with the UNIX operating system. In particular,
1230we use simple scripts written in “csh.” In addition, we assume you have obtained
1231all the necessary files and executables and that the training files are located
1232at ${TRAINING TOP}.
1233
1234The goal of this training is not only to familiarize you with the execution and
1235options in QMCPACK but also to introduce you to important concepts in QMC calculations and many-body electronic structure calculations.
1236