10. Interfaces to psi4 and pyscf

CheMPS2 is currently interfaced with two ab initio quantum chemistry packages:

  1. The dmrgscf plugin to psi4 allows to perform DMRG-CI and DMRG-SCF calculations with CheMPS2, by using psi4 input files. Since April 2015, CheMPS2 is also an integral part of psi4.
  2. There are also DMRG-CI and DMRG-SCF interfaces between pyscf and CheMPS2.

10.1. psi4 dmrgscf plugin

DMRG-CI and DMRG-SCF calculations can be performed directly with psi4. The plugin has been tested on commit 14c78eabdca86f8e094576890518d93d300d2500 (February 27, 2015) on https://github.com/psi4/psi4public, and should work on later versions as well.

To perform DMRG-CI and DMRG-SCF calculations, build psi4 with the plugin option, and then run:

$ cd /mypsi4plugins
$ psi4 --new-plugin dmrgscf
$ cd dmrgscf

Now, replace the file dmrgscf.cc with /sourcefolder/chemps2/integrals/psi4plugins/dmrgscf.cc. To compile the plugin, the Makefile should be adjusted. Change the line

PSIPLUGIN = -L$(OBJDIR)/lib -lplugin

to

PSIPLUGIN = -L$(OBJDIR)/lib -lplugin -lchemps2

Remember to add the library and include paths to the Makefile as well, if libchemps2 is not installed in a standard location. To compile the plugin, run:

$ make

An example input file to perform a DMRG-SCF calculation with the dmrgscf plugin:

molecule O2 {
  O       0.0   0.0   0.0
  O       0.0   0.0   3.0 
units au
}

plugin_load("dmrgscf/dmrgscf.so")

set basis     cc-pVDZ
set reference rhf

set dmrgscf wfn_irrep            0
set dmrgscf wfn_multp            1
set dmrgscf frozen_docc          [ 1 , 0 , 0 , 0 , 0 , 1 , 0 , 0 ]
set dmrgscf active               [ 2 , 0 , 2 , 2 , 0 , 2 , 2 , 2 ]

set dmrgscf dmrg_states          [   500,  1000,  1000 ]
set dmrgscf dmrg_econv           [ 1e-10, 1e-10, 1e-10 ]
set dmrgscf dmrg_maxsweeps       [     5,     5,    10 ]
set dmrgscf dmrg_noiseprefactors [  0.05,  0.05,   0.0 ]
set dmrgscf dmrg_print_corr      false
set dmrgscf mps_chkpt            false

set dmrgscf dmrgscf_convergence  1e-6
set dmrgscf dmrgscf_store_unit   true
set dmrgscf dmrgscf_do_diis      true
set dmrgscf dmrgscf_diis_branch  1e-2
set dmrgscf dmrgscf_store_diis   true

set dmrgscf dmrgscf_max_iter     100
set dmrgscf dmrgscf_which_root   2   # First excited state
set dmrgscf dmrgscf_state_avg    true
set dmrgscf dmrgscf_active_space NO  # INPUT; NO; LOC
set dmrgscf dmrgscf_loc_random   false

scf()

plugin("dmrgscf.so")

This file (O2.dmrgscf.in) should be placed in the folder /mypsi4plugins. The DMRG-SCF calculation can then be started with:

$ cd /mypsi4plugins
$ psi4 O2.dmrgscf.in O2.dmrgscf.out

An example input file to perform a DMRG-CI calculation with the dmrgscf plugin:

molecule H2O {
 0 1
   O   0.000000000   0.00   0.000000000
   H   0.790689766   0.00   0.612217330
   H  -0.790689766   0.00   0.612217330
 units angstrom
}

plugin_load("dmrgscf/dmrgscf.so")

set basis          cc-pVDZ
set reference      rhf
set e_convergence  1e-13
set d_convergence  1e-13
set ints_tolerance 0.0

set dmrgscf wfn_irrep            0
set dmrgscf wfn_multp            1
set dmrgscf frozen_docc          [ 1 , 0 , 0 , 0 ]
set dmrgscf active               [ 5 , 0 , 4 , 2 ]

set dmrgscf dmrg_states          [  200,  500, 1000, 1000 ]
set dmrgscf dmrg_econv           [ 1e-8, 1e-8, 1e-8, 1e-8 ]
set dmrgscf dmrg_maxsweeps       [    5,    5,    5,  100 ]
set dmrgscf dmrg_noiseprefactors [ 0.03, 0.03, 0.03,  0.0 ]
set dmrgscf dmrg_print_corr      false
set dmrgscf mps_chkpt            false

set dmrgscf dmrgscf_max_iter     1

scf()

plugin("dmrgscf.so")

Note that the option dmrgscf_max_iter has been set to 1, so that only one active space calculation is performed. This file (H2O.dmrgci.in) should be placed in the folder /mypsi4plugins. The DMRG-CI calculation can then be started with:

$ cd /mypsi4plugins
$ psi4 H2O.dmrgci.in H2O.dmrgci.out

Since April 2015, CheMPS2 is also an integral part of psi4. Please consult psi4‘s documentation on how to run DMRG-SCF calculations with psi4.

10.2. pyscf

pyscf is a new quantum chemistry package, in which all layers are written or interfaced in python. In the future, the package will be able to perform DMRG-CI and DMRG-SCF calculations using PyCheMPS2: chemps2.py.

Examples of how to extract MO integrals from pyscf to perform DMRG-CI calculations with PyCheMPS2 can be found in:

  1. /sourcefolder/chemps2/integrals/pyscf/example.py
  2. /sourcefolder/chemps2/integrals/pyscf/example2.py
  3. /sourcefolder/chemps2/integrals/pyscf/example3.py
  4. /sourcefolder/chemps2/integrals/pyscf/dmrgci.py
  5. /sourcefolder/chemps2/integrals/pyscf/call_chemps2.py

Please remember to append the correct pyscf and PyCheMPS2 directories to sys.path at the top of these files.