<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wikis.ch.cam.ac.uk/thom/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Acc73</id>
	<title>Thom Group Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wikis.ch.cam.ac.uk/thom/wiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Acc73"/>
	<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/thom/wiki/index.php/Special:Contributions/Acc73"/>
	<updated>2026-06-10T11:43:05Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.7</generator>
	<entry>
		<id>https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=247</id>
		<title>SimpleDMC</title>
		<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=247"/>
		<updated>2017-07-20T14:32:11Z</updated>

		<summary type="html">&lt;p&gt;Acc73: /* qWalk */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Theory =&lt;br /&gt;
&lt;br /&gt;
= Compilation of SimpleDMC =&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== The Hydrogen Atom ==&lt;br /&gt;
&lt;br /&gt;
=== Gaussian ===&lt;br /&gt;
Let&#039;s begin by generating a trial wavefunction with Gaussian03. To start with, we need to define an atomic orbital basis, then tell Gaussian03 to use it in conjunction with some &#039;&#039;ab initio&#039;&#039; method. We&#039;ll use the STO-6G basis set, where 6 Gaussian primitives are used to represent an atomic orbital. We&#039;ll create an input file for Gaussian03, called H.com,&lt;br /&gt;
&lt;br /&gt;
   $ cat -n H.com&lt;br /&gt;
      1   %chk=H.chk&lt;br /&gt;
      2   #p UHF/STO-6G 6d 10f SCF Test IOP(3/24=10) IOP(3/81=1) Pop=Full&lt;br /&gt;
      3   &lt;br /&gt;
      4   Hydrogen Atom - UHF STO-6G&lt;br /&gt;
      5&lt;br /&gt;
      6   0 2&lt;br /&gt;
      7   H   0.000   0.000   0.000&lt;br /&gt;
      8&lt;br /&gt;
&lt;br /&gt;
This may seem cryptic for the moment, but each line (and entry therein) is necessary. Line 1 tells Gaussian03 to put some output in an encrypted file called H.chk. Line 2 is the ``route section&amp;quot;: The IOP arguments are &#039;&#039;internal options&#039;&#039;, and tell Gaussian03 to spit out data in a certain format. Line 4 contains a title section, and must be included, as must the sandwiching blank lines. Line 6 specifies the charge and multiplicity (number of unpaired electrons + 1). Finally, on line 7, we specify the molecular configuration; atom types and Cartesian position vectors of the constituent atoms are enumerated here.&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s run Gaussian03,&lt;br /&gt;
&lt;br /&gt;
   $ g03 H.com&lt;br /&gt;
&lt;br /&gt;
No return value is normally a good sign- you&#039;ll typically be greeted with an (unhelpful) SEGFAULT of some kind if the calculation was unsuccessful. It&#039;s also worth explicitly checking for errors, since Gaussian is also able to die silently&lt;br /&gt;
&lt;br /&gt;
   $ grep &amp;quot;Error&amp;quot; H.log&lt;br /&gt;
&lt;br /&gt;
Gaussian03 writes to two files- H.log and H.chk; the contents of the former are obvious while we&#039;ve already briefly discussed the contents of the latter. In the output, all we care about is the energy, so invoke&lt;br /&gt;
&lt;br /&gt;
   $ grep -n &amp;quot;SCF Done&amp;quot; H.log&lt;br /&gt;
   219: SCF Done:  E(UHF) = -0.471039054196     A.U. after     1 cycles&lt;br /&gt;
&lt;br /&gt;
This is a rather poor value relative to the analytical -0.5 Hartrees, but at least we have something to improve upon. We must now do some conversions to extract information from the checkpoint file&lt;br /&gt;
&lt;br /&gt;
   $ formchk H.chk H.fchk&lt;br /&gt;
   Read checkpoint file H.chk&lt;br /&gt;
   Write formatted file H.fchk&lt;br /&gt;
   Rotating derivatives, DoTrsp=T IDiff= 1 LEDeriv=    197 LFDPrp=       0 LDFDPr=       0.&lt;br /&gt;
&lt;br /&gt;
formchk is a Gaussian utility that converts the unreadable H.chk to a formatted checkpoint file, H.fchk. Since this formatted file is more amenable to parsing, it can be used by a number of visualisation/ post-Gaussian tools.&lt;br /&gt;
&lt;br /&gt;
=== qWalk ===&lt;br /&gt;
qWalk is a piece of software we can benchmark the simpleDMC software against, possessing both variational&lt;br /&gt;
and diffusion Monte Carlo (VMC and DMC, respectively) functionalities. The simpleDMC software also uses &lt;br /&gt;
the same input file formats as qWalk, and so we are able to use their file conversion tools to extract data &lt;br /&gt;
from a host of &#039;&#039;ab initio&#039;&#039; software suites.&lt;br /&gt;
&lt;br /&gt;
First, we parse the H.fchk file into a number of qWalk input files:&lt;br /&gt;
&lt;br /&gt;
   $ ./g032qmc -log H.log -fchk H.fchk &lt;br /&gt;
   --- read fchk file ---&lt;br /&gt;
   Number of atoms: 1&lt;br /&gt;
   Number of basis functions: 1&lt;br /&gt;
   Number of independant functions: 1&lt;br /&gt;
   Multiplicity: 2&lt;br /&gt;
   Number of alpha electrons: 1&lt;br /&gt;
   Number of beta electrons: 0&lt;br /&gt;
   Total Energy: -0.471039054195684&lt;br /&gt;
   Pure/Cartesian d shells: 6D&lt;br /&gt;
   Pure/Cartesian f shells: 10F&lt;br /&gt;
   found beta component, scftpe=UHF&lt;br /&gt;
   --- read log file ---&lt;br /&gt;
   basis set is from &#039;AO basis set&#039; section&lt;br /&gt;
   --- have read files ---&lt;br /&gt;
   norb=1&lt;br /&gt;
   spin up end size=1&lt;br /&gt;
   moCoeff total size=2&lt;br /&gt;
   writing qwalk input files ... &lt;br /&gt;
   writing orb file.  This could take a few seconds.&lt;br /&gt;
   output: sample.orb&lt;br /&gt;
   output: sample.basis&lt;br /&gt;
   output: sample.slater&lt;br /&gt;
   output: sample.jast2&lt;br /&gt;
   output: sample.sys&lt;br /&gt;
   output: sample.hf&lt;br /&gt;
   output: sample.opt&lt;br /&gt;
   Done&lt;br /&gt;
    &lt;br /&gt;
   Warning: Now the basisset must be the same for the same specie of atoms&lt;br /&gt;
&lt;br /&gt;
We&#039;ll try to reproduce the UHF results by use of VMC with qWalk. Let&#039;s have a look at sample.hf:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.hf&lt;br /&gt;
   METHOD { VMC nconfig 1000 } &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   INCLUDE sample.sys  &lt;br /&gt;
   TRIALFUNC { INCLUDE sample.slater}&lt;br /&gt;
&lt;br /&gt;
Note that we have added &amp;quot;nconfig 1000&amp;quot;, which gives us control over how many walkers are to be used&lt;br /&gt;
for the VMC. sample.sys contains the system configuration (number of electrons with a given spin, &lt;br /&gt;
atomic coordinates, etc.), while sample.slater contains the orbital information for the Slater&lt;br /&gt;
determinant (in conjunction with sample.orb and sample.basis). This Slater determinant will be used&lt;br /&gt;
to sample the trial wavefunction created by g03. We now run qWalk:&lt;br /&gt;
&lt;br /&gt;
   $ ./qwalk sample.hf&lt;br /&gt;
   output to sample.hf.o&lt;br /&gt;
   System&lt;br /&gt;
   Wave function&lt;br /&gt;
   Pseudopotential&lt;br /&gt;
   Could not open sample.hf.config. Generating configurations from scratch&lt;br /&gt;
  &lt;br /&gt;
and upon completion, are left with three files,&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|sample.hf.o&lt;br /&gt;
|Information about the run.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.log&lt;br /&gt;
|Log for statistical analysis.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.config&lt;br /&gt;
|Checkfile for the run.&lt;br /&gt;
|}   &lt;br /&gt;
&lt;br /&gt;
We can extract averages from the VMC by invoking&lt;br /&gt;
&lt;br /&gt;
   $ ./gosling sample.hf.log      &lt;br /&gt;
   #####################&lt;br /&gt;
   vmc:  100 total blocks reblocked into 100&lt;br /&gt;
   #####################&lt;br /&gt;
   Threw out the first 0 blocks in the averaging.&lt;br /&gt;
   total_energy0        -0.4702684082 +/-  0.000922386677 (sigma     0.425114576 ) &lt;br /&gt;
   kinetic0              0.7706545412 +/-  0.003605881864 (sigma     1.448514687 ) &lt;br /&gt;
   potential0            -1.240922949 +/-  0.003148015019 (sigma      1.21325133 ) &lt;br /&gt;
   nonlocal0                        0 +/-               0 (sigma               0 ) &lt;br /&gt;
   weight0                          1 +/- 6.661338148e-17 (sigma               0 ) &lt;br /&gt;
   &lt;br /&gt;
   --------Properties differences-------------&lt;br /&gt;
   approximate number of independent points: 212415.3753&lt;br /&gt;
&lt;br /&gt;
We see that the VMC estimate of the energy of the trial wavefunction (-0.470(2)) matches&lt;br /&gt;
relatively well with the UHF energy (-0.471039054195684). We have also obtained the&lt;br /&gt;
sample.hf.config file, containing the distribution of walkers sampling the&lt;br /&gt;
trial wavefunction.&lt;br /&gt;
&lt;br /&gt;
   $ head -8 sample.hf.config&lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   -0.731706383078456 0.620589802605041 -0.092157439050284 &lt;br /&gt;
   } &lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   0.366970593352899 0.216757302067973 -0.48313699793852 &lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==== Known Issues ====&lt;br /&gt;
&lt;br /&gt;
A bug has been found pertaining to the parsing of the Gaussian *.fchk file, by the qWalk executable &amp;quot;g032qmc&amp;quot;. You may attempt the $ ./g032qmc -log H.log -fchk H.fchk command, only to receive the following error:&lt;br /&gt;
&lt;br /&gt;
  --- read fchk file ---&lt;br /&gt;
  Number of atoms: 3&lt;br /&gt;
  Number of basis functions: 13&lt;br /&gt;
  Number of independent functions: 0&lt;br /&gt;
  Multiplicity: 1&lt;br /&gt;
  Number of alpha electrons: 5&lt;br /&gt;
  Number of beta electrons: 5&lt;br /&gt;
  Total Energy: -75.5859595605798&lt;br /&gt;
  Pure/Cartesian d shells: 6D&lt;br /&gt;
  Pure/Cartesian f shells: 7F&lt;br /&gt;
  main_read_g03fchkfile:  error in alpha MO&lt;br /&gt;
&lt;br /&gt;
The issue is that qWalk must seach for the key phrase &amp;quot;Number of independent functions&amp;quot; in the *.fchk file, however, certain versions of Gaussian will write the *.fchk file with the following on line 10:&lt;br /&gt;
&lt;br /&gt;
  &amp;quot; Number of independant functions            I        &amp;lt;number&amp;gt; &amp;quot;&lt;br /&gt;
&lt;br /&gt;
The simple fix to this problem is to correct the spelling in the *.fchk file to instead read &amp;quot;independent&amp;quot; (the correct, english, spelling), and qWalk will then successfully parse the file.&lt;br /&gt;
&lt;br /&gt;
=== simpleDMC ===&lt;br /&gt;
&lt;br /&gt;
We can use this distribution of walkers as a starting point for our DMC calculations with&lt;br /&gt;
simpleDMC. We require an input file to run simpleDMC, sample.simple:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.simple&lt;br /&gt;
   simple { &lt;br /&gt;
      nWalkers             1000     # Number of walkers&lt;br /&gt;
      nSteps              10000     # Maximum number of steps&lt;br /&gt;
      dTau                0.001     # Timestep&lt;br /&gt;
      dETrial              -0.5     # Trial energy should start (&amp;gt; FCI energy but close to it)&lt;br /&gt;
      dWeightInit           1.0     # Initial weight&lt;br /&gt;
      bConstWalkerNum     false     # Are we enforcing a constant number of walkers? (Currently not working)&lt;br /&gt;
      nWalkersSpace       20480	    # Walker growth space (Maximum number of walkers permitted)&lt;br /&gt;
      dWeightTarget     10000.0     # Total weight above which we undertake population control&lt;br /&gt;
      dWeightMin         1500.0     # Total weight below which we undertake population control&lt;br /&gt;
      dLowThresh            1.0     # If walker has weight below this, try to either kill or recombine it&lt;br /&gt;
      dWeightBranch         1.5     # If walker has weight above this, we branch the walker&lt;br /&gt;
      nShiftSteps             1     # Vary the shift every nShiftSteps steps.&lt;br /&gt;
      dShiftDamp            1.0     # Larger shift damping is more radical damping&lt;br /&gt;
      dOldWeight            0.0     # The total weight at the previous cycle for calculating the shift&lt;br /&gt;
      bUpdateShift        false     # Are we updating the shift every nShiftSteps cycles?&lt;br /&gt;
   }&lt;br /&gt;
                                                             &lt;br /&gt;
simpleDMC reuses the input files of qWalk, and can be invoked by listing the files as command line &lt;br /&gt;
arguments (in any order)&lt;br /&gt;
   &lt;br /&gt;
   $ ./simpleDMC.x sample.{sys,slater,orb,basis,simple,hf.config,hf.log} &amp;gt;&amp;gt; sample.log&lt;br /&gt;
&lt;br /&gt;
We pass all of the output to sample.log since the majority of information concerning the simulation is&lt;br /&gt;
streamed straight to STDOUT. We are primarily concerned with the final nSteps lines, since these give&lt;br /&gt;
the various energetic quantities associated with the system of walkers at each timestep. In fact, with&lt;br /&gt;
a little foresight, the fifth column corresponds to the total energy averaged over all walkers at that&lt;br /&gt;
timestep. Averaging over this column, we obtain the DMC energy:&lt;br /&gt;
&lt;br /&gt;
   $ export nsteps=10000&lt;br /&gt;
   $ tail -n $nsteps sample.log | awk &#039;{ sum += $5; n++ } END { if (n &amp;gt; 0) print sum / n; }&#039;&lt;br /&gt;
   -0.498772&lt;br /&gt;
&lt;br /&gt;
This quantity is in very good agreement with the exact energy of -0.5 Hartrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;V = \frac{\epsilon}{2} \sum_{i&amp;lt;j} \left[ \left(\frac{r_{ij}}{\sigma}\right)^2+\left(\frac{\sigma}{r_{ij}}\right)^2 \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Jastrow Factor ==&lt;br /&gt;
&lt;br /&gt;
One further usable output from qWalk is the Jastrow factor parameters. This helps to add in explicit correlation terms between electron-electron pairs (known two body terms) and electron-ion pairs (one body terms). After having performed the parsing of the *.fchk file with ./g032qmc, a blank template of the Jastrow parameters will be created, called *.jast2. This is designed to include both two-body and one-body interaction, hence the suffix of &amp;quot;2&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
A good tutorial for how to optimise the Jastrow parameters is given in the qWalk documentation ( [https://github.com/QWalk/mainline/wiki/Tutorial] ), but a potted version which will consistently produce the same result is outlined here. Nothing needs to be altered in the *.jast2 file, but the *.opt file requires some additions. For a system called sample, Edit the sample.opt file so that the very first line reads:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  METHOD { OPTIMIZE iterations 1000 READCONFIG sample.hf.config  }&lt;br /&gt;
  &lt;br /&gt;
  INCLUDE sample.sys&lt;br /&gt;
  TRIALFUNC {&lt;br /&gt;
    SLATER-JASTROW&lt;br /&gt;
    WF1 { INCLUDE sample.slater }&lt;br /&gt;
    WF2 { INCLUDE sample.jast2 }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;iterations&amp;quot; keyword extends the number of Jastrow optimisation cycles beyond the default which is only 30 (which in practice is often not enough). The &amp;quot;READCONFIG&amp;quot; file forces qWalk to explicitly read in the electron configurations from a previous qWalk run (if a more accurate *.dmc.config file exists, then of course use that!). The advantage of this keyword is that qWalk does not have to make up its own configurations, which will make the Jastrow optimisation unreproducible and, quite often, spurious. &lt;br /&gt;
&lt;br /&gt;
Once edited, simply run:&lt;br /&gt;
$ qwalk sample.opt&lt;br /&gt;
&lt;br /&gt;
A new file called &amp;quot;sample.opt.wfout&amp;quot; will have been produced, which contains the combined Slater and Jastrow parameters. Since we are only interested in the Jastrow parameters, and the parser gets confused with the Slater bit, delete the first portion of the file up until the lines which read:&lt;br /&gt;
&lt;br /&gt;
  JASTROW2&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
  [etc...]&lt;br /&gt;
&lt;br /&gt;
If the system only contains a single atom, then you are done, and the file should be successfully parsed! The only addition you will need to make is in the Make.include file, whereby the .opt.wfout must be added to the line which calls the executable, and tells it which files to read. For example, for the sample, the following needs to exist in Make.include:&lt;br /&gt;
&lt;br /&gt;
  [...]&lt;br /&gt;
  sample: program&lt;br /&gt;
          $(EXECWITH) bin/simpleDMC.x examples/SAMPLE_DIR/sample.{sys,slater,orb,basis,simple,hf.config,hf.log,opt.wfout}&lt;br /&gt;
  [etc...]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Water Example ===&lt;br /&gt;
&lt;br /&gt;
One further complication arises when more than one atom type is present, and one further amendment must be made to the *opt.wfout file. Out of the box, qWalk will produce the following line for a monomer of water whose Jastrow has been optimised:&lt;br /&gt;
&lt;br /&gt;
  [...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
  [etc...]&lt;br /&gt;
&lt;br /&gt;
The parser will not be able to read this, as it looks for the keyword &amp;quot;ONEBODY&amp;quot; and expects only a single line to follow. Therefore, the following addition will fix this problem, and a working file should look like:&lt;br /&gt;
&lt;br /&gt;
  [...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
    }&lt;br /&gt;
    ONEBODY{&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
  [etc...]&lt;/div&gt;</summary>
		<author><name>Acc73</name></author>
	</entry>
	<entry>
		<id>https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=246</id>
		<title>SimpleDMC</title>
		<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=246"/>
		<updated>2017-07-20T14:24:58Z</updated>

		<summary type="html">&lt;p&gt;Acc73: /* The Jastrow Factor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Theory =&lt;br /&gt;
&lt;br /&gt;
= Compilation of SimpleDMC =&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== The Hydrogen Atom ==&lt;br /&gt;
&lt;br /&gt;
=== Gaussian ===&lt;br /&gt;
Let&#039;s begin by generating a trial wavefunction with Gaussian03. To start with, we need to define an atomic orbital basis, then tell Gaussian03 to use it in conjunction with some &#039;&#039;ab initio&#039;&#039; method. We&#039;ll use the STO-6G basis set, where 6 Gaussian primitives are used to represent an atomic orbital. We&#039;ll create an input file for Gaussian03, called H.com,&lt;br /&gt;
&lt;br /&gt;
   $ cat -n H.com&lt;br /&gt;
      1   %chk=H.chk&lt;br /&gt;
      2   #p UHF/STO-6G 6d 10f SCF Test IOP(3/24=10) IOP(3/81=1) Pop=Full&lt;br /&gt;
      3   &lt;br /&gt;
      4   Hydrogen Atom - UHF STO-6G&lt;br /&gt;
      5&lt;br /&gt;
      6   0 2&lt;br /&gt;
      7   H   0.000   0.000   0.000&lt;br /&gt;
      8&lt;br /&gt;
&lt;br /&gt;
This may seem cryptic for the moment, but each line (and entry therein) is necessary. Line 1 tells Gaussian03 to put some output in an encrypted file called H.chk. Line 2 is the ``route section&amp;quot;: The IOP arguments are &#039;&#039;internal options&#039;&#039;, and tell Gaussian03 to spit out data in a certain format. Line 4 contains a title section, and must be included, as must the sandwiching blank lines. Line 6 specifies the charge and multiplicity (number of unpaired electrons + 1). Finally, on line 7, we specify the molecular configuration; atom types and Cartesian position vectors of the constituent atoms are enumerated here.&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s run Gaussian03,&lt;br /&gt;
&lt;br /&gt;
   $ g03 H.com&lt;br /&gt;
&lt;br /&gt;
No return value is normally a good sign- you&#039;ll typically be greeted with an (unhelpful) SEGFAULT of some kind if the calculation was unsuccessful. It&#039;s also worth explicitly checking for errors, since Gaussian is also able to die silently&lt;br /&gt;
&lt;br /&gt;
   $ grep &amp;quot;Error&amp;quot; H.log&lt;br /&gt;
&lt;br /&gt;
Gaussian03 writes to two files- H.log and H.chk; the contents of the former are obvious while we&#039;ve already briefly discussed the contents of the latter. In the output, all we care about is the energy, so invoke&lt;br /&gt;
&lt;br /&gt;
   $ grep -n &amp;quot;SCF Done&amp;quot; H.log&lt;br /&gt;
   219: SCF Done:  E(UHF) = -0.471039054196     A.U. after     1 cycles&lt;br /&gt;
&lt;br /&gt;
This is a rather poor value relative to the analytical -0.5 Hartrees, but at least we have something to improve upon. We must now do some conversions to extract information from the checkpoint file&lt;br /&gt;
&lt;br /&gt;
   $ formchk H.chk H.fchk&lt;br /&gt;
   Read checkpoint file H.chk&lt;br /&gt;
   Write formatted file H.fchk&lt;br /&gt;
   Rotating derivatives, DoTrsp=T IDiff= 1 LEDeriv=    197 LFDPrp=       0 LDFDPr=       0.&lt;br /&gt;
&lt;br /&gt;
formchk is a Gaussian utility that converts the unreadable H.chk to a formatted checkpoint file, H.fchk. Since this formatted file is more amenable to parsing, it can be used by a number of visualisation/ post-Gaussian tools.&lt;br /&gt;
&lt;br /&gt;
=== qWalk ===&lt;br /&gt;
qWalk is a piece of software we can benchmark the simpleDMC software against, possessing both variational&lt;br /&gt;
and diffusion Monte Carlo (VMC and DMC, respectively) functionalities. The simpleDMC software also uses &lt;br /&gt;
the same input file formats as qWalk, and so we are able to use their file conversion tools to extract data &lt;br /&gt;
from a host of &#039;&#039;ab initio&#039;&#039; software suites.&lt;br /&gt;
&lt;br /&gt;
First, we parse the H.fchk file into a number of qWalk input files:&lt;br /&gt;
&lt;br /&gt;
   $ ./g032qmc -log H.log -fchk H.fchk &lt;br /&gt;
   --- read fchk file ---&lt;br /&gt;
   Number of atoms: 1&lt;br /&gt;
   Number of basis functions: 1&lt;br /&gt;
   Number of independant functions: 1&lt;br /&gt;
   Multiplicity: 2&lt;br /&gt;
   Number of alpha electrons: 1&lt;br /&gt;
   Number of beta electrons: 0&lt;br /&gt;
   Total Energy: -0.471039054195684&lt;br /&gt;
   Pure/Cartesian d shells: 6D&lt;br /&gt;
   Pure/Cartesian f shells: 10F&lt;br /&gt;
   found beta component, scftpe=UHF&lt;br /&gt;
   --- read log file ---&lt;br /&gt;
   basis set is from &#039;AO basis set&#039; section&lt;br /&gt;
   --- have read files ---&lt;br /&gt;
   norb=1&lt;br /&gt;
   spin up end size=1&lt;br /&gt;
   moCoeff total size=2&lt;br /&gt;
   writing qwalk input files ... &lt;br /&gt;
   writing orb file.  This could take a few seconds.&lt;br /&gt;
   output: sample.orb&lt;br /&gt;
   output: sample.basis&lt;br /&gt;
   output: sample.slater&lt;br /&gt;
   output: sample.jast2&lt;br /&gt;
   output: sample.sys&lt;br /&gt;
   output: sample.hf&lt;br /&gt;
   output: sample.opt&lt;br /&gt;
   Done&lt;br /&gt;
    &lt;br /&gt;
   Warning: Now the basisset must be the same for the same specie of atoms&lt;br /&gt;
&lt;br /&gt;
We&#039;ll try to reproduce the UHF results by use of VMC with qWalk. Let&#039;s have a look at sample.hf:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.hf&lt;br /&gt;
   METHOD { VMC nconfig 1000 } &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   INCLUDE sample.sys  &lt;br /&gt;
   TRIALFUNC { INCLUDE sample.slater}&lt;br /&gt;
&lt;br /&gt;
Note that we have added &amp;quot;nconfig 1000&amp;quot;, which gives us control over how many walkers are to be used&lt;br /&gt;
for the VMC. sample.sys contains the system configuration (number of electrons with a given spin, &lt;br /&gt;
atomic coordinates, etc.), while sample.slater contains the orbital information for the Slater&lt;br /&gt;
determinant (in conjunction with sample.orb and sample.basis). This Slater determinant will be used&lt;br /&gt;
to sample the trial wavefunction created by g03. We now run qWalk:&lt;br /&gt;
&lt;br /&gt;
   $ ./qwalk sample.hf&lt;br /&gt;
   output to sample.hf.o&lt;br /&gt;
   System&lt;br /&gt;
   Wave function&lt;br /&gt;
   Pseudopotential&lt;br /&gt;
   Could not open sample.hf.config. Generating configurations from scratch&lt;br /&gt;
  &lt;br /&gt;
and upon completion, are left with three files,&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|sample.hf.o&lt;br /&gt;
|Information about the run.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.log&lt;br /&gt;
|Log for statistical analysis.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.config&lt;br /&gt;
|Checkfile for the run.&lt;br /&gt;
|}   &lt;br /&gt;
&lt;br /&gt;
We can extract averages from the VMC by invoking&lt;br /&gt;
&lt;br /&gt;
   $ ./gosling sample.hf.log      &lt;br /&gt;
   #####################&lt;br /&gt;
   vmc:  100 total blocks reblocked into 100&lt;br /&gt;
   #####################&lt;br /&gt;
   Threw out the first 0 blocks in the averaging.&lt;br /&gt;
   total_energy0        -0.4702684082 +/-  0.000922386677 (sigma     0.425114576 ) &lt;br /&gt;
   kinetic0              0.7706545412 +/-  0.003605881864 (sigma     1.448514687 ) &lt;br /&gt;
   potential0            -1.240922949 +/-  0.003148015019 (sigma      1.21325133 ) &lt;br /&gt;
   nonlocal0                        0 +/-               0 (sigma               0 ) &lt;br /&gt;
   weight0                          1 +/- 6.661338148e-17 (sigma               0 ) &lt;br /&gt;
   &lt;br /&gt;
   --------Properties differences-------------&lt;br /&gt;
   approximate number of independent points: 212415.3753&lt;br /&gt;
&lt;br /&gt;
We see that the VMC estimate of the energy of the trial wavefunction (-0.470(2)) matches&lt;br /&gt;
relatively well with the UHF energy (-0.471039054195684). We have also obtained the&lt;br /&gt;
sample.hf.config file, containing the distribution of walkers sampling the&lt;br /&gt;
trial wavefunction.&lt;br /&gt;
&lt;br /&gt;
   $ head -8 sample.hf.config&lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   -0.731706383078456 0.620589802605041 -0.092157439050284 &lt;br /&gt;
   } &lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   0.366970593352899 0.216757302067973 -0.48313699793852 &lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
=== simpleDMC ===&lt;br /&gt;
&lt;br /&gt;
We can use this distribution of walkers as a starting point for our DMC calculations with&lt;br /&gt;
simpleDMC. We require an input file to run simpleDMC, sample.simple:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.simple&lt;br /&gt;
   simple { &lt;br /&gt;
      nWalkers             1000     # Number of walkers&lt;br /&gt;
      nSteps              10000     # Maximum number of steps&lt;br /&gt;
      dTau                0.001     # Timestep&lt;br /&gt;
      dETrial              -0.5     # Trial energy should start (&amp;gt; FCI energy but close to it)&lt;br /&gt;
      dWeightInit           1.0     # Initial weight&lt;br /&gt;
      bConstWalkerNum     false     # Are we enforcing a constant number of walkers? (Currently not working)&lt;br /&gt;
      nWalkersSpace       20480	    # Walker growth space (Maximum number of walkers permitted)&lt;br /&gt;
      dWeightTarget     10000.0     # Total weight above which we undertake population control&lt;br /&gt;
      dWeightMin         1500.0     # Total weight below which we undertake population control&lt;br /&gt;
      dLowThresh            1.0     # If walker has weight below this, try to either kill or recombine it&lt;br /&gt;
      dWeightBranch         1.5     # If walker has weight above this, we branch the walker&lt;br /&gt;
      nShiftSteps             1     # Vary the shift every nShiftSteps steps.&lt;br /&gt;
      dShiftDamp            1.0     # Larger shift damping is more radical damping&lt;br /&gt;
      dOldWeight            0.0     # The total weight at the previous cycle for calculating the shift&lt;br /&gt;
      bUpdateShift        false     # Are we updating the shift every nShiftSteps cycles?&lt;br /&gt;
   }&lt;br /&gt;
                                                             &lt;br /&gt;
simpleDMC reuses the input files of qWalk, and can be invoked by listing the files as command line &lt;br /&gt;
arguments (in any order)&lt;br /&gt;
   &lt;br /&gt;
   $ ./simpleDMC.x sample.{sys,slater,orb,basis,simple,hf.config,hf.log} &amp;gt;&amp;gt; sample.log&lt;br /&gt;
&lt;br /&gt;
We pass all of the output to sample.log since the majority of information concerning the simulation is&lt;br /&gt;
streamed straight to STDOUT. We are primarily concerned with the final nSteps lines, since these give&lt;br /&gt;
the various energetic quantities associated with the system of walkers at each timestep. In fact, with&lt;br /&gt;
a little foresight, the fifth column corresponds to the total energy averaged over all walkers at that&lt;br /&gt;
timestep. Averaging over this column, we obtain the DMC energy:&lt;br /&gt;
&lt;br /&gt;
   $ export nsteps=10000&lt;br /&gt;
   $ tail -n $nsteps sample.log | awk &#039;{ sum += $5; n++ } END { if (n &amp;gt; 0) print sum / n; }&#039;&lt;br /&gt;
   -0.498772&lt;br /&gt;
&lt;br /&gt;
This quantity is in very good agreement with the exact energy of -0.5 Hartrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;V = \frac{\epsilon}{2} \sum_{i&amp;lt;j} \left[ \left(\frac{r_{ij}}{\sigma}\right)^2+\left(\frac{\sigma}{r_{ij}}\right)^2 \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Jastrow Factor ==&lt;br /&gt;
&lt;br /&gt;
One further usable output from qWalk is the Jastrow factor parameters. This helps to add in explicit correlation terms between electron-electron pairs (known two body terms) and electron-ion pairs (one body terms). After having performed the parsing of the *.fchk file with ./g032qmc, a blank template of the Jastrow parameters will be created, called *.jast2. This is designed to include both two-body and one-body interaction, hence the suffix of &amp;quot;2&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
A good tutorial for how to optimise the Jastrow parameters is given in the qWalk documentation ( [https://github.com/QWalk/mainline/wiki/Tutorial] ), but a potted version which will consistently produce the same result is outlined here. Nothing needs to be altered in the *.jast2 file, but the *.opt file requires some additions. For a system called sample, Edit the sample.opt file so that the very first line reads:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  METHOD { OPTIMIZE iterations 1000 READCONFIG sample.hf.config  }&lt;br /&gt;
  &lt;br /&gt;
  INCLUDE sample.sys&lt;br /&gt;
  TRIALFUNC {&lt;br /&gt;
    SLATER-JASTROW&lt;br /&gt;
    WF1 { INCLUDE sample.slater }&lt;br /&gt;
    WF2 { INCLUDE sample.jast2 }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;iterations&amp;quot; keyword extends the number of Jastrow optimisation cycles beyond the default which is only 30 (which in practice is often not enough). The &amp;quot;READCONFIG&amp;quot; file forces qWalk to explicitly read in the electron configurations from a previous qWalk run (if a more accurate *.dmc.config file exists, then of course use that!). The advantage of this keyword is that qWalk does not have to make up its own configurations, which will make the Jastrow optimisation unreproducible and, quite often, spurious. &lt;br /&gt;
&lt;br /&gt;
Once edited, simply run:&lt;br /&gt;
$ qwalk sample.opt&lt;br /&gt;
&lt;br /&gt;
A new file called &amp;quot;sample.opt.wfout&amp;quot; will have been produced, which contains the combined Slater and Jastrow parameters. Since we are only interested in the Jastrow parameters, and the parser gets confused with the Slater bit, delete the first portion of the file up until the lines which read:&lt;br /&gt;
&lt;br /&gt;
  JASTROW2&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
  [etc...]&lt;br /&gt;
&lt;br /&gt;
If the system only contains a single atom, then you are done, and the file should be successfully parsed! The only addition you will need to make is in the Make.include file, whereby the .opt.wfout must be added to the line which calls the executable, and tells it which files to read. For example, for the sample, the following needs to exist in Make.include:&lt;br /&gt;
&lt;br /&gt;
  [...]&lt;br /&gt;
  sample: program&lt;br /&gt;
          $(EXECWITH) bin/simpleDMC.x examples/SAMPLE_DIR/sample.{sys,slater,orb,basis,simple,hf.config,hf.log,opt.wfout}&lt;br /&gt;
  [etc...]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Water Example ===&lt;br /&gt;
&lt;br /&gt;
One further complication arises when more than one atom type is present, and one further amendment must be made to the *opt.wfout file. Out of the box, qWalk will produce the following line for a monomer of water whose Jastrow has been optimised:&lt;br /&gt;
&lt;br /&gt;
  [...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
  [etc...]&lt;br /&gt;
&lt;br /&gt;
The parser will not be able to read this, as it looks for the keyword &amp;quot;ONEBODY&amp;quot; and expects only a single line to follow. Therefore, the following addition will fix this problem, and a working file should look like:&lt;br /&gt;
&lt;br /&gt;
  [...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
    }&lt;br /&gt;
    ONEBODY{&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
  [etc...]&lt;/div&gt;</summary>
		<author><name>Acc73</name></author>
	</entry>
	<entry>
		<id>https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=245</id>
		<title>SimpleDMC</title>
		<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=245"/>
		<updated>2017-07-20T14:24:32Z</updated>

		<summary type="html">&lt;p&gt;Acc73: /* The Jastrow Factor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Theory =&lt;br /&gt;
&lt;br /&gt;
= Compilation of SimpleDMC =&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== The Hydrogen Atom ==&lt;br /&gt;
&lt;br /&gt;
=== Gaussian ===&lt;br /&gt;
Let&#039;s begin by generating a trial wavefunction with Gaussian03. To start with, we need to define an atomic orbital basis, then tell Gaussian03 to use it in conjunction with some &#039;&#039;ab initio&#039;&#039; method. We&#039;ll use the STO-6G basis set, where 6 Gaussian primitives are used to represent an atomic orbital. We&#039;ll create an input file for Gaussian03, called H.com,&lt;br /&gt;
&lt;br /&gt;
   $ cat -n H.com&lt;br /&gt;
      1   %chk=H.chk&lt;br /&gt;
      2   #p UHF/STO-6G 6d 10f SCF Test IOP(3/24=10) IOP(3/81=1) Pop=Full&lt;br /&gt;
      3   &lt;br /&gt;
      4   Hydrogen Atom - UHF STO-6G&lt;br /&gt;
      5&lt;br /&gt;
      6   0 2&lt;br /&gt;
      7   H   0.000   0.000   0.000&lt;br /&gt;
      8&lt;br /&gt;
&lt;br /&gt;
This may seem cryptic for the moment, but each line (and entry therein) is necessary. Line 1 tells Gaussian03 to put some output in an encrypted file called H.chk. Line 2 is the ``route section&amp;quot;: The IOP arguments are &#039;&#039;internal options&#039;&#039;, and tell Gaussian03 to spit out data in a certain format. Line 4 contains a title section, and must be included, as must the sandwiching blank lines. Line 6 specifies the charge and multiplicity (number of unpaired electrons + 1). Finally, on line 7, we specify the molecular configuration; atom types and Cartesian position vectors of the constituent atoms are enumerated here.&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s run Gaussian03,&lt;br /&gt;
&lt;br /&gt;
   $ g03 H.com&lt;br /&gt;
&lt;br /&gt;
No return value is normally a good sign- you&#039;ll typically be greeted with an (unhelpful) SEGFAULT of some kind if the calculation was unsuccessful. It&#039;s also worth explicitly checking for errors, since Gaussian is also able to die silently&lt;br /&gt;
&lt;br /&gt;
   $ grep &amp;quot;Error&amp;quot; H.log&lt;br /&gt;
&lt;br /&gt;
Gaussian03 writes to two files- H.log and H.chk; the contents of the former are obvious while we&#039;ve already briefly discussed the contents of the latter. In the output, all we care about is the energy, so invoke&lt;br /&gt;
&lt;br /&gt;
   $ grep -n &amp;quot;SCF Done&amp;quot; H.log&lt;br /&gt;
   219: SCF Done:  E(UHF) = -0.471039054196     A.U. after     1 cycles&lt;br /&gt;
&lt;br /&gt;
This is a rather poor value relative to the analytical -0.5 Hartrees, but at least we have something to improve upon. We must now do some conversions to extract information from the checkpoint file&lt;br /&gt;
&lt;br /&gt;
   $ formchk H.chk H.fchk&lt;br /&gt;
   Read checkpoint file H.chk&lt;br /&gt;
   Write formatted file H.fchk&lt;br /&gt;
   Rotating derivatives, DoTrsp=T IDiff= 1 LEDeriv=    197 LFDPrp=       0 LDFDPr=       0.&lt;br /&gt;
&lt;br /&gt;
formchk is a Gaussian utility that converts the unreadable H.chk to a formatted checkpoint file, H.fchk. Since this formatted file is more amenable to parsing, it can be used by a number of visualisation/ post-Gaussian tools.&lt;br /&gt;
&lt;br /&gt;
=== qWalk ===&lt;br /&gt;
qWalk is a piece of software we can benchmark the simpleDMC software against, possessing both variational&lt;br /&gt;
and diffusion Monte Carlo (VMC and DMC, respectively) functionalities. The simpleDMC software also uses &lt;br /&gt;
the same input file formats as qWalk, and so we are able to use their file conversion tools to extract data &lt;br /&gt;
from a host of &#039;&#039;ab initio&#039;&#039; software suites.&lt;br /&gt;
&lt;br /&gt;
First, we parse the H.fchk file into a number of qWalk input files:&lt;br /&gt;
&lt;br /&gt;
   $ ./g032qmc -log H.log -fchk H.fchk &lt;br /&gt;
   --- read fchk file ---&lt;br /&gt;
   Number of atoms: 1&lt;br /&gt;
   Number of basis functions: 1&lt;br /&gt;
   Number of independant functions: 1&lt;br /&gt;
   Multiplicity: 2&lt;br /&gt;
   Number of alpha electrons: 1&lt;br /&gt;
   Number of beta electrons: 0&lt;br /&gt;
   Total Energy: -0.471039054195684&lt;br /&gt;
   Pure/Cartesian d shells: 6D&lt;br /&gt;
   Pure/Cartesian f shells: 10F&lt;br /&gt;
   found beta component, scftpe=UHF&lt;br /&gt;
   --- read log file ---&lt;br /&gt;
   basis set is from &#039;AO basis set&#039; section&lt;br /&gt;
   --- have read files ---&lt;br /&gt;
   norb=1&lt;br /&gt;
   spin up end size=1&lt;br /&gt;
   moCoeff total size=2&lt;br /&gt;
   writing qwalk input files ... &lt;br /&gt;
   writing orb file.  This could take a few seconds.&lt;br /&gt;
   output: sample.orb&lt;br /&gt;
   output: sample.basis&lt;br /&gt;
   output: sample.slater&lt;br /&gt;
   output: sample.jast2&lt;br /&gt;
   output: sample.sys&lt;br /&gt;
   output: sample.hf&lt;br /&gt;
   output: sample.opt&lt;br /&gt;
   Done&lt;br /&gt;
    &lt;br /&gt;
   Warning: Now the basisset must be the same for the same specie of atoms&lt;br /&gt;
&lt;br /&gt;
We&#039;ll try to reproduce the UHF results by use of VMC with qWalk. Let&#039;s have a look at sample.hf:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.hf&lt;br /&gt;
   METHOD { VMC nconfig 1000 } &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   INCLUDE sample.sys  &lt;br /&gt;
   TRIALFUNC { INCLUDE sample.slater}&lt;br /&gt;
&lt;br /&gt;
Note that we have added &amp;quot;nconfig 1000&amp;quot;, which gives us control over how many walkers are to be used&lt;br /&gt;
for the VMC. sample.sys contains the system configuration (number of electrons with a given spin, &lt;br /&gt;
atomic coordinates, etc.), while sample.slater contains the orbital information for the Slater&lt;br /&gt;
determinant (in conjunction with sample.orb and sample.basis). This Slater determinant will be used&lt;br /&gt;
to sample the trial wavefunction created by g03. We now run qWalk:&lt;br /&gt;
&lt;br /&gt;
   $ ./qwalk sample.hf&lt;br /&gt;
   output to sample.hf.o&lt;br /&gt;
   System&lt;br /&gt;
   Wave function&lt;br /&gt;
   Pseudopotential&lt;br /&gt;
   Could not open sample.hf.config. Generating configurations from scratch&lt;br /&gt;
  &lt;br /&gt;
and upon completion, are left with three files,&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|sample.hf.o&lt;br /&gt;
|Information about the run.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.log&lt;br /&gt;
|Log for statistical analysis.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.config&lt;br /&gt;
|Checkfile for the run.&lt;br /&gt;
|}   &lt;br /&gt;
&lt;br /&gt;
We can extract averages from the VMC by invoking&lt;br /&gt;
&lt;br /&gt;
   $ ./gosling sample.hf.log      &lt;br /&gt;
   #####################&lt;br /&gt;
   vmc:  100 total blocks reblocked into 100&lt;br /&gt;
   #####################&lt;br /&gt;
   Threw out the first 0 blocks in the averaging.&lt;br /&gt;
   total_energy0        -0.4702684082 +/-  0.000922386677 (sigma     0.425114576 ) &lt;br /&gt;
   kinetic0              0.7706545412 +/-  0.003605881864 (sigma     1.448514687 ) &lt;br /&gt;
   potential0            -1.240922949 +/-  0.003148015019 (sigma      1.21325133 ) &lt;br /&gt;
   nonlocal0                        0 +/-               0 (sigma               0 ) &lt;br /&gt;
   weight0                          1 +/- 6.661338148e-17 (sigma               0 ) &lt;br /&gt;
   &lt;br /&gt;
   --------Properties differences-------------&lt;br /&gt;
   approximate number of independent points: 212415.3753&lt;br /&gt;
&lt;br /&gt;
We see that the VMC estimate of the energy of the trial wavefunction (-0.470(2)) matches&lt;br /&gt;
relatively well with the UHF energy (-0.471039054195684). We have also obtained the&lt;br /&gt;
sample.hf.config file, containing the distribution of walkers sampling the&lt;br /&gt;
trial wavefunction.&lt;br /&gt;
&lt;br /&gt;
   $ head -8 sample.hf.config&lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   -0.731706383078456 0.620589802605041 -0.092157439050284 &lt;br /&gt;
   } &lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   0.366970593352899 0.216757302067973 -0.48313699793852 &lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
=== simpleDMC ===&lt;br /&gt;
&lt;br /&gt;
We can use this distribution of walkers as a starting point for our DMC calculations with&lt;br /&gt;
simpleDMC. We require an input file to run simpleDMC, sample.simple:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.simple&lt;br /&gt;
   simple { &lt;br /&gt;
      nWalkers             1000     # Number of walkers&lt;br /&gt;
      nSteps              10000     # Maximum number of steps&lt;br /&gt;
      dTau                0.001     # Timestep&lt;br /&gt;
      dETrial              -0.5     # Trial energy should start (&amp;gt; FCI energy but close to it)&lt;br /&gt;
      dWeightInit           1.0     # Initial weight&lt;br /&gt;
      bConstWalkerNum     false     # Are we enforcing a constant number of walkers? (Currently not working)&lt;br /&gt;
      nWalkersSpace       20480	    # Walker growth space (Maximum number of walkers permitted)&lt;br /&gt;
      dWeightTarget     10000.0     # Total weight above which we undertake population control&lt;br /&gt;
      dWeightMin         1500.0     # Total weight below which we undertake population control&lt;br /&gt;
      dLowThresh            1.0     # If walker has weight below this, try to either kill or recombine it&lt;br /&gt;
      dWeightBranch         1.5     # If walker has weight above this, we branch the walker&lt;br /&gt;
      nShiftSteps             1     # Vary the shift every nShiftSteps steps.&lt;br /&gt;
      dShiftDamp            1.0     # Larger shift damping is more radical damping&lt;br /&gt;
      dOldWeight            0.0     # The total weight at the previous cycle for calculating the shift&lt;br /&gt;
      bUpdateShift        false     # Are we updating the shift every nShiftSteps cycles?&lt;br /&gt;
   }&lt;br /&gt;
                                                             &lt;br /&gt;
simpleDMC reuses the input files of qWalk, and can be invoked by listing the files as command line &lt;br /&gt;
arguments (in any order)&lt;br /&gt;
   &lt;br /&gt;
   $ ./simpleDMC.x sample.{sys,slater,orb,basis,simple,hf.config,hf.log} &amp;gt;&amp;gt; sample.log&lt;br /&gt;
&lt;br /&gt;
We pass all of the output to sample.log since the majority of information concerning the simulation is&lt;br /&gt;
streamed straight to STDOUT. We are primarily concerned with the final nSteps lines, since these give&lt;br /&gt;
the various energetic quantities associated with the system of walkers at each timestep. In fact, with&lt;br /&gt;
a little foresight, the fifth column corresponds to the total energy averaged over all walkers at that&lt;br /&gt;
timestep. Averaging over this column, we obtain the DMC energy:&lt;br /&gt;
&lt;br /&gt;
   $ export nsteps=10000&lt;br /&gt;
   $ tail -n $nsteps sample.log | awk &#039;{ sum += $5; n++ } END { if (n &amp;gt; 0) print sum / n; }&#039;&lt;br /&gt;
   -0.498772&lt;br /&gt;
&lt;br /&gt;
This quantity is in very good agreement with the exact energy of -0.5 Hartrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;V = \frac{\epsilon}{2} \sum_{i&amp;lt;j} \left[ \left(\frac{r_{ij}}{\sigma}\right)^2+\left(\frac{\sigma}{r_{ij}}\right)^2 \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Jastrow Factor ==&lt;br /&gt;
&lt;br /&gt;
One further usable output from qWalk is the Jastrow factor parameters. This helps to add in explicit correlation terms between electron-electron pairs (known two body terms) and electron-ion pairs (one body terms). After having performed the parsing of the *.fchk file with ./g032qmc, a blank template of the Jastrow parameters will be created, called *.jast2. This is designed to include both two-body and one-body interaction, hence the suffix of &amp;quot;2&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
A good tutorial for how to optimise the Jastrow parameters is given in the qWalk documentation ( [https://github.com/QWalk/mainline/wiki/Tutorial] ), but a potted version which will consistently produce the same result is outlined here. Nothing needs to be altered in the *.jast2 file, but the *.opt file requires some additions. For a system called sample, Edit the sample.opt file so that the very first line reads:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  METHOD { OPTIMIZE iterations 1000 READCONFIG sample.hf.config  }&lt;br /&gt;
  &lt;br /&gt;
  INCLUDE WaterHex.sys&lt;br /&gt;
  TRIALFUNC {&lt;br /&gt;
    SLATER-JASTROW&lt;br /&gt;
    WF1 { INCLUDE WaterHex.slater }&lt;br /&gt;
    WF2 { INCLUDE WaterHex.jast2 }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;iterations&amp;quot; keyword extends the number of Jastrow optimisation cycles beyond the default which is only 30 (which in practice is often not enough). The &amp;quot;READCONFIG&amp;quot; file forces qWalk to explicitly read in the electron configurations from a previous qWalk run (if a more accurate *.dmc.config file exists, then of course use that!). The advantage of this keyword is that qWalk does not have to make up its own configurations, which will make the Jastrow optimisation unreproducible and, quite often, spurious. &lt;br /&gt;
&lt;br /&gt;
Once edited, simply run:&lt;br /&gt;
$ qwalk sample.opt&lt;br /&gt;
&lt;br /&gt;
A new file called &amp;quot;sample.opt.wfout&amp;quot; will have been produced, which contains the combined Slater and Jastrow parameters. Since we are only interested in the Jastrow parameters, and the parser gets confused with the Slater bit, delete the first portion of the file up until the lines which read:&lt;br /&gt;
&lt;br /&gt;
  JASTROW2&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
  [etc...]&lt;br /&gt;
&lt;br /&gt;
If the system only contains a single atom, then you are done, and the file should be successfully parsed! The only addition you will need to make is in the Make.include file, whereby the .opt.wfout must be added to the line which calls the executable, and tells it which files to read. For example, for the sample, the following needs to exist in Make.include:&lt;br /&gt;
&lt;br /&gt;
  [...]&lt;br /&gt;
  sample: program&lt;br /&gt;
          $(EXECWITH) bin/simpleDMC.x examples/SAMPLE_DIR/sample.{sys,slater,orb,basis,simple,hf.config,hf.log,opt.wfout}&lt;br /&gt;
  [etc...]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Water Example ===&lt;br /&gt;
&lt;br /&gt;
One further complication arises when more than one atom type is present, and one further amendment must be made to the *opt.wfout file. Out of the box, qWalk will produce the following line for a monomer of water whose Jastrow has been optimised:&lt;br /&gt;
&lt;br /&gt;
  [...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
  [etc...]&lt;br /&gt;
&lt;br /&gt;
The parser will not be able to read this, as it looks for the keyword &amp;quot;ONEBODY&amp;quot; and expects only a single line to follow. Therefore, the following addition will fix this problem, and a working file should look like:&lt;br /&gt;
&lt;br /&gt;
  [...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
    }&lt;br /&gt;
    ONEBODY{&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
  [etc...]&lt;/div&gt;</summary>
		<author><name>Acc73</name></author>
	</entry>
	<entry>
		<id>https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=244</id>
		<title>SimpleDMC</title>
		<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=244"/>
		<updated>2017-07-20T14:23:49Z</updated>

		<summary type="html">&lt;p&gt;Acc73: /* The Jastrow Factor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Theory =&lt;br /&gt;
&lt;br /&gt;
= Compilation of SimpleDMC =&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== The Hydrogen Atom ==&lt;br /&gt;
&lt;br /&gt;
=== Gaussian ===&lt;br /&gt;
Let&#039;s begin by generating a trial wavefunction with Gaussian03. To start with, we need to define an atomic orbital basis, then tell Gaussian03 to use it in conjunction with some &#039;&#039;ab initio&#039;&#039; method. We&#039;ll use the STO-6G basis set, where 6 Gaussian primitives are used to represent an atomic orbital. We&#039;ll create an input file for Gaussian03, called H.com,&lt;br /&gt;
&lt;br /&gt;
   $ cat -n H.com&lt;br /&gt;
      1   %chk=H.chk&lt;br /&gt;
      2   #p UHF/STO-6G 6d 10f SCF Test IOP(3/24=10) IOP(3/81=1) Pop=Full&lt;br /&gt;
      3   &lt;br /&gt;
      4   Hydrogen Atom - UHF STO-6G&lt;br /&gt;
      5&lt;br /&gt;
      6   0 2&lt;br /&gt;
      7   H   0.000   0.000   0.000&lt;br /&gt;
      8&lt;br /&gt;
&lt;br /&gt;
This may seem cryptic for the moment, but each line (and entry therein) is necessary. Line 1 tells Gaussian03 to put some output in an encrypted file called H.chk. Line 2 is the ``route section&amp;quot;: The IOP arguments are &#039;&#039;internal options&#039;&#039;, and tell Gaussian03 to spit out data in a certain format. Line 4 contains a title section, and must be included, as must the sandwiching blank lines. Line 6 specifies the charge and multiplicity (number of unpaired electrons + 1). Finally, on line 7, we specify the molecular configuration; atom types and Cartesian position vectors of the constituent atoms are enumerated here.&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s run Gaussian03,&lt;br /&gt;
&lt;br /&gt;
   $ g03 H.com&lt;br /&gt;
&lt;br /&gt;
No return value is normally a good sign- you&#039;ll typically be greeted with an (unhelpful) SEGFAULT of some kind if the calculation was unsuccessful. It&#039;s also worth explicitly checking for errors, since Gaussian is also able to die silently&lt;br /&gt;
&lt;br /&gt;
   $ grep &amp;quot;Error&amp;quot; H.log&lt;br /&gt;
&lt;br /&gt;
Gaussian03 writes to two files- H.log and H.chk; the contents of the former are obvious while we&#039;ve already briefly discussed the contents of the latter. In the output, all we care about is the energy, so invoke&lt;br /&gt;
&lt;br /&gt;
   $ grep -n &amp;quot;SCF Done&amp;quot; H.log&lt;br /&gt;
   219: SCF Done:  E(UHF) = -0.471039054196     A.U. after     1 cycles&lt;br /&gt;
&lt;br /&gt;
This is a rather poor value relative to the analytical -0.5 Hartrees, but at least we have something to improve upon. We must now do some conversions to extract information from the checkpoint file&lt;br /&gt;
&lt;br /&gt;
   $ formchk H.chk H.fchk&lt;br /&gt;
   Read checkpoint file H.chk&lt;br /&gt;
   Write formatted file H.fchk&lt;br /&gt;
   Rotating derivatives, DoTrsp=T IDiff= 1 LEDeriv=    197 LFDPrp=       0 LDFDPr=       0.&lt;br /&gt;
&lt;br /&gt;
formchk is a Gaussian utility that converts the unreadable H.chk to a formatted checkpoint file, H.fchk. Since this formatted file is more amenable to parsing, it can be used by a number of visualisation/ post-Gaussian tools.&lt;br /&gt;
&lt;br /&gt;
=== qWalk ===&lt;br /&gt;
qWalk is a piece of software we can benchmark the simpleDMC software against, possessing both variational&lt;br /&gt;
and diffusion Monte Carlo (VMC and DMC, respectively) functionalities. The simpleDMC software also uses &lt;br /&gt;
the same input file formats as qWalk, and so we are able to use their file conversion tools to extract data &lt;br /&gt;
from a host of &#039;&#039;ab initio&#039;&#039; software suites.&lt;br /&gt;
&lt;br /&gt;
First, we parse the H.fchk file into a number of qWalk input files:&lt;br /&gt;
&lt;br /&gt;
   $ ./g032qmc -log H.log -fchk H.fchk &lt;br /&gt;
   --- read fchk file ---&lt;br /&gt;
   Number of atoms: 1&lt;br /&gt;
   Number of basis functions: 1&lt;br /&gt;
   Number of independant functions: 1&lt;br /&gt;
   Multiplicity: 2&lt;br /&gt;
   Number of alpha electrons: 1&lt;br /&gt;
   Number of beta electrons: 0&lt;br /&gt;
   Total Energy: -0.471039054195684&lt;br /&gt;
   Pure/Cartesian d shells: 6D&lt;br /&gt;
   Pure/Cartesian f shells: 10F&lt;br /&gt;
   found beta component, scftpe=UHF&lt;br /&gt;
   --- read log file ---&lt;br /&gt;
   basis set is from &#039;AO basis set&#039; section&lt;br /&gt;
   --- have read files ---&lt;br /&gt;
   norb=1&lt;br /&gt;
   spin up end size=1&lt;br /&gt;
   moCoeff total size=2&lt;br /&gt;
   writing qwalk input files ... &lt;br /&gt;
   writing orb file.  This could take a few seconds.&lt;br /&gt;
   output: sample.orb&lt;br /&gt;
   output: sample.basis&lt;br /&gt;
   output: sample.slater&lt;br /&gt;
   output: sample.jast2&lt;br /&gt;
   output: sample.sys&lt;br /&gt;
   output: sample.hf&lt;br /&gt;
   output: sample.opt&lt;br /&gt;
   Done&lt;br /&gt;
    &lt;br /&gt;
   Warning: Now the basisset must be the same for the same specie of atoms&lt;br /&gt;
&lt;br /&gt;
We&#039;ll try to reproduce the UHF results by use of VMC with qWalk. Let&#039;s have a look at sample.hf:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.hf&lt;br /&gt;
   METHOD { VMC nconfig 1000 } &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   INCLUDE sample.sys  &lt;br /&gt;
   TRIALFUNC { INCLUDE sample.slater}&lt;br /&gt;
&lt;br /&gt;
Note that we have added &amp;quot;nconfig 1000&amp;quot;, which gives us control over how many walkers are to be used&lt;br /&gt;
for the VMC. sample.sys contains the system configuration (number of electrons with a given spin, &lt;br /&gt;
atomic coordinates, etc.), while sample.slater contains the orbital information for the Slater&lt;br /&gt;
determinant (in conjunction with sample.orb and sample.basis). This Slater determinant will be used&lt;br /&gt;
to sample the trial wavefunction created by g03. We now run qWalk:&lt;br /&gt;
&lt;br /&gt;
   $ ./qwalk sample.hf&lt;br /&gt;
   output to sample.hf.o&lt;br /&gt;
   System&lt;br /&gt;
   Wave function&lt;br /&gt;
   Pseudopotential&lt;br /&gt;
   Could not open sample.hf.config. Generating configurations from scratch&lt;br /&gt;
  &lt;br /&gt;
and upon completion, are left with three files,&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|sample.hf.o&lt;br /&gt;
|Information about the run.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.log&lt;br /&gt;
|Log for statistical analysis.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.config&lt;br /&gt;
|Checkfile for the run.&lt;br /&gt;
|}   &lt;br /&gt;
&lt;br /&gt;
We can extract averages from the VMC by invoking&lt;br /&gt;
&lt;br /&gt;
   $ ./gosling sample.hf.log      &lt;br /&gt;
   #####################&lt;br /&gt;
   vmc:  100 total blocks reblocked into 100&lt;br /&gt;
   #####################&lt;br /&gt;
   Threw out the first 0 blocks in the averaging.&lt;br /&gt;
   total_energy0        -0.4702684082 +/-  0.000922386677 (sigma     0.425114576 ) &lt;br /&gt;
   kinetic0              0.7706545412 +/-  0.003605881864 (sigma     1.448514687 ) &lt;br /&gt;
   potential0            -1.240922949 +/-  0.003148015019 (sigma      1.21325133 ) &lt;br /&gt;
   nonlocal0                        0 +/-               0 (sigma               0 ) &lt;br /&gt;
   weight0                          1 +/- 6.661338148e-17 (sigma               0 ) &lt;br /&gt;
   &lt;br /&gt;
   --------Properties differences-------------&lt;br /&gt;
   approximate number of independent points: 212415.3753&lt;br /&gt;
&lt;br /&gt;
We see that the VMC estimate of the energy of the trial wavefunction (-0.470(2)) matches&lt;br /&gt;
relatively well with the UHF energy (-0.471039054195684). We have also obtained the&lt;br /&gt;
sample.hf.config file, containing the distribution of walkers sampling the&lt;br /&gt;
trial wavefunction.&lt;br /&gt;
&lt;br /&gt;
   $ head -8 sample.hf.config&lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   -0.731706383078456 0.620589802605041 -0.092157439050284 &lt;br /&gt;
   } &lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   0.366970593352899 0.216757302067973 -0.48313699793852 &lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
=== simpleDMC ===&lt;br /&gt;
&lt;br /&gt;
We can use this distribution of walkers as a starting point for our DMC calculations with&lt;br /&gt;
simpleDMC. We require an input file to run simpleDMC, sample.simple:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.simple&lt;br /&gt;
   simple { &lt;br /&gt;
      nWalkers             1000     # Number of walkers&lt;br /&gt;
      nSteps              10000     # Maximum number of steps&lt;br /&gt;
      dTau                0.001     # Timestep&lt;br /&gt;
      dETrial              -0.5     # Trial energy should start (&amp;gt; FCI energy but close to it)&lt;br /&gt;
      dWeightInit           1.0     # Initial weight&lt;br /&gt;
      bConstWalkerNum     false     # Are we enforcing a constant number of walkers? (Currently not working)&lt;br /&gt;
      nWalkersSpace       20480	    # Walker growth space (Maximum number of walkers permitted)&lt;br /&gt;
      dWeightTarget     10000.0     # Total weight above which we undertake population control&lt;br /&gt;
      dWeightMin         1500.0     # Total weight below which we undertake population control&lt;br /&gt;
      dLowThresh            1.0     # If walker has weight below this, try to either kill or recombine it&lt;br /&gt;
      dWeightBranch         1.5     # If walker has weight above this, we branch the walker&lt;br /&gt;
      nShiftSteps             1     # Vary the shift every nShiftSteps steps.&lt;br /&gt;
      dShiftDamp            1.0     # Larger shift damping is more radical damping&lt;br /&gt;
      dOldWeight            0.0     # The total weight at the previous cycle for calculating the shift&lt;br /&gt;
      bUpdateShift        false     # Are we updating the shift every nShiftSteps cycles?&lt;br /&gt;
   }&lt;br /&gt;
                                                             &lt;br /&gt;
simpleDMC reuses the input files of qWalk, and can be invoked by listing the files as command line &lt;br /&gt;
arguments (in any order)&lt;br /&gt;
   &lt;br /&gt;
   $ ./simpleDMC.x sample.{sys,slater,orb,basis,simple,hf.config,hf.log} &amp;gt;&amp;gt; sample.log&lt;br /&gt;
&lt;br /&gt;
We pass all of the output to sample.log since the majority of information concerning the simulation is&lt;br /&gt;
streamed straight to STDOUT. We are primarily concerned with the final nSteps lines, since these give&lt;br /&gt;
the various energetic quantities associated with the system of walkers at each timestep. In fact, with&lt;br /&gt;
a little foresight, the fifth column corresponds to the total energy averaged over all walkers at that&lt;br /&gt;
timestep. Averaging over this column, we obtain the DMC energy:&lt;br /&gt;
&lt;br /&gt;
   $ export nsteps=10000&lt;br /&gt;
   $ tail -n $nsteps sample.log | awk &#039;{ sum += $5; n++ } END { if (n &amp;gt; 0) print sum / n; }&#039;&lt;br /&gt;
   -0.498772&lt;br /&gt;
&lt;br /&gt;
This quantity is in very good agreement with the exact energy of -0.5 Hartrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;V = \frac{\epsilon}{2} \sum_{i&amp;lt;j} \left[ \left(\frac{r_{ij}}{\sigma}\right)^2+\left(\frac{\sigma}{r_{ij}}\right)^2 \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Jastrow Factor ==&lt;br /&gt;
&lt;br /&gt;
One further usable output from qWalk is the Jastrow factor parameters. This helps to add in explicit correlation terms between electron-electron pairs (known two body terms) and electron-ion pairs (one body terms). After having performed the parsing of the *.fchk file with ./g032qmc, a blank template of the Jastrow parameters will be created, called *.jast2. This is designed to include both two-body and one-body interaction, hence the suffix of &amp;quot;2&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
A good tutorial for how to optimise the Jastrow parameters is given in the qWalk documentation ( [https://github.com/QWalk/mainline/wiki/Tutorial] ), but a potted version which will consistently produce the same result is outlined here. Nothing needs to be altered in the *.jast2 file, but the *.opt file requires some additions. For a system called sample, Edit the sample.opt file so that the very first line reads:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  METHOD { OPTIMIZE iterations 1000 READCONFIG sample.hf.config  }&lt;br /&gt;
  INCLUDE WaterHex.sys&lt;br /&gt;
  TRIALFUNC {&lt;br /&gt;
    SLATER-JASTROW&lt;br /&gt;
    WF1 { INCLUDE WaterHex.slater }&lt;br /&gt;
    WF2 { INCLUDE WaterHex.jast2 }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;iterations&amp;quot; keyword extends the number of Jastrow optimisation cycles beyond the default which is only 30 (which in practice is often not enough). The &amp;quot;READCONFIG&amp;quot; file forces qWalk to explicitly read in the electron configurations from a previous qWalk run (if a more accurate *.dmc.config file exists, then of course use that!). The advantage of this keyword is that qWalk does not have to make up its own configurations, which will make the Jastrow optimisation unreproducible and, quite often, spurious. &lt;br /&gt;
&lt;br /&gt;
Once edited, simply run:&lt;br /&gt;
$ qwalk sample.opt&lt;br /&gt;
&lt;br /&gt;
A new file called &amp;quot;sample.opt.wfout&amp;quot; will have been produced, which contains the combined Slater and Jastrow parameters. Since we are only interested in the Jastrow parameters, and the parser gets confused with the Slater bit, delete the first portion of the file up until the lines which read:&lt;br /&gt;
&lt;br /&gt;
  JASTROW2&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
If the system only contains a single atom, then you are done, and the file should be successfully parsed! The only addition you will need to make is in the Make.include file, whereby the .opt.wfout must be added to the line which calls the executable, and tells it which files to read. For example, for the sample, the following needs to exist in Make.include:&lt;br /&gt;
&lt;br /&gt;
  [...]&lt;br /&gt;
  sample: program&lt;br /&gt;
          $(EXECWITH) bin/simpleDMC.x examples/SAMPLE_DIR/sample.{sys,slater,orb,basis,simple,hf.config,hf.log,opt.wfout}&lt;br /&gt;
  [etc...]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Water Example ===&lt;br /&gt;
&lt;br /&gt;
One further complication arises when more than one atom type is present, and one further amendment must be made to the *opt.wfout file. Out of the box, qWalk will produce the following line for a monomer of water whose Jastrow has been optimised:&lt;br /&gt;
&lt;br /&gt;
  [...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
  [etc...]&lt;br /&gt;
&lt;br /&gt;
The parser will not be able to read this, as it looks for the keyword &amp;quot;ONEBODY&amp;quot; and expects only a single line to follow. Therefore, the following addition will fix this problem, and a working file should look like:&lt;br /&gt;
&lt;br /&gt;
  [...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
    }&lt;br /&gt;
    ONEBODY{&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
  [etc...]&lt;/div&gt;</summary>
		<author><name>Acc73</name></author>
	</entry>
	<entry>
		<id>https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=243</id>
		<title>SimpleDMC</title>
		<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=243"/>
		<updated>2017-07-20T14:22:53Z</updated>

		<summary type="html">&lt;p&gt;Acc73: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Theory =&lt;br /&gt;
&lt;br /&gt;
= Compilation of SimpleDMC =&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== The Hydrogen Atom ==&lt;br /&gt;
&lt;br /&gt;
=== Gaussian ===&lt;br /&gt;
Let&#039;s begin by generating a trial wavefunction with Gaussian03. To start with, we need to define an atomic orbital basis, then tell Gaussian03 to use it in conjunction with some &#039;&#039;ab initio&#039;&#039; method. We&#039;ll use the STO-6G basis set, where 6 Gaussian primitives are used to represent an atomic orbital. We&#039;ll create an input file for Gaussian03, called H.com,&lt;br /&gt;
&lt;br /&gt;
   $ cat -n H.com&lt;br /&gt;
      1   %chk=H.chk&lt;br /&gt;
      2   #p UHF/STO-6G 6d 10f SCF Test IOP(3/24=10) IOP(3/81=1) Pop=Full&lt;br /&gt;
      3   &lt;br /&gt;
      4   Hydrogen Atom - UHF STO-6G&lt;br /&gt;
      5&lt;br /&gt;
      6   0 2&lt;br /&gt;
      7   H   0.000   0.000   0.000&lt;br /&gt;
      8&lt;br /&gt;
&lt;br /&gt;
This may seem cryptic for the moment, but each line (and entry therein) is necessary. Line 1 tells Gaussian03 to put some output in an encrypted file called H.chk. Line 2 is the ``route section&amp;quot;: The IOP arguments are &#039;&#039;internal options&#039;&#039;, and tell Gaussian03 to spit out data in a certain format. Line 4 contains a title section, and must be included, as must the sandwiching blank lines. Line 6 specifies the charge and multiplicity (number of unpaired electrons + 1). Finally, on line 7, we specify the molecular configuration; atom types and Cartesian position vectors of the constituent atoms are enumerated here.&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s run Gaussian03,&lt;br /&gt;
&lt;br /&gt;
   $ g03 H.com&lt;br /&gt;
&lt;br /&gt;
No return value is normally a good sign- you&#039;ll typically be greeted with an (unhelpful) SEGFAULT of some kind if the calculation was unsuccessful. It&#039;s also worth explicitly checking for errors, since Gaussian is also able to die silently&lt;br /&gt;
&lt;br /&gt;
   $ grep &amp;quot;Error&amp;quot; H.log&lt;br /&gt;
&lt;br /&gt;
Gaussian03 writes to two files- H.log and H.chk; the contents of the former are obvious while we&#039;ve already briefly discussed the contents of the latter. In the output, all we care about is the energy, so invoke&lt;br /&gt;
&lt;br /&gt;
   $ grep -n &amp;quot;SCF Done&amp;quot; H.log&lt;br /&gt;
   219: SCF Done:  E(UHF) = -0.471039054196     A.U. after     1 cycles&lt;br /&gt;
&lt;br /&gt;
This is a rather poor value relative to the analytical -0.5 Hartrees, but at least we have something to improve upon. We must now do some conversions to extract information from the checkpoint file&lt;br /&gt;
&lt;br /&gt;
   $ formchk H.chk H.fchk&lt;br /&gt;
   Read checkpoint file H.chk&lt;br /&gt;
   Write formatted file H.fchk&lt;br /&gt;
   Rotating derivatives, DoTrsp=T IDiff= 1 LEDeriv=    197 LFDPrp=       0 LDFDPr=       0.&lt;br /&gt;
&lt;br /&gt;
formchk is a Gaussian utility that converts the unreadable H.chk to a formatted checkpoint file, H.fchk. Since this formatted file is more amenable to parsing, it can be used by a number of visualisation/ post-Gaussian tools.&lt;br /&gt;
&lt;br /&gt;
=== qWalk ===&lt;br /&gt;
qWalk is a piece of software we can benchmark the simpleDMC software against, possessing both variational&lt;br /&gt;
and diffusion Monte Carlo (VMC and DMC, respectively) functionalities. The simpleDMC software also uses &lt;br /&gt;
the same input file formats as qWalk, and so we are able to use their file conversion tools to extract data &lt;br /&gt;
from a host of &#039;&#039;ab initio&#039;&#039; software suites.&lt;br /&gt;
&lt;br /&gt;
First, we parse the H.fchk file into a number of qWalk input files:&lt;br /&gt;
&lt;br /&gt;
   $ ./g032qmc -log H.log -fchk H.fchk &lt;br /&gt;
   --- read fchk file ---&lt;br /&gt;
   Number of atoms: 1&lt;br /&gt;
   Number of basis functions: 1&lt;br /&gt;
   Number of independant functions: 1&lt;br /&gt;
   Multiplicity: 2&lt;br /&gt;
   Number of alpha electrons: 1&lt;br /&gt;
   Number of beta electrons: 0&lt;br /&gt;
   Total Energy: -0.471039054195684&lt;br /&gt;
   Pure/Cartesian d shells: 6D&lt;br /&gt;
   Pure/Cartesian f shells: 10F&lt;br /&gt;
   found beta component, scftpe=UHF&lt;br /&gt;
   --- read log file ---&lt;br /&gt;
   basis set is from &#039;AO basis set&#039; section&lt;br /&gt;
   --- have read files ---&lt;br /&gt;
   norb=1&lt;br /&gt;
   spin up end size=1&lt;br /&gt;
   moCoeff total size=2&lt;br /&gt;
   writing qwalk input files ... &lt;br /&gt;
   writing orb file.  This could take a few seconds.&lt;br /&gt;
   output: sample.orb&lt;br /&gt;
   output: sample.basis&lt;br /&gt;
   output: sample.slater&lt;br /&gt;
   output: sample.jast2&lt;br /&gt;
   output: sample.sys&lt;br /&gt;
   output: sample.hf&lt;br /&gt;
   output: sample.opt&lt;br /&gt;
   Done&lt;br /&gt;
    &lt;br /&gt;
   Warning: Now the basisset must be the same for the same specie of atoms&lt;br /&gt;
&lt;br /&gt;
We&#039;ll try to reproduce the UHF results by use of VMC with qWalk. Let&#039;s have a look at sample.hf:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.hf&lt;br /&gt;
   METHOD { VMC nconfig 1000 } &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   INCLUDE sample.sys  &lt;br /&gt;
   TRIALFUNC { INCLUDE sample.slater}&lt;br /&gt;
&lt;br /&gt;
Note that we have added &amp;quot;nconfig 1000&amp;quot;, which gives us control over how many walkers are to be used&lt;br /&gt;
for the VMC. sample.sys contains the system configuration (number of electrons with a given spin, &lt;br /&gt;
atomic coordinates, etc.), while sample.slater contains the orbital information for the Slater&lt;br /&gt;
determinant (in conjunction with sample.orb and sample.basis). This Slater determinant will be used&lt;br /&gt;
to sample the trial wavefunction created by g03. We now run qWalk:&lt;br /&gt;
&lt;br /&gt;
   $ ./qwalk sample.hf&lt;br /&gt;
   output to sample.hf.o&lt;br /&gt;
   System&lt;br /&gt;
   Wave function&lt;br /&gt;
   Pseudopotential&lt;br /&gt;
   Could not open sample.hf.config. Generating configurations from scratch&lt;br /&gt;
  &lt;br /&gt;
and upon completion, are left with three files,&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|sample.hf.o&lt;br /&gt;
|Information about the run.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.log&lt;br /&gt;
|Log for statistical analysis.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.config&lt;br /&gt;
|Checkfile for the run.&lt;br /&gt;
|}   &lt;br /&gt;
&lt;br /&gt;
We can extract averages from the VMC by invoking&lt;br /&gt;
&lt;br /&gt;
   $ ./gosling sample.hf.log      &lt;br /&gt;
   #####################&lt;br /&gt;
   vmc:  100 total blocks reblocked into 100&lt;br /&gt;
   #####################&lt;br /&gt;
   Threw out the first 0 blocks in the averaging.&lt;br /&gt;
   total_energy0        -0.4702684082 +/-  0.000922386677 (sigma     0.425114576 ) &lt;br /&gt;
   kinetic0              0.7706545412 +/-  0.003605881864 (sigma     1.448514687 ) &lt;br /&gt;
   potential0            -1.240922949 +/-  0.003148015019 (sigma      1.21325133 ) &lt;br /&gt;
   nonlocal0                        0 +/-               0 (sigma               0 ) &lt;br /&gt;
   weight0                          1 +/- 6.661338148e-17 (sigma               0 ) &lt;br /&gt;
   &lt;br /&gt;
   --------Properties differences-------------&lt;br /&gt;
   approximate number of independent points: 212415.3753&lt;br /&gt;
&lt;br /&gt;
We see that the VMC estimate of the energy of the trial wavefunction (-0.470(2)) matches&lt;br /&gt;
relatively well with the UHF energy (-0.471039054195684). We have also obtained the&lt;br /&gt;
sample.hf.config file, containing the distribution of walkers sampling the&lt;br /&gt;
trial wavefunction.&lt;br /&gt;
&lt;br /&gt;
   $ head -8 sample.hf.config&lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   -0.731706383078456 0.620589802605041 -0.092157439050284 &lt;br /&gt;
   } &lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   0.366970593352899 0.216757302067973 -0.48313699793852 &lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
=== simpleDMC ===&lt;br /&gt;
&lt;br /&gt;
We can use this distribution of walkers as a starting point for our DMC calculations with&lt;br /&gt;
simpleDMC. We require an input file to run simpleDMC, sample.simple:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.simple&lt;br /&gt;
   simple { &lt;br /&gt;
      nWalkers             1000     # Number of walkers&lt;br /&gt;
      nSteps              10000     # Maximum number of steps&lt;br /&gt;
      dTau                0.001     # Timestep&lt;br /&gt;
      dETrial              -0.5     # Trial energy should start (&amp;gt; FCI energy but close to it)&lt;br /&gt;
      dWeightInit           1.0     # Initial weight&lt;br /&gt;
      bConstWalkerNum     false     # Are we enforcing a constant number of walkers? (Currently not working)&lt;br /&gt;
      nWalkersSpace       20480	    # Walker growth space (Maximum number of walkers permitted)&lt;br /&gt;
      dWeightTarget     10000.0     # Total weight above which we undertake population control&lt;br /&gt;
      dWeightMin         1500.0     # Total weight below which we undertake population control&lt;br /&gt;
      dLowThresh            1.0     # If walker has weight below this, try to either kill or recombine it&lt;br /&gt;
      dWeightBranch         1.5     # If walker has weight above this, we branch the walker&lt;br /&gt;
      nShiftSteps             1     # Vary the shift every nShiftSteps steps.&lt;br /&gt;
      dShiftDamp            1.0     # Larger shift damping is more radical damping&lt;br /&gt;
      dOldWeight            0.0     # The total weight at the previous cycle for calculating the shift&lt;br /&gt;
      bUpdateShift        false     # Are we updating the shift every nShiftSteps cycles?&lt;br /&gt;
   }&lt;br /&gt;
                                                             &lt;br /&gt;
simpleDMC reuses the input files of qWalk, and can be invoked by listing the files as command line &lt;br /&gt;
arguments (in any order)&lt;br /&gt;
   &lt;br /&gt;
   $ ./simpleDMC.x sample.{sys,slater,orb,basis,simple,hf.config,hf.log} &amp;gt;&amp;gt; sample.log&lt;br /&gt;
&lt;br /&gt;
We pass all of the output to sample.log since the majority of information concerning the simulation is&lt;br /&gt;
streamed straight to STDOUT. We are primarily concerned with the final nSteps lines, since these give&lt;br /&gt;
the various energetic quantities associated with the system of walkers at each timestep. In fact, with&lt;br /&gt;
a little foresight, the fifth column corresponds to the total energy averaged over all walkers at that&lt;br /&gt;
timestep. Averaging over this column, we obtain the DMC energy:&lt;br /&gt;
&lt;br /&gt;
   $ export nsteps=10000&lt;br /&gt;
   $ tail -n $nsteps sample.log | awk &#039;{ sum += $5; n++ } END { if (n &amp;gt; 0) print sum / n; }&#039;&lt;br /&gt;
   -0.498772&lt;br /&gt;
&lt;br /&gt;
This quantity is in very good agreement with the exact energy of -0.5 Hartrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;V = \frac{\epsilon}{2} \sum_{i&amp;lt;j} \left[ \left(\frac{r_{ij}}{\sigma}\right)^2+\left(\frac{\sigma}{r_{ij}}\right)^2 \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Jastrow Factor ==&lt;br /&gt;
&lt;br /&gt;
One further usable output from qWalk is the Jastrow factor parameters. This helps to add in explicit correlation terms between electron-electron pairs (known two body terms) and electron-ion pairs (one body terms). After having performed the parsing of the *.fchk file with ./g032qmc, a blank template of the Jastrow parameters will be created, called *.jast2. This is designed to include both two-body and one-body interaction, hence the suffix of &amp;quot;2&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
A good tutorial for how to optimise the Jastrow parameters is given in the qWalk documentation ( [https://github.com/QWalk/mainline/wiki/Tutorial] ), but a potted version which will consistently produce the same result is outlined here. Nothing needs to be altered in the *.jast2 file, but the *.opt file requires some additions. For a system called sample, Edit the sample.opt file so that the very first line reads:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
  METHOD { OPTIMIZE iterations 1000 READCONFIG sample.hf.config  }&lt;br /&gt;
  &lt;br /&gt;
&lt;br /&gt;
  INCLUDE WaterHex.sys&lt;br /&gt;
  TRIALFUNC {&lt;br /&gt;
    SLATER-JASTROW&lt;br /&gt;
    WF1 { INCLUDE WaterHex.slater }&lt;br /&gt;
    WF2 { INCLUDE WaterHex.jast2 }&lt;br /&gt;
  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;iterations&amp;quot; keyword extends the number of Jastrow optimisation cycles beyond the default which is only 30 (which in practice is often not enough). The &amp;quot;READCONFIG&amp;quot; file forces qWalk to explicitly read in the electron configurations from a previous qWalk run (if a more accurate *.dmc.config file exists, then of course use that!). The advantage of this keyword is that qWalk does not have to make up its own configurations, which will make the Jastrow optimisation unreproducible and, quite often, spurious. &lt;br /&gt;
&lt;br /&gt;
Once edited, simply run:&lt;br /&gt;
$ qwalk sample.opt&lt;br /&gt;
&lt;br /&gt;
A new file called &amp;quot;sample.opt.wfout&amp;quot; will have been produced, which contains the combined Slater and Jastrow parameters. Since we are only interested in the Jastrow parameters, and the parser gets confused with the Slater bit, delete the first portion of the file up until the lines which read:&lt;br /&gt;
&lt;br /&gt;
  JASTROW2&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
If the system only contains a single atom, then you are done, and the file should be successfully parsed! The only addition you will need to make is in the Make.include file, whereby the .opt.wfout must be added to the line which calls the executable, and tells it which files to read. For example, for the sample, the following needs to exist in Make.include:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
sample: program&lt;br /&gt;
        $(EXECWITH) bin/simpleDMC.x examples/SAMPLE_DIR/sample.{sys,slater,orb,basis,simple,hf.config,hf.log,opt.wfout}&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Water Example ===&lt;br /&gt;
&lt;br /&gt;
One further complication arises when more than one atom type is present, and one further amendment must be made to the *opt.wfout file. Out of the box, qWalk will produce the following line for a monomer of water whose Jastrow has been optimised:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
The parser will not be able to read this, as it looks for the keyword &amp;quot;ONEBODY&amp;quot; and expects only a single line to follow. Therefore, the following addition will fix this problem, and a working file should look like:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
    }&lt;br /&gt;
    ONEBODY{&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
[etc...]&lt;/div&gt;</summary>
		<author><name>Acc73</name></author>
	</entry>
	<entry>
		<id>https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=242</id>
		<title>SimpleDMC</title>
		<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=242"/>
		<updated>2017-07-20T14:21:34Z</updated>

		<summary type="html">&lt;p&gt;Acc73: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Theory =&lt;br /&gt;
&lt;br /&gt;
= Compilation of SimpleDMC =&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== The Hydrogen Atom ==&lt;br /&gt;
&lt;br /&gt;
=== Gaussian ===&lt;br /&gt;
Let&#039;s begin by generating a trial wavefunction with Gaussian03. To start with, we need to define an atomic orbital basis, then tell Gaussian03 to use it in conjunction with some &#039;&#039;ab initio&#039;&#039; method. We&#039;ll use the STO-6G basis set, where 6 Gaussian primitives are used to represent an atomic orbital. We&#039;ll create an input file for Gaussian03, called H.com,&lt;br /&gt;
&lt;br /&gt;
   $ cat -n H.com&lt;br /&gt;
      1   %chk=H.chk&lt;br /&gt;
      2   #p UHF/STO-6G 6d 10f SCF Test IOP(3/24=10) IOP(3/81=1) Pop=Full&lt;br /&gt;
      3   &lt;br /&gt;
      4   Hydrogen Atom - UHF STO-6G&lt;br /&gt;
      5&lt;br /&gt;
      6   0 2&lt;br /&gt;
      7   H   0.000   0.000   0.000&lt;br /&gt;
      8&lt;br /&gt;
&lt;br /&gt;
This may seem cryptic for the moment, but each line (and entry therein) is necessary. Line 1 tells Gaussian03 to put some output in an encrypted file called H.chk. Line 2 is the ``route section&amp;quot;: The IOP arguments are &#039;&#039;internal options&#039;&#039;, and tell Gaussian03 to spit out data in a certain format. Line 4 contains a title section, and must be included, as must the sandwiching blank lines. Line 6 specifies the charge and multiplicity (number of unpaired electrons + 1). Finally, on line 7, we specify the molecular configuration; atom types and Cartesian position vectors of the constituent atoms are enumerated here.&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s run Gaussian03,&lt;br /&gt;
&lt;br /&gt;
   $ g03 H.com&lt;br /&gt;
&lt;br /&gt;
No return value is normally a good sign- you&#039;ll typically be greeted with an (unhelpful) SEGFAULT of some kind if the calculation was unsuccessful. It&#039;s also worth explicitly checking for errors, since Gaussian is also able to die silently&lt;br /&gt;
&lt;br /&gt;
   $ grep &amp;quot;Error&amp;quot; H.log&lt;br /&gt;
&lt;br /&gt;
Gaussian03 writes to two files- H.log and H.chk; the contents of the former are obvious while we&#039;ve already briefly discussed the contents of the latter. In the output, all we care about is the energy, so invoke&lt;br /&gt;
&lt;br /&gt;
   $ grep -n &amp;quot;SCF Done&amp;quot; H.log&lt;br /&gt;
   219: SCF Done:  E(UHF) = -0.471039054196     A.U. after     1 cycles&lt;br /&gt;
&lt;br /&gt;
This is a rather poor value relative to the analytical -0.5 Hartrees, but at least we have something to improve upon. We must now do some conversions to extract information from the checkpoint file&lt;br /&gt;
&lt;br /&gt;
   $ formchk H.chk H.fchk&lt;br /&gt;
   Read checkpoint file H.chk&lt;br /&gt;
   Write formatted file H.fchk&lt;br /&gt;
   Rotating derivatives, DoTrsp=T IDiff= 1 LEDeriv=    197 LFDPrp=       0 LDFDPr=       0.&lt;br /&gt;
&lt;br /&gt;
formchk is a Gaussian utility that converts the unreadable H.chk to a formatted checkpoint file, H.fchk. Since this formatted file is more amenable to parsing, it can be used by a number of visualisation/ post-Gaussian tools.&lt;br /&gt;
&lt;br /&gt;
=== qWalk ===&lt;br /&gt;
qWalk is a piece of software we can benchmark the simpleDMC software against, possessing both variational&lt;br /&gt;
and diffusion Monte Carlo (VMC and DMC, respectively) functionalities. The simpleDMC software also uses &lt;br /&gt;
the same input file formats as qWalk, and so we are able to use their file conversion tools to extract data &lt;br /&gt;
from a host of &#039;&#039;ab initio&#039;&#039; software suites.&lt;br /&gt;
&lt;br /&gt;
First, we parse the H.fchk file into a number of qWalk input files:&lt;br /&gt;
&lt;br /&gt;
   $ ./g032qmc -log H.log -fchk H.fchk &lt;br /&gt;
   --- read fchk file ---&lt;br /&gt;
   Number of atoms: 1&lt;br /&gt;
   Number of basis functions: 1&lt;br /&gt;
   Number of independant functions: 1&lt;br /&gt;
   Multiplicity: 2&lt;br /&gt;
   Number of alpha electrons: 1&lt;br /&gt;
   Number of beta electrons: 0&lt;br /&gt;
   Total Energy: -0.471039054195684&lt;br /&gt;
   Pure/Cartesian d shells: 6D&lt;br /&gt;
   Pure/Cartesian f shells: 10F&lt;br /&gt;
   found beta component, scftpe=UHF&lt;br /&gt;
   --- read log file ---&lt;br /&gt;
   basis set is from &#039;AO basis set&#039; section&lt;br /&gt;
   --- have read files ---&lt;br /&gt;
   norb=1&lt;br /&gt;
   spin up end size=1&lt;br /&gt;
   moCoeff total size=2&lt;br /&gt;
   writing qwalk input files ... &lt;br /&gt;
   writing orb file.  This could take a few seconds.&lt;br /&gt;
   output: sample.orb&lt;br /&gt;
   output: sample.basis&lt;br /&gt;
   output: sample.slater&lt;br /&gt;
   output: sample.jast2&lt;br /&gt;
   output: sample.sys&lt;br /&gt;
   output: sample.hf&lt;br /&gt;
   output: sample.opt&lt;br /&gt;
   Done&lt;br /&gt;
    &lt;br /&gt;
   Warning: Now the basisset must be the same for the same specie of atoms&lt;br /&gt;
&lt;br /&gt;
We&#039;ll try to reproduce the UHF results by use of VMC with qWalk. Let&#039;s have a look at sample.hf:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.hf&lt;br /&gt;
   METHOD { VMC nconfig 1000 } &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   INCLUDE sample.sys  &lt;br /&gt;
   TRIALFUNC { INCLUDE sample.slater}&lt;br /&gt;
&lt;br /&gt;
Note that we have added &amp;quot;nconfig 1000&amp;quot;, which gives us control over how many walkers are to be used&lt;br /&gt;
for the VMC. sample.sys contains the system configuration (number of electrons with a given spin, &lt;br /&gt;
atomic coordinates, etc.), while sample.slater contains the orbital information for the Slater&lt;br /&gt;
determinant (in conjunction with sample.orb and sample.basis). This Slater determinant will be used&lt;br /&gt;
to sample the trial wavefunction created by g03. We now run qWalk:&lt;br /&gt;
&lt;br /&gt;
   $ ./qwalk sample.hf&lt;br /&gt;
   output to sample.hf.o&lt;br /&gt;
   System&lt;br /&gt;
   Wave function&lt;br /&gt;
   Pseudopotential&lt;br /&gt;
   Could not open sample.hf.config. Generating configurations from scratch&lt;br /&gt;
  &lt;br /&gt;
and upon completion, are left with three files,&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|sample.hf.o&lt;br /&gt;
|Information about the run.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.log&lt;br /&gt;
|Log for statistical analysis.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.config&lt;br /&gt;
|Checkfile for the run.&lt;br /&gt;
|}   &lt;br /&gt;
&lt;br /&gt;
We can extract averages from the VMC by invoking&lt;br /&gt;
&lt;br /&gt;
   $ ./gosling sample.hf.log      &lt;br /&gt;
   #####################&lt;br /&gt;
   vmc:  100 total blocks reblocked into 100&lt;br /&gt;
   #####################&lt;br /&gt;
   Threw out the first 0 blocks in the averaging.&lt;br /&gt;
   total_energy0        -0.4702684082 +/-  0.000922386677 (sigma     0.425114576 ) &lt;br /&gt;
   kinetic0              0.7706545412 +/-  0.003605881864 (sigma     1.448514687 ) &lt;br /&gt;
   potential0            -1.240922949 +/-  0.003148015019 (sigma      1.21325133 ) &lt;br /&gt;
   nonlocal0                        0 +/-               0 (sigma               0 ) &lt;br /&gt;
   weight0                          1 +/- 6.661338148e-17 (sigma               0 ) &lt;br /&gt;
   &lt;br /&gt;
   --------Properties differences-------------&lt;br /&gt;
   approximate number of independent points: 212415.3753&lt;br /&gt;
&lt;br /&gt;
We see that the VMC estimate of the energy of the trial wavefunction (-0.470(2)) matches&lt;br /&gt;
relatively well with the UHF energy (-0.471039054195684). We have also obtained the&lt;br /&gt;
sample.hf.config file, containing the distribution of walkers sampling the&lt;br /&gt;
trial wavefunction.&lt;br /&gt;
&lt;br /&gt;
   $ head -8 sample.hf.config&lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   -0.731706383078456 0.620589802605041 -0.092157439050284 &lt;br /&gt;
   } &lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   0.366970593352899 0.216757302067973 -0.48313699793852 &lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
=== simpleDMC ===&lt;br /&gt;
&lt;br /&gt;
We can use this distribution of walkers as a starting point for our DMC calculations with&lt;br /&gt;
simpleDMC. We require an input file to run simpleDMC, sample.simple:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.simple&lt;br /&gt;
   simple { &lt;br /&gt;
      nWalkers             1000     # Number of walkers&lt;br /&gt;
      nSteps              10000     # Maximum number of steps&lt;br /&gt;
      dTau                0.001     # Timestep&lt;br /&gt;
      dETrial              -0.5     # Trial energy should start (&amp;gt; FCI energy but close to it)&lt;br /&gt;
      dWeightInit           1.0     # Initial weight&lt;br /&gt;
      bConstWalkerNum     false     # Are we enforcing a constant number of walkers? (Currently not working)&lt;br /&gt;
      nWalkersSpace       20480	    # Walker growth space (Maximum number of walkers permitted)&lt;br /&gt;
      dWeightTarget     10000.0     # Total weight above which we undertake population control&lt;br /&gt;
      dWeightMin         1500.0     # Total weight below which we undertake population control&lt;br /&gt;
      dLowThresh            1.0     # If walker has weight below this, try to either kill or recombine it&lt;br /&gt;
      dWeightBranch         1.5     # If walker has weight above this, we branch the walker&lt;br /&gt;
      nShiftSteps             1     # Vary the shift every nShiftSteps steps.&lt;br /&gt;
      dShiftDamp            1.0     # Larger shift damping is more radical damping&lt;br /&gt;
      dOldWeight            0.0     # The total weight at the previous cycle for calculating the shift&lt;br /&gt;
      bUpdateShift        false     # Are we updating the shift every nShiftSteps cycles?&lt;br /&gt;
   }&lt;br /&gt;
                                                             &lt;br /&gt;
simpleDMC reuses the input files of qWalk, and can be invoked by listing the files as command line &lt;br /&gt;
arguments (in any order)&lt;br /&gt;
   &lt;br /&gt;
   $ ./simpleDMC.x sample.{sys,slater,orb,basis,simple,hf.config,hf.log} &amp;gt;&amp;gt; sample.log&lt;br /&gt;
&lt;br /&gt;
We pass all of the output to sample.log since the majority of information concerning the simulation is&lt;br /&gt;
streamed straight to STDOUT. We are primarily concerned with the final nSteps lines, since these give&lt;br /&gt;
the various energetic quantities associated with the system of walkers at each timestep. In fact, with&lt;br /&gt;
a little foresight, the fifth column corresponds to the total energy averaged over all walkers at that&lt;br /&gt;
timestep. Averaging over this column, we obtain the DMC energy:&lt;br /&gt;
&lt;br /&gt;
   $ export nsteps=10000&lt;br /&gt;
   $ tail -n $nsteps sample.log | awk &#039;{ sum += $5; n++ } END { if (n &amp;gt; 0) print sum / n; }&#039;&lt;br /&gt;
   -0.498772&lt;br /&gt;
&lt;br /&gt;
This quantity is in very good agreement with the exact energy of -0.5 Hartrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;V = \frac{\epsilon}{2} \sum_{i&amp;lt;j} \left[ \left(\frac{r_{ij}}{\sigma}\right)^2+\left(\frac{\sigma}{r_{ij}}\right)^2 \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Jastrow Factor ==&lt;br /&gt;
&lt;br /&gt;
One further usable output from qWalk is the Jastrow factor parameters. This helps to add in explicit correlation terms between electron-electron pairs (known two body terms) and electron-ion pairs (one body terms). After having performed the parsing of the *.fchk file with ./g032qmc, a blank template of the Jastrow parameters will be created, called *.jast2. This is designed to include both two-body and one-body interaction, hence the suffix of &amp;quot;2&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
A good tutorial for how to optimise the Jastrow parameters is given in the qWalk documentation ( [https://github.com/QWalk/mainline/wiki/Tutorial] ), but a potted version which will consistently produce the same result is outlined here. Nothing needs to be altered in the *.jast2 file, but the *.opt file requires some additions. For a system called sample, Edit the sample.opt file so that the very first line reads:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
METHOD { OPTIMIZE iterations 1000 READCONFIG sample.hf.config  }&lt;br /&gt;
INCLUDE WaterHex.sys&lt;br /&gt;
TRIALFUNC {&lt;br /&gt;
  SLATER-JASTROW&lt;br /&gt;
  WF1 { INCLUDE WaterHex.slater }&lt;br /&gt;
  WF2 { INCLUDE WaterHex.jast2 }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;iterations&amp;quot; keyword extends the number of Jastrow optimisation cycles beyond the default which is only 30 (which in practice is often not enough). The &amp;quot;READCONFIG&amp;quot; file forces qWalk to explicitly read in the electron configurations from a previous qWalk run (if a more accurate *.dmc.config file exists, then of course use that!). The advantage of this keyword is that qWalk does not have to make up its own configurations, which will make the Jastrow optimisation unreproducible and, quite often, spurious. &lt;br /&gt;
&lt;br /&gt;
Once edited, simply run:&lt;br /&gt;
$ qwalk sample.opt&lt;br /&gt;
&lt;br /&gt;
A new file called &amp;quot;sample.opt.wfout&amp;quot; will have been produced, which contains the combined Slater and Jastrow parameters. Since we are only interested in the Jastrow parameters, and the parser gets confused with the Slater bit, delete the first portion of the file up until the lines which read:&lt;br /&gt;
&lt;br /&gt;
  JASTROW2&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
If the system only contains a single atom, then you are done, and the file should be successfully parsed! The only addition you will need to make is in the Make.include file, whereby the .opt.wfout must be added to the line which calls the executable, and tells it which files to read. For example, for the sample, the following needs to exist in Make.include:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
sample: program&lt;br /&gt;
        $(EXECWITH) bin/simpleDMC.x examples/SAMPLE_DIR/sample.{sys,slater,orb,basis,simple,hf.config,hf.log,opt.wfout}&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Water Example ===&lt;br /&gt;
&lt;br /&gt;
One further complication arises when more than one atom type is present, and one further amendment must be made to the *opt.wfout file. Out of the box, qWalk will produce the following line for a monomer of water whose Jastrow has been optimised:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
The parser will not be able to read this, as it looks for the keyword &amp;quot;ONEBODY&amp;quot; and expects only a single line to follow. Therefore, the following addition will fix this problem, and a working file should look like:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
    }&lt;br /&gt;
    ONEBODY{&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
[etc...]&lt;/div&gt;</summary>
		<author><name>Acc73</name></author>
	</entry>
	<entry>
		<id>https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=241</id>
		<title>SimpleDMC</title>
		<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=241"/>
		<updated>2017-07-20T14:20:34Z</updated>

		<summary type="html">&lt;p&gt;Acc73: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Theory =&lt;br /&gt;
&lt;br /&gt;
= Compilation of SimpleDMC =&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== The Hydrogen Atom ==&lt;br /&gt;
&lt;br /&gt;
=== Gaussian ===&lt;br /&gt;
Let&#039;s begin by generating a trial wavefunction with Gaussian03. To start with, we need to define an atomic orbital basis, then tell Gaussian03 to use it in conjunction with some &#039;&#039;ab initio&#039;&#039; method. We&#039;ll use the STO-6G basis set, where 6 Gaussian primitives are used to represent an atomic orbital. We&#039;ll create an input file for Gaussian03, called H.com,&lt;br /&gt;
&lt;br /&gt;
   $ cat -n H.com&lt;br /&gt;
      1   %chk=H.chk&lt;br /&gt;
      2   #p UHF/STO-6G 6d 10f SCF Test IOP(3/24=10) IOP(3/81=1) Pop=Full&lt;br /&gt;
      3   &lt;br /&gt;
      4   Hydrogen Atom - UHF STO-6G&lt;br /&gt;
      5&lt;br /&gt;
      6   0 2&lt;br /&gt;
      7   H   0.000   0.000   0.000&lt;br /&gt;
      8&lt;br /&gt;
&lt;br /&gt;
This may seem cryptic for the moment, but each line (and entry therein) is necessary. Line 1 tells Gaussian03 to put some output in an encrypted file called H.chk. Line 2 is the ``route section&amp;quot;: The IOP arguments are &#039;&#039;internal options&#039;&#039;, and tell Gaussian03 to spit out data in a certain format. Line 4 contains a title section, and must be included, as must the sandwiching blank lines. Line 6 specifies the charge and multiplicity (number of unpaired electrons + 1). Finally, on line 7, we specify the molecular configuration; atom types and Cartesian position vectors of the constituent atoms are enumerated here.&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s run Gaussian03,&lt;br /&gt;
&lt;br /&gt;
   $ g03 H.com&lt;br /&gt;
&lt;br /&gt;
No return value is normally a good sign- you&#039;ll typically be greeted with an (unhelpful) SEGFAULT of some kind if the calculation was unsuccessful. It&#039;s also worth explicitly checking for errors, since Gaussian is also able to die silently&lt;br /&gt;
&lt;br /&gt;
   $ grep &amp;quot;Error&amp;quot; H.log&lt;br /&gt;
&lt;br /&gt;
Gaussian03 writes to two files- H.log and H.chk; the contents of the former are obvious while we&#039;ve already briefly discussed the contents of the latter. In the output, all we care about is the energy, so invoke&lt;br /&gt;
&lt;br /&gt;
   $ grep -n &amp;quot;SCF Done&amp;quot; H.log&lt;br /&gt;
   219: SCF Done:  E(UHF) = -0.471039054196     A.U. after     1 cycles&lt;br /&gt;
&lt;br /&gt;
This is a rather poor value relative to the analytical -0.5 Hartrees, but at least we have something to improve upon. We must now do some conversions to extract information from the checkpoint file&lt;br /&gt;
&lt;br /&gt;
   $ formchk H.chk H.fchk&lt;br /&gt;
   Read checkpoint file H.chk&lt;br /&gt;
   Write formatted file H.fchk&lt;br /&gt;
   Rotating derivatives, DoTrsp=T IDiff= 1 LEDeriv=    197 LFDPrp=       0 LDFDPr=       0.&lt;br /&gt;
&lt;br /&gt;
formchk is a Gaussian utility that converts the unreadable H.chk to a formatted checkpoint file, H.fchk. Since this formatted file is more amenable to parsing, it can be used by a number of visualisation/ post-Gaussian tools.&lt;br /&gt;
&lt;br /&gt;
=== qWalk ===&lt;br /&gt;
qWalk is a piece of software we can benchmark the simpleDMC software against, possessing both variational&lt;br /&gt;
and diffusion Monte Carlo (VMC and DMC, respectively) functionalities. The simpleDMC software also uses &lt;br /&gt;
the same input file formats as qWalk, and so we are able to use their file conversion tools to extract data &lt;br /&gt;
from a host of &#039;&#039;ab initio&#039;&#039; software suites.&lt;br /&gt;
&lt;br /&gt;
First, we parse the H.fchk file into a number of qWalk input files:&lt;br /&gt;
&lt;br /&gt;
   $ ./g032qmc -log H.log -fchk H.fchk &lt;br /&gt;
   --- read fchk file ---&lt;br /&gt;
   Number of atoms: 1&lt;br /&gt;
   Number of basis functions: 1&lt;br /&gt;
   Number of independant functions: 1&lt;br /&gt;
   Multiplicity: 2&lt;br /&gt;
   Number of alpha electrons: 1&lt;br /&gt;
   Number of beta electrons: 0&lt;br /&gt;
   Total Energy: -0.471039054195684&lt;br /&gt;
   Pure/Cartesian d shells: 6D&lt;br /&gt;
   Pure/Cartesian f shells: 10F&lt;br /&gt;
   found beta component, scftpe=UHF&lt;br /&gt;
   --- read log file ---&lt;br /&gt;
   basis set is from &#039;AO basis set&#039; section&lt;br /&gt;
   --- have read files ---&lt;br /&gt;
   norb=1&lt;br /&gt;
   spin up end size=1&lt;br /&gt;
   moCoeff total size=2&lt;br /&gt;
   writing qwalk input files ... &lt;br /&gt;
   writing orb file.  This could take a few seconds.&lt;br /&gt;
   output: sample.orb&lt;br /&gt;
   output: sample.basis&lt;br /&gt;
   output: sample.slater&lt;br /&gt;
   output: sample.jast2&lt;br /&gt;
   output: sample.sys&lt;br /&gt;
   output: sample.hf&lt;br /&gt;
   output: sample.opt&lt;br /&gt;
   Done&lt;br /&gt;
    &lt;br /&gt;
   Warning: Now the basisset must be the same for the same specie of atoms&lt;br /&gt;
&lt;br /&gt;
We&#039;ll try to reproduce the UHF results by use of VMC with qWalk. Let&#039;s have a look at sample.hf:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.hf&lt;br /&gt;
   METHOD { VMC nconfig 1000 } &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   INCLUDE sample.sys  &lt;br /&gt;
   TRIALFUNC { INCLUDE sample.slater}&lt;br /&gt;
&lt;br /&gt;
Note that we have added &amp;quot;nconfig 1000&amp;quot;, which gives us control over how many walkers are to be used&lt;br /&gt;
for the VMC. sample.sys contains the system configuration (number of electrons with a given spin, &lt;br /&gt;
atomic coordinates, etc.), while sample.slater contains the orbital information for the Slater&lt;br /&gt;
determinant (in conjunction with sample.orb and sample.basis). This Slater determinant will be used&lt;br /&gt;
to sample the trial wavefunction created by g03. We now run qWalk:&lt;br /&gt;
&lt;br /&gt;
   $ ./qwalk sample.hf&lt;br /&gt;
   output to sample.hf.o&lt;br /&gt;
   System&lt;br /&gt;
   Wave function&lt;br /&gt;
   Pseudopotential&lt;br /&gt;
   Could not open sample.hf.config. Generating configurations from scratch&lt;br /&gt;
  &lt;br /&gt;
and upon completion, are left with three files,&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|sample.hf.o&lt;br /&gt;
|Information about the run.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.log&lt;br /&gt;
|Log for statistical analysis.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.config&lt;br /&gt;
|Checkfile for the run.&lt;br /&gt;
|}   &lt;br /&gt;
&lt;br /&gt;
We can extract averages from the VMC by invoking&lt;br /&gt;
&lt;br /&gt;
   $ ./gosling sample.hf.log      &lt;br /&gt;
   #####################&lt;br /&gt;
   vmc:  100 total blocks reblocked into 100&lt;br /&gt;
   #####################&lt;br /&gt;
   Threw out the first 0 blocks in the averaging.&lt;br /&gt;
   total_energy0        -0.4702684082 +/-  0.000922386677 (sigma     0.425114576 ) &lt;br /&gt;
   kinetic0              0.7706545412 +/-  0.003605881864 (sigma     1.448514687 ) &lt;br /&gt;
   potential0            -1.240922949 +/-  0.003148015019 (sigma      1.21325133 ) &lt;br /&gt;
   nonlocal0                        0 +/-               0 (sigma               0 ) &lt;br /&gt;
   weight0                          1 +/- 6.661338148e-17 (sigma               0 ) &lt;br /&gt;
   &lt;br /&gt;
   --------Properties differences-------------&lt;br /&gt;
   approximate number of independent points: 212415.3753&lt;br /&gt;
&lt;br /&gt;
We see that the VMC estimate of the energy of the trial wavefunction (-0.470(2)) matches&lt;br /&gt;
relatively well with the UHF energy (-0.471039054195684). We have also obtained the&lt;br /&gt;
sample.hf.config file, containing the distribution of walkers sampling the&lt;br /&gt;
trial wavefunction.&lt;br /&gt;
&lt;br /&gt;
   $ head -8 sample.hf.config&lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   -0.731706383078456 0.620589802605041 -0.092157439050284 &lt;br /&gt;
   } &lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   0.366970593352899 0.216757302067973 -0.48313699793852 &lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
=== simpleDMC ===&lt;br /&gt;
&lt;br /&gt;
We can use this distribution of walkers as a starting point for our DMC calculations with&lt;br /&gt;
simpleDMC. We require an input file to run simpleDMC, sample.simple:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.simple&lt;br /&gt;
   simple { &lt;br /&gt;
      nWalkers             1000     # Number of walkers&lt;br /&gt;
      nSteps              10000     # Maximum number of steps&lt;br /&gt;
      dTau                0.001     # Timestep&lt;br /&gt;
      dETrial              -0.5     # Trial energy should start (&amp;gt; FCI energy but close to it)&lt;br /&gt;
      dWeightInit           1.0     # Initial weight&lt;br /&gt;
      bConstWalkerNum     false     # Are we enforcing a constant number of walkers? (Currently not working)&lt;br /&gt;
      nWalkersSpace       20480	    # Walker growth space (Maximum number of walkers permitted)&lt;br /&gt;
      dWeightTarget     10000.0     # Total weight above which we undertake population control&lt;br /&gt;
      dWeightMin         1500.0     # Total weight below which we undertake population control&lt;br /&gt;
      dLowThresh            1.0     # If walker has weight below this, try to either kill or recombine it&lt;br /&gt;
      dWeightBranch         1.5     # If walker has weight above this, we branch the walker&lt;br /&gt;
      nShiftSteps             1     # Vary the shift every nShiftSteps steps.&lt;br /&gt;
      dShiftDamp            1.0     # Larger shift damping is more radical damping&lt;br /&gt;
      dOldWeight            0.0     # The total weight at the previous cycle for calculating the shift&lt;br /&gt;
      bUpdateShift        false     # Are we updating the shift every nShiftSteps cycles?&lt;br /&gt;
   }&lt;br /&gt;
                                                             &lt;br /&gt;
simpleDMC reuses the input files of qWalk, and can be invoked by listing the files as command line &lt;br /&gt;
arguments (in any order)&lt;br /&gt;
   &lt;br /&gt;
   $ ./simpleDMC.x sample.{sys,slater,orb,basis,simple,hf.config,hf.log} &amp;gt;&amp;gt; sample.log&lt;br /&gt;
&lt;br /&gt;
We pass all of the output to sample.log since the majority of information concerning the simulation is&lt;br /&gt;
streamed straight to STDOUT. We are primarily concerned with the final nSteps lines, since these give&lt;br /&gt;
the various energetic quantities associated with the system of walkers at each timestep. In fact, with&lt;br /&gt;
a little foresight, the fifth column corresponds to the total energy averaged over all walkers at that&lt;br /&gt;
timestep. Averaging over this column, we obtain the DMC energy:&lt;br /&gt;
&lt;br /&gt;
   $ export nsteps=10000&lt;br /&gt;
   $ tail -n $nsteps sample.log | awk &#039;{ sum += $5; n++ } END { if (n &amp;gt; 0) print sum / n; }&#039;&lt;br /&gt;
   -0.498772&lt;br /&gt;
&lt;br /&gt;
This quantity is in very good agreement with the exact energy of -0.5 Hartrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;V = \frac{\epsilon}{2} \sum_{i&amp;lt;j} \left[ \left(\frac{r_{ij}}{\sigma}\right)^2+\left(\frac{\sigma}{r_{ij}}\right)^2 \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Jastrow Factor ==&lt;br /&gt;
&lt;br /&gt;
One further usable output from qWalk is the Jastrow factor parameters. This helps to add in explicit correlation terms between electron-electron pairs (known two body terms) and electron-ion pairs (one body terms). After having performed the parsing of the *.fchk file with ./g032qmc, a blank template of the Jastrow parameters will be created, called *.jast2. This is designed to include both two-body and one-body interaction, hence the suffix of &amp;quot;2&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
A good tutorial for how to optimise the Jastrow parameters is given in the qWalk documentation ( [https://github.com/QWalk/mainline/wiki/Tutorial] ), but a potted version which will consistently produce the same result is outlined here. Nothing needs to be altered in the *.jast2 file, but the *.opt file requires some additions. For a system called sample, Edit the sample.opt file so that the very first line reads:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
METHOD { OPTIMIZE iterations 1000 READCONFIG sample.hf.config  }&lt;br /&gt;
&lt;br /&gt;
INCLUDE WaterHex.sys&lt;br /&gt;
TRIALFUNC {&lt;br /&gt;
  SLATER-JASTROW&lt;br /&gt;
  WF1 { INCLUDE WaterHex.slater }&lt;br /&gt;
  WF2 { INCLUDE WaterHex.jast2 }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;iterations&amp;quot; keyword extends the number of Jastrow optimisation cycles beyond the default which is only 30 (which in practice is often not enough). The &amp;quot;READCONFIG&amp;quot; file forces qWalk to explicitly read in the electron configurations from a previous qWalk run (if a more accurate *.dmc.config file exists, then of course use that!). The advantage of this keyword is that qWalk does not have to make up its own configurations, which will make the Jastrow optimisation unreproducible and, quite often, spurious. &lt;br /&gt;
&lt;br /&gt;
Once edited, simply run:&lt;br /&gt;
$ qwalk sample.opt&lt;br /&gt;
&lt;br /&gt;
A new file called &amp;quot;sample.opt.wfout&amp;quot; will have been produced, which contains the combined Slater and Jastrow parameters. Since we are only interested in the Jastrow parameters, and the parser gets confused with the Slater bit, delete the first portion of the file up until the lines which read:&lt;br /&gt;
&lt;br /&gt;
  JASTROW2&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
If the system only contains a single atom, then you are done, and the file should be successfully parsed! The only addition you will need to make is in the Make.include file, whereby the .opt.wfout must be added to the line which calls the executable, and tells it which files to read. For example, for the sample, the following needs to exist in Make.include:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
sample: program&lt;br /&gt;
        $(EXECWITH) bin/simpleDMC.x examples/SAMPLE_DIR/sample.{sys,slater,orb,basis,simple,hf.config,hf.log,opt.wfout}&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Water Example ===&lt;br /&gt;
&lt;br /&gt;
One further complication arises when more than one atom type is present, and one further amendment must be made to the *opt.wfout file. Out of the box, qWalk will produce the following line for a monomer of water whose Jastrow has been optimised:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
The parser will not be able to read this, as it looks for the keyword &amp;quot;ONEBODY&amp;quot; and expects only a single line to follow. Therefore, the following addition will fix this problem, and a working file should look like:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
    }&lt;br /&gt;
    ONEBODY{&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
[etc...]&lt;/div&gt;</summary>
		<author><name>Acc73</name></author>
	</entry>
	<entry>
		<id>https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=240</id>
		<title>SimpleDMC</title>
		<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=240"/>
		<updated>2017-07-20T14:19:34Z</updated>

		<summary type="html">&lt;p&gt;Acc73: /* The Jastrow Factor */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Theory =&lt;br /&gt;
&lt;br /&gt;
= Compilation of SimpleDMC =&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== The Hydrogen Atom ==&lt;br /&gt;
&lt;br /&gt;
=== Gaussian ===&lt;br /&gt;
Let&#039;s begin by generating a trial wavefunction with Gaussian03. To start with, we need to define an atomic orbital basis, then tell Gaussian03 to use it in conjunction with some &#039;&#039;ab initio&#039;&#039; method. We&#039;ll use the STO-6G basis set, where 6 Gaussian primitives are used to represent an atomic orbital. We&#039;ll create an input file for Gaussian03, called H.com,&lt;br /&gt;
&lt;br /&gt;
   $ cat -n H.com&lt;br /&gt;
      1   %chk=H.chk&lt;br /&gt;
      2   #p UHF/STO-6G 6d 10f SCF Test IOP(3/24=10) IOP(3/81=1) Pop=Full&lt;br /&gt;
      3   &lt;br /&gt;
      4   Hydrogen Atom - UHF STO-6G&lt;br /&gt;
      5&lt;br /&gt;
      6   0 2&lt;br /&gt;
      7   H   0.000   0.000   0.000&lt;br /&gt;
      8&lt;br /&gt;
&lt;br /&gt;
This may seem cryptic for the moment, but each line (and entry therein) is necessary. Line 1 tells Gaussian03 to put some output in an encrypted file called H.chk. Line 2 is the ``route section&amp;quot;: The IOP arguments are &#039;&#039;internal options&#039;&#039;, and tell Gaussian03 to spit out data in a certain format. Line 4 contains a title section, and must be included, as must the sandwiching blank lines. Line 6 specifies the charge and multiplicity (number of unpaired electrons + 1). Finally, on line 7, we specify the molecular configuration; atom types and Cartesian position vectors of the constituent atoms are enumerated here.&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s run Gaussian03,&lt;br /&gt;
&lt;br /&gt;
   $ g03 H.com&lt;br /&gt;
&lt;br /&gt;
No return value is normally a good sign- you&#039;ll typically be greeted with an (unhelpful) SEGFAULT of some kind if the calculation was unsuccessful. It&#039;s also worth explicitly checking for errors, since Gaussian is also able to die silently&lt;br /&gt;
&lt;br /&gt;
   $ grep &amp;quot;Error&amp;quot; H.log&lt;br /&gt;
&lt;br /&gt;
Gaussian03 writes to two files- H.log and H.chk; the contents of the former are obvious while we&#039;ve already briefly discussed the contents of the latter. In the output, all we care about is the energy, so invoke&lt;br /&gt;
&lt;br /&gt;
   $ grep -n &amp;quot;SCF Done&amp;quot; H.log&lt;br /&gt;
   219: SCF Done:  E(UHF) = -0.471039054196     A.U. after     1 cycles&lt;br /&gt;
&lt;br /&gt;
This is a rather poor value relative to the analytical -0.5 Hartrees, but at least we have something to improve upon. We must now do some conversions to extract information from the checkpoint file&lt;br /&gt;
&lt;br /&gt;
   $ formchk H.chk H.fchk&lt;br /&gt;
   Read checkpoint file H.chk&lt;br /&gt;
   Write formatted file H.fchk&lt;br /&gt;
   Rotating derivatives, DoTrsp=T IDiff= 1 LEDeriv=    197 LFDPrp=       0 LDFDPr=       0.&lt;br /&gt;
&lt;br /&gt;
formchk is a Gaussian utility that converts the unreadable H.chk to a formatted checkpoint file, H.fchk. Since this formatted file is more amenable to parsing, it can be used by a number of visualisation/ post-Gaussian tools.&lt;br /&gt;
&lt;br /&gt;
=== qWalk ===&lt;br /&gt;
qWalk is a piece of software we can benchmark the simpleDMC software against, possessing both variational&lt;br /&gt;
and diffusion Monte Carlo (VMC and DMC, respectively) functionalities. The simpleDMC software also uses &lt;br /&gt;
the same input file formats as qWalk, and so we are able to use their file conversion tools to extract data &lt;br /&gt;
from a host of &#039;&#039;ab initio&#039;&#039; software suites.&lt;br /&gt;
&lt;br /&gt;
First, we parse the H.fchk file into a number of qWalk input files:&lt;br /&gt;
&lt;br /&gt;
   $ ./g032qmc -log H.log -fchk H.fchk &lt;br /&gt;
   --- read fchk file ---&lt;br /&gt;
   Number of atoms: 1&lt;br /&gt;
   Number of basis functions: 1&lt;br /&gt;
   Number of independant functions: 1&lt;br /&gt;
   Multiplicity: 2&lt;br /&gt;
   Number of alpha electrons: 1&lt;br /&gt;
   Number of beta electrons: 0&lt;br /&gt;
   Total Energy: -0.471039054195684&lt;br /&gt;
   Pure/Cartesian d shells: 6D&lt;br /&gt;
   Pure/Cartesian f shells: 10F&lt;br /&gt;
   found beta component, scftpe=UHF&lt;br /&gt;
   --- read log file ---&lt;br /&gt;
   basis set is from &#039;AO basis set&#039; section&lt;br /&gt;
   --- have read files ---&lt;br /&gt;
   norb=1&lt;br /&gt;
   spin up end size=1&lt;br /&gt;
   moCoeff total size=2&lt;br /&gt;
   writing qwalk input files ... &lt;br /&gt;
   writing orb file.  This could take a few seconds.&lt;br /&gt;
   output: sample.orb&lt;br /&gt;
   output: sample.basis&lt;br /&gt;
   output: sample.slater&lt;br /&gt;
   output: sample.jast2&lt;br /&gt;
   output: sample.sys&lt;br /&gt;
   output: sample.hf&lt;br /&gt;
   output: sample.opt&lt;br /&gt;
   Done&lt;br /&gt;
    &lt;br /&gt;
   Warning: Now the basisset must be the same for the same specie of atoms&lt;br /&gt;
&lt;br /&gt;
We&#039;ll try to reproduce the UHF results by use of VMC with qWalk. Let&#039;s have a look at sample.hf:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.hf&lt;br /&gt;
   METHOD { VMC nconfig 1000 } &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   INCLUDE sample.sys  &lt;br /&gt;
   TRIALFUNC { INCLUDE sample.slater}&lt;br /&gt;
&lt;br /&gt;
Note that we have added &amp;quot;nconfig 1000&amp;quot;, which gives us control over how many walkers are to be used&lt;br /&gt;
for the VMC. sample.sys contains the system configuration (number of electrons with a given spin, &lt;br /&gt;
atomic coordinates, etc.), while sample.slater contains the orbital information for the Slater&lt;br /&gt;
determinant (in conjunction with sample.orb and sample.basis). This Slater determinant will be used&lt;br /&gt;
to sample the trial wavefunction created by g03. We now run qWalk:&lt;br /&gt;
&lt;br /&gt;
   $ ./qwalk sample.hf&lt;br /&gt;
   output to sample.hf.o&lt;br /&gt;
   System&lt;br /&gt;
   Wave function&lt;br /&gt;
   Pseudopotential&lt;br /&gt;
   Could not open sample.hf.config. Generating configurations from scratch&lt;br /&gt;
  &lt;br /&gt;
and upon completion, are left with three files,&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|sample.hf.o&lt;br /&gt;
|Information about the run.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.log&lt;br /&gt;
|Log for statistical analysis.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.config&lt;br /&gt;
|Checkfile for the run.&lt;br /&gt;
|}   &lt;br /&gt;
&lt;br /&gt;
We can extract averages from the VMC by invoking&lt;br /&gt;
&lt;br /&gt;
   $ ./gosling sample.hf.log      &lt;br /&gt;
   #####################&lt;br /&gt;
   vmc:  100 total blocks reblocked into 100&lt;br /&gt;
   #####################&lt;br /&gt;
   Threw out the first 0 blocks in the averaging.&lt;br /&gt;
   total_energy0        -0.4702684082 +/-  0.000922386677 (sigma     0.425114576 ) &lt;br /&gt;
   kinetic0              0.7706545412 +/-  0.003605881864 (sigma     1.448514687 ) &lt;br /&gt;
   potential0            -1.240922949 +/-  0.003148015019 (sigma      1.21325133 ) &lt;br /&gt;
   nonlocal0                        0 +/-               0 (sigma               0 ) &lt;br /&gt;
   weight0                          1 +/- 6.661338148e-17 (sigma               0 ) &lt;br /&gt;
   &lt;br /&gt;
   --------Properties differences-------------&lt;br /&gt;
   approximate number of independent points: 212415.3753&lt;br /&gt;
&lt;br /&gt;
We see that the VMC estimate of the energy of the trial wavefunction (-0.470(2)) matches&lt;br /&gt;
relatively well with the UHF energy (-0.471039054195684). We have also obtained the&lt;br /&gt;
sample.hf.config file, containing the distribution of walkers sampling the&lt;br /&gt;
trial wavefunction.&lt;br /&gt;
&lt;br /&gt;
   $ head -8 sample.hf.config&lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   -0.731706383078456 0.620589802605041 -0.092157439050284 &lt;br /&gt;
   } &lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   0.366970593352899 0.216757302067973 -0.48313699793852 &lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
=== simpleDMC ===&lt;br /&gt;
&lt;br /&gt;
We can use this distribution of walkers as a starting point for our DMC calculations with&lt;br /&gt;
simpleDMC. We require an input file to run simpleDMC, sample.simple:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.simple&lt;br /&gt;
   simple { &lt;br /&gt;
      nWalkers             1000     # Number of walkers&lt;br /&gt;
      nSteps              10000     # Maximum number of steps&lt;br /&gt;
      dTau                0.001     # Timestep&lt;br /&gt;
      dETrial              -0.5     # Trial energy should start (&amp;gt; FCI energy but close to it)&lt;br /&gt;
      dWeightInit           1.0     # Initial weight&lt;br /&gt;
      bConstWalkerNum     false     # Are we enforcing a constant number of walkers? (Currently not working)&lt;br /&gt;
      nWalkersSpace       20480	    # Walker growth space (Maximum number of walkers permitted)&lt;br /&gt;
      dWeightTarget     10000.0     # Total weight above which we undertake population control&lt;br /&gt;
      dWeightMin         1500.0     # Total weight below which we undertake population control&lt;br /&gt;
      dLowThresh            1.0     # If walker has weight below this, try to either kill or recombine it&lt;br /&gt;
      dWeightBranch         1.5     # If walker has weight above this, we branch the walker&lt;br /&gt;
      nShiftSteps             1     # Vary the shift every nShiftSteps steps.&lt;br /&gt;
      dShiftDamp            1.0     # Larger shift damping is more radical damping&lt;br /&gt;
      dOldWeight            0.0     # The total weight at the previous cycle for calculating the shift&lt;br /&gt;
      bUpdateShift        false     # Are we updating the shift every nShiftSteps cycles?&lt;br /&gt;
   }&lt;br /&gt;
                                                             &lt;br /&gt;
simpleDMC reuses the input files of qWalk, and can be invoked by listing the files as command line &lt;br /&gt;
arguments (in any order)&lt;br /&gt;
   &lt;br /&gt;
   $ ./simpleDMC.x sample.{sys,slater,orb,basis,simple,hf.config,hf.log} &amp;gt;&amp;gt; sample.log&lt;br /&gt;
&lt;br /&gt;
We pass all of the output to sample.log since the majority of information concerning the simulation is&lt;br /&gt;
streamed straight to STDOUT. We are primarily concerned with the final nSteps lines, since these give&lt;br /&gt;
the various energetic quantities associated with the system of walkers at each timestep. In fact, with&lt;br /&gt;
a little foresight, the fifth column corresponds to the total energy averaged over all walkers at that&lt;br /&gt;
timestep. Averaging over this column, we obtain the DMC energy:&lt;br /&gt;
&lt;br /&gt;
   $ export nsteps=10000&lt;br /&gt;
   $ tail -n $nsteps sample.log | awk &#039;{ sum += $5; n++ } END { if (n &amp;gt; 0) print sum / n; }&#039;&lt;br /&gt;
   -0.498772&lt;br /&gt;
&lt;br /&gt;
This quantity is in very good agreement with the exact energy of -0.5 Hartrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;V = \frac{\epsilon}{2} \sum_{i&amp;lt;j} \left[ \left(\frac{r_{ij}}{\sigma}\right)^2+\left(\frac{\sigma}{r_{ij}}\right)^2 \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Jastrow Factor ==&lt;br /&gt;
&lt;br /&gt;
One further usable output from qWalk is the Jastrow factor parameters. This helps to add in explicit correlation terms between electron-electron pairs (known two body terms) and electron-ion pairs (one body terms). After having performed the parsing of the *.fchk file with ./g032qmc, a blank template of the Jastrow parameters will be created, called *.jast2. This is designed to include both two-body and one-body interaction, hence the suffix of &amp;quot;2&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
A good tutorial for how to optimise the Jastrow parameters is given in the qWalk documentation ( [https://github.com/QWalk/mainline/wiki/Tutorial] ), but a potted version which will consistently produce the same result is outlined here. Nothing needs to be altered in the *.jast2 file, but the *.opt file requires some additions. For a system called sample, Edit the sample.opt file so that the very first line reads:&lt;br /&gt;
&lt;br /&gt;
METHOD { OPTIMIZE iterations 1000 READCONFIG sample.hf.config  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
INCLUDE WaterHex.sys&lt;br /&gt;
TRIALFUNC {&lt;br /&gt;
  SLATER-JASTROW&lt;br /&gt;
  WF1 { INCLUDE WaterHex.slater }&lt;br /&gt;
  WF2 { INCLUDE WaterHex.jast2 }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;iterations&amp;quot; keyword extends the number of Jastrow optimisation cycles beyond the default which is only 30 (which in practice is often not enough). The &amp;quot;READCONFIG&amp;quot; file forces qWalk to explicitly read in the electron configurations from a previous qWalk run (if a more accurate *.dmc.config file exists, then of course use that!). The advantage of this keyword is that qWalk does not have to make up its own configurations, which will make the Jastrow optimisation unreproducible and, quite often, spurious. &lt;br /&gt;
&lt;br /&gt;
Once edited, simply run:&lt;br /&gt;
$ qwalk sample.opt&lt;br /&gt;
&lt;br /&gt;
A new file called &amp;quot;sample.opt.wfout&amp;quot; will have been produced, which contains the combined Slater and Jastrow parameters. Since we are only interested in the Jastrow parameters, and the parser gets confused with the Slater bit, delete the first portion of the file up until the lines which read:&lt;br /&gt;
&lt;br /&gt;
  JASTROW2&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
If the system only contains a single atom, then you are done, and the file should be successfully parsed! The only addition you will need to make is in the Make.include file, whereby the .opt.wfout must be added to the line which calls the executable, and tells it which files to read. For example, for the sample, the following needs to exist in Make.include:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
sample: program&lt;br /&gt;
        $(EXECWITH) bin/simpleDMC.x examples/SAMPLE_DIR/sample.{sys,slater,orb,basis,simple,hf.config,hf.log,opt.wfout}&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Water Example ===&lt;br /&gt;
&lt;br /&gt;
One further complication arises when more than one atom type is present, and one further amendment must be made to the *opt.wfout file. Out of the box, qWalk will produce the following line for a monomer of water whose Jastrow has been optimised:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
The parser will not be able to read this, as it looks for the keyword &amp;quot;ONEBODY&amp;quot; and expects only a single line to follow. Therefore, the following addition will fix this problem, and a working file should look like:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
    }&lt;br /&gt;
    ONEBODY{&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
[etc...]&lt;/div&gt;</summary>
		<author><name>Acc73</name></author>
	</entry>
	<entry>
		<id>https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=239</id>
		<title>SimpleDMC</title>
		<link rel="alternate" type="text/html" href="https://wikis.ch.cam.ac.uk/thom/wiki/index.php?title=SimpleDMC&amp;diff=239"/>
		<updated>2017-07-20T14:18:37Z</updated>

		<summary type="html">&lt;p&gt;Acc73: /* Examples */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Theory =&lt;br /&gt;
&lt;br /&gt;
= Compilation of SimpleDMC =&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
== The Hydrogen Atom ==&lt;br /&gt;
&lt;br /&gt;
=== Gaussian ===&lt;br /&gt;
Let&#039;s begin by generating a trial wavefunction with Gaussian03. To start with, we need to define an atomic orbital basis, then tell Gaussian03 to use it in conjunction with some &#039;&#039;ab initio&#039;&#039; method. We&#039;ll use the STO-6G basis set, where 6 Gaussian primitives are used to represent an atomic orbital. We&#039;ll create an input file for Gaussian03, called H.com,&lt;br /&gt;
&lt;br /&gt;
   $ cat -n H.com&lt;br /&gt;
      1   %chk=H.chk&lt;br /&gt;
      2   #p UHF/STO-6G 6d 10f SCF Test IOP(3/24=10) IOP(3/81=1) Pop=Full&lt;br /&gt;
      3   &lt;br /&gt;
      4   Hydrogen Atom - UHF STO-6G&lt;br /&gt;
      5&lt;br /&gt;
      6   0 2&lt;br /&gt;
      7   H   0.000   0.000   0.000&lt;br /&gt;
      8&lt;br /&gt;
&lt;br /&gt;
This may seem cryptic for the moment, but each line (and entry therein) is necessary. Line 1 tells Gaussian03 to put some output in an encrypted file called H.chk. Line 2 is the ``route section&amp;quot;: The IOP arguments are &#039;&#039;internal options&#039;&#039;, and tell Gaussian03 to spit out data in a certain format. Line 4 contains a title section, and must be included, as must the sandwiching blank lines. Line 6 specifies the charge and multiplicity (number of unpaired electrons + 1). Finally, on line 7, we specify the molecular configuration; atom types and Cartesian position vectors of the constituent atoms are enumerated here.&lt;br /&gt;
&lt;br /&gt;
Now, let&#039;s run Gaussian03,&lt;br /&gt;
&lt;br /&gt;
   $ g03 H.com&lt;br /&gt;
&lt;br /&gt;
No return value is normally a good sign- you&#039;ll typically be greeted with an (unhelpful) SEGFAULT of some kind if the calculation was unsuccessful. It&#039;s also worth explicitly checking for errors, since Gaussian is also able to die silently&lt;br /&gt;
&lt;br /&gt;
   $ grep &amp;quot;Error&amp;quot; H.log&lt;br /&gt;
&lt;br /&gt;
Gaussian03 writes to two files- H.log and H.chk; the contents of the former are obvious while we&#039;ve already briefly discussed the contents of the latter. In the output, all we care about is the energy, so invoke&lt;br /&gt;
&lt;br /&gt;
   $ grep -n &amp;quot;SCF Done&amp;quot; H.log&lt;br /&gt;
   219: SCF Done:  E(UHF) = -0.471039054196     A.U. after     1 cycles&lt;br /&gt;
&lt;br /&gt;
This is a rather poor value relative to the analytical -0.5 Hartrees, but at least we have something to improve upon. We must now do some conversions to extract information from the checkpoint file&lt;br /&gt;
&lt;br /&gt;
   $ formchk H.chk H.fchk&lt;br /&gt;
   Read checkpoint file H.chk&lt;br /&gt;
   Write formatted file H.fchk&lt;br /&gt;
   Rotating derivatives, DoTrsp=T IDiff= 1 LEDeriv=    197 LFDPrp=       0 LDFDPr=       0.&lt;br /&gt;
&lt;br /&gt;
formchk is a Gaussian utility that converts the unreadable H.chk to a formatted checkpoint file, H.fchk. Since this formatted file is more amenable to parsing, it can be used by a number of visualisation/ post-Gaussian tools.&lt;br /&gt;
&lt;br /&gt;
=== qWalk ===&lt;br /&gt;
qWalk is a piece of software we can benchmark the simpleDMC software against, possessing both variational&lt;br /&gt;
and diffusion Monte Carlo (VMC and DMC, respectively) functionalities. The simpleDMC software also uses &lt;br /&gt;
the same input file formats as qWalk, and so we are able to use their file conversion tools to extract data &lt;br /&gt;
from a host of &#039;&#039;ab initio&#039;&#039; software suites.&lt;br /&gt;
&lt;br /&gt;
First, we parse the H.fchk file into a number of qWalk input files:&lt;br /&gt;
&lt;br /&gt;
   $ ./g032qmc -log H.log -fchk H.fchk &lt;br /&gt;
   --- read fchk file ---&lt;br /&gt;
   Number of atoms: 1&lt;br /&gt;
   Number of basis functions: 1&lt;br /&gt;
   Number of independant functions: 1&lt;br /&gt;
   Multiplicity: 2&lt;br /&gt;
   Number of alpha electrons: 1&lt;br /&gt;
   Number of beta electrons: 0&lt;br /&gt;
   Total Energy: -0.471039054195684&lt;br /&gt;
   Pure/Cartesian d shells: 6D&lt;br /&gt;
   Pure/Cartesian f shells: 10F&lt;br /&gt;
   found beta component, scftpe=UHF&lt;br /&gt;
   --- read log file ---&lt;br /&gt;
   basis set is from &#039;AO basis set&#039; section&lt;br /&gt;
   --- have read files ---&lt;br /&gt;
   norb=1&lt;br /&gt;
   spin up end size=1&lt;br /&gt;
   moCoeff total size=2&lt;br /&gt;
   writing qwalk input files ... &lt;br /&gt;
   writing orb file.  This could take a few seconds.&lt;br /&gt;
   output: sample.orb&lt;br /&gt;
   output: sample.basis&lt;br /&gt;
   output: sample.slater&lt;br /&gt;
   output: sample.jast2&lt;br /&gt;
   output: sample.sys&lt;br /&gt;
   output: sample.hf&lt;br /&gt;
   output: sample.opt&lt;br /&gt;
   Done&lt;br /&gt;
    &lt;br /&gt;
   Warning: Now the basisset must be the same for the same specie of atoms&lt;br /&gt;
&lt;br /&gt;
We&#039;ll try to reproduce the UHF results by use of VMC with qWalk. Let&#039;s have a look at sample.hf:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.hf&lt;br /&gt;
   METHOD { VMC nconfig 1000 } &lt;br /&gt;
    &lt;br /&gt;
    &lt;br /&gt;
   INCLUDE sample.sys  &lt;br /&gt;
   TRIALFUNC { INCLUDE sample.slater}&lt;br /&gt;
&lt;br /&gt;
Note that we have added &amp;quot;nconfig 1000&amp;quot;, which gives us control over how many walkers are to be used&lt;br /&gt;
for the VMC. sample.sys contains the system configuration (number of electrons with a given spin, &lt;br /&gt;
atomic coordinates, etc.), while sample.slater contains the orbital information for the Slater&lt;br /&gt;
determinant (in conjunction with sample.orb and sample.basis). This Slater determinant will be used&lt;br /&gt;
to sample the trial wavefunction created by g03. We now run qWalk:&lt;br /&gt;
&lt;br /&gt;
   $ ./qwalk sample.hf&lt;br /&gt;
   output to sample.hf.o&lt;br /&gt;
   System&lt;br /&gt;
   Wave function&lt;br /&gt;
   Pseudopotential&lt;br /&gt;
   Could not open sample.hf.config. Generating configurations from scratch&lt;br /&gt;
  &lt;br /&gt;
and upon completion, are left with three files,&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|sample.hf.o&lt;br /&gt;
|Information about the run.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.log&lt;br /&gt;
|Log for statistical analysis.&lt;br /&gt;
|-&lt;br /&gt;
|sample.hf.config&lt;br /&gt;
|Checkfile for the run.&lt;br /&gt;
|}   &lt;br /&gt;
&lt;br /&gt;
We can extract averages from the VMC by invoking&lt;br /&gt;
&lt;br /&gt;
   $ ./gosling sample.hf.log      &lt;br /&gt;
   #####################&lt;br /&gt;
   vmc:  100 total blocks reblocked into 100&lt;br /&gt;
   #####################&lt;br /&gt;
   Threw out the first 0 blocks in the averaging.&lt;br /&gt;
   total_energy0        -0.4702684082 +/-  0.000922386677 (sigma     0.425114576 ) &lt;br /&gt;
   kinetic0              0.7706545412 +/-  0.003605881864 (sigma     1.448514687 ) &lt;br /&gt;
   potential0            -1.240922949 +/-  0.003148015019 (sigma      1.21325133 ) &lt;br /&gt;
   nonlocal0                        0 +/-               0 (sigma               0 ) &lt;br /&gt;
   weight0                          1 +/- 6.661338148e-17 (sigma               0 ) &lt;br /&gt;
   &lt;br /&gt;
   --------Properties differences-------------&lt;br /&gt;
   approximate number of independent points: 212415.3753&lt;br /&gt;
&lt;br /&gt;
We see that the VMC estimate of the energy of the trial wavefunction (-0.470(2)) matches&lt;br /&gt;
relatively well with the UHF energy (-0.471039054195684). We have also obtained the&lt;br /&gt;
sample.hf.config file, containing the distribution of walkers sampling the&lt;br /&gt;
trial wavefunction.&lt;br /&gt;
&lt;br /&gt;
   $ head -8 sample.hf.config&lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   -0.731706383078456 0.620589802605041 -0.092157439050284 &lt;br /&gt;
   } &lt;br /&gt;
   walker { &lt;br /&gt;
   nElec 1 ndim 3&lt;br /&gt;
   0.366970593352899 0.216757302067973 -0.48313699793852 &lt;br /&gt;
   }&lt;br /&gt;
&lt;br /&gt;
=== simpleDMC ===&lt;br /&gt;
&lt;br /&gt;
We can use this distribution of walkers as a starting point for our DMC calculations with&lt;br /&gt;
simpleDMC. We require an input file to run simpleDMC, sample.simple:&lt;br /&gt;
&lt;br /&gt;
   $ cat sample.simple&lt;br /&gt;
   simple { &lt;br /&gt;
      nWalkers             1000     # Number of walkers&lt;br /&gt;
      nSteps              10000     # Maximum number of steps&lt;br /&gt;
      dTau                0.001     # Timestep&lt;br /&gt;
      dETrial              -0.5     # Trial energy should start (&amp;gt; FCI energy but close to it)&lt;br /&gt;
      dWeightInit           1.0     # Initial weight&lt;br /&gt;
      bConstWalkerNum     false     # Are we enforcing a constant number of walkers? (Currently not working)&lt;br /&gt;
      nWalkersSpace       20480	    # Walker growth space (Maximum number of walkers permitted)&lt;br /&gt;
      dWeightTarget     10000.0     # Total weight above which we undertake population control&lt;br /&gt;
      dWeightMin         1500.0     # Total weight below which we undertake population control&lt;br /&gt;
      dLowThresh            1.0     # If walker has weight below this, try to either kill or recombine it&lt;br /&gt;
      dWeightBranch         1.5     # If walker has weight above this, we branch the walker&lt;br /&gt;
      nShiftSteps             1     # Vary the shift every nShiftSteps steps.&lt;br /&gt;
      dShiftDamp            1.0     # Larger shift damping is more radical damping&lt;br /&gt;
      dOldWeight            0.0     # The total weight at the previous cycle for calculating the shift&lt;br /&gt;
      bUpdateShift        false     # Are we updating the shift every nShiftSteps cycles?&lt;br /&gt;
   }&lt;br /&gt;
                                                             &lt;br /&gt;
simpleDMC reuses the input files of qWalk, and can be invoked by listing the files as command line &lt;br /&gt;
arguments (in any order)&lt;br /&gt;
   &lt;br /&gt;
   $ ./simpleDMC.x sample.{sys,slater,orb,basis,simple,hf.config,hf.log} &amp;gt;&amp;gt; sample.log&lt;br /&gt;
&lt;br /&gt;
We pass all of the output to sample.log since the majority of information concerning the simulation is&lt;br /&gt;
streamed straight to STDOUT. We are primarily concerned with the final nSteps lines, since these give&lt;br /&gt;
the various energetic quantities associated with the system of walkers at each timestep. In fact, with&lt;br /&gt;
a little foresight, the fifth column corresponds to the total energy averaged over all walkers at that&lt;br /&gt;
timestep. Averaging over this column, we obtain the DMC energy:&lt;br /&gt;
&lt;br /&gt;
   $ export nsteps=10000&lt;br /&gt;
   $ tail -n $nsteps sample.log | awk &#039;{ sum += $5; n++ } END { if (n &amp;gt; 0) print sum / n; }&#039;&lt;br /&gt;
   -0.498772&lt;br /&gt;
&lt;br /&gt;
This quantity is in very good agreement with the exact energy of -0.5 Hartrees.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;math&amp;gt;V = \frac{\epsilon}{2} \sum_{i&amp;lt;j} \left[ \left(\frac{r_{ij}}{\sigma}\right)^2+\left(\frac{\sigma}{r_{ij}}\right)^2 \right]&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== The Jastrow Factor ==&lt;br /&gt;
&lt;br /&gt;
One further usable output from qWalk is the Jastrow factor Parameters. This helps to add in explicit correlation terms between electron-electron pairs (known two body terms) and electron-ion pairs (one body terms). After having performed the parsing of the *.fchk file with ./g032qmc, a blank template of the Jastrow parameters will be created, called *.jast2. This is designed to include both two-body and one-body interaction, hence the suffix of &amp;quot;2&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
A good tutorial for how to optimise the Jastrow parameters is given in the qWalk documentation ( [https://github.com/QWalk/mainline/wiki/Tutorial] ), but a potted version which will consistently produce the same result is outlined here. Nothing needs to be altered in the *.jast2 file, but the *.opt file requires some additions. For a system called sample, Edit the sample.opt file so that the very first line reads:&lt;br /&gt;
&lt;br /&gt;
METHOD { OPTIMIZE iterations 1000 READCONFIG sample.hf.config  }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
INCLUDE WaterHex.sys&lt;br /&gt;
TRIALFUNC {&lt;br /&gt;
  SLATER-JASTROW&lt;br /&gt;
  WF1 { INCLUDE WaterHex.slater }&lt;br /&gt;
  WF2 { INCLUDE WaterHex.jast2 }&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
The &amp;quot;iterations&amp;quot; keyword extends the number of Jastrow optimisation cycles beyond the default which is only 30 (which in practice is often not enough). The &amp;quot;READCONFIG&amp;quot; file forces qWalk to explicitly read in the electron configurations from a previous qWalk run (if a more accurate *.dmc.config file exists, then of course use that!). The advantage of this keyword is that qWalk does not have to make up its own configurations, which will make the Jastrow optimisation unreproducible and, quite often, spurious. &lt;br /&gt;
&lt;br /&gt;
Once edited, simply run:&lt;br /&gt;
$ qwalk sample.opt&lt;br /&gt;
&lt;br /&gt;
A new file called &amp;quot;sample.opt.wfout&amp;quot; will have been produced, which contains the combined Slater and Jastrow parameters. Since we are only interested in the Jastrow parameters, and the parser gets confused with the Slater bit, delete the first portion of the file up until the lines which read:&lt;br /&gt;
&lt;br /&gt;
  JASTROW2&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
If the system only contains a single atom, then you are done, and the file should be successfully parsed! The only addition you will need to make is in the Make.include file, whereby the .opt.wfout must be added to the line which calls the executable, and tells it which files to read. For example, for the sample, the following needs to exist in Make.include:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
sample: program&lt;br /&gt;
        $(EXECWITH) bin/simpleDMC.x examples/SAMPLE_DIR/sample.{sys,slater,orb,basis,simple,hf.config,hf.log,opt.wfout}&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Water Example ===&lt;br /&gt;
&lt;br /&gt;
One further complication arises when more than one atom type is present, and one further amendment must be made to the *opt.wfout file. Out of the box, qWalk will produce the following line for a monomer of water whose Jastrow has been optimised:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
[etc...]&lt;br /&gt;
&lt;br /&gt;
The parser will not be able to read this, as it looks for the keyword &amp;quot;ONEBODY&amp;quot; and expects only a single line to follow. Therefore, the following addition will fix this problem, and a working file should look like:&lt;br /&gt;
&lt;br /&gt;
[...]&lt;br /&gt;
  GROUP {&lt;br /&gt;
    OPTIMIZEBASIS&lt;br /&gt;
    ONEBODY {&lt;br /&gt;
      COEFFICIENTS { O  0.0552961257026809  -0.0570651722411533  0.0412059756740772   }&lt;br /&gt;
    }&lt;br /&gt;
    ONEBODY{&lt;br /&gt;
      COEFFICIENTS { H  -0.0203739180406208  -0.0465365828480515  0.225417700569402   }&lt;br /&gt;
    }&lt;br /&gt;
    TWOBODY {&lt;br /&gt;
      COEFFICIENTS { 0.163979168113989  -0.0968499964559348  -0.0100359372373529   }&lt;br /&gt;
    }&lt;br /&gt;
[etc...]&lt;/div&gt;</summary>
		<author><name>Acc73</name></author>
	</entry>
</feed>