Skip to content

QMol_DFT_Vks_basis

Cristel Chandre edited this page Jul 10, 2024 · 3 revisions

QMol_DFT_Vks_basis

Kohn-Sham-potential operator object

Description

Use QMol_DFT_Vks_basis to store the Kohn-Sham-potential operator for (TD)DFT simulations with a basis-set discretization. QMol_DFT_Vks_basis is a handle class.

Class properties

Kohn-Sham potential

The QMol_DFT_Vks_basis class defines the following public get-access properties; each can be changed using the set method:

potential (V)

Discretization of the explicit part of the Kohn-Sham potential [ vector (default []) ]

  • For spin restricted DFT model; irrelevant for spin restricted ones
  • Properly allocated potential is a numel(disc.xspan)-by-1 vector matching the domain discretization of the associated (TD)DFT model

potentialUp (Vup)

Discretization of the explicit part of the up-spin channel Kohn-Sham potential [ vector (default []) ]

  • For spin polarized DFT model; irrelevant for spin restricted ones
  • Properly allocated potentialUp is a numel(disc.xspan)-by-1 vector matching the domain discretization of the associated (TD)DFT model

potentialDown (Vdw)

Discretization of the explicit part of the down-spin channel Kohn-Sham potential [ vector (default []) ]

  • For spin polarized DFT model; irrelevant for spin restricted ones
  • Properly allocated potentialDown is a numel(disc.xspan)-by-1 vector matching the domain discretization of the associated (TD)DFT model

potentialImplicit (Vimp)

Implicit components of the Kohn-Sham potential [ cell of handle functions (default {}) ]

  • For both spin restricted and polarized models, holds the implicit components of the Kohn-Sham potential. Implicit potential are defined through their action on orbitals instead of the value-at-grid-point their explicit counterparts.
  • Each component of potentialImplicit contains a handle function describing one implicit-potential component.
  • For spin restricted models, the signature for implicit-potential components is Hp = funV(p). p and Hp are both numel(disc.xspan)-by-1 vectors respectively containing the discretization of the orbital to which the potential should be applied and its result.
  • For spin polarized models, the signature for implicit-potential components is Hp = funV(p,isUp). p and Hp are both numel(disc.xspan)-by-1 vectors respectively containing the discretization of the orbital to which the potential should be applied and its result. The second logical input isUp specifies whether applying the up- (true) or down-spin (false) potential operator to the input orbital.

isSpinPol

Whether the Kohn-Sham potential is spin polarized (true) or spin restricted (false). isSpinPol is used by other classes to determine whether they should use the potential or potentialUp and potentialDown properties, and the proper interface for any potentialImplicit component, in their calculations.

Other properties

These properties cannot be edited with the set method.

isInitialized (isInit)

Whether the Kohn-Sham-potential operator 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.

isBasis

Flag indicating that QMol_DFT_Vks_basis objects are discretization over a basis set [ false ]

  • At run time, isBasis can be used to discriminate QMol_DFT_Vks objects from QMol_DFT_Vks_basis (which overloads the class)
  • For class development purposes, isBasis is technically a static method. Practically, though, it can virtually almost always be treated as a constant property.

Class methods

Creation

constructor

Create a Kohn-Sham-potential operator object with empty class properties.

obj = QMol_DFT_Vks;

Create a Kohn-Sham-potential operator object with the name properties set to the specified value. Several name-value pairs can be specified consecutively. Suitable name is any of the Kohn-Sham potential properties and is case insensitive.

obj = QMol_DFT_Vks(name1,value1);
obj = QMol_DFT_Vks(name1,value1,name2,value2,___);

Most often, Kohn-Sham-potential operator objects are created through domain-discretization or DFT objects.

obj = disc.DFT_allocatePotential;
obj = DFT.getPotential;
  • Note: potential property assignation is provided for extended support. Most end users will not need these as editing the potential may cause simulations to produce erroneous results or fail altogether.

Changing class properties

set

Update the name properties of a Kohn-Sham potential object to the specified value. Several name-value pairs can be specified consecutively. Suitable name is any of the Kohn-Sham potential properties 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 false.

  • Note: potential property assignation is provided for extended support. Most end users will not need these as editing the potential may cause simulations to produce erroneous results or fail altogether.

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 Kohn-Sham potential properties 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_Vks class.

Initializing the object

initialize

Initialize a Kohn-Sham-potential operator object and sets the isInitialized flag to true.

obj.initialize(disc);
  • To avoid any mismatch in internal properties, initialize first reset the object before performing the initialization.
  • The object must be initialized with its associated domain-discretization object disc (unlike for the grid-based discretization QMol_DFT_Vks for which it is optional, albeit recommended).

Run-time documentation

getMemoryProfile

Get an estimate of the memory held by a QMol_DFT_Vks_basis object with either

mem = obj.getMemoryProfile;
mem = obj.getMemoryProfile(false);
  • The object must be properly initialized with a domain discretization.
  • The estimate only includes the discretization of the explicit part of the Kohn-Sham potential 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);

Arithmetic with potentials

add

For spin restricted DFT models, add an explicit potential component to a QMol_DFT_Vks_basis object

obj.add(V);
  • This performs the in-place addition potential = potential + V
  • The input V should be a numel(disc.xspan)-by-1 vector matching the domain discretization of the associated (TD)DFT model

For spin polarized DFT models, add the same explicit potential components to both the up- and down-spin components of a QMol_DFT_Vks_basis object

obj.add(V);
  • This performs the in-place additions potentialUp = potentialUp + V and potentialDown = potentialDown + V
  • The input V should be a numel(disc.xspan)-by-1 vector matching the domain discretization of the associated (TD)DFT model

For spin polarized DFT models, add different explicit potential components to the up- and down-spin components of a QMol_DFT_Vks_basis object

obj.add(Vup,Vdown);
  • This performs the in-place additions potentialUp = potentialUp + Vup and potentialDown = potentialDown + Vdown
  • The inputs Vup and Vdown should each be numel(disc.xspan)-by-1 vector matching the domain discretization of the associated (TD)DFT model
  • Replace any of Vup and Vdown by scalar 0 to add an explicit potential component solely to the other spin channel.

For both spin restricted and polarized DFT models, add an implicit potential component to a QMol_DFT_Vks_basis object

obj.add(funV);
  • funV is a function handle describing the implicit-potential component (which is then added to the potentialImplicit list).
  • For spin resctricted models, the signature for the input function handle is Hp = funV(p). p and Hp are both numel(disc.xspan)-by-1 vectors respectively containing the discretization of the orbital to which the potential should be applied and its result.
  • For spin polarized models, the signature for the input function handle is Hp = funV(p,isUp). p and Hp are both numel(disc.xspan)-by-1 vectors respectively containing the discretization of the orbital to which the potential should be applied and its result. The second logical input isUp specifies whether applying the up- (true) or down-spin (false) potential operator to the input orbital.

applyPotential

For spin-restricted models, apply the potential operator to a wave function

Hp = obj.applyPotential(p);
  • This computes the action of the entire -- including both explicit and implicit components -- Kohn-Sham potential operator on the input wave function p. All implicit components require the associated functional object to have their potential kernels properly set beforehand (with setPotentialKernel -- see the functional documentation). applyPotential does not perform or check for this initialization.
  • p and Hp are both size(disc.basis,2)-by-1 vectors respectively containing the discretization of the orbital to which the potential should be applied and its result.
  • applyPotential requires the Kohn-Sham potential object to have been initialized

For spin-polarized models, apply the up- and down-spin Kohn-Sham potential operators to a wave function respectively with

Hp = obj.applyPotential(p,true);
Hp = obj.applyPotential(p,false);
  • This computes the action of the entire -- including both explicit and implicit components -- Kohn-Sham potential operator on the input wave function p. All implicit components require the associated functional object to have their potential kernels properly set beforehand (with setPotentialKernel -- see the functional documentation). applyPotential does not perform or check for this initialization.
  • p and Hp are both size(disc.basis,2)-by-1 vectors respectively containing the discretization of the orbital to which the potential should be applied and its result.
  • applyPotential requires the Kohn-Sham potential object to have been initialized

Examples

Most users will not use Kohn-Sham potential objects directly or will get them indirectly, through DFT and TDDFT simulations -- see their respective documentations for examples.

Test suite

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

QMol_test.test('DFT_Vks_basis');
QMol_test.test('-summary','DFT_Vks_basis');

For developers

QMol_DFT_Vks_basis implements a streamlined version of the clear all method, since it might be called frequently in DFT and TDDFT computations. If adding properties to the class, the streamlined clear all must be updated accordingly.

QMol_DFT_Vks_basis overloads QMol_DFT_Vks (and thus also QMol_suite).

For internal use QMol_DFT_Vks_basis defines additional transient properties. These cannot be edited with the set method but can be directly edited by classes in the QMol-grig package.

mV

Matrix representation of the explicit part of the Kohn-Sham potential [ square matrix (default []) ]

  • mV is computed at the initialization of the object
  • It is defined as mV(k,l) = sum(conj(disc.v(:,k)).*obj.V.*disc.v(:,l))*disc.dx

mVup

Matrix representation of the explicit part of the spin-up channel Kohn-Sham potential [ square matrix (default []) ]

  • mVup is computed at the initialization of the object
  • It is defined as mVup(k,l) = sum(conj(disc.v(:,k)).*obj.Vup.*disc.v(:,l))*disc.dx

mVdw

Matrix representation of the explicit part of the spin-down channel Kohn-Sham potential [ square matrix (default []) ]

  • mVdw is computed at the initialization of the object
  • It is defined as mVdw(k,l) = sum(conj(disc.v(:,k)).*obj.Vdw.*disc.v(:,l))*disc.dx

Notes

  • QMol_DFT_Vks_basis was introduced in version 01.00
  • Version 01.10 integrated initialization with a domain discretization object
  • getMemoryProfile was introduced in version 01.10
Density-functional theory (DFT)

$~~$ Hartree-Fock theory (HF)

Schrödinger equation (SE)
Time-dependent density-functional theory (TDDFT)
Time-dependent Schrödinger equation (TDSE)
Discretization
Pseudopotentials
External field
External components
Tutorials

$~~$ Documentation

$~~$ Test suite

For developers
Clone this wiki locally