exercises:2015_pitt:hfx
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
exercises:2015_pitt:hfx [2015/03/03 12:26] – created vondele | exercises:2015_pitt:hfx [2020/08/21 10:15] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Hartree-Fock exchange ====== | ====== Hartree-Fock exchange ====== | ||
- | The purpose of this section is to explain how to compute hybrid functionals (or Hartree-Fock exchange) with CP2K in condensed phase systems. It is based on the developments described in [[doi> | + | The purpose of this section is to explain how to compute hybrid functionals (or Hartree-Fock exchange, HFX) with CP2K in condensed phase systems. It is based on the developments described in [[doi> |
- | ====== Truncated Coulomb operator ====== | + | Hartree-Fock exchange in CP2K is based on four center integrals, these are computed with an external library ([[http:// |
- | ====== Auxiliary Density Matrix Methods (ADMM) ====== | + | This approach has a computational cost that depends strongly on the nature of the basis, unless combined with ADMM (see below), do not use MOLOPT basis sets with HFX. We use basis sets from '' |
+ | |||
+ | ===== Truncated Coulomb operator ===== | ||
+ | |||
+ | To enable HFX in the condensed phase (described at the Gamma point only), CP2K employs a truncated Coulomb operator for the exchange part. The physical picture is that we do not want to have ' | ||
+ | |||
+ | ==== 1st task : GGA restart wfn ==== | ||
+ | |||
+ | using the water input from the [[exercises: | ||
+ | |||
+ | Change the input to: | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * comment section ''& | ||
+ | |||
+ | Run the input and rename the generated wfn file ('' | ||
+ | Also make a note of the '' | ||
+ | |||
+ | ==== 2nd task: PBE0-D3 water ==== | ||
+ | |||
+ | To do a hybrid calculation, | ||
+ | |||
+ | Change the input to: | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | And employ the following ''& | ||
+ | |||
+ | < | ||
+ | ! specify the exchange and correlation treatment | ||
+ | &XC | ||
+ | ! use a PBE0 functional | ||
+ | & | ||
+ | & | ||
+ | ! 75% GGA exchange | ||
+ | | ||
+ | ! 100% GGA correlation | ||
+ | | ||
+ | & | ||
+ | &END XC_FUNCTIONAL | ||
+ | &HF | ||
+ | ! 25 % HFX exchange | ||
+ | FRACTION 0.25 | ||
+ | & | ||
+ | ! important parameter to get stable HFX calcs | ||
+ | EPS_SCHWARZ 1.0E-6 | ||
+ | ! needs a good (GGA) initial guess | ||
+ | SCREEN_ON_INITIAL_P TRUE | ||
+ | &END | ||
+ | & | ||
+ | ! for condensed phase systems | ||
+ | POTENTIAL_TYPE TRUNCATED | ||
+ | ! should be less than halve the cell | ||
+ | CUTOFF_RADIUS 6.0 | ||
+ | ! data file needed with the truncated operator | ||
+ | T_C_G_DATA ./ | ||
+ | &END | ||
+ | & | ||
+ | ! In MB per MPI rank.. use as much as need to get in-core operation | ||
+ | MAX_MEMORY 4000 | ||
+ | EPS_STORAGE_SCALING 0.1 | ||
+ | &END | ||
+ | &END | ||
+ | ! adding Grimme' | ||
+ | & | ||
+ | | ||
+ | & | ||
+ | PARAMETER_FILE_NAME dftd3.dat | ||
+ | TYPE DFTD3 | ||
+ | REFERENCE_FUNCTIONAL PBE0 | ||
+ | R_CUTOFF [angstrom] 16 | ||
+ | & | ||
+ | &END VDW_POTENTIAL | ||
+ | &END XC | ||
+ | </ | ||
+ | |||
+ | Topics: | ||
+ | * '' | ||
+ | * Fraction of exchange ('' | ||
+ | |||
+ | Run this input, it should lead to an output like: | ||
+ | |||
+ | < | ||
+ | HFX_MEM_INFO| Number of cart. primitive ERI's calculated: | ||
+ | HFX_MEM_INFO| Number of sph. ERI's calculated: | ||
+ | HFX_MEM_INFO| Number of sph. ERI's stored in-core: | ||
+ | HFX_MEM_INFO| Number of sph. ERI's stored on disk: 0 | ||
+ | HFX_MEM_INFO| Number of sph. ERI's calculated on the fly: 0 | ||
+ | HFX_MEM_INFO| Total memory consumption ERI's RAM [MB' | ||
+ | HFX_MEM_INFO| Whereof max-vals [MB' | ||
+ | HFX_MEM_INFO| Total compression factor ERI's RAM: | ||
+ | HFX_MEM_INFO| Total memory consumption ERI's disk [MB' | ||
+ | HFX_MEM_INFO| Total compression factor ERI's disk: 0.00 | ||
+ | HFX_MEM_INFO| Size of density/ | ||
+ | HFX_MEM_INFO| Size of buffers [MB' | ||
+ | HFX_MEM_INFO| Number of periodic image cells considered: | ||
+ | HFX_MEM_INFO| Est. max. program size after HFX [MB' | ||
+ | |||
+ | 1 OT DIIS | ||
+ | |||
+ | Trace(PS): | ||
+ | Electronic density on regular grids: | ||
+ | Core density on regular grids: | ||
+ | Total charge density on r-space grids: | ||
+ | Total charge density g-space grids: | ||
+ | |||
+ | 2 OT DIIS | ||
+ | </ | ||
+ | |||
+ | Topics: | ||
+ | * in-core operation. | ||
+ | * How to detect instabilities due to too aggressive screening. | ||
+ | |||
+ | Question: What is the HOMO-LUMO gap for this configuration ? How does this compare to the GGA result ? Adjust the fraction of exchange (modify the input in two places!) to 20% and/or 30%, how does this influence the gap ? | ||
+ | |||
+ | ===== Truncated Coulomb operator with long range correction ===== | ||
+ | |||
+ | Like in the HSE functional, the difference between the operator used for exchange and 1/r, can be accounted for by a special GGA exchange functional. Also for the truncated coulomb operator this is possible, and allows for xc functionals that embed very short range exchange operators only. This can be used to speedup the calculation, | ||
+ | |||
+ | ==== 3rd task ==== | ||
+ | |||
+ | Add to the & | ||
+ | |||
+ | < | ||
+ | & | ||
+ | | ||
+ | | ||
+ | & | ||
+ | </ | ||
+ | |||
+ | and employ the same '' | ||
+ | |||
+ | Rerun the single point energy calculation and note the band gap. | ||
+ | * Is such a short range sufficient to have a sizable effect on the band gap ? | ||
+ | * is '' | ||
+ | |||
+ | |||
+ | ===== Auxiliary Density Matrix Methods (ADMM) ===== | ||
+ | |||
+ | ADMM is an approach to mitigate the cost of HFX for large basis sets. In particular, if MOLOPT basis sets are used, standard HFX becomes too expensive (CP2K can not deal efficiently with highly contracted AOs). In ADMM, an '' | ||
+ | |||
+ | ==== 4rd task : introduce ADMM ==== | ||
+ | |||
+ | Make the following changes: | ||
+ | * insert and additional line '' | ||
+ | * insert for each ''& | ||
+ | * insert a secion ''& | ||
+ | |||
+ | < | ||
+ | ! use ADMM | ||
+ | & | ||
+ | ! recommended, | ||
+ | ! each kind will need an AUX_FIT_BASIS_SET. | ||
+ | METHOD BASIS_PROJECTION | ||
+ | ! recommended, | ||
+ | ! can be expensive for large systems | ||
+ | ADMM_PURIFICATION_METHOD MO_DIAG | ||
+ | &END | ||
+ | </ | ||
+ | |||
+ | < | ||
+ | |||
+ | < | ||
+ | |||
+ | Run the input, what's the '' | ||
+ | |||
+ | ===== Chasing charge localization in liquid water ===== | ||
+ | |||
+ | The combination of truncated exchange and ADMM results in the most effective way to run AIMD with hybrid functionals. In some systems the difference between GGA DFT and hybrids is very large. One such systems is liquid water after ionization (i.e. charge +1), where only with hybrids the expected species (OH radicals) are formed. See [[doi> | ||
+ | |||
+ | ==== 5th task : ionized water ==== | ||
+ | |||
+ | < | ||
+ | |||
+ | adapt the admm input for water to reflect the ionized state: | ||
+ | < | ||
+ | ! Charge and multiplicity | ||
+ | LSD | ||
+ | CHARGE 1 | ||
+ | MULTIPLICITY 2 | ||
+ | </ | ||
+ | because the system is electronically very difficult initially, we'll reduce the convergence threshold '' | ||
+ | |||
+ | Note that the '' | ||
+ | |||
+ | Run single point energy calculations varying the fraction of exchange from 0.25 to 0.50, does the mulliken spin population reproduce Fig. 2 in [[doi> | ||
+ | |||
+ | For the fraction 0.5, run AIMD for about 50-100fs (if time permits), what happens with the water molecule on which the spin was localized ? Do you results agree with [[doi> | ||
+ | |||
+ | ===== Required files ===== | ||
+ | |||
+ | No new files are required for this exercise. If you're stuck, you can use the following worked out examples. | ||
+ | |||
+ | <code - water_pbe0_cheating.inp> | ||
+ | & | ||
+ | ! the project name is made part of most output files... useful to keep order | ||
+ | PROJECT WATER | ||
+ | ! various runtypes (energy, geo_opt, etc.) available. | ||
+ | RUN_TYPE ENERGY | ||
+ | ! limit the runs to 30min | ||
+ | WALLTIME 1800 | ||
+ | ! reduce the amount of IO | ||
+ | IOLEVEL | ||
+ | &END GLOBAL | ||
+ | |||
+ | & | ||
+ | ! the electronic structure part of CP2K is named Quickstep | ||
+ | METHOD Quickstep | ||
+ | &DFT | ||
+ | ! basis sets and pseudopotential files can be found in cp2k/data | ||
+ | BASIS_SET_FILE_NAME HFX_BASIS | ||
+ | POTENTIAL_FILE_NAME GTH_POTENTIALS | ||
+ | ! GGA restart to provide a good initial density matrix | ||
+ | WFN_RESTART_FILE_NAME WATER-RESTART-GGA.wfn | ||
+ | |||
+ | ! Charge and multiplicity | ||
+ | CHARGE 0 | ||
+ | MULTIPLICITY 1 | ||
+ | |||
+ | & | ||
+ | ! PW cutoff ... depends on the element (basis) too small cutoffs lead to the eggbox effect. | ||
+ | ! certain calculations (e.g. geometry optimization, | ||
+ | ! NPT and cell optimizations, | ||
+ | | ||
+ | &END | ||
+ | |||
+ | &QS | ||
+ | ! use the GPW method (i.e. pseudopotential based calculations with the Gaussian and Plane Waves scheme). | ||
+ | | ||
+ | ! default threshold for numerics ~ roughly numerical accuracy of the total energy per electron, | ||
+ | ! sets reasonable values for all other thresholds. | ||
+ | | ||
+ | ! used for MD, the method used to generate the initial guess. | ||
+ | | ||
+ | &END | ||
+ | |||
+ | & | ||
+ | | ||
+ | &END | ||
+ | |||
+ | & | ||
+ | ! at the end of the SCF procedure generate cube files of the density | ||
+ | & | ||
+ | & | ||
+ | ! compute eigenvalues and homo-lumo gap each 10nd MD step | ||
+ | & | ||
+ | NLUMO 4 | ||
+ | NHOMO 4 | ||
+ | WRITE_CUBE .FALSE. | ||
+ | &EACH | ||
+ | MD 10 | ||
+ | &END | ||
+ | & | ||
+ | &END | ||
+ | |||
+ | ! use the OT METHOD for robust and efficient SCF, suitable for all non-metallic systems. | ||
+ | & | ||
+ | SCF_GUESS RESTART ! can be used to RESTART an interrupted calculation | ||
+ | MAX_SCF 30 | ||
+ | EPS_SCF 1.0E-6 ! accuracy of the SCF procedure typically 1.0E-6 - 1.0E-7 | ||
+ | &OT | ||
+ | ! an accurate preconditioner suitable also for larger systems | ||
+ | PRECONDITIONER FULL_SINGLE_INVERSE | ||
+ | ! the most robust choice (DIIS might sometimes be faster, but not as stable). | ||
+ | MINIMIZER DIIS | ||
+ | &END OT | ||
+ | & | ||
+ | MAX_SCF 10 | ||
+ | EPS_SCF 1.0E-6 ! must match the above | ||
+ | &END | ||
+ | ! do not store the wfn during MD | ||
+ | & | ||
+ | & | ||
+ | &END | ||
+ | &END | ||
+ | &END SCF | ||
+ | |||
+ | ! specify the exchange and correlation treatment | ||
+ | &XC | ||
+ | ! use a PBE0 functional | ||
+ | & | ||
+ | & | ||
+ | ! 75% GGA exchange | ||
+ | | ||
+ | ! 100% GGA correlation | ||
+ | | ||
+ | & | ||
+ | &END XC_FUNCTIONAL | ||
+ | &HF | ||
+ | ! 25 % HFX exchange | ||
+ | FRACTION 0.25 | ||
+ | & | ||
+ | ! important parameter to get stable HFX calcs | ||
+ | EPS_SCHWARZ 1.0E-6 | ||
+ | ! needs a good (GGA) initial guess | ||
+ | SCREEN_ON_INITIAL_P TRUE | ||
+ | &END | ||
+ | & | ||
+ | ! for condensed phase systems | ||
+ | POTENTIAL_TYPE TRUNCATED | ||
+ | ! should be less than halve the cell | ||
+ | CUTOFF_RADIUS 6.0 | ||
+ | ! data file needed with the truncated operator | ||
+ | T_C_G_DATA ./ | ||
+ | &END | ||
+ | & | ||
+ | ! In MB per MPI rank.. use as much as need to get in-core operation | ||
+ | MAX_MEMORY 4000 | ||
+ | ! additional accuracy for storing compressed results | ||
+ | EPS_STORAGE_SCALING 0.1 | ||
+ | &END | ||
+ | &END | ||
+ | ! adding Grimme' | ||
+ | & | ||
+ | | ||
+ | & | ||
+ | PARAMETER_FILE_NAME dftd3.dat | ||
+ | TYPE DFTD3 | ||
+ | REFERENCE_FUNCTIONAL PBE0 | ||
+ | R_CUTOFF [angstrom] 16 | ||
+ | & | ||
+ | &END VDW_POTENTIAL | ||
+ | &END XC | ||
+ | &END DFT | ||
+ | |||
+ | ! description of the system | ||
+ | & | ||
+ | &CELL | ||
+ | ! unit cells that are orthorhombic are more efficient with CP2K | ||
+ | ABC [angstrom] 12.42 12.42 12.42 | ||
+ | &END CELL | ||
+ | |||
+ | ! atom coordinates can be in the &COORD section, | ||
+ | ! or provided as an external file. | ||
+ | & | ||
+ | COORD_FILE_NAME water.xyz | ||
+ | COORD_FILE_FORMAT XYZ | ||
+ | &END | ||
+ | |||
+ | ! MOLOPT basis sets are fairly costly, | ||
+ | ! but in the ' | ||
+ | ! their contracted nature makes them suitable | ||
+ | ! for condensed and gas phase systems alike. | ||
+ | &KIND H | ||
+ | BASIS_SET DZVP-GTH | ||
+ | POTENTIAL GTH-PBE-q1 | ||
+ | &END KIND | ||
+ | &KIND O | ||
+ | BASIS_SET DZVP-GTH | ||
+ | POTENTIAL GTH-PBE-q6 | ||
+ | &END KIND | ||
+ | &END SUBSYS | ||
+ | &END FORCE_EVAL | ||
+ | |||
+ | ! how to propagate the system, selection via RUN_TYPE in the &GLOBAL section | ||
+ | & | ||
+ | & | ||
+ | | ||
+ | | ||
+ | | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | | ||
+ | | ||
+ | | ||
+ | STEPS 1000 | ||
+ | # GLE thermostat as generated at http:// | ||
+ | # GLE provides an effective NVT sampling. | ||
+ | & | ||
+ | | ||
+ | TYPE GLE | ||
+ | & | ||
+ | NDIM 5 | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | MD 1 | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | MD 500 | ||
+ | & | ||
+ | & | ||
+ | & | ||
+ | | ||
+ | & | ||
+ | MD 1 | ||
+ | & | ||
+ | & | ||
+ | &END PRINT | ||
+ | &END | ||
+ | </ | ||
exercises/2015_pitt/hfx.1425385605.txt.gz · Last modified: 2020/08/21 10:15 (external edit)