10 Tutorial
Anthony Scemama edited this page 2017-12-18 12:18:08 +01:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

In this tutorial, we will run a CIPSI calculation on the HCN molecule in two basis sets. Before using the quantum package, you need to load the needed environment variables by sourcing the $QP_ROOT/quantum_package.rc file. For example::

source $HOME/quantum_package/quantum_package.rc

Ensure all required binaries are compiled

This command will compile everything and install the Hartree-Fock and Full-CI module

  cd $QP_ROOT
  qp_module.py install Full_CI_ZMQ
  ninja

Create the EZFIO input file

The EZFIO is a hierarchical data format which uses the hierarchy of the file system to organize the data. The EZFIO file is a database which will contain the input and output data. To access the data in the EZFIO file, you can use the provided API, or tools such as qp_edit, or even look at the files present in the directories.

First, create an xyz file containing the coordinates of the molecule. The file hcn.xyz contains:

 3
 HCN molecule
 C    0.0    0.0    0.0
 H    0.0    0.0    1.064
 N    0.0    0.0    -1.156

Note that you can also input the coordinates using a Z-matrix:

 c
 n   1 nc2
 h   1 hc3         2 hcn3

nc2         1.156
hc3         1.064
hcn3        180.0

Now, this xyz file is used to generate an EZFIO input directory using the qp_create_ezfio_from_xyz command. The main options of that command are

  -b string      Name of basis set.
  [-au]          Input geometry is in atomic units.
  [-c int]       Total charge of the molecule. Default is 0.
  [-cart]        Compute AOs in the Cartesian basis set (6d, 10f, ...)
  [-d float]     Add dummy atoms. x * (covalent radii of the atoms)
  [-m int]       Spin multiplicity (2S+1) of the molecule. Default is 1.
  [-o file]      Name of the created EZFIO file.
  [-p string]    Name of the pseudopotential

To generate hcn.ezfio in the 6-31G basis set, we use::

qp_create_ezfio_from_xyz -b "6-31G" hcn.xyz

With the qp_edit command, you can edit interactively the EZFIO file with all the options available for all the binaries installed.

Run the SCF and Full-CI calculations

First, create the canonical MOs by running an SCF calculation::

  qp_run SCF hcn.ezfio

The expected SCF energy is -92.8278567 au.

In the selected FCI calculation, by default the program will stop when the 1.000.000 most important determinants are selected, or when the PT2 correction is below 1.e-4. To make a quick test, we want to stop for 10.000 determinants. To change this behavior, edit hcn.ezfio to modify the options of the selected Full-CI calculation::

  qp_edit hcn.ezfio

This will open a temporary file enabling the modification of the EZFIO directory. Search for the Determinants section, and set the n_det_max option to 10000::

  n_det_max = 10000

Now we can run the Full-CI calculation. Type

  qp_run fci_zmq hcn.ezfio

The variational energy should be -93.044945 and the Full-CI approximate energy should be -93.052019.

Freeze core electrons in the CI

We will enlarge the basis set to cc-pvdz and freeze the core orbitals in the CI calculation.

First create the new EZFIO with the relevant basis-set qp_create_ezfio_from_xyz -b "cc-pvdz" hcn.xyz -o hcn_large.ezfio

Then run the SCF

  qp_run SCF hcn_large.ezfio

The expected SCF energy is -92.8829467.

We want to run the selected Full-CI calculation in the valence only. For this, we will use the qp_set_mo_class utility. The options are

-act range     Range of active orbitals
-core range    Range of core orbitals
-del range     Range of deleted orbitals
-inact range   Range of inactive orbitals
-virt range    Range of virtual orbitals

We set 2 first canonical orbitals as core and all the remaining MOs are set as active ::

  qp_set_mo_class hcn_large.ezfio -core "[1,2]" -act "[3-33]"

or we can do it automatically:

  qp_set_frozen_core.py hcn_large.ezfio

The qp_set_frozen_core.py script finds the heavy atoms and proposes a set of core and active MOs. For atoms with few electrons in the valence such as Li or Na, the script will propose a small core.

Then, edit hcn_large.ezfio to modify the options of the selected Full-CI calculation::

  qp_edit hcn_large.ezfio

This will open a temporary file enabling the modification of the EZFIO directory. Search for the Determinants section, and set the n_det_max option to 10000::

  n_det_max = 10000

And run the Full-CI calculation::

  qp_run fci_zmq hcn_large.ezfio

The expected variational energy is -93.16482111.

From the current wave function, we can generate the corresponding natural orbitals::

  qp_run save_natorb hcn_large.ezfio

and run the selected FCI calculation again. The expected variational energy is -93.172895441 and the energy + the PT2 contribution is -93.19059084.