QChem: Difference between revisions

From Thom Group Wiki
Jump to navigation Jump to search
(Added NOCI Tutorial)
m (Fixed formatting, other small changes)
Line 1: Line 1:
Q-Chem is a commercial quantum chemistry package available for use in our group.
Q-Chem is a commercial quantum chemistry package available for use in our group.


= Fragment Guesses with multiple bases =
==Fragment Guesses with multiple bases==
To uses basis set projection and fragment guesses you have to run the smaller basis set calculation with fragments first, and then read this into a second calculation which does the projection
To use basis set projection and fragment guesses you have to run the smaller basis set calculation with fragments first, and then read this into a second calculation which does the projection
<pre>$molecule
<code>
$molecule
0 1
0 1
--
--
Line 15: Line 14:
He 10000 0 0
He 10000 0 0
$end
$end

$rem
$rem
JOBTYPE sp
JOBTYPE sp
Line 24: Line 24:
SYM_IGNORE true
SYM_IGNORE true
$end
$end

@@@
@@@

$molecule
$molecule
read
read
$end
$end

$rem
$rem
scf_guess read
scf_guess read
Line 39: Line 42:
SYM_IGNORE true
SYM_IGNORE true
basisprojtype ovprojection
basisprojtype ovprojection
$end
$end</pre>
</code>


==INTDUMP / FCIDUMP ==
==INTDUMP / FCIDUMP ==

To create files in the FCIDUMP format (used e.g. by Hande) create a QChem input file:
To create files in the FCIDUMP format (used e.g. by Hande) create a QChem input file:

<pre>
<pre>
$molecule
$molecule
Line 89: Line 89:


==Troubleshooting SCF Metadynamics Calculations==
==Troubleshooting SCF Metadynamics Calculations==

A full example for SCF Metadynamics can be found at [https://wikis.ch.cam.ac.uk/thom/wiki/index.php/QCMagic QCMagic SymmetryTools Tutorial (Section 7.1)]. This section provides more information on how to choose parameters in different situations.


If a calculation repeatedly converges on the same solution, adjusting one or more of these keywords can help to find different solutions.
If a calculation repeatedly converges on the same solution, adjusting one or more of these keywords can help to find different solutions.

* Increasing <code>SCF_MINFIND_INITNORM</code>, <code>SCF_MINFIND_INITLAMBDA</code> and <code>SCF_MINFIND_INCREASEFACTOR</code> can help get out of the minimum. However, setting <code>SCF_MINFIND_INITLAMBDA</code> too high can result in SCF solutions with very high energies, and <code>SCF_MINFIND_INITNORM</code> can get in the way of convergence, particularly when reading in a solution (in that case, set it to zero).
* Increasing <code>SCF_MINFIND_INITNORM</code>, <code>SCF_MINFIND_INITLAMBDA</code> and <code>SCF_MINFIND_INCREASEFACTOR</code> can help get out of the minimum. However, setting <code>SCF_MINFIND_INITLAMBDA</code> too high can result in SCF solutions with very high energies, and <code>SCF_MINFIND_INITNORM</code> can get in the way of convergence, particularly when reading in a solution (in that case, set it to zero).
* Increasing <code>SCF_MINFIND_RESTARTSTEPS</code> helps if a solution is close to another minima but does not converge before the calculation restarts with new orbitals
* Increasing <code>SCF_MINFIND_RESTARTSTEPS</code> helps if a solution is close to another minima but does not converge before the calculation restarts with new orbitals
* Changing <code>SCF_MINFIND_RANDOMMIXING</code> is generally helpful. +/- 15708 and 31416 are sensible values to try, and 07854 (which corresponds to halfway between swapping the orbitals) can also help.
* Changing <code>SCF_MINFIND_RANDOMMIXING</code> is generally helpful. +/- 15708 and 31416 are sensible values to try, and 07854 (which corresponds to halfway between swapping the orbitals) can also help.



If the resulting solutions are too high in energy,
If the resulting solutions are too high in energy,

Revision as of 21:19, 24 July 2021

Q-Chem is a commercial quantum chemistry package available for use in our group.

Fragment Guesses with multiple bases

To use basis set projection and fragment guesses you have to run the smaller basis set calculation with fragments first, and then read this into a second calculation which does the projection

$molecule
     0 1
  --
  0 1
     H       0.000000    -0.115747     1.133769
     H       0.000000     1.109931    -0.113383
     O       0.000000     0.005817    -0.020386
  --
  0 1
     He      10000   0 0
  $end

  $rem
     JOBTYPE              sp
     EXCHANGE             b3lyp
     BASIS                cc-pVDZ
     scf_guess fragmo
     CORRELATION          none
     SYMMETRY             false
     SYM_IGNORE           true
  $end

  @@@

  $molecule
  read
  $end

  $rem
     scf_guess read
     JOBTYPE              sp
     EXCHANGE             b3lyp
     BASIS                cc-pVTZ
     BASIS2                cc-pVDZ
     CORRELATION          none
     MAX_SCF_CYCLES       600
     SYMMETRY             false
     SYM_IGNORE           true
     basisprojtype ovprojection
  $end

INTDUMP / FCIDUMP

To create files in the FCIDUMP format (used e.g. by Hande) create a QChem input file:

$molecule
0 1
  H 0 0 0
  H 1 0 0
$end

$rem
  correlation idump
  exchange hf
  basis sto-3G
  use_abelian_subgroup true
  scf_guess_print 9999
$end

and use the version of QChem currently (2020-02-20) available from:

[you@liminal] $ export QC=public_o
[you@liminal] $ source ~ajwt3/code/qchem/qcsetup.bash
[you@liminal] $ qchem your-input-file.in

This should produce a file called INTDUMP

 &FCI NORB= 2,NELEC=  2,MS2=  0
  ORBSYM=1,6,
  ISYM=1 UHF=.FALSE.
 &END
     0.62640249948715   1   1   1   1
     0.19679058349422   1   2   1   2
      0.6217067630807   2   2   1   1
     0.19679058349422   2   1   1   2
     0.19679058349422   2   1   2   1
     0.65307074688898   2   2   2   2
     -1.1108441795661   1   1   0   0
    -0.58912100326925   2   2   0   0
    -0.39980670964291   1   0   0   0
     0.37823811728909   2   0   0   0
     0.52917721026434   0   0   0   0

Troubleshooting SCF Metadynamics Calculations

A full example for SCF Metadynamics can be found at QCMagic SymmetryTools Tutorial (Section 7.1). This section provides more information on how to choose parameters in different situations.

If a calculation repeatedly converges on the same solution, adjusting one or more of these keywords can help to find different solutions.

  • Increasing SCF_MINFIND_INITNORM, SCF_MINFIND_INITLAMBDA and SCF_MINFIND_INCREASEFACTOR can help get out of the minimum. However, setting SCF_MINFIND_INITLAMBDA too high can result in SCF solutions with very high energies, and SCF_MINFIND_INITNORM can get in the way of convergence, particularly when reading in a solution (in that case, set it to zero).
  • Increasing SCF_MINFIND_RESTARTSTEPS helps if a solution is close to another minima but does not converge before the calculation restarts with new orbitals
  • Changing SCF_MINFIND_RANDOMMIXING is generally helpful. +/- 15708 and 31416 are sensible values to try, and 07854 (which corresponds to halfway between swapping the orbitals) can also help.

If the resulting solutions are too high in energy,

  • decreasing SCF_MINFIND_INITNORM
  • decreasing SCF_MINFIND_INITLAMBDA
  • decreasing SCF_MINFIND_MIXENERGY (even to 00005)
  • adjusting MOM_START
  • and using SCF_MINFIND_MIXMETHOD 1 or 2

can help to find lower-energy excited states.

NOCI Tutorial

This tutorial includes two possible methods for doing NOCI. The examples below show how to do NOCI at a single geometry, but these methods can easily be extended to cover NOCI at multiple points along a path.

Method #1

In this approach, we find minima using SCF Metadynamics and then do NOCI on them in the same Q-Chem output file. A sample Q-Chem input file for formaldehyde is shown below. In this example, we have Q-Chem generate four initial reference determinants using SCF Metadynamics by selecting NOCI_REGEN 0, NOCI_DETGEN 3, and SCF_SAVEMINIMA 4.

$molecule
0 1
  H   -0.0000000    0.9275885    1.1766889
  C   -0.0000000    0.0000000    0.6019825
  H   -0.0000000   -0.9275885    1.1766889
  O    0.0000000   -0.0000000   -0.6001772
$end

$rem
   EXCHANGE                   HF
   CORRELATION                NOCI
   BASIS		      STO-3G
   UNRESTRICTED               true
   MAX_SCF_CYCLES             1000
   SCF_CONVERGENCE            10
   MOM_START                  1
   SCF_SAVEMINIMA             4
   SCF_MINFIND_INITNORM       05000
   SCF_MINFIND_INITLAMBDA     00300
   SCF_MINFIND_RANDOMMIXING   30000
   SCF_MINFIND_MIXMETHOD      1
   USE_LIBNOCI                true
   NOCI_REFGEN                0
   NOCI_DETGEN                3
   NOCI_NEIGVAL               4
   NOCI_PRINT                 5
$end

We then run

qchem formaldehyde.noci.in formaldehyde.noci.out

and look for the energies of the SCF solutions with

grep “Saving Minimum” formaldehyde.noci.out

which gives

      Saving Minimum 1:    -112.3535105301
      Saving Minimum 2:    -111.9177589859
      Saving Minimum 3:    -111.7116823375
      Saving Minimum 4:    -112.3571993219

Information about the resulting NOCI states is printed at the end of the output file. In this example, the energies and S2 values can be examined with

grep -A5 "NOCI Energy" formaldehyde.noci.out

giving

  NOCI Energy:
            1           2           3           4    
    1  -112.36268  -112.16945  -111.91685  -111.71168
  NOCI <S^2>:
            1           2           3           4    
    1   0.0835515   1.8508569   0.0321459   1.0273785

Method #2

In this method, we use QCMagic to read in SCF Metadynamics states in .sd files into a Q-Chem NOCI calculation.

In this example, we are starting with HF SCF solutions for formaldehyde in four separate .sd files (form.s1.sd, form.s2.sd, form.s3.sd and form.s4.sd) with the following energies:

-112.3535105299      Minimum 1
-111.9177348081      Minimum 2
-111.4909067597      Minimum 3
-111.8200842261      Minimum 4

First, we combine all .sd files for the states at a particular geometry using runcombineSDXC.py, e.g.:

runcombineSDXC.py -i form.s1.sd\
                     form.s2.sd\
                     form.s3.sd\
                     form.s4.sd\
                  -o form_1234 > terminal_sdxc

This creates an .sd file, form_1234.sd, which contains all the minima at that geometry. We then use runrunSDXC.py to apply a template for NOCI and call Q-Chem:

runrunSDXC.py -p 12 -L --template=noci.template form_1234.sd noci_form_1234 > terminal_noci

An example noci.template file for LIBNOCI is shown below:

$molecule
read
$end

$rem
        EXCHANGE                HF
        CORRELATION             NOCI
        UNRESTRICTED            TRUE
        BASIS                   STO-3G
        SCF_SAVEMINIMA          4
        SCF_READMINIMA          -4
        NOCI_PRINT              10
        USE_LIBNOCI             TRUE
        NOCI_REFGEN             1
        NOCI_DETGEN             0
        SKIP_SCFMAN             TRUE
$end

$noci
1 2 3 4
$end

In this template, we specify NOCI_REFGEN 1 and NOCI_DETGEN 0 since we are reading in our reference determinants and do not wish to generate any more. We use the $noci section to specify which states to read in: here, we read in all the states, though we could read in a subset of the states in the .sd file if we wanted to. In this example, we use SKIP_SCFMAN TRUE to avoid reconverging the solutions. If we wanted to reconverge them, we would omit this option and include any missing SCF options in the template.

We can now examine our output file, noci_form_1234.g0.xc0.out. First, we check the energies of the HF states we read in with

grep "Total Energy =" noci_form_1234.g0.xc0.out

which gives

    Total Energy =     -112.3535105266
    Total Energy =     -111.9177347312
    Total Energy =     -111.4909067030
    Total Energy =     -111.8200841138

and examine the energies and S2 values of the NOCI solutions with

grep -A5 "NOCI Energy" noci_form_1234.g0.xc0.out

giving

  NOCI Energy:
            1           2           3           4    
    1  -112.35436  -111.91688  -111.82008  -111.49091
  NOCI <S^2>:
            1           2           3           4    
    1   0.0000000   0.0000000   1.0107832   1.9977364

(N.B. If we compare the NOCI states from method #1 and method #2, we notice that they are different because weused different HF states in both methods. If we had used the same states in both examples, we would get the same NOCI results.)

Further Information

Finding SCF solutions with Metadynamics:

NOCI

  • Q-Chem documentation for NOCI (Section 7.4)
  • Burton H. G. A.; Thom, A. J. W. General Approach for Multireference Ground and Excited States Using Nonorthogonal Configuration Interaction. J Chem. Theory Comput. 2019, 15, 4851.

Keywords for different implementations of NOCI in Q-Chem

  • LIBNOCI (most recent implementation): USE_LIBNOCI TRUE
  • older implementation: USE_LIBNOCI FALSE and GEN_SCFMAN OFF