# QMol_DFT_Vx_LDA_exp - fmauger1/QMol-grid GitHub Wiki

`QMol_DFT_Vx_LDA_exp`

Local-density approximation (LDA) Slater-exchange potential and functional for exponential electron-electron interaction potentials.

# Description

Use `QMol_DFT_Vx_LDA_exp`

to describe the LDA Slater exchange potential and functional for exponential electron-electron interaction potentials of the form

$$ {\mathcal{V}} _{{\mathrm{ee}}} (r)=V_0 \exp \left(-\frac{|r|}{\sigma }\right), ~~~~~~ (1) $$

in DFT models. Following standard conventions, the LDA Slater exchange energy functional is

$$ H _\mathrm{X}^\mathrm{LDA} \left\lbrack \rho^{\uparrow } ,\rho^{\downarrow } \right\rbrack = \frac{1}{2} \left( E _{{\mathrm{X}}} ^{{\mathrm{LDA}}} \left\lbrack 2\rho^{\uparrow } \right\rbrack + E _{{\mathrm{X}}} ^{{\mathrm{LDA}}} \left\lbrack 2\rho ^{\downarrow } \right\rbrack \right) ~~ ~~ \mathrm{and} ~~ ~~ \mathrm{E} _\mathrm{X}^\mathrm{LDA} [\rho ] = \int \rho (\mathrm{x})\varepsilon _\mathrm{X}^\mathrm{LDA} (\rho (\mathrm{x})) ~ \mathrm{d} \mathrm{x} ,~~~~~~(2) $$

with the exchange-energy per particle [Mauger 2024]

$$ \varepsilon _{{\mathrm{X}}}^{{\mathrm{LDA}}} (\rho )=-\int_0^{\infty } \frac{\sin^2 u}{\pi u^2 }{\mathcal{V}} _{{\mathrm{ee}}} \left(\frac{2u}{\pi \rho }\right)~du. ~~~~~~ (3) $$

This leads to the LDA Slater-exchange potential

$$ {\mathcal{V}} _{{\mathrm{X}}}^{{\mathrm{LDA},\uparrow }} [\rho ^{\uparrow } ] (x) = \varepsilon _{{\mathrm{X}}}^{{\mathrm{LDA}}} (2\rho^{\uparrow } (x)) + 2\rho^{\uparrow } (x) \partial _{\rho } \varepsilon _{{\mathrm{X}}}^{{\mathrm{LDA}}} (2\rho^{\uparrow } (x)) ,~~~~~~(4) $$

and likewise for the down-spin potential ${\mathcal{V}}_{{\mathrm{X}}}^{{\mathrm{L}\mathrm{D}\mathrm{A},\downarrow }}$ . For the exponential potential of Eq. (1), one can write analytical closed-form solutions for the exchange-energy per particle and potentials [Baker 2015]

$$ \varepsilon _{{\mathrm{X}}}^{{\mathrm{LDA}}} (\rho ) = \frac{V _0 }{\sigma }\frac{\ln \left(1+{\left(\pi \sigma \rho \right)}^2 \right) - 2\pi \sigma \rho \arctan \left(\pi \sigma \rho \right)}{2\pi^2 \rho } ~~ ~~ \Rightarrow ~~ ~~ {\mathcal{V}} _{{\mathrm{X}}}^{{\mathrm{LDA},\uparrow }} [\rho^{\uparrow } ] (x) = - \frac{V_0 }{\pi }\arctan \left(2\pi \sigma \rho^{\uparrow } \right) ,~~~~~~(5) $$

and likewise for the down-spin potential ${\mathcal{V}}_{{\mathrm{X}}}^{{\mathrm{L}\mathrm{D}\mathrm{A},\downarrow }}$ . For spin-restricted models one gets equivalent, but computationally less expensive, equations for the LDA Slater exchange energy per particle and potential using that the total one-body density is $\rho =2\rho^{\uparrow } =2\rho^{\downarrow }$ .

`QMol_DFT_Vx_LDA_exp`

supports average-density self-interaction correction (ADSIC) [Legrand 2002].

# Class properties

## Electron-interaction potential model

The `QMol_DFT_Vx_LDA_exp`

class defines the following public get-access properties; each can be changed using the `set`

method:

`potentialHeight (V0)`

Height of the exponential electron-electron interaction potential at the origin `[ nonnegative scalar (default 1/sqrt(2)) ]`

- Potential amplitude coefficient $V_0$ of Eq. (1).

`potentialWidth (s)`

Width of the exponential electron-electron interaction potential `[ nonnegative scalar (default 5) ]`

- Potential width coefficient $\sigma$ of Eq. (1).

## Other properties

These properties cannot be edited with the `set`

method.

`isInitialized (isInit)`

Whether the potential object is properly initialized. This is used throughout the QMol-grid package to check that the potential object holds meaningful information and is ready for use. Changing its `isSpinPol`

may cause simulations to fail or produce erroneous results.

`type`

Flavor of DFT functional `[ 'LDA_X' ]`

- This is a constant property, which can be used by other components of the QMol-grid package to determine the flavor/type of functional a given object belongs to.

# Class methods

## Creation

### constructor

Create a LDA Slater exchange object with empty class properties.

```
obj = QMol_DFT_Vx_LDA_exp;
```

Create a LDA Slater exchange object with the `name`

properties set to the specified `value`

. Several `name-value`

pairs can be specified consecutively. Suitable `name`

is any of the electron-interaction potential model and is case insensitive.

```
obj = QMol_DFT_Vx_LDA_exp(name1,value1);
obj = QMol_DFT_Vx_LDA_exp(name1,value1,name2,value2,___);
```

## Changing class properties

`set`

Update the `name`

properties of a LDA Slater exchange object to the specified `value`

. Several `name-value`

pairs can be specified consecutively. Suitable `name`

is any of the electron-interaction potential model and is case insensitive.

```
obj.set(name1,value1);
obj.set(name1,value1,name2,value2,___);
```

This is the common name-value pair assignment method used throughout the QMol-grid package. The `set`

method also `reset`

the class. After running, the `set`

property updates the `isInitialized`

flag to a `false`

value.

`reset`

Reset the object by deleting/re-initializing all run-time properties of the class and updating the `isInitialized`

flag to `false`

.

```
obj.reset;
```

- This is the common
`reset`

method available to all classes throughout the QMol-grid package.

`clear`

Clear all class properties

```
obj.clear;
```

Clear a specific set of the class properties. Suitable `name`

is any of the electron-interaction potential model and is case insensitive.

```
obj.clear(name1,name2,___);
```

This is the common `clear`

method available to all classes throughout the QMol-grid package. The `clear`

method also `reset`

the class. The `clear`

method can be used to delete specific properties before saving an instance of the `QMol_DFT_Vx_LDA_exp`

class.

## Initializing the object

`initialize`

Initialize a `QMol_DFT_Vx_LDA_exp`

object and set the `isInitialized`

flag to `true`

```
obj.initialize(DFT);
```

`DFT`

is the DFT-model handle object,*i.e.*,`QMol_DFT_spinPol`

or`QMol_DFT_spinRes`

, to which the LDA Slater exchange functional is attached- To avoid any mismatch in internal properties,
`initialize`

first`reset`

the object before performing the initialization

Initialize a `QMol_DFT_Vx_LDA_exp`

object for a specific flavor of self-interaction correction (SIC) and set the `isInitialized`

flag to `true`

```
obj.initialize(DFT,SIC);
```

- Omitted,
`[]`

or`'none'`

input`SIC`

disable SIC. `'ADSIC'`

input`SIC`

uses ADSIC [Legrand 2002].

`Run-time documentation`

`getMemoryProfile`

Get an estimate of the memory held by a `QMol_DFT_Vx_LDA_exp`

object with either

```
mem = obj.getMemoryProfile;
mem = obj.getMemoryProfile(false);
```

- The object must be properly
`initialize`

d with a domain discretization. - The estimate only includes the discretization of member components on the domain grid and ignores other (small) properties.
- The output
`mem`

is the estimated size in bytes.

Additionally display the detail of the memory footprint with

```
mem = obj.getMemoryProfile(true);
```

`showDocumentation`

Display the run-time documentation for the specific configuration of a `QMol_DFT_Vx_LDA_exp`

object

```
ref = obj.showDocumentation;
```

- The output
`ref`

is a cell vector containing the list of references to be included in the bibliography.

## LDA Slater exchange functional

Before using any of its LDA Slater-exchange functional methods, the `QMol_DFT_Vx_LDA_exp`

object must be properly `initialize`

d.

`getEnergy`

Get the LDA Slater exchange energy for the parent DFT object

```
E = obj.getEnergy;
```

- This computes the exchange energy associated with the Kohn-Sham orbitals in the parent DFT model. To do so, it first compute the one-body density associated with the Kohn-Sham orbitals and their occupation parameters.
- The output scalar
`E`

contains the numerical evaluation of the exchange energy of Eq. (2). - This is equivalent to, but more efficient than,
`obj.getEnergy(DFT.getDensity)`

with`DFT`

being the same DFT-model handle object used to`initialize`

the external-potential object.

Get the LDA Slater exchange energy for a specific one-body density

```
E = obj.getEnergy(rho);
```

- Same as above but with using the input one-body-density object
`rho`

in the numerical computation of the energy. `rho`

should be a`QMol_DFT_density`

object defined over the same domain discretization as the parent DFT model.

`getPotential`

Get the LDA Slater exchange potential for the parent DFT object with either

```
V = obj.getPotential;
V = obj.getPotential([]);
```

- This computes the exchange potential associated with the Kohn-Sham orbitals in the parent DFT model. To do so, it first compute the one-body density $\rho$ associated with the Kohn-Sham orbitals and their occupation parameters.
- The output Kohn-Sham potential object contains the numerical evaluation of the exchange potential of Eq. (4).
- This creates a new Kohn-Sham potential object
`V`

in which the exchange potential is stored. - For spin-restricted models, access the discretization of the exchange potential with
`V.potential`

. - For spin-restricted models, access the discretization of the up- and down-spin exchange potentials with
`V.potentialUp`

and`V.potentialDown`

, respectively. - Note that
`getPotential`

does not`initialize`

the output potential object`V`

.

Get the LDA Slater exchange potential for a specific one-body density

```
V = obj.getPotential(rho);
```

- Same as above but with using the input one-body-density object
`rho`

in the numerical computation of the potential. `rho`

should be a`QMol_DFT_density`

object defined over the same domain discretization as the parent DFT model.

Overwrite the LDA Slater exchange potential in an existing Kohn-Sham potential object with any of

```
obj.getPotential([],V); % use parent DFT density
obj.getPotential([],V,false);
obj.getPotential(rho,V); % supply the density
obj.getPotential(rho,V,false);
```

- This is similar to above without creating a new Kohn-Sham potential object.
- Any content in the input object
`V`

is erased before assigning the exchange potential to it.

Add the LDA Slater exchange potential to an existing Kohn-Sham potential object

```
obj.getPotential([],V,true); % use parent DFT density
obj.getPotential(rho,V,true); % supply the density
```

- This is formally equivalent to the in-place addition $
`\mathcal{V}\gets \mathcal{V}+{\mathcal{V}}_{{\mathrm{X}}}^{{\mathrm{L}\mathrm{D}\mathrm{A}}}`

$ .

`getPotentialDerivative`

Get the LDA Slater exchange potential gradient for the parent DFT object with either

```
DV = obj.getPotentialDerivative(1);
DV = obj.getPotentialDerivative(1,[]);
```

- This computes the exchange potential gradient associated with the Kohn-Sham orbitals in the parent DFT model. To do so, it first compute the one-body density $\rho$ associated with the Kohn-Sham orbitals and their occupation parameters.
- The output Kohn-Sham potential gradient object contains the numerical evaluation of the exchange potential gradient.
- In practice,
`getPotentialDerivative`

computes the exchange potential -- like in`getPotential`

-- from which it determines the gradient via fast-Fourier transforms. This is made possible by the local nature of the LDA Slater exchange potential which should therefore have periodic or vanishing boundary conditions over the domain, like the one-body density and Kohn-Sham orbitals do. - This creates a new Kohn-Sham potential gradient object
`DV`

in which the exchange potential gradient is stored. - For spin-restricted models, access the discretization of the exchange potential gradient with
`DV.potentialGradient`

. - For spin-restricted models, access the discretization of the up- and down-spin exchange potential gradients with
`DV.potentialGradientUp`

and`DV.potentialGradientDown`

, respectively. - Note that
`getPotentialDerivative`

does not`initialize`

the output potential gradient object`DV`

. - Note that the first input
`1`

is required. This is to provide a uniform signature with higher dimension where the dimension along which the gradient component is applied must be specified.

Get the LDA Slater exchange potential gradient for a specific one-body density

```
DV = obj.getPotentialDerivative(1,rho);
```

- Same as above but with using the input one-body-density object
`rho`

in the numerical computation of the potential gradient. `rho`

should be a`QMol_DFT_density`

object defined over the same domain discretization as the parent DFT model.

Overwrite the LDA Slater exchange potential gradient in an existing Kohn-Sham potential gradient object with any of

```
obj.getPotentialDerivative(1,[],DV); % use parent DFT density
obj.getPotentialDerivative(1,[],DV,false);
obj.getPotentialDerivative(1,rho,DV); % supply the density
obj.getPotentialDerivative(1,rho,DV,false);
```

- This is similar to above without creating a new Kohn-Sham potential gradient object.
- Any content in the input object
`DV`

is erased before assigning the exchange potential gradient to it.

Add the LDA Slater exchange potential gradient to an existing Kohn-Sham potential gradient object with either

```
obj.getPotentialDerivative(1,[],DV,true); % use parent DFT density
obj.getPotentialDerivative(1,rho,DV,true); % supply the density
```

- This is formally equivalent to the in-place addition $
`\nabla \mathcal{V}\gets \nabla \mathcal{V}+\nabla {\mathcal{V}}_{{\mathrm{X}}}^{{\mathrm{L}\mathrm{D}\mathrm{A}}}`

$ .

# Examples

Create a discretization domain

```
disc = QMol_disc('xspan',-20:.1:25);
```

Create a LDA Slater exchange functional object with default parameters

```
V_X = QMol_DFT_Vx_LDA_exp;
```

Create a minimal `DFT`

-model object required to `initialize`

the exchange functional class and display the run-time documentation

```
DFT = QMol_DFT_spinRes('discretization',disc);
disc.initialize(DFT);
V_X.initialize(DFT);
V_X.showDocumentation;
```

yielding

```
* Slater-exchange functional local-density approximation (LDA)
for exponential-potential electron-electron interaction [Baker 2015],
parameterized as:
Vee(x) = 0.707 * exp( - |x| / 5).
V-01.21.001 (07/10/2024) F. Mauger
```

Display the estimated memory footprint for the object

```
V_X.getMemoryProfile(true);
```

```
* Exchange functional (LDA exponential)
```

`QMol_DFT_Vx_LDA_exp`

objects do not store any large data and their memory footprint is approximated to 0 (which is why the previous command does not display any number).

Since we don't define a full DFT system, we need to generate the one-body density

```
% Create one-body density
rho = DFT.discretization.DFT_allocateDensity;
rho.set('density',3*exp(-(disc.x(:)+5).^2/4)+2*exp(-(disc.x(:)-5).^2/6));
rho.initialize(disc);
```

Plot the exchange potential and its gradient

```
% Get potential and gradient
V = V_X.getPotential(rho);
DV = V_X.getPotentialDerivative(1,rho);
% Plot the results
figure; hold on
plot(disc.xspan,V.potential,'-','LineWidth',2,'DisplayName','V_{X}^{LDA}')
plot(disc.xspan,DV.potentialGradient,'-','LineWidth',2','DisplayName','{\nabla}V_{X}^{LDA}')
xlabel('position (a.u.)'); xlim(disc.xspan([1 end]));
ylabel('potential/gradient')
legend show
```

# Test suite

Run the test suite for the class in normal or summary mode respectively with

```
QMol_test.test('DFT_Vx_LDA_exp');
QMol_test.test('-summary','DFT_Vx_LDA_exp');
```

# For developers

## Other hidden class properties

`QMol_DFT_Vx_LDA_exp`

defines a handful of additional transient/constant and hidden properties to facilitate and speed up computations. These properties cannot be edited with the `set`

method, nor by any function outside of the object (`SetAccess=private`

attribute).

`DFT`

DFT-model object `[ [] (default) |`

`QMol_DFT_spinPol`

`handle object |`

`QMol_DFT_spinRes`

`handle object ]`

- This is a copy of the DFT-model handle object passed to
`initialize`

. - Un-initialized
`QMol_DFT_Vx_LDA_exp`

objects,*i.e.*,`isInitialized == false`

, have empty`DFT`

. - For practical reasons,
`DFT`

is editable by`QMol_DFT`

classes.

`SIC`

Flavor of self-interaction correction (SIC) `[ [] (default) | 0 | 1 ]`

`SIC == 0`

corresponds to no SIC.`SIC == 1`

corresponds to ADSIC [Legrand 2002].

`tol`

Density threshold `[ nonnegative scalar (default 1e-10) ]`

- Wherever the density fall below
`tol`

, the exchange-energy per particle and potential are forced to zero values. This is to avoid numerical artefacts associated with dividing with very small numbers in Eqs. (4).

# References

[Baker 2015] T.E. Baker, E.M. Stoudenmire, L.O. Wagner, K. Burke, and S.R. White, "One-dimensional mimicking of electronic structure: The case for exponentials," Physical Review B 91, 235141 (2015).

[Legrand 2002] C. Legrand, E. Suraud, and P.-G. Reinhard, "Comparison of self-interaction-corrections for metal clusters," Journal of Physics B: Atomic, Molecular and Optical Physics 35, 1115 (2002).

[Mauger 2024] F. Mauger, C. Chandre, M.B. Gaarde, K. Lopata, and K.J. Schafer, "Hamiltonian formulation and symplectic split-operator schemes for time-dependent density-functional-theory equations of electron dynamics in molecules," Communications in Nonlinear Science and Numerical Simulation 129, 107685 (2024).

# Notes

The results displayed in this documentation page were generated using version 01.21 of the QMol-grid package.

`QMol_DFT_Vx_LDA_exp`

was introduced in version 01.00- Version 01.10 changed the definition of $
`{\mathcal{V}}_{{\mathrm{e}\mathrm{e}}}`

$ from $`V_0 \exp (-\sigma \times r)`

$ to $`V_0 \exp \left(-\frac{r}{\sigma }\right)`

$ , so that $`\sigma`

$ properly defines a width `getMemoryProfile`

was introduced in version 01.10