UP | HOME

Excited states with Quantum Package and CHAMP

Table of Contents

\(\longrightarrow\) \(\longrightarrow\) \(\longrightarrow\)

1 Introduction

We will import a Hartree-Fock wavefunction for the formaldehyde (H2CO) molecule from a TREXIO file into Quantum Package (QP), and run a two-state CIPSI calculation with these orbitals. The wavefunctions for the 2 states will be stored in the TREXIO file, and we will run wave function optimization in CHAMP, followed by a Diffusion Monte Carlo calculation.

The theoretical best estimate of the excitation energy (complete basis set extrapolation from coupled cluster calculations) is 3.97 eV.

2 CIPSI 2-state calculations

You can import the single-determinant wave function from the provided TREXIO file COH2.trexio as:

qp_import_trexio.py COH2.trexio -o COH2
qp set_file COH2

Specify that you want to run a two-state calculation:

qp set determinants n_states 2

Tell QP to stop when the number of determinants is larger than 2000

qp set determinants n_det_max 2000

and run the CIPSI in the Full-CI space:

qp run fci | tee COH2.fci.out

The extrapolated excitation energy is around 8 eV and we expect 4 ev, so we did not catch the correct state. This is because the orbitals in the TREXIO file are symmetry adapted, so it is impossible to make a determinant from another symmetry enter in the determinant space.

To obtain a solution from another symmetry, we need to put at least one determinant of each symmetry.

The simplest practical solution is to first perform a CIS, and then continue with a CIPSI in the FCI space.

By default, at every iteration QP tries to double the size of the wave function. In QMC, we will use a small number of determinants, so we should tell QP to add less determinants at each iteration to have a finer selection.

qp set determinants selection_factor 0.5
qp run cis | tee COH2.cis.out
qp set determinants read_wf true
qp run fci | tee COH2.fci.out

read_wf = true specifies that the wave function stored in the EZFIO database should be used as a starting point for the the CI calculation.

Now, we have obtained a more reasonable excitation energy, around 4 eV. We are now ready to export the data for CHAMP.

3 Export wave functions to CHAMP

The excited states are of different symmetries, so we will generate two different setups in CHAMP, one for each state. To do that, we will save two different files, one for each state, and containing only the non-zero determinants.

First, copy the COH2 directory into COH2_GS and COH2_ES, one directory for each state:

cp -r COH2 COH2_GS
cp -r COH2 COH2_ES

Then, we will use qp_edit to extract one state in each EZFIO directory:

qp set_file COH2_GS
qp edit --state=1

qp set_file COH2_ES
qp edit --state=2

The states have been extracted, but the EZFIO databases still contain the determinants with almost zero coefficients. We can remove them by running

qp set_file COH2_GS
qp run truncate_wf

This last program is interactive and asks for the minimum weight of the kept configurations. Answer 1.d-10 to this question.

Similarly, remove the negligible determinants from the excited state:

qp set_file COH2_ES
qp run truncate_wf

We can now export the wave functions in two different TREXIO files. To do that, for each state we copy the initial TREXIO file and add the determinants information:

cp COH2.trexio COH2_GS.trexio
qp set_file COH2_GS
qp set trexio trexio_file  COH2_GS.trexio
qp run export_trexio
cp COH2.trexio COH2_ES.trexio
qp set_file COH2_ES
qp set trexio trexio_file  COH2_ES.trexio
qp run export_trexio

Now, we are ready to run the QMC calculations for each state.

4 QMC wave function optimizations

In this section, we will optimize a Jastrow factor for each state, and we will the re-optimize the CI coefficients in the presence of the Jastrow. The setup of the CHAMP files is similar to what we have done in section 4.

Here, we have 12 electrons, 6 up and 6 down.

4.1 Optimization of the ground state

Create a new directory, and copy the COH2_GS.trexio TREXIO file inside it. Convert the TREXIO file into CHAMP files:

python3 /lustre/home/filippi/Tutorial-QMC-School/trex2champ.py \
                        --trex          "COH2_GS.trexio" \
                        --motype        "Canonical" \
                        --backend       "HDF5" \
                        --basis_prefix  "BFD-aug-cc-pVDZ" \
                        --lcao \
                        --geom \
                        --basis \
                        --ecp \
                        --sym \
                        --det

H2CO has three different atom types, so the Jastrow factor file will be slightly different from the file for water with one extra line for \(a\) parameters. You can start by creating a file called jastrow.start:

jastrow_parameter   1
  5  5  0           norda,nordb,nordc
   0.60000000   0.00000000     scalek,a21
   0.00000000   0.00000000  0. 0. 0. 0. (a(iparmj),iparmj=1,nparma) ! e-n C
   0.00000000   0.00000000  0. 0. 0. 0. (a(iparmj),iparmj=1,nparma) ! e-n O
   0.00000000   0.00000000  0. 0. 0. 0. (a(iparmj),iparmj=1,nparma) ! e-n H
   0.50000000   1.00000000  0. 0. 0. 0. (b(iparmj),iparmj=1,nparmb)
 (c(iparmj),iparmj=1,nparmc) ! e-e-n C
 (c(iparmj),iparmj=1,nparmc) ! e-e-n O
 (c(iparmj),iparmj=1,nparmc) ! e-e-n H
end

Start by optimizing the Jastrow factor and perform a "quick" optimization. The following champ input file (vmc_quick.inp) contains the parameters for such a "quick" optimization.

%module optwf
    ioptwf        1
    ioptci        0
    ioptjas       1
    ioptorb       0
    method        'sr_n'

    ncore         0
    nextorb       600
    nblk_max      5000

    nopt_iter     10
    sr_tau        0.05
    sr_eps        0.01
    sr_adiag      0.01
%endmodule


%module blocking_vmc
    vmc_nstep     20
    vmc_nblk      20
    vmc_nblkeq    1
    vmc_nconf_new 0
%endmodule

Move the jastrow_optimal.1.iter10 file to jastrow_optimal.rough_GS and load this optimized Jastrow factor. You can now optimize also the CI coefficients together with the Jastrow factor by setting:

ioptci        1

Use some more Monte Carlo steps to perform a more strict optimization.

%module blocking_vmc
    vmc_nstep     20
    vmc_nblk      500
    vmc_nblkeq    1
    vmc_nconf_new 0
%endmodule

In your directory, you will now have jastrow_optimal.1.iterX and det_optimal.1.iterX files.

Set up a DMC calculation where you use the optimal Jastrow and CI coefficients. Adjust the etrial to be a bit below the VMC energy. Recall that you will have to generate the mc_configs file.

Note: You could have also optimized the orbitals but we did not do it here to keep the calculations short. If you are setting optorb=1, load also the symmetry file.

load champ_v2_COH2_GS_symmetry.sym

4.2 Optimization of the excited state

Create a new directory, and copy the COH2_ES.trexio TREXIO file inside it. Apply the same procedure as for the ground state.

Repeat what you have done for the ground state. Start to perform a quick optimization of the Jastrow factor but do not start from zero's: start from the Jastrow factor you have for the ground state, namely, jastrow_optimal.rough_GS.

Do all step until when you obtain the DMC energy.

Compute the VMC and DMC excitation energies. Recall that if your energies are \[ E_{\rm GS}+\delta E_{\rm GS} \text{ and } E_{\rm ES}+\delta E_{\rm ES}, \] where \(\delta E\) is the statistical error, the error on \(\Delta E= E_{\rm ES}-E_{\rm GS}\) is given by \[ \sqrt{\delta E_{\text{GS}}^2+\delta E_{\text{ES}}^2}. \]

Author: Anthony Scemama, Claudia Filippi

Created: 2022-06-21 Tue 15:13

Validate