This file is indexed.

/usr/share/doc/psi4/html/psithoninput.html is in psi4-data 1:0.3-5.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    
    <title>Psithon: Structuring an Input File &mdash; Psi4 [] Docs</title>
    
    <link rel="stylesheet" href="_static/psi4.css" type="text/css" />
    <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
    <link rel="stylesheet" href="./" type="text/css" />
    
    <script type="text/javascript">
      var DOCUMENTATION_OPTIONS = {
        URL_ROOT:    './',
        VERSION:     '',
        COLLAPSE_INDEX: false,
        FILE_SUFFIX: '.html',
        HAS_SOURCE:  true
      };
    </script>
    <script type="text/javascript" src="_static/jquery.js"></script>
    <script type="text/javascript" src="_static/underscore.js"></script>
    <script type="text/javascript" src="_static/doctools.js"></script>
    <script type="text/javascript" src="_static/jquery.cookie.js"></script>
    <script type="text/javascript" src="_static/toggle_sections.js"></script>
    <script type="text/javascript" src="_static/toggle_sidebar.js"></script>
    <script type="text/javascript" src="_static/toggle_codeprompt.js"></script>
    <link rel="shortcut icon" href="_static/favicon-psi4.ico"/>
    <link rel="top" title="Psi4 [] Docs" href="index.html" />
    <link rel="next" title="Molecule and Geometry Specification" href="psithonmol.html" />
    <link rel="prev" title="A Psi4 Tutorial" href="tutorial.html" /> 
  </head>
  <body role="document">
    <div class="relbar-top">
        
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="contents.html" title="Table Of Contents"
             accesskey="C">toc</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="psithonmol.html" title="Molecule and Geometry Specification"
             accesskey="N">next</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="tutorial.html" title="A Psi4 Tutorial"
             accesskey="P">previous</a> &nbsp; &nbsp;</li>
    <li><a href="index.html">Psi4 []</a> &raquo; </li>
 
      </ul>
    </div>
    </div>
  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <a class="reference internal image-reference" href="_images/psi4banner.png"><img alt="Psi4 Project Logo" src="_images/psi4banner.png" style="width: 100%;" /></a>
<div class="section" id="psithon-structuring-an-input-file">
<span id="sec-psithoninput"></span><h1>Psithon: Structuring an Input File<a class="headerlink" href="#psithon-structuring-an-input-file" title="Permalink to this headline"></a></h1>
<p>To allow arbitrarily complex computations to be performed, <span class="sc">Psi4</span> was built
upon the Python interpreter. However, to make the input syntax simpler, some
pre-processing of the input file is performed before it is interpreted,
resulting in Python syntax that is customized for PSI, termed Psithon.  In
this section we will describe the essential features of the Psithon language.
<span class="sc">Psi4</span> is distributed with an extensive test suite, described in section
<a class="reference internal" href="testsuite.html#apdx-testsuite"><span>Test Suite and Sample Inputs</span></a>; the input files for these test cases can be found in the
samples subdirectory of the top-level <span class="sc">Psi4</span> source directory, and should
serve as useful examples.</p>
<div class="section" id="physical-constants">
<span id="sec-physicalconstants"></span><span id="index-0"></span><h2>Physical Constants<a class="headerlink" href="#physical-constants" title="Permalink to this headline"></a></h2>
<p>For convenience, the Python interpreter will execute the contents of the
<code class="docutils literal"><span class="pre">~/.psi4rc</span></code> file in the current user&#8217;s home area (if present) before performing any
tasks in the input file.  This allows frequently used python variables to be
automatically defined in all input files.  For example, if we repeatedly make
use of the universal gravitational constant, the following line could be placed
in the <code class="docutils literal"><span class="pre">~/.psi4rc</span></code> file</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">UGC</span> <span class="o">=</span> <span class="mf">6.67384E-11</span> <span class="c"># m^3 / kg^-1 s^-2</span>
</pre></div>
</div>
<p>which would make the variable <code class="docutils literal"><span class="pre">UGC</span></code> available in all <span class="sc">Psi4</span> input files.
For convenience, the physical constants used within the <span class="sc">Psi4</span> code (which
are obtained from the 3rd edition of the IUPAC Green
book <a class="reference internal" href="bibliography.html#cohen-greenbook-2008" id="id1">[Cohen:GreenBook:2008]</a>) are also automatically loaded as Psithon
variables (before <code class="docutils literal"><span class="pre">~/.psi4rc</span></code> is loaded, so that <code class="docutils literal"><span class="pre">~/.psi4rc</span></code> values can be overridden by
the user).</p>
<p id="table-physconst">The physical constants used within <span class="sc">Psi4</span>, which are automatically
made available within all <span class="sc">Psi4</span> input files.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">psi_h</span>                        <span class="o">=</span> <span class="mf">6.62606896E-34</span>       <span class="c"># The Planck constant (Js)               </span>
<span class="n">psi_c</span>                        <span class="o">=</span> <span class="mf">2.99792458E8</span>         <span class="c"># Speed of light (ms$^{-1}$)             </span>
<span class="n">psi_kb</span>                       <span class="o">=</span> <span class="mf">1.3806504E-23</span>        <span class="c"># The Boltzmann constant (JK$^{-1}$)     </span>
<span class="n">psi_R</span>                        <span class="o">=</span> <span class="mf">8.314472</span>             <span class="c"># Universal gas constant (JK$^{-1}$mol$^{-1}$) </span>
<span class="n">psi_bohr2angstroms</span>           <span class="o">=</span> <span class="mf">0.52917720859</span>        <span class="c"># Bohr to Angstroms conversion factor    </span>
<span class="n">psi_bohr2m</span>                   <span class="o">=</span> <span class="mf">0.52917720859E-10</span>    <span class="c"># Bohr to meters conversion factor       </span>
<span class="n">psi_bohr2cm</span>                  <span class="o">=</span> <span class="mf">0.52917720859E-8</span>     <span class="c"># Bohr to centimeters conversion factor  </span>
<span class="n">psi_amu2g</span>                    <span class="o">=</span> <span class="mf">1.660538782E-24</span>      <span class="c"># Atomic mass units to grams conversion factor </span>
<span class="n">psi_amu2kg</span>                   <span class="o">=</span> <span class="mf">1.660538782E-27</span>      <span class="c"># Atomic mass units to kg conversion factor </span>
<span class="n">psi_au2amu</span>                   <span class="o">=</span> <span class="mf">5.485799097E-4</span>       <span class="c"># Atomic units (m$@@e$) to atomic mass units conversion factor </span>
<span class="n">psi_hartree2J</span>                <span class="o">=</span> <span class="mf">4.359744E-18</span>         <span class="c"># Hartree to joule conversion factor     </span>
<span class="n">psi_hartree2aJ</span>               <span class="o">=</span> <span class="mf">4.359744</span>             <span class="c"># Hartree to attojoule (10$^{-18}$J) conversion factor </span>
<span class="n">psi_cal2J</span>                    <span class="o">=</span> <span class="mf">4.184</span>                <span class="c"># Calorie to joule conversion factor     </span>
<span class="n">psi_dipmom_au2si</span>             <span class="o">=</span> <span class="mf">8.47835281E-30</span>       <span class="c"># Atomic units to SI units (Cm) conversion factor for dipoles </span>
<span class="n">psi_dipmom_au2debye</span>          <span class="o">=</span> <span class="mf">2.54174623</span>           <span class="c"># Atomic units to Debye conversion factor for dipoles </span>
<span class="n">psi_dipmom_debye2si</span>          <span class="o">=</span> <span class="mf">3.335640952E-30</span>      <span class="c"># Debye to SI units (Cm) conversion factor for dipoles </span>
<span class="n">psi_c_au</span>                     <span class="o">=</span> <span class="mf">137.035999679</span>        <span class="c"># Speed of light in atomic units         </span>
<span class="n">psi_hartree2ev</span>               <span class="o">=</span> <span class="mf">27.21138</span>             <span class="c"># Hartree to eV conversion factor        </span>
<span class="n">psi_hartree2wavenumbers</span>      <span class="o">=</span> <span class="mf">219474.6</span>             <span class="c"># Hartree to cm$^{-1}$ conversion factor </span>
<span class="n">psi_hartree2kcalmol</span>          <span class="o">=</span> <span class="mf">627.5095</span>             <span class="c"># Hartree to kcal mol$^{-1}$ conversion factor </span>
<span class="n">psi_hartree2MHz</span>              <span class="o">=</span> <span class="mf">6.579684E9</span>           <span class="c"># Hartree to MHz conversion factor       </span>
<span class="n">psi_kcalmol2wavenumbers</span>      <span class="o">=</span> <span class="mf">349.7551</span>             <span class="c"># kcal mol$^{-1}$ to cm$^{-1}$ conversion factor </span>
<span class="n">psi_e0</span>                       <span class="o">=</span> <span class="mf">8.854187817E-12</span>      <span class="c"># Vacuum permittivity (Fm$^{-1}$)        </span>
<span class="n">psi_na</span>                       <span class="o">=</span> <span class="mf">6.02214179E23</span>        <span class="c"># Avagadro&#39;s number                      </span>
<span class="n">psi_me</span>                       <span class="o">=</span> <span class="mf">9.10938215E-31</span>       <span class="c"># Electron rest mass (in kg)             </span>
</pre></div>
</div>
<p>The <code class="docutils literal"><span class="pre">psi_</span></code> prefix is to prevent clashes with user-defined variables in
<span class="sc">Psi4</span> input files.</p>
</div>
<div class="section" id="memory-specification">
<span id="sec-memory"></span><span id="index-1"></span><h2>Memory Specification<a class="headerlink" href="#memory-specification" title="Permalink to this headline"></a></h2>
<p>By default, <span class="sc">Psi4</span> assumes that 256 Mb of memory are available. While this is
enough for many computations, many of the algorithms will perform better if
more is available. To specify memory, the <code class="docutils literal"><span class="pre">memory</span></code> keyword should be used. The following
lines are all equivalent methods for specifying that 2 Gb of RAM is available
to <span class="sc">Psi4</span>:</p>
<div class="highlight-python"><div class="highlight"><pre># all equivalent

memory 2 Gb

memory 2000 Mb

memory 2000000 Kb
</pre></div>
</div>
<p>One convenient way to override the <span class="sc">Psi4</span> default memory is to place a
memory command in the <code class="docutils literal"><span class="pre">~/.psi4rc</span></code> file (Sec. <a class="reference internal" href="external.html#sec-psirc"><span>Scratch Files and the ~/.psi4rc File</span></a>). For example,
the following makes the default memory 2 Gb.</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">set_memory</span><span class="p">(</span><span class="mi">2000000000</span><span class="p">)</span>
</pre></div>
</div>
<p>However, unless you&#8217;re assured of having only one job running on a node at
a time (and all nodes on the filesystem with <code class="docutils literal"><span class="pre">~/.psi4rc</span></code> have similar memory
capacities), it is advised to set memory in the input file on a
per-calculation basis.</p>
<div class="admonition note">
<p class="first admonition-title">Note</p>
<p class="last">For parallel jobs, the <code class="docutils literal"><span class="pre">memory</span></code> keyword represents the total memory
available to the job, <em>not</em> the memory per thread.</p>
</div>
</div>
<div class="section" id="molecule-and-geometry-specification">
<h2>Molecule and Geometry Specification<a class="headerlink" href="#molecule-and-geometry-specification" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="psithonmol.html">Molecule and Geometry Specification</a><ul>
<li class="toctree-l2"><a class="reference internal" href="psithonmol.html#coordinates">Coordinates</a></li>
<li class="toctree-l2"><a class="reference internal" href="psithonmol.html#molecule-keywords">Molecule Keywords</a></li>
<li class="toctree-l2"><a class="reference internal" href="psithonmol.html#multiple-molecules">Multiple Molecules</a></li>
<li class="toctree-l2"><a class="reference internal" href="psithonmol.html#ghost-atoms">Ghost Atoms</a></li>
<li class="toctree-l2"><a class="reference internal" href="psithonmol.html#pubchem-database">PubChem Database</a></li>
<li class="toctree-l2"><a class="reference internal" href="psithonmol.html#symmetry">Symmetry</a></li>
<li class="toctree-l2"><a class="reference internal" href="psithonmol.html#non-covalently-bonded-molecule-fragments">Non-Covalently Bonded Molecule Fragments</a></li>
<li class="toctree-l2"><a class="reference internal" href="psithonmol.html#advanced-python">Advanced Python</a></li>
</ul>
</li>
</ul>
</div>
<p>To add EFP fragments to a molecule, see <a class="reference internal" href="libefp.html#sec-usingefpfragments"><span>Molecule Specification</span></a>.</p>
</div>
<div class="section" id="job-control-keywords">
<span id="sec-jobcontrol"></span><span id="index-2"></span><h2>Job Control Keywords<a class="headerlink" href="#job-control-keywords" title="Permalink to this headline"></a></h2>
<p><span class="sc">Psi4</span> comprises a number of modules, written in C++, that each perform
specific tasks and are callable directly from the Python front end. Each module
recognizes specific keywords in the input file which control its function.
These keywords are detailed in Appendix <a class="reference internal" href="autodoc_options_c_bymodule.html#apdx-options-c-module"><span>Keywords by Module</span></a>.
The keywords can be made global, or scoped to apply to
certain specific modules. The following examples demonstrate some of the ways
that global keywords can be specified:</p>
<div class="highlight-python"><div class="highlight"><pre># all equivalent

set globals basis cc-pVDZ

set basis cc-pVDZ

set globals basis = cc-pVDZ

set basis = cc-pVDZ

set globals{
  basis cc-pVDZ
}

set {
  basis cc-pVDZ
}

set {
  basis = cc-pVDZ
}
</pre></div>
</div>
<p>Note the lack of quotes around <code class="docutils literal"><span class="pre">cc-pVDZ</span></code>, even though it is a string. The
Psithon preprocessor automatically wraps any string values in <code class="docutils literal"><span class="pre">set</span></code> commands in
strings. The last three examples provide a more convenient way for specifying
multiple keywords:</p>
<div class="highlight-python"><div class="highlight"><pre>set {
  basis = cc-pVDZ
  print = 1
  reference = rhf
}
</pre></div>
</div>
<p>For arguments that require an array input, standard Python list syntax should
be used, <em>viz.</em>:</p>
<div class="highlight-python"><div class="highlight"><pre>set {
  docc = [3, 0, 1, 1]
}
</pre></div>
</div>
<p>List/matrix inputs may span multiple lines, as long as the opening <code class="docutils literal"><span class="pre">[</span></code> is
on the same line as the name of the keyword.</p>
<p>Any of the above keyword specifications can be scoped to individual modules,
by adding the name of the module after the <code class="docutils literal"><span class="pre">set</span></code> keyword. Omitting the module
name, or using the name <code class="docutils literal"><span class="pre">global</span></code> or <code class="docutils literal"><span class="pre">globals</span></code> will result in the keyword being
applied to all modules. For example, in the following input</p>
<div class="highlight-python"><div class="highlight"><pre>molecule{
  o
  h 1 roh
  h 1 roh 2 ahoh

  roh = 0.957
  ahoh = 104.5
}

set basis cc-pVDZ
set ccenergy print 3
set scf print 1
energy(&#39;ccsd&#39;)
</pre></div>
</div>
<p>the basis set is set to cc-pVDZ throughout, the SCF code will have a print
level of 1 and the ccenergy code, which performs coupled cluster computations,
will use a print level of 3. In this example a full CCSD computation is
performed by running the SCF code first, then the coupled cluster modules;
the <code class="docutils literal"><span class="pre">energy()</span></code> Python helper function ensures that this is performed correctly.
Note that the Python interpreter executes commands in the order they appear in
the input file, so if the last four commands in the above example were to read</p>
<div class="highlight-python"><div class="highlight"><pre>set basis cc-pVDZ
energy(&#39;ccsd&#39;)
set ccenergy print 3
set scf print 1
</pre></div>
</div>
<p>the commands that set the print level would be ineffective, as they would be
processed after the CCSD computation completes.</p>
</div>
<div class="section" id="basis-sets">
<h2>Basis Sets<a class="headerlink" href="#basis-sets" title="Permalink to this headline"></a></h2>
<div class="toctree-wrapper compound">
<ul>
<li class="toctree-l1"><a class="reference internal" href="basissets.html">Basis Sets</a><ul>
<li class="toctree-l2"><a class="reference internal" href="basissets.html#built-in-basis-sets">Built-In Basis Sets</a></li>
<li class="toctree-l2"><a class="reference internal" href="basissets.html#mixing-basis-sets">Mixing Basis Sets</a></li>
<li class="toctree-l2"><a class="reference internal" href="basissets.html#user-defined-basis-sets">User-Defined Basis Sets</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="section" id="psi-variables-return-values">
<span id="sec-psivariables"></span><h2>PSI Variables &amp; Return Values<a class="headerlink" href="#psi-variables-return-values" title="Permalink to this headline"></a></h2>
<p>To harness the power of Python, <span class="sc">Psi4</span> makes the most pertinent results
of each computation available to the Python interpreter for
post-processing. To demonstrate, we can embellish the previous example of
H<sub>2</sub> and H atom:</p>
<div class="highlight-python"><div class="highlight"><pre>molecule h2 {
  H
  H 1 0.9
}

set basis cc-pvdz
set reference rhf
h2_energy = energy(&#39;scf&#39;)

molecule h {
  H
}

set basis cc-pvdz
set reference uhf
h_energy = energy(&#39;scf&#39;)

D_e = psi_hartree2kcalmol * (2*h_energy - h2_energy)
print &quot;De=%f&quot; % D_e
</pre></div>
</div>
<p>The <a class="reference internal" href="energy.html#driver.energy" title="driver.energy"><code class="xref py py-func docutils literal"><span class="pre">energy()</span></code></a> function returns the final result of the
computation, the requested total energy in Hartrees, which we assign to a
Python variable. The two energies are then converted to a dissociation
energy and printed to the output file using standard Python notation.</p>
<p>Generally, there are multiple quantities of interest. Appendix
<a class="reference internal" href="autodoc_psivariables_bymodule.html#apdx-psivariables-module"><span>PSI Variables by Module</span></a> lists PSI variables variables set by each
module, and <a class="reference internal" href="glossary_psivariables.html#apdx-psivariables-alpha"><span>PSI Variables by Alpha</span></a> defines them.  These can be
accessed through the <code class="docutils literal"><span class="pre">get_variable()</span></code> function.  For example, after
performing a density fitted MP2 computation, both the spin component
scaled energy and the unscaled MP2 energy are made available:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">e_mp2</span> <span class="o">=</span> <span class="n">get_variable</span><span class="p">(</span><span class="s">&#39;MP2 TOTAL ENERGY&#39;</span><span class="p">)</span>
<span class="n">e_scs_mp2</span> <span class="o">=</span> <span class="n">get_variable</span><span class="p">(</span><span class="s">&#39;SCS-MP2 TOTAL ENERGY&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>Each module and the Python driver set PSI variables over the course of a
calculation.  The values for all can be printed in the output file with
the input file command <code class="docutils literal"><span class="pre">print_variables()</span></code>. Note that PSI variables
accumulate over a <span class="sc">Psi4</span> instance unless cleared by <code class="docutils literal"><span class="pre">clean_variables()</span></code>.
So if you run in a single input file a STO-3G FCI followed by a
aug-cc-pVQZ SCF followed by a <code class="docutils literal"><span class="pre">print_variables()</span></code> command, the last will
include both <a class="reference internal" href="glossary_psivariables.html#psivar-SCFTOTALENERGY"><code class="xref std std-psivar docutils literal"><span class="pre">SCF</span> <span class="pre">TOTAL</span> <span class="pre">ENERGY</span></code></a> and <a class="reference internal" href="glossary_psivariables.html#psivar-FCITOTALENERGY"><code class="xref std std-psivar docutils literal"><span class="pre">FCI</span>
<span class="pre">TOTAL</span> <span class="pre">ENERGY</span></code></a>. Don&#8217;t get excited that you got a
high-quality calculation cheaply.</p>
<p>Most of the usual user computation functions (<em>i.e.</em>,
<a class="reference internal" href="energy.html#driver.energy" title="driver.energy"><code class="xref py py-func docutils literal"><span class="pre">energy()</span></code></a>, <a class="reference internal" href="opt.html#driver.optimize" title="driver.optimize"><code class="xref py py-func docutils literal"><span class="pre">optimize()</span></code></a>, and
<a class="reference internal" href="freq.html#driver.frequency" title="driver.frequency"><code class="xref py py-func docutils literal"><span class="pre">frequency()</span></code></a>) return simply the current total energy.
Consult the descriptions of other functions in <a class="reference internal" href="psithonfunc.html#sec-psithonfunc"><span>Psithon Functions: Invoking a Calculation</span></a> for
what quantities they return and for what data structures they make
available for post-processing.</p>
</div>
<div class="section" id="loops">
<span id="sec-loops"></span><h2>Loops<a class="headerlink" href="#loops" title="Permalink to this headline"></a></h2>
<p>Python provides many control structures, any of which can be used within <span class="sc">Psi4</span>
input files. For example, to loop over three basis sets, the following code can
be used:</p>
<div class="highlight-python"><div class="highlight"><pre>basis_sets = [&quot;cc-pVDZ&quot;, &quot;cc-pVTZ&quot;, &quot;cc-pVQZ&quot;]
for basis_set in basis_sets:
    set basis = $basis_set
    energy(&#39;scf&#39;)
</pre></div>
</div>
<p>The declaration of <code class="docutils literal"><span class="pre">basis_sets</span></code> is completely standard Python, as is the next
line, which iterates over the list. However, because the Psithon preprocessor
wraps strings in quotes by default, we have to tell it that <code class="docutils literal"><span class="pre">basis_set</span></code> is a
Python variable, not a string, by prefixing it with a dollar sign.</p>
<p>The geometry specification supports delayed initialization of variable,
which permits potential energy scans. As an example, we can scan both the
angle and bond length in water:</p>
<div class="highlight-python"><div class="highlight"><pre>molecule h2o{
  O
  H 1 R
  H 1 R 2 A
}

Rvals = [0.9, 1.0, 1.1]
Avals = range(102, 106, 2)

set basis cc-pvdz
set scf e_convergence=11
for R in Rvals:
    h2o.R = R
    for A in Avals:
        h2o.A = A
        energy(&#39;scf&#39;)
</pre></div>
</div>
<p>The declarations of <code class="docutils literal"><span class="pre">Rvals</span></code> and <code class="docutils literal"><span class="pre">Avals</span></code> are both completely standard Python syntax.
Having named our molecule <code class="docutils literal"><span class="pre">h2o</span></code> we can then set the values of <code class="docutils literal"><span class="pre">R</span></code> and <code class="docutils literal"><span class="pre">A</span></code> within
the loops. Note that we do not need the dollar sign to access the Python
variable in this example; that is required only when using Python variables
with the <code class="docutils literal"><span class="pre">set</span></code> keyword.</p>
<p>Cartesian geometries, because of details of the geometry update process,
need to be specified within the loop(s) along with their basis set when
geometry scans are performed. See <a class="reference external" href="https://github.com/psi4/psi4public/blob/master/samples/scf4/input.dat">scf4</a> for analogous Z-matrix
and Cartiesian scans.</p>
</div>
<div class="section" id="tables-of-results">
<span id="sec-resultstables"></span><h2>Tables of Results<a class="headerlink" href="#tables-of-results" title="Permalink to this headline"></a></h2>
<p>The results of computations can be compactly tabulated with the <code class="xref py py-func docutils literal"><span class="pre">Table()</span></code> Psithon
function. For example, in the following potential energy surface scan for water</p>
<div class="highlight-python"><div class="highlight"><pre>molecule h2o {
  O
  H 1 R
  H 1 R 2 A
}

Rvals=[0.9,1.0,1.1]
Avals=range(100,102,2)

table=Table(rows=[&quot;R&quot;,&quot;A&quot;], cols=[&quot;E(SCF)&quot;,&quot;E(SCS)&quot;,&quot;E(DFMP2)&quot;])

set basis cc-pvdz

for R in Rvals:
    h2o.R = R
    for A in Avals:
        h2o.A = A
        energy(&#39;df-mp2&#39;)
        escf = get_variable(&#39;SCF TOTAL ENERGY&#39;)
        edfmp2 = get_variable(&#39;DF-MP2 TOTAL ENERGY&#39;)
        escsmp2 = get_variable(&#39;SCS-DF-MP2 TOTAL ENERGY&#39;)
        table[R][A] = [escf, escsmp2, edfmp2]

print table
relative=table.copy()
relative.absolute_to_relative()
print relative
</pre></div>
</div>
<p>we first define a table (on line 10) with two row indices and three column
indices. As the potential energy scan is performed, the results are stored
(line 22) and the final table is printed to the output file (line 24). The
table is converted from absolute energies to relative energies (in kcal mol<sup>-1</sup>)
on line 26, before being printed again. The relative energies are reported with
respect to the lowest value in each column. More examples of how to control the
formatting of the tables can be found in the sample input files provided; see
Appendix <a class="reference internal" href="testsuite.html#apdx-testsuite"><span>Test Suite and Sample Inputs</span></a> for a complete listing.</p>
</div>
<div class="section" id="python-wrappers">
<span id="sec-wrappers"></span><h2>Python Wrappers<a class="headerlink" href="#python-wrappers" title="Permalink to this headline"></a></h2>
<p>The Python foundations of the <span class="sc">Psi4</span> driver and Psithon syntax permit
many commonly performed post-processing procedures to be integrated into
the <span class="sc">Psi4</span> suite.</p>
<p>As seen in the neon dimer example from the <a class="reference internal" href="tutorial.html#sec-tutorial"><span>A Psi4 Tutorial</span></a> section,
the <a class="reference internal" href="cp.html#wrappers.cp" title="wrappers.cp"><code class="xref py py-func docutils literal"><span class="pre">cp()</span></code></a> wrapper provides automatic computation of
counterpoise-corrected interaction energies between two molecules.  For
example,:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">cp</span><span class="p">(</span><span class="s">&#39;df-mp2&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>will compute the counterpoise-corrected density-fitted MP2 interaction energy
between two molecules.</p>
<p><span class="sc">Psi4</span> also provides the <a class="reference internal" href="cbs.html#wrappers.complete_basis_set" title="wrappers.complete_basis_set"><code class="xref py py-func docutils literal"><span class="pre">complete_basis_set()</span></code></a> wrapper,
which automatically computes a complete-basis-set extrapolation (and
automatically sets up the computations with different basis sets required to
do the extrapolation).  For example,:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">cbs</span><span class="p">(</span><span class="s">&#39;mp2&#39;</span><span class="p">,</span> <span class="n">corl_basis</span><span class="o">=</span><span class="s">&#39;cc-pv[dt]z&#39;</span><span class="p">,</span> <span class="n">corl_scheme</span><span class="o">=</span><span class="n">corl_xtpl_helgaker_2</span><span class="p">)</span>
</pre></div>
</div>
<p>will compute a 2-point Helgaker extrapolation of the correlation energy
using the cc-pVDZ and cc-pVTZ basis sets (with method MP2), and add this
extrapolated correlation energy to the Hartree&#8211;Fock energy in the
largest basis (cc-pVTZ).</p>
<p>Another very useful and powerful feature of <span class="sc">Psi4</span> is the ability
to compute results on entire databases of molecules at a time,
as provided by the <a class="reference internal" href="db.html#wrappers.database" title="wrappers.database"><code class="xref py py-func docutils literal"><span class="pre">database()</span></code></a> wrapper.  For example,:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="n">database</span><span class="p">(</span><span class="s">&#39;df-mp2&#39;</span><span class="p">,</span><span class="s">&#39;S22&#39;</span><span class="p">,</span><span class="n">cp</span><span class="o">=</span><span class="mi">1</span><span class="p">,</span><span class="n">benchmark</span><span class="o">=</span><span class="s">&#39;S22B&#39;</span><span class="p">)</span>
</pre></div>
</div>
<p>will perform DF-MP2 counterpoise-corrected interaction energies
(<code class="docutils literal"><span class="pre">cp=1</span></code>) on all members of Hobza&#8217;s S22 database set of van der Waals
dimers, and then compare the results against the S22B benchmark energies.
Built-in databases include S22, A24, HTBH, HBC6, HSG, S22by5, S66, JSCH,
NCB31, S66by8, and NBC10, among others.</p>
<p>These wrapper functions are discussed separately in
<a class="reference internal" href="psithonfunc.html#sec-psithonfunc"><span>Psithon Functions: Invoking a Calculation</span></a>.  Note that the options documented for Python
functions are placed as arguments in the command that calls the function,
not in the <code class="docutils literal"><span class="pre">set</span> <span class="pre">{...}</span></code> block or with any other <code class="docutils literal"><span class="pre">set</span></code> command.</p>
<style type="text/css"><!--
 .green {color: red;}
 .sc {font-variant: small-caps;}
 --></style></div>
</div>


          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="index.html">Table Of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">Psithon: Structuring an Input File</a><ul>
<li><a class="reference internal" href="#physical-constants">Physical Constants</a></li>
<li><a class="reference internal" href="#memory-specification">Memory Specification</a></li>
<li><a class="reference internal" href="#molecule-and-geometry-specification">Molecule and Geometry Specification</a></li>
<li><a class="reference internal" href="#job-control-keywords">Job Control Keywords</a></li>
<li><a class="reference internal" href="#basis-sets">Basis Sets</a></li>
<li><a class="reference internal" href="#psi-variables-return-values">PSI Variables &amp; Return Values</a></li>
<li><a class="reference internal" href="#loops">Loops</a></li>
<li><a class="reference internal" href="#tables-of-results">Tables of Results</a></li>
<li><a class="reference internal" href="#python-wrappers">Python Wrappers</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="tutorial.html"
                        title="previous chapter">A <span class="sc">Psi4</span> Tutorial</a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="psithonmol.html"
                        title="next chapter">Molecule and Geometry Specification</a></p>
  <div role="note" aria-label="source link">
    <h3>This Page</h3>
    <ul class="this-page-menu">
      <li><a href="_sources/psithoninput.txt"
            rel="nofollow">Show Source</a></li>
    </ul>
   </div>
<div id="searchbox" style="display: none" role="search">
  <h3>Quick search</h3>
    <form class="search" action="search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>
    <p class="searchtip" style="font-size: 90%">
    Enter search terms or a module, class or function name.
    </p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="relbar-bottom">
        
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="py-modindex.html" title="Python Module Index"
             >modules</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="contents.html" title="Table Of Contents"
             >toc</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="psithonmol.html" title="Molecule and Geometry Specification"
             >next</a> &nbsp; &nbsp;</li>
        <li class="right" >
          <a href="tutorial.html" title="A Psi4 Tutorial"
             >previous</a> &nbsp; &nbsp;</li>
    <li><a href="index.html">Psi4 []</a> &raquo; </li>
 
      </ul>
    </div>
    </div>

    <div class="footer" role="contentinfo">
        &copy; Copyright 2015, The Psi4 Project.
      Last updated on Tuesday, 12 January 2016 03:10PM.
      Created using <a href="http://sphinx-doc.org/">Sphinx</a> 1.3.3.
    </div>
    <!-- cloud_sptheme 1.3 -->
  </body>
</html>