User Tools

Site Tools


howto:cdft

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
Next revisionBoth sides next revision
howto:cdft [2018/01/09 16:33] – [Example: Electronic coupling of Zn cation dimer] nholmberhowto:cdft [2018/11/01 08:57] – [CDFT in summary] nholmber
Line 21: Line 21:
 A more exhaustive list of potential applications has been presented in this [[doi>10.1021/cr200148b | review article]]. A more exhaustive list of potential applications has been presented in this [[doi>10.1021/cr200148b | review article]].
  
-The charge and spin localized states are created by enforcing electron and spin density localization within atom centered regions of space. The relevant theory has been derived by Wu and Van Voorhis in a series of key papers: [[doi>10.1103/PhysRevA.72.024502 | paper 1]],  [[doi>10.1063/1.2360263 | paper 2]],  [[doi>10.1063/1.2360263 | paper 3]]. Further useful references can be found in the aforementioned review article. The CDFT implementation of CP2K has been throughly described in this [[doi>10.1021/acs.jctc.6b01085 | publication]].+The charge and spin localized states are created by enforcing electron and spin density localization within atom centered regions of space. The relevant theory has been derived by Wu and Van Voorhis in a series of key papers: [[doi>10.1103/PhysRevA.72.024502 | paper 1]],  [[doi>10.1063/1.2360263 | paper 2]],  [[doi>10.1063/1.2360263 | paper 3]]. Further useful references can be found in the aforementioned review article. The CDFT implementation of CP2K has been throughly described in these two papers: [[doi>10.1021/acs.jctc.6b01085 | paper 1]] and [[doi>10.1063/1.5038959 | paper 2]].
  
-In this tutorial, only the main results needed to understand what is happening during a CDFT simulation will be summarized. The charge/spin localized states can be generated by augmenting the Kohn-Sham energy functional, $E_\mathrm{KS}$, by additional constraint potentials+In this tutorial, only the main theoretical aspects needed to understand what is happening during a CDFT simulation will be summarized. The charge/spin localized states can be generated by augmenting the Kohn-Sham energy functional, $E_\mathrm{KS}$, by additional constraint potentials
  
 \begin{equation} \begin{equation}
Line 35: Line 35:
 \end{equation} \end{equation}
    
-where $c_j$ are atomic coefficients which determine how each atom is included in the constraint (more on this later), $P_j$ is the so-called cell function which determines the volume occupied by atom $j$ according to some population analysis method, and $\mathcal{N}$ is the set of all atoms in a system. Currently, only the Becke partitioning scheme is fully supported in CP2K, which will be elaborated in the following section. Different types of constraints can be constructed by modifying the weight function according to the following conventions +where $c_j$ are atomic coefficients which determine how each atom is included in the constraint (more on this later), $P_j$ is the so-called cell function which determines the volume occupied by atom $j$ according to some population analysis method, and $\mathcal{N}$ is the set of all atoms in a system. Different types of constraints can be constructed by modifying the weight function according to the following conventions 
   * charge density constraint ($\rho^\uparrow + \rho^\downarrow$): $w^\uparrow = w^\downarrow = w$   * charge density constraint ($\rho^\uparrow + \rho^\downarrow$): $w^\uparrow = w^\downarrow = w$
   * magnetization density constraint ($\rho^\uparrow - \rho^\downarrow$): $w^\uparrow = -w^\downarrow = w$   * magnetization density constraint ($\rho^\uparrow - \rho^\downarrow$): $w^\uparrow = -w^\downarrow = w$
   * spin specific constraint ($\rho^{\uparrow/\downarrow}$): $w^{\uparrow/\downarrow} = w, w^{\downarrow/\uparrow} = 0$   * spin specific constraint ($\rho^{\uparrow/\downarrow}$): $w^{\uparrow/\downarrow} = w, w^{\downarrow/\uparrow} = 0$
  
-When CDFT is used in a molecular dynamics or a geometry optimization simulation, additional force terms arising from the constraints are calculated+The Becke and Hirshfeld space partitioning schemes can be used as constraint weight functions in CP2K. The main differences between these two constraints will be explained in a subsequent section. Please note that Becke constraints have been tested much more extensively.  
 + 
 +When CDFT is used in a molecular dynamics or a geometry optimization simulation, additional force terms arising from the constraints are calculated (currently only implemented for Becke constraints)
  
 \begin{equation} \begin{equation}
Line 61: Line 63:
  
 \begin{equation} \begin{equation}
-\vec\lambda_n = \vec\lambda_{n-1} - \alpha \mathbf{J}_n^{-1}[\vec c(\vec\lambda_n)-\vec c(\vec\lambda_n)]+\vec\lambda_n = \vec\lambda_{n-1} - \alpha \mathbf{J}_n^{-1}\vec c(\vec\lambda_{n-1})
 \end{equation} \end{equation}
  
Line 75: Line 77:
 ===== Using the CDFT module ===== ===== Using the CDFT module =====
  
-The input sections [[inp>FORCE_EVAL/DFT/QS/CDFT]] and [[inp>FORCE_EVAL/DFT/QS/BECKE_CONSTRAINT]] are used for setting up a CDFT simulation. A brief description of these sections will be given in the next two subsections. Subsequently, various aspects of running CDFT simulations will be explored through example calculations.+The input section [[inp>FORCE_EVAL/DFT/QS/CDFT]] is used to set up a CDFT simulation. A brief description of this input section will be given in the next two subsections. Subsequently, various aspects of running CDFT simulations will be explored through example calculations.
  
 ==== Defining CDFT SCF parameters  ===== ==== Defining CDFT SCF parameters  =====
  
 Settings for the CDFT SCF loop are controlled by the input section [[inp>FORCE_EVAL/DFT/QS/CDFT]]. An example of a typical CDFT input is given below. These parameter selections should be suitable for most systems. Settings for the CDFT SCF loop are controlled by the input section [[inp>FORCE_EVAL/DFT/QS/CDFT]]. An example of a typical CDFT input is given below. These parameter selections should be suitable for most systems.
 +
 +<note important>The CDFT input structure was altered slightly in CP2K version 6.1. The changes are indicated below. Input files for subsequent example calculations are provided for both versions 5.1 and 6.1, though using the latest available version is always recommended. </note>
  
 <code cp2k> <code cp2k>
Line 100: Line 104:
       ! Optimizer step size       ! Optimizer step size
       STEP_SIZE -1.0       STEP_SIZE -1.0
-      ! Line search settings +      ! Note that the section CDFT_OPT exists in CP2K version >= 6.1 
-      MAX_LS 5 +      ! Remove section for CP2K version 5.1 (keywords are unchanged) 
-      CONTINUE_LS +      &CDFT_OPT ON 
-      FACTOR_LS 0.5 +        ! Line search settings 
-      ! Finite difference settings for calculation of Jacobian matrix +        MAX_LS 5 
-      JACOBIAN_STEP 1.0E-2 +        CONTINUE_LS 
-      JACOBIAN_FREQ 1 1 +        FACTOR_LS 0.5 
-      JACOBIAN_TYPE FD1 +        ! Finite difference settings for calculation of Jacobian matrix 
-      JACOBIAN_RESTART FALSE+        JACOBIAN_STEP 1.0E-2 
 +        JACOBIAN_FREQ 1 1 
 +        JACOBIAN_TYPE FD1 
 +        JACOBIAN_RESTART FALSE 
 +      &END CDFT_OPT
     &END OUTER_SCF     &END OUTER_SCF
   &END CDFT   &END CDFT
Line 114: Line 122:
 </code> </code>
  
-The structure of this input section is quite straightforward. The keyword [[inp>FORCE_EVAL/DFT/QS/CDFT/OUTER_SCF#EPS_SCF|EPS_SCF]] defines the CDFT constraint convergence threshold $\varepsilon$ and [[inp>FORCE_EVAL/DFT/QS/CDFT/OUTER_SCF#OPTIMIZER|OPTIMIZER]] selects the CDFT optimizer. Using Newton or quasi-Newton optimizers (Broyden methods) is recommended for most applications. These optimizers accept additional control settings that define how the Jacobian matrix is calculated (keywords JACOBIAN_*) and how to optimize the step size $\alpha$ (keywords *_LS). MD simulations with a single constraint might benefit from using the bisect optimizer, which avoids building the Jacobian matrix, in case a considerable amount of the total time per MD step is spent in building the Jacobian. Notice, however, that the frequency of Jacobian rebuilds [[inp>FORCE_EVAL/DFT/QS/CDFT/OUTER_SCF#JACOBIAN_FREQ|JACOBIAN_FREQ]] can be controlled on a per MD step and per CDFT SCF step basis. The Broyden optimizers require less frequent rebuilds of the Jacobian matrix because the matrix is [[https://en.wikipedia.org/wiki/Broyden%27s_method|rank-one updated]] every iteration, although the stability of the method with respect to the rebuild frequency needs to be carefully studied.+The structure of this input section is quite straightforward. The keyword [[inp>FORCE_EVAL/DFT/QS/CDFT/OUTER_SCF#EPS_SCF|EPS_SCF]] defines the CDFT constraint convergence threshold $\varepsilon$ and [[inp>FORCE_EVAL/DFT/QS/CDFT/OUTER_SCF#OPTIMIZER|OPTIMIZER]] selects the CDFT optimizer. Using Newton or quasi-Newton optimizers (Broyden methods) is recommended for most applications. These optimizers accept additional control settings that define how the Jacobian matrix is calculated (keywords JACOBIAN_*) and how to optimize the step size $\alpha$ (keywords *_LS). These keywords are available in the [[inp>FORCE_EVAL/DFT/QS/CDFT/OUTER_SCF/CDFT_OPT|CDFT_OPT]] section. MD simulations with a single constraint might benefit from using the bisect optimizer, which avoids building the Jacobian matrix, in case a considerable amount of the total time per MD step is spent in building the Jacobian. Notice, however, that the frequency of Jacobian rebuilds [[inp>FORCE_EVAL/DFT/QS/CDFT/OUTER_SCF/CDFT_OPT#JACOBIAN_FREQ|JACOBIAN_FREQ]] can be controlled on a per MD step and per CDFT SCF step basis. The Broyden optimizers require less frequent rebuilds of the Jacobian matrix because the matrix is [[https://en.wikipedia.org/wiki/Broyden%27s_method|rank-one updated]] every iteration, although the stability of the method with respect to the rebuild frequency needs to be carefully studied.
  
 Above, for instance, the Jacobian is explicitly calculated every CDFT SCF iteration and MD step by perturbing each constraint Lagragian using a first order forward difference stencil with a step size of $10^{-2}$. The Newton step size is optimized with backtracking line search using the update formula $\alpha_n = 0.5*\alpha_{n-1}$ for a maximum of 5 steps as long as the CDFT constraint error decreases. Above, for instance, the Jacobian is explicitly calculated every CDFT SCF iteration and MD step by perturbing each constraint Lagragian using a first order forward difference stencil with a step size of $10^{-2}$. The Newton step size is optimized with backtracking line search using the update formula $\alpha_n = 0.5*\alpha_{n-1}$ for a maximum of 5 steps as long as the CDFT constraint error decreases.
howto/cdft.txt · Last modified: 2024/01/03 13:20 by oschuett