# CDFT

References: Holmberg2017, Holmberg2018

Parameters needed to set up a constrained DFT calculation. Each repetition of the ATOM_GROUP section defines a new constraint. The constraint(s) is (are) converged in a separate external SCF loop with settings read from the OUTER_SCF section. Supported constraints: Becke and Gaussian Hirshfeld (partial). [Edit on GitHub]

Subsections

- ATOM_GROUP
- BECKE_CONSTRAINT
- DUMMY_ATOMS
- HIRSHFELD_CONSTRAINT
- OUTER_SCF
- PROGRAM_RUN_INFO

## Keywords

- ATOMIC_CHARGES

- COUNTER

- FLIP_FRAGMENT_A

- FLIP_FRAGMENT_B

- FRAGMENT_A_FILE_NAME

- FRAGMENT_A_SPIN_FILE

- FRAGMENT_B_FILE_NAME

- FRAGMENT_B_SPIN_FILE

- IN_MEMORY

- MAX_REUSE

- PRECOND_FREQ

- PURGE_FREQ

- PURGE_HISTORY

- PURGE_OFFSET

- REUSE_PRECOND

- STRENGTH

- TARGET

- TYPE_OF_CONSTRAINT

## Keyword descriptions

ATOMIC_CHARGES: logical = F

  Lone keyword: `T`

  Usage: ATOMIC_CHARGES

  Calculate atomic CDFT charges with selected weight function (Z = Z_core - Z_CDFT). With fragment based constraints, charges are relative to the fragment reference state i.e. Z = Z_CDFT - Z_frag_reference. Note: if the number of atoms is greater than the default pw_pool max cache, calculation of atomic CDFT charges will prompt harmless warnings during deallocation of atomic grids. [Edit on GitHub]

COUNTER: integer = 0

  Usage: COUNTER {int}

  A counter to track the total number of energy evaluations. Needed by some optimizers to print information. Useful mainly for restarts. [Edit on GitHub]

FLIP_FRAGMENT_A: logical = F

  Lone keyword: `T`

  Usage: FLIP_FRAGMENT_A

  Logical which determines if the reference spin difference density (rho_alpha-rho_beta) for fragment A should be flipped. With default (off) value, the fragment is constrained to have more alpha than beta electrons if the isolated fragment has unpaired electrons. Useful in conjunction with FLIP_FRAGMENT_B. [Edit on GitHub]

FLIP_FRAGMENT_B: logical = F

  Lone keyword: `T`

  Usage: FLIP_FRAGMENT_B

  Logical which determines if the reference spin difference density (rho_alpha-rho_beta) for fragment B should be flipped. With default (off) value, the fragment is constrained to have more alpha than beta electrons if the isolated fragment has unpaired electrons. Useful in conjunction with FLIP_FRAGMENT_A. [Edit on GitHub]

FRAGMENT_A_FILE_NAME: string = fragment_a.cube

  Aliases: FRAGMENT_A_FILE

  Usage: FRAGMENT_A_FILE_NAME <FILENAME>

  Name of the reference total electron density cube file for fragment A. May include a path. The reference electron density needs to be outputted on the same grid as the full system (same cutoff and cell, output stride 1). [Edit on GitHub]

FRAGMENT_A_SPIN_FILE: string = fragment_a_spin.cube

  Aliases: FRAGMENT_A_SPIN_FILE_NAME

  Usage: FRAGMENT_A_SPIN_FILE <FILENAME>

  Name of the reference spin density cube file for fragment A. May include a path. The reference spin density needs to be outputted on the same grid as the full system (same cutoff and cell, output stride 1). [Edit on GitHub]

FRAGMENT_B_FILE_NAME: string = fragment_b.cube

  Aliases: FRAGMENT_B_FILE

  Usage: FRAGMENT_B_FILE_NAME <FILENAME>

  Name of the reference total electron density cube file for fragment B. May include a path. The reference electron density needs to be outputted on the same grid as the full system (same cutoff and cell, output stride 1). [Edit on GitHub]

FRAGMENT_B_SPIN_FILE: string = fragment_b_spin.cube

  Aliases: FRAGMENT_B_SPIN_FILE_NAME

  Usage: FRAGMENT_B_SPIN_FILE <FILENAME>

  Name of the reference spin density cube file for fragment B. May include a path. The reference spin density needs to be outputted on the same grid as the full system (same cutoff and cell, output stride 1). [Edit on GitHub]

IN_MEMORY: logical = F

  Lone keyword: `T`

  Usage: IN_MEMORY

  Precompute gradients due to constraint during initial formation of constraint and store them in memory. Does nothing if forces are not calculated. [Edit on GitHub]

MAX_REUSE: integer = 0

  Usage: MAX_REUSE {int}

  Determines how many times a previously built preconditioner can be reused. [Edit on GitHub]

PRECOND_FREQ: integer = 0

  Usage: PRECOND_FREQ {int}

  See REUSE_PRECOND. [Edit on GitHub]

PURGE_FREQ: integer = 1

  Usage: PURGE_FREQ {int}

  See PURGE_HISTORY. [Edit on GitHub]

PURGE_HISTORY: logical = F

  Lone keyword: `T`

  Usage: PURGE_HISTORY yes

  Purge wavefunction and constraint history to improve SCF convergence during MD. Counts how often the convergence of the first CDFT SCF iteration takes 2 or more outer SCF iterations and purges the history if the counter exceeds PURGE_FREQ, and PURGE_OFFSET MD steps have passed since the last purge. The counter is zeroed after each purge. [Edit on GitHub]

PURGE_OFFSET: integer = 1

  Usage: PURGE_OFFSET {int}

  See PURGE_HISTORY. [Edit on GitHub]

REUSE_PRECOND: logical = F

  Lone keyword: `T`

  Usage: REUSE_PRECOND yes

  Reuse a previously built OT preconditioner between subsequent CDFT SCF iterations if the inner OT SCF loop converged in PRECOND_FREQ steps or less. Intended mainly for MD simulations with the FULL_ALL preconditioner to speed up the final iterations of the CDFT SCF loop. [Edit on GitHub]

STRENGTH: real[ ] = 0.00000000E+000

  Mentions: ⭐Constrained DFT

  Constraint force constants (Lagrange multipliers). Give one value per constraint group. [Edit on GitHub]

TARGET: real[ ] = 0.00000000E+000

  Usage: TARGET {real}

  Mentions: ⭐Constrained DFT

  Constraint target values. Give one value per constraint group. The target value is the desired number of valence electrons, spin moment, or the number of alpha or beta electrons on the atoms that define the constraint, suitably multiplied by atomic coefficients in case a relative constraint between two sets of atoms is employed. Note that core charges are not subtracted from the target value. [Edit on GitHub]

TYPE_OF_CONSTRAINT: enum = NONE

  Usage: TYPE_OF_CONSTRAINT (NONE|HIRSHFELD|BECKE)

  Valid values:

  - `NONE` No constraint (disables section).

  - `HIRSHFELD` Gaussian Hirshfeld constraint. Partial implementation: no forces. Requires corresponding section. Not as extensively tested.

  - `BECKE` Becke constraint. Requires corresponding section.

  References: Becke1988b

  Mentions: ⭐Constrained DFT

  Specifies the type of constraint used. [Edit on GitHub]