Skip to content
Snippets Groups Projects

Møller–Plesset Correlation Energy Density Generator

This is python code of generating MP2, MP3, and MP4 correlation energy density based on one boby decomposition scheme (https://doi.org/10.1002/qua.22017)

Requirement of python packages:

numpy, scipy, h5py, torch, quadpy, itertools, mmap, tqdm

Optional of python packages:

pycuda, skcuda # if you use GPU for preparing Ajb

Requirement of external packages to run example files:

psi4 # to generate wavefunction and FCIDUMP file
molden2aim # to convert molden format to .WFN

Examples

ch4_200_031

This is to calculate energy density on Carbon and Hydrogen atom of CH4@3-21g with grid settings: Legendre quadrature (200 radial points) and Lebedev quadrature (noted as 031, 350 angular points).

# prepare wavefunction and FCIDUMP files, here we use Psi4 package
# one can also use other packages, e.g. PySCF, OpenMolcas
$ cd examples/ch4_200_031/calcu/
$ psi4 -n 8 -i input.dat -o output.dat

# convert molden format of wavefunction and txt format of FCIDUMP (in Psi 4 is INPDUMP)
# into .npy files
# Note that external package is needed to convert molden to .wfn first, we use molden2aim 
# (https://github.com/zorkzou/Molden2AIM) for example.
$ cd ../prep/
$ chmod +x mlcorr_prep.sh
$ ./mlcorr_prep.sh ch4

# calculate MP2 MP3 MP4 energy density
$ cd ../eneden/
$ chmod +x eneden.sh
$ ./eneden.sh ch4 # Here STDOUT will give the values of summing up of the energy density on each atom,
                # which should equals to MPn correlation energy

# calculate reference value:
$ cd ../ref/
$ psi4 -n 8 -i input.dat -o output.dat # you can find reference MP2, MP3, and MP4
                                     # correlation energy in output.dat

Results: contribution for each atom (Atomic Contribution)

PT2: 
C: -0.0713488682277866
H: -0.0072268498366822
PT3:
C: -0.0056150246921240
H: -0.0019143657456038
PT4:
C: -0.0031286420616285
H: -0.0005634905197682

Combine:
MP2: -0.1002562675745154
MP3: -0.1135287552490546
MP4(SDTQ): -0.1189113593897559

Compare with reference correlation energy:
MP2: -0.099901794206
MP3: -0.113086192916
MP4(SDTQ): -0.118437326291

~0.5 mH deviation is due to the integration issue. One can decrease by further increase the density of quadratures, or redistribute the deviation to each atom.

ch4_50_011

This is to calculate energy density on Carbon and Hydrogen atom of CH4@3-21g with grid settings: Legendre quadrature (50 radial points) and Lebedev quadrature (noted as 011, 50 angular points). Note that this example settings is not recommended for calculation

# First you need to modify:
codes/prep/Becke_grid.py:
qd.line_segment.gauss_legendre(200) -> qd.line_segment.gauss_legendre(50)
qd.sphere.lebedev_031() -> qd.sphere.lebedev_011()

# Others same with ch4_200_031

Results: contribution for each atom (Atomic Contribution)

PT2: 
C: -0.0731792208782222
H: -0.0073744070379437
PT3:
C: -0.0059725794473153
H: -0.0019610653069297
PT4:
C: -0.0032755188689802
H: -0.0005762340521139

Combine:
MP2: -0.102676849029997
MP3: -0.116493689705031
MP4(SDTQ): -0.1220741447824669

Compare with reference correlation energy:
MP2: -0.099901794206
MP3: -0.113086192916
MP4(SDTQ): -0.118437326291

~3.5 mH deviation is too large, so this setting is not recommended.

h2

This is to calculate energy density on Hydrogen atom of H2@cc-pvdz with grid settings: Legendre quadrature (200 radial points) and Lebedev quadrature (noted as 031, 350 angular points).

# prepare wavefunction and FCIDUMP files, here we use Psi4 package
# one can also use other packages, e.g. PySCF, OpenMolcas
$ cd examples/h2/calcu/
$ psi4 -n 8 -i input.dat -o output.dat

# convert molden format of wavefunction and txt format of FCIDUMP (in Psi 4 is INPDUMP)
# into .npy files
# Note that external package is needed to convert molden to .wfn first, we use molden2aim 
# (https://github.com/zorkzou/Molden2AIM) for example.
$ cd ../prep/
$ chmod +x mlcorr_prep.sh
$ ./mlcorr_prep.sh h2

# calculate MP2 MP3 MP4 energy density
$ cd ../eneden/
$ chmod +x eneden.sh
$ ./eneden.sh h2 # Here STDOUT will give the values of summing up of the energy density on each atom,
                 # which should equals to MPn correlation energy

# calculate reference value:
$ cd ../ref/
$ psi4 -n 8 -i input.dat -o output.dat # you can find reference MP2, MP3, and MP4
                                       # correlation energy in output.dat

Results: contribution for each atom (Atomic Contribution)

PT2: 
H: -0.0132622797812593
PT3:
H: -0.0031027482505314
PT4:
H: -0.0007878420821888

Combine:
MP2: -0.0265245595625186
MP3: -0.0327300560635814
MP4(SDTQ): -0.034305740227959

Compare with reference correlation energy:
MP2: -0.026443871885
MP3: -0.032632881103
MP4(SDTQ): -0.034205101033

~0.1 mH deviation.