Trace:

exercises:2017_uzh_cp2k-tutorial:wfc

This shows you the differences between two versions of the page.

Both sides previous revision Previous revision Next revision | Previous revision Next revision Both sides next revision | ||

exercises:2017_uzh_cp2k-tutorial:wfc [2017/06/28 14:23] vrybkin |
exercises:2017_uzh_cp2k-tutorial:wfc [2017/07/07 15:02] vrybkin [1. Task: Benzene dimer MP2 binding energy] |
||
---|---|---|---|

Line 1: | Line 1: | ||

- | In order to go beyond GGA and hybrid DFT, one option is to use wave function correlation methods. Recently, second-order Møller-Plesset perturbation theory (MP2) and random phase approximation (RPA) have been added to CP2K [[doi>10.1016/j.cpc.2014.10.021]], [[doi>10.1021/ct4002202]], [[doi>10.1021/ct300531w]]. The implementations are aimed at condensed phase calculations (see e.g. [[doi>10.1021/jz401931f]] and [[doi>10.1021/jz501985w]]), and in the case of MP2 provides energies, forces and stress (see [[doi>10.1063/1.4919238]] and [[doi>10.1021/acs.jctc.6b00015]]), and electron (spin) densities at O(N^5) cost, while RPA provides energies at O(N^4) or O(N^3) cost. | + | In order to go beyond GGA and hybrid DFT, one option is to use wave function correlation methods. Recently, second-order Møller-Plesset perturbation theory (MP2) and random phase approximation (RPA) have been added to CP2K . The implementations are aimed at condensed phase calculations, and in the case of MP2 provides energies, forces and stress, as well as electron (spin) densities at O(N^5) cost, while RPA provides energies at O(N^4) or O(N^3) cost. |

- | However, significant computational resources are needed for the condensed phase calculations. Therefore, we will perform the gas phase calculations in this tutorial, even though RI-GPW is not very efficient in this case. | + | However, significant computational resources are needed for the condensed phase calculations (for the overview see the corresponding lecture). Therefore, we will perform the gas phase calculations in this tutorial, even though RI-GPW is not very efficient in this case. |

+ | | ||

+ | **Some references:** | ||

+ | | ||

+ | MP2 and RPA energies implementations in CP2K:[[doi>10.1016/j.cpc.2014.10.021]], [[doi>10.1021/ct4002202]], [[doi>10.1021/ct300531w]] | ||

+ | | ||

+ | MP2 forces: [[doi>10.1063/1.4919238]] and [[doi>10.1021/acs.jctc.6b00015]] | ||

+ | | ||

+ | Cubic scaling RPA implementation: [[doi>10.1021/acs.jctc.6b00840]] | ||

+ | | ||

+ | **Since the correlated wave function calculations are expensive, please use 4 cores for execution (with one OMP thread):** | ||

+ | <code> | ||

+ | mpirun -np 4 -x OMP_NUM_THREADS=1 cp2k.psmp -i input -o output | ||

+ | </code> | ||

===== 1. Task: Benzene dimer MP2 binding energy ===== | ===== 1. Task: Benzene dimer MP2 binding energy ===== | ||

- | Employ the provided input file to compute the benzene dimer binding energy. The provided dimer geometry is optimized already. To obtain the energy of the monomer, geometry optimization is necessary (or else is not). Perform a few optimization steps to see how much the energy changes and to calculate electron density (saved as .cube files) at the MP2 level. | + | Employ the provided input file to compute the benzene dimer binding energy. The provided dimer geometry is optimized already. To obtain the energy of the monomer, geometry optimization is in principle necessary, although the geometry of a benzene monomer must be close to the one in the dimer. This can be done by removing one of the benzene molecules editing the coordinates in the input. Perform a few optimization steps to see how much the energy changes and to calculate electron density (saved as .cube files) at the MP2 level. If energy does not change much, this means that the monomer structure is already close to the optimal. Compare the times needed for one geometry optimization step (energy+forces) for a monomer and energy for a dimer, as well as the relative timing for energy and forces evaluation for a monomer. |

+ | | ||

+ | During the optimization of benzene, one will calculate gradient which, in turn, requires density matrices. Hence, one can calculate electronic densities. Add the following to the ''&GLOBAL'' section: | ||

+ | <code> | ||

+ | &PRINT MEDIUM | ||

+ | &END | ||

+ | </code> | ||

+ | and the following lines to the ''&DFT'' section | ||

+ | <code> | ||

+ | &PRINT | ||

+ | &E_DENSITY_CUBE MEDIUM | ||

+ | &END | ||

+ | &END | ||

+ | </code> | ||

+ | | ||

+ | Importantly, during the force calculations one will have to solve the coupled-perturbed equations invoking exact exchange calculations. If there is enough memory we can reuse the integrals from the HF calculation by setting the following keyword in the ''&RI_MP2'' section: | ||

+ | <code> | ||

+ | FREE_HFX_BUFFER .FALSE. | ||

+ | </code> | ||

+ | | ||

+ | Perform two optimizations setting ''FREE_HFX_BUFFER'' to ''.TRUE.'' and ''.FALSE.'' Compare the overall timings and especially the times for performing Hartree-Fock exchange calculations: | ||

+ | <code> | ||

+ | integrate_four_center 71 12.3 2.261 4.012 108.805 109.179 | ||

+ | </code> | ||

+ | The last number in the line is the real time of execution. The memory distribution between the RI-MP2 integrals and HFX integrals are tuned by the ''MEMORY'' keyword in the ''&WF_CORRELATION'' section and the ''&MEMORY'' section in the ''&HF'' section: | ||

+ | <code> | ||

+ | &MEMORY | ||

+ | MAX_MEMORY 1800 | ||

+ | &END | ||

+ | | ||

+ | </code> | ||

+ | | ||

+ | At the optimized (or the most optimized) geometry of benzene monomer perform a Hartree-Fock calculation to compare electron densities. Visualize them with VMD. Electron density difference between MP2 and HF looks as follows: | ||

+ | {{ :exercises:2017_uzh_cp2k-tutorial:benzene_diff.png?400 |}} | ||

+ | | ||

+ | | ||

+ | ===== 2. Task: Benzene monomer RPA energy: frequency integration ===== | ||

+ | | ||

+ | RPA is HFX+RPA correlation. It can be performed with HFX orbitals and eigenvalues, but also based on e.g. GGA or hybrid orbitals. Two advantages over MP2 are : 1) scaling is O(N^4) (for RI-dRPA with frequency integration). 2) it is applicable for systems with a small gap. A O(N^3)implementation is also available in CP2K, although with a very large prefactor, which makes it worth using for very large systems. | ||

+ | | ||

+ | Here, we look at the convergence of the RPA energy as a function of the number of integration points (''RPA_NUM_QUAD_POINTS''). Change this parameter in the range 4-16. For large systems the time needed for the calculations is proportional to the number of integration points. | ||

+ | | ||

+ | Use the following section to change to RPA: | ||

+ | | ||

+ | <code> | ||

+ | ! with WF correlation | ||

+ | &WF_CORRELATION | ||

+ | ! use the RI-GPW approach | ||

+ | METHOD RI_RPA_GPW | ||

+ | &WFC_GPW | ||

+ | &END | ||

+ | &RI_RPA | ||

+ | ! number of quadrature points, essential for accurate energies. | ||

+ | ! small gap systems need more points | ||

+ | RPA_NUM_QUAD_POINTS 8 | ||

+ | ! essentially always use minimax | ||

+ | MINIMAX | ||

+ | &HF | ||

+ | FRACTION 1.0000000 | ||

+ | &SCREENING | ||

+ | EPS_SCHWARZ 1.0E-8 | ||

+ | SCREEN_ON_INITIAL_P FALSE | ||

+ | &END SCREENING | ||

+ | &END HF | ||

+ | &END RI_RPA | ||

+ | MEMORY 1800 | ||

+ | NUMBER_PROC 1 | ||

+ | &END | ||

+ | </code> | ||

- | Topics: | + | It is strongly recommended to use the ''MINIMAX'' integration scheme. |

- | * RI approach (''RI_MP2_GPW'' and ''RI_AUX_BASIS_SET'') | + | |

- | * Wavelet solver (''PSOLVER WAVELET'', ''CENTER_COORDINATES'') | + | |

- | * gas phase HFX calculation | + | |

- | * memory issues (''FREE_HFX_BUFFER'') | + | |

====== Required files ====== | ====== Required files ====== | ||

+ | Input files and a wave function restart file can be found in the archive: {{ :exercises:2017_uzh_cp2k-tutorial:mp2_rpa.tar.gz |}} | ||

input file for an RI-MP2 calculation on a benzene dimer | input file for an RI-MP2 calculation on a benzene dimer | ||

Line 156: | Line 234: | ||

&MOTION | &MOTION | ||

&GEO_OPT | &GEO_OPT | ||

- | OPTIMIZER BFGS ! Good choice for 'small' systems (use LBFGS for large systems) | + | OPTIMIZER BFGS ! Good choice for 'small' systems like benzene |

- | MAX_ITER 100 | + | |

MAX_DR [bohr] 0.003 ! adjust target as needed | MAX_DR [bohr] 0.003 ! adjust target as needed | ||

&BFGS | &BFGS | ||

Line 165: | Line 242: | ||

</code> | </code> | ||

- | During the optimization of benzene, one will calculate gradient which, in turn, requires density matrices. Hence, one can calculate electronic densities. Add the following to the ''&GLOBAL'' section: | ||

- | <code> | ||

- | &PRINT MEDIUM | ||

- | &END | ||

- | </code> | ||

- | and the following lines to the ''&DFT'' section | ||

- | <code> | ||

- | |||

- | &E_DENSITY_CUBE MEDIUM | ||

- | &END | ||

- | &END | ||

- | </code> | ||

- | Importantly, during the force calculations one will have to solve the coupled-perturbed equations invoking exact exchange calculations. If there is enough memory we can reuse the integrals from the HF calculation by setting the following keyword in the ''&RI_MP2'' section: | ||

- | <code> | ||

- | FREE_HFX_BUFFER .FALSE. | ||

- | </code> | ||

| |

exercises/2017_uzh_cp2k-tutorial/wfc.txt · Last modified: 2017/07/13 15:44 by vrybkin

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-ShareAlike 4.0 International