User Tools

Site Tools


exercises:2017_uzh_cp2k-tutorial:gw

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
exercises:2017_uzh_cp2k-tutorial:gw [2017/07/03 14:50] – [2. Basis set extrapolation] jwilhelmexercises:2017_uzh_cp2k-tutorial:gw [2022/10/31 14:33] (current) oschuett
Line 1: Line 1:
 +<note warning>This text is out of date. Please use [[howto:gw | this howto]] instead.</note>
 +
 ====== GW method for computing electronic levels ====== ====== GW method for computing electronic levels ======
  
-The purpose of this section is to explain how to compute the energy of a molecular orbital from GW for molecules and condensed phase systems with CP2K. In DFT, the energy of a molecular orbital corresponds to an eigenvalue of the Kohn-Sham matrix. In GW, the procedure for getting the level energies is to first perform a DFT calculation (commonly with the PBE or PBE0 functional) to get the molecular orbital wavefunctions and then compute a new GW energy for the molecular orbitals of interest. For an introduction into the concept of GW, please read Sec. II and the introduction to Sec. III in [[doi>10.1103/PhysRevB.87.235132]].+The purpose of this section is to explain how to compute the energy of a molecular orbital from GW for molecules and condensed phase systems with CP2K. In DFT, the energy of a molecular orbital corresponds to an eigenvalue of the Kohn-Sham matrix. In GW, the procedure for getting the level energies is to first perform a DFT calculation (commonly with the PBE or PBE0 functional) to get the molecular orbital wavefunctions and then compute a new GW energy for the molecular orbitals of interest. For an introduction into the concept of GW, please read Sec. II and the introduction to Sec. III in [[doi>10.1103/PhysRevB.87.235132]] [1].
  
-The GW implementation in CP2K is based on the developments described in [[doi>10.1021/acs.jctc.6b00380]] which is very similar to the GW implementation in FHI-aims [[doi>10.1088/1367-2630/14/5/053020]], Fiesta [[doi>10.1103/PhysRevB.83.115103]] and molgw [[doi>10.1016/j.cpc.2016.06.019]]. The computational cost of GW is comparable to RPA and MP2 total energy calculations and therefore high. The computational cost of a canonical GW implementation grows as $N^4$ with the system size $N$, while the memory scales as $N^3$ with the system size. The basis set convergence of GW is slow and therefore has to be carefully examined. +The GW implementation in CP2K is based on the developments described in [[doi>10.1021/acs.jctc.6b00380]] [2] which is very similar to the GW implementation in FHI-aims [[doi>10.1088/1367-2630/14/5/053020]] [3], Fiesta [[doi>10.1103/PhysRevB.83.115103]] [4] and molgw [[doi>10.1016/j.cpc.2016.06.019]] [5]. The computational cost of GW is comparable to RPA and MP2 total energy calculations and therefore high. The computational cost of a canonical GW implementation grows as $N^4$ with the system size $N$, while the memory scales as $N^3$ with the system size. The basis set convergence of GW is slow and therefore has to be carefully examined. 
  
-In this tutorial, GW values from the GW100 benchmark set [[doi>10.1021/acs.jctc.5b00453]] are reproduced (Section 1), the basis set extrapolation is examined for the water molecule (Section 2), an input for large-scale, parallel calculations is given (Section 3), periodic GW calculations are presented [[doi>10.1103/PhysRevB.95.235123]] (Section 4), and cubic-scaling GW calculations are shown which can be more efficient for systems with hundrets of atoms (Section 5).+In this tutorial, GW values from the GW100 benchmark set [[doi>10.1021/acs.jctc.5b00453]] [6] are reproduced (Section 1), the basis set extrapolation is examined for the water molecule (Section 2), an input for large-scale, parallel calculations is given (Section 3), periodic GW calculations are presented [[doi>10.1103/PhysRevB.95.235123]] [7] (Section 4), and cubic-scaling GW calculations are shown which can be more efficient for systems with hundrets of atoms (Section 5).
  
-Since the calculations are rather small, please use a single MPI rank for the calculation+Since the calculations are rather small, please use a single MPI rank for the calculation:
  
 <code> <code>
Line 14: Line 16:
  
 ===== 1. Reproducing values from the GW100 set ===== ===== 1. Reproducing values from the GW100 set =====
-See below the input for a G0W0@PBE calculation of the water molecule in a def2-QZVP basis: A PBE calculation is used for computing the molecular orbitals which can be seen from the keyword "XC_FUNCTIONAL PBE". The input parameters for G0W0 are commented below. While the calculation is running, you can look up the G0W0@PBE value for the highest occupied molecular orbital (HOMO) and the lowest unoccupied molecular orbital (LUMO) in [[doi>10.1021/acs.jctc.5b00453]] [Table 2 and 3 (column AIMS-P16/TM-no RI, molecule index 76) which should be -11.97 eV and 2.37 eV for HOMO and LUMO, respectively]. CP2K should be able to exactly reproduce these values. +See below the input for a G0W0@PBE calculation of the water molecule in a def2-QZVP basis: A PBE calculation is used for computing the molecular orbitals which can be seen from the keyword "XC_FUNCTIONAL PBE". The input parameters for G0W0 are commented below. While the calculation is running, you can look up the G0W0@PBE value for the highest occupied molecular orbital (HOMO) and the lowest unoccupied molecular orbital (LUMO) in [[doi>10.1021/acs.jctc.5b00453]] [6] [Table 2 and 3 (column AIMS-P16/TM-no RI, molecule index 76) which should be -11.97 eV and 2.37 eV for HOMO and LUMO, respectively]. CP2K should be able to exactly reproduce these values. In the output of CP2K, the G0W0@PBE results are listed after the SCF after the headline //GW quasiparticle energies//.  
  
-The G0W0@PBE HOMO value is not in good agreement with the experimental ionization potential of water (12.62 eV). A possible explanation is that PBE may not be a good starting point for G0W0 calculations for molecules in the gas phase, see e.g. [[doi>10.1021/ct300835h]]. For checking the basis set convergence, we refer to a detailed analysis in [[doi>10.1021/acs.jctc.6b00380]] in Fig. 2 for benzene. An extensive table of basis set extrapolated GW levels can be found in [[doi>10.1021/acs.jctc.5b00453]] (column EXTRA). +The G0W0@PBE HOMO value is not in good agreement with the experimental ionization potential of water (12.62 eV). A possible explanation is that PBE may not be a good starting point for G0W0 calculations for molecules in the gas phase, see e.g. [[doi>10.1021/ct300835h]] [8]. For checking the basis set convergence, we refer to a detailed analysis in [[doi>10.1021/acs.jctc.6b00380]] [2] in Fig. 2 for benzene. An extensive table of basis set extrapolated GW levels can be found in [[doi>10.1021/acs.jctc.5b00453]] [6] (column EXTRA). 
-<code>+<code - H2O_GW100.inp>
 &FORCE_EVAL &FORCE_EVAL
   METHOD Quickstep   METHOD Quickstep
Line 125: Line 127:
 To do so, download the cc basis sets {{exercises:2017_uzh_cp2k-tutorial:cc_basis_h2o.tar ?direct&400 |}} which has been taken from the EMSL basis set database. Run the input from Sec. 1 using the cc-DZVP to cc-5ZVP basis set (in total four calculations) by replacing the basis sets: To do so, download the cc basis sets {{exercises:2017_uzh_cp2k-tutorial:cc_basis_h2o.tar ?direct&400 |}} which has been taken from the EMSL basis set database. Run the input from Sec. 1 using the cc-DZVP to cc-5ZVP basis set (in total four calculations) by replacing the basis sets:
 <code> <code>
-    BASIS_SET_FILE_NAME BASIS_def2_QZVP_RI_ALL +BASIS_SET_FILE_NAME BASIS_def2_QZVP_RI_ALL 
-    BASIS_SET_FILE_NAME ./BASIS_H2O+BASIS_SET_FILE_NAME ./BASIS_H2O
 </code> </code>
 <code> <code>
-    &KIND H +&KIND H 
-      BASIS_SET cc-DZVP-all +  BASIS_SET cc-DZVP-all 
-      RI_AUX_BASIS RI-5Z +  RI_AUX_BASIS RI-5Z 
-      POTENTIAL ALL +  POTENTIAL ALL 
-    &END KIND +&END KIND 
-    &KIND O +&KIND O 
-      BASIS_SET cc-DZVP-all +  BASIS_SET cc-DZVP-all 
-      RI_AUX_BASIS RI-5Z +  RI_AUX_BASIS RI-5Z 
-      POTENTIAL ALL +  POTENTIAL ALL 
-    &END KIND +&END KIND
 </code> </code>
  
Line 160: Line 161:
 </code> </code>
  
-For the extrapolation, two schemes have been used as described in the GW100 paper and its supporting information [[doi>10.1021/acs.jctc.5b00453]].  +For the extrapolation, two schemes have been used as described in the GW100 paper and its supporting information [[doi>10.1021/acs.jctc.5b00453]] [6].  
-The first scheme extrapolates versus the inverse cardinal number $N_\text{card}$ of the basis set while the second scheme extrapolates versus the inverse number of basis functions $N_\text{basis}$ which can be computed as sum of the number of occupied orbitals and the number of virtual orbitals as printed in RI_INFO in the output. +The first scheme employs a linear fit on the HOMO or LUMO values when they are plotted against the inverse cardinal number $N_\text{card}$ of the basis set while the second scheme extrapolates versus the inverse number of basis functions $N_\text{basis}$ which can be computed as sum of the number of occupied orbitals and the number of virtual orbitals as printed in RI_INFO in the output. 
 You can check the extrapolation from the table above with your tool of choice. You can check the extrapolation from the table above with your tool of choice.
  
-The basis set extrapolated values from the table above deviate from the values reported in the GW100 paper [[doi>10.1021/acs.jctc.5b00453]], probably because only two basis sets (def2-TZVP, def2-QZVP) have been used in [[doi>10.1021/acs.jctc.5b00453]] for the extrapolation. The extrapolation for the LUMO is not working well because one would need much more diffuse functions to represent unbound electronic levels (with positive energy). +The basis set extrapolated values from the table above deviate from the values reported in the GW100 paper [[doi>10.1021/acs.jctc.5b00453]] [6], probably because only two basis sets (def2-TZVP, def2-QZVP) have been used in [[doi>10.1021/acs.jctc.5b00453]] [6] for the extrapolation. The extrapolation for the LUMO is not working well because one would need much more diffuse functions to represent unbound electronic levels (with positive energy). 
  
-Often, the HOMO-LUMO gap is of interest. In this case, augmented basis sets (e.g. from the EMSL database) can offer an alternative for very fast basis set convergence, see also Fig. 2b in [[doi>10.1021/acs.jctc.6b00380]].+Often, the HOMO-LUMO gap is of interest. In this case, augmented basis sets (e.g. from the EMSL database) can offer an alternative for very fast basis set convergence, see also Fig. 2b in [[doi>10.1021/acs.jctc.6b00380]] [2].
 ===== 3. Input for large-scale calculations ===== ===== 3. Input for large-scale calculations =====
-An exemplary input for a parallel calculation can be found in the supporting information of [[doi>10.1021/acs.jctc.6b00380]]. The emphasis is on the parameters SIZE_FREQ_INTEG_GROUP and NUMBER_PROC which should be increased for larger calculations. In case of a too small number, the code will crash due to out of memory while a too large number results in slow speed. Typically, one starts for large-scale calculations from a small molecule. When increasing the system size, the parameters SIZE_FREQ_INTEG_GROUP and NUMBER_PROC should be both increased to avoid a crash due to out of memory. The maximum number for both parameters is the number of MPI tasks. Also, the number of nodes should be increased with $N^3_\text{atoms}$ to account for the scaling of the memory of GW. +An exemplary input for a parallel calculation can be found in the supporting information of [[doi>10.1021/acs.jctc.6b00380]] [2]. The emphasis is on the parameters SIZE_FREQ_INTEG_GROUP and NUMBER_PROC which should be increased for larger calculations. In case of a too small number, the code will crash due to out of memory while a too large number results in slow speed. Typically, one starts for large-scale calculations from a small molecule. When increasing the system size, the parameters SIZE_FREQ_INTEG_GROUP and NUMBER_PROC should be both increased to avoid a crash due to out of memory. The maximum number for both parameters is the number of MPI tasks. Also, the number of nodes should be increased with $N^3_\text{atoms}$ to account for the scaling of the memory of GW. 
  
 ===== 4. Periodic GW calculations ===== ===== 4. Periodic GW calculations =====
-For periodic GW calculations, a special correction scheme is necessary. A similar problem is appearing in Hartree-Fock calculations. In HF, an easy way out is given by the truncation of the Coulomb operator which works due to the convenient form of the HF equations. GW does not exhibit this convenient form and therefore, this truncation does not work for GW calculations. The theory why a correction is necessary and the correction scheme is described in [[doi>10.1103/PhysRevB.95.235123]].+For periodic GW calculations, a special correction scheme is necessary. A similar problem is appearing in Hartree-Fock calculations. In HF, an easy way out is given by the truncation of the Coulomb operator which works due to the convenient form of the HF equations. GW does not exhibit this convenient form and therefore, this truncation does not work for GW calculations. The theory why a correction is necessary and the correction scheme is described in [[doi>10.1103/PhysRevB.95.235123]] [7].
  
-The basis can be found in {{exercises:2017_uzh_cp2k-tutorial:LiH_BASIS_RI.tar ?direct&400 |}}. It is already a textfile. Please rename it to LiH_BASIS_RI and copy it into your directory of the calculation. Then run the calculation as listed below. The computed gap of LiH with the input from below should be 5.95 eV which is still significantly off from the converged result of 4.7 eV from [[doi>10.1103/PhysRevB.95.235123]]. Here, a basis set extrapolation (as shown above) and a larger supercell are necessary to get closer to the result of 4.7 eV. Please redo the calculation without the flag PERIODIC in the GW section and see that the resulting gap of 11.25 eV is much more off than the gap with correction. +The basis can be found in {{exercises:2017_uzh_cp2k-tutorial:LiH_BASIS_RI.tar ?direct&400 |}}. Then run the calculation as listed below. The computed gap of LiH with the input from below should be 6.05 eV which is still significantly off from the converged result of 4.7 eV from [[doi>10.1103/PhysRevB.95.235123]] [7]. Here, a basis set extrapolation (as shown above) and a larger supercell are necessary to get closer to the result of 4.7 eV. Please redo the calculation without the flag PERIODIC in the GW section and see that the resulting gap of 11.25 eV is much more off than the gap with correction. 
  
-<code>+<code - LiH_periodic.inp>
 &FORCE_EVAL &FORCE_EVAL
   METHOD Quickstep   METHOD Quickstep
Line 271: Line 272:
 Cubic-scaling GW calculations could be a more efficient alternative for large systems. See below an exemplary input for one water molecule. Compare the results to the ones from Sec. 1. In general, small deviations (< 0.05 eV) for GW levels can be expected from cubic-scaling GW calculations compared to canonical GW calculations due to additional approximations in cubic-scaling GW.  Cubic-scaling GW calculations could be a more efficient alternative for large systems. See below an exemplary input for one water molecule. Compare the results to the ones from Sec. 1. In general, small deviations (< 0.05 eV) for GW levels can be expected from cubic-scaling GW calculations compared to canonical GW calculations due to additional approximations in cubic-scaling GW. 
  
-Please observe that the input below is much slower than the input for canonical GW. Therefore, it can be benefitial to run it with more processes. The benefitial scaling of cubic-scaling GW only pays off for large systems where it is more efficient as canonical GW calculations (rule of thumb: cubic-scaling GW can be more efficient for systems with more than 100 atoms if the filter parameters are well set). +Please observe that the input below is much slower than the input for canonical GW. Therefore, it can be beneficial to run it with more MPI tasks. The beneficial scaling of cubic-scaling GW only pays off for large systems where it is more efficient as canonical GW calculations (rule of thumb: cubic-scaling GW can be more efficient for systems with more than 100 atoms if the filter parameters are well set). 
  
-<code>+<code - H2O_GW100_cubic_scaling.inp>
 &FORCE_EVAL &FORCE_EVAL
   METHOD Quickstep   METHOD Quickstep
   &DFT   &DFT
     ! retrieve basis set from the CP2K trunk version     ! retrieve basis set from the CP2K trunk version
-    BASIS_SET_FILE_NAME BASIS_def2_QZVP_ALL+    BASIS_SET_FILE_NAME BASIS_def2_QZVP_RI_ALL
     POTENTIAL_FILE_NAME POTENTIAL     POTENTIAL_FILE_NAME POTENTIAL
     &MGRID     &MGRID
Line 317: Line 318:
           ! in imag. time and frequency           ! in imag. time and frequency
           MINIMAX           MINIMAX
-          ! If the HOMO-LUMO gap of the system is small, more  +          ! If the HOMO-LUMO gap of the system is small, 20  
-          ! points for the time/frequency grid have to be used+          ! points for the time/frequency grid should be used
           ! (flag RPA_NUM_QUAD_POINTS). The time and frequency grid            ! (flag RPA_NUM_QUAD_POINTS). The time and frequency grid 
           ! are equally large. The maximum grid size is 20.            ! are equally large. The maximum grid size is 20. 
-          ! In principle, the grid size is a convergence parameter  +          ! For large-gap systems (as the water molecule), 12 points 
-          ! but for many large-gap systems (as the water molecule),  +          ! should be sufficient
-          ! convergence of this grid is hard to achieve due to  +
-          ! numerical instabilities.+
           RPA_NUM_QUAD_POINTS  12           RPA_NUM_QUAD_POINTS  12
           ! imaginary time flag enables cubic-scaling RPA or            ! imaginary time flag enables cubic-scaling RPA or 
Line 330: Line 329:
           IM_TIME           IM_TIME
           &IM_TIME           &IM_TIME
 +            ! EPS_FILTER_IM_TIME should be tuned for the specific 
 +            ! application: the computational cost strongly 
 +            ! depends on EPS_FILTER
             EPS_FILTER_IM_TIME 1.0E-12             EPS_FILTER_IM_TIME 1.0E-12
-            ! for large systems, increase GROUP_SIZE_3C not  +            ! for large systems, increase GROUP_SIZE_3C   
-            ! to run out of memory (OOM)+            ! to prevent out of memory (OOM)
             GROUP_SIZE_3C 1             GROUP_SIZE_3C 1
             ! for extremely large systems, increase GROUP_SIZE_P              ! for extremely large systems, increase GROUP_SIZE_P 
-            ! not to run OOM+            ! to prevent OOM
             ! for very large systems, it is also recommended              ! for very large systems, it is also recommended 
-            ! to use OMP threads not to run OOM+            ! to use OMP threads to prevent OOM
             GROUP_SIZE_P 1             GROUP_SIZE_P 1
 +            ! for larger systems, MEMORY_CUT must be increased
 +            ! to prevent out of memory (OOM)
 +            MEMORY_CUT  1
             GW             GW
           &END IM_TIME           &END IM_TIME
exercises/2017_uzh_cp2k-tutorial/gw.1499093402.txt.gz · Last modified: 2020/08/21 10:15 (external edit)