QMol_DFT_spinPol - fmauger1/QMol-grid GitHub Wiki
QMol_DFT_spinPol
DFT Hamiltonian and functional for spin-polarized models.
Description
Use QMol_DFT_spinPol
to describe spin-polarized DFT models in simulations. Note that QMol_DFT_spinPol
only describes the DFT Hamiltonian and, e.g., does not perform ground state or time-propagation computations. QMol_DFT_spinPol
is a handle class.
Class properties
DFT model
The QMol_DFT_spinPol
class defines the following public get-access properties; each can be changed using the set
method:
discretization (disc)
Domain discretization object [ handle object (default []) ]
xspan (x)
Cartesian grid for the domain discretization [ vector (default []) ]
- Before the
QMol_DFT_spinPol
object isinitialize
d, as a substitute for thediscretization
object,xspan
is used to directly provide the Cartesian grid (all-increasing, equally-spaces, vector) for the domain discretization. Upon initializetion,xspan
is converted into the properdiscretization
object. - After the
QMol_DFT_spinPol
object isinitialize
d, fetchesdiscretization.xspan
. - Irrespective of the initialization status,
xspan
consistently provides the Cartesian-grid discretization vector for the DFT model.
occupation (occ)
Kohn-Sham orbital population parameters [ cell | (default []) ]
occupation = {[n_up1,n_up2,___],[n_down1,n_down2,___]}
with each of the $0\le n\le 1
$ specifies the number of electrons associated with the up- and down-spin Kohn-Shamorbital
s.
orbital (KSO)
Kohn-Sham orbital object [ handle object (default []) ]
externalPotential (Vext)
External functional object [handle object (default []) ]
HartreePotential (Vh)
Hartree functional object [handle object (default []) ]
exchangeCorrelationPotential (Vxc)
Exchange-correlation functional object(s) [ [] (default) | handle object | cell ]
- Empty
exchangeCorrelationPotential
ignores exchange-correlation effects altogether in the DFT model. - Provide multiple exchange-correlation functionals -- e.g., one exchange functional plus a separate correlation one -- grouped in a cell
{Vxc1,Vxc2,___}
- If the DFT model includes a single exchange-correlation functional, it can be directly provided
exchangeCorrelationPotential = Vxc
or included in a cellexchangeCorrelationPotential = {Vxc}
.
selfInteractionCorrection (SIC)
Flavor of self-interaction correction (SIC) [ 'none' (default) | 'ADSIC' | cell ]
- If a single SIC flag is provided, the same flavor of SIC corresponding to the flag, is applied to the Hartree and exchange-correlation functionals.
selfInteractionCorrection = {SIC_H,SIC_XC}
independently specifies the flavor of SIC to use for the Hartree and exchange-correlation functionals, respectively.- If the DFT model uses several exchange-correlation functional,
selfInteractionCorrection = {SIC_H,SIC_XC_1,SIC_XC_1,___}
independently specifies the flavor of SIC for each of the exchange-correlation functionals, respectively.
Other properties
To facilitate simulations, QMol_DFT_spinPol
defines a handful of additional transient properties. These cannot be edited with the set
method.
isInitialized (isInit)
Whether the DFT-model object is properly initialized. This is used throughout the QMol-grid package to check that the DFT-model object holds meaningful information and is ready for use.
totalCharge (Ntot)
Total number of electrons in the DFT model [ scalar | vector (default []) ]
totalCharge
is defined as[sum(obj.occupation{1}),sum(obj.occupation{2})]
totalCharge
is set byinitialize
; It is empty when theisInitialized
flag isfalse
Constant properties
isSpinPol (true)
- Flags that the DFT model is spin polarized.
dim (1)
- Indicates that the DFT model dimension is one.
Class methods
Creation
constructor
Create a spin-polarized DFT-model object with empty class properties.
obj = QMol_DFT_spinPol;
Create a spin-polarized DFT-model object with the name
properties set to the specified value
. Several name-value
pairs can be specified consecutively. Suitable name
is any of the DFT-model properties and is case insensitive.
obj = QMol_DFT_spinPol(name1,value1);
obj = QMol_DFT_spinPol(name1,value1,name2,value2,___);
Changing class properties
set
Update the name
properties of a spin-polarized DFT-model object to the specified value
. Several name-value
pairs can be specified consecutively. Suitable name
is any of the DFT-model 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 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. - To avoid any mismatch in the DFT component internal properties, this also
reset
s thediscretization
(domain discretization),orbital
(Kohn-Sham orbitals),externalPotential
(external functional and potential),HartreePotential
(Hartree functional and potential), andexchangeCorrelationPotential
(exchange-correlation functional and potential) components objects.
clear
Clear all class properties
obj.clear;
Clear a specific set of the class properties. Suitable name
is any of the DFT-model 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_spinPol
class.
Initializing the object
initialize
Initialize a spin-polarized DFT-model object in silent mode, i.e., without displaying any initialization status, and set the isInitialized
flag to true
with either
obj.initialize;
obj.initialize(0)
- This
initialize
sdiscretization
(domain discretization),orbital
(Kohn-Sham orbitals),externalPotential
(external functional and potential),HartreePotential
(Hartree functional and potential), andexchangeCorrelationPotential
(exchange-correlation functional and potential) component objects. - To avoid any mismatch in internal properties,
initialize
firstreset
the object before performing the initialization
To perform the same initialization but with displaying the status of the object initialization, including the QMol-grid package header and footer,
obj.initialize(1);
To perform the initialization and display and display the status of the object initialization, without the QMol-grid package header and footer,
obj.initialize(2); % 2 or any integer larger than 1
Run-time documentation
getMemoryProfile
Get an estimate of the memory held by a QMol_DFT_spinPol
object with either
mem = obj.getMemoryProfile;
mem = obj.getMemoryProfile(false);
- The object does not need to be
initialize
d for the memory footprint evaluation. getMemoryProfile
makes efforts to return the object in the same configuration as before the profiling but small side effects cannot be entirely excluded: all the DFT-model properties are left unchanged while run-time properties (for developers) may be altered. Notably, if the object was not initialized (isInitialized = false
),getMemoryProfile
reset
s the object.- The estimate includes (1) the domain discretization, (2) Kohn-Sham orbitals, (3) one body density, (4) Kohn-Sham potential, (5) Kohn-Sham potential gradient, (6) External functional, (7) Hartree functional, and (8) exchange-correlation functional(s). Note that all these components may not be used in actual simulations and the memory estimate tries to be conservative. On the other hand, it 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 spin-polarized QMol_DFT
object, which must have been initialize
d beforehand
obj.showDocumentation;
The run-time documentation performs the following steps
- Display the QMol-grid package header (showing the kernel, external component versions)
- Display the
discretization
(domain discretization) object run-time documentation - Display the
HartreePotential
(Hartree functional and potential) object run-time documentation - Display the
externalPotential
(external functional and potential) object run-time documentation - Display the
exchangeCorrelationPotential
(exchange-correlation functional and potential) object run-time documentation - Display the electronic structure, with the occupation (number of electrons) in each Kohn-Sham orbital
- Display the bibliography associated with the list of cited references (from the previous steps)
- Display the funding information
- Display the QMol-grid package footer
One-body density and Kohn-Sham potential
All the following methods require the object to have been initialize
d.
getDensity
Compute and obtain the one-body density associated with the Kohn-Sham orbitals and occupation parameters
rho = obj.getDensity;
- This creates a new one-body density object
rho
in which the result is stored.
Alternatively, store the result in an existing one-body density object with
obj.getDensity(rho);
setPotentialKernel
Trigger the initialization of the kernels of implicit exchange-correlation potentials/functionals
obj.setPotentialKernel;
getPotential
Compute and obtain the total Kohn-Sham potential (sum of the external, Hartree, and exchange-correlation potentials)
V = obj.getPotential;
- Uses the one-body density associated with the Kohn-Sham orbitals and occupation parameters (this forces first the computation of the one-body density)
Specify the one-body density to be used in the calculation of the Kohn-Sham potential with
V = obj.getPotential(rho)
rho
is compatible one-body density object
Alternatively, store the results in an existing Kohn-Sham potential object respectively with
obj.getPotential([],V); % Use current density (must be computed first)
obj.getPotential(rho,V); % Supply one-body density
getPotentialGradient
Compute and obtain the gradient of the total Kohn-Sham potential (sum of the external, Hartree, and exchange-correlation potentials)
DV = obj.getPotentialGradient;
- Uses the one-body density associated with the Kohn-Sham orbitals and occupation parameters (this forces first the computation of the one-body density)
Specify the one-body density to be used in the calculation of the Kohn-Sham potential gradient with
DV = obj.getPotentialGradient(rho)
rho
is compatible one-body density object
Alternatively, store the results in an existing Kohn-Sham potential object respectively with
obj.getPotentialGradient([],DV); % Use current density (must be computed first)
obj.getPotentialGradient(rho,DV); % Supply one-body density
By default getPotentialGradient
computes the gradient along all possible directions; Specify the directions along which the gradient should be computed with
DV = obj.getPotentialGradient([],[],dim); % Use current density (must be computed first)
obj.getPotentialGradient([],DV,dim);
DV = obj.getPotentialGradient(rho,[],dim); % Supply one-body density
obj.getPotentialGradient(rho,DV,dim);
DFT and orbital energies
All the following methods require the object to have been initialize
d.
getEnergy
Compute the DFT-component energies with either
[Etot,Ekin,Eext,Eh,Exc] = obj.getEnergy;
[Etot,Ekin,Eext,Eh,Exc] = obj.getEnergy('DFT');
Etot
is the total (sum of the following components) energy;Ekin = [Ekin_up, Ekin_down]
is the kinetic energy in the up- and down-spin channels, respectively;Eext = [Eext_up Eext_down]
is the external energy in the up- and down-spin channels, respectively;Eh
is the Hartree energy;Exc
is the exchange-correlation energy (summed over all exchange-correlation functionals).- Uses the one-body density associated with the Kohn-Sham orbitals and occupation parameters (this forces first the computation of the one-body density)
Compute the Kohn-Sham orbital energies and error
[E,DE] = obj.getEnergy('orbital');
- For each orbital $
\left|\phi \right\rangle
$ , the orbital energy is defined as the real $E=\langle \phi |{\hat{\mathcal{H}} }_{{\mathrm{D}\mathrm{F}\mathrm{T}}} |\phi \rangle
$ and the error is defined as the positive real $\left\|({\hat{\mathcal{H}} }_{{\mathrm{D}\mathrm{F}\mathrm{T}}} -E)|\phi \rangle \right\|
$. ${\hat{\mathcal{H}} }_{{\mathrm{D}\mathrm{F}\mathrm{T}}}
$ is the total DFT Hamiltonian operator. - For spin-polarized models,
E = {Eup,Edown}
are the orbital energies in the up- and down-spin channels, respectively. - For spin-polarized models,
DE = {DEup,DEdown}
are the orbital energy errors in the up- and down-spin channels, respectively. - This uses the one-body density associated with the Kohn-Sham orbitals and occupation parameters and its corresponding Kohn-Sham potential (this forces first the computation of both the one-body density and the Kohn-Sham potential).
Specify the one-body density (for the Kohn-Sham potential) for computing the Kohn-Sham orbital energies and error with
[E,DE] = obj.getEnergy('orbital',rho);
rho
is a compatible one-body density object.- This forces the computation of the Kohn-Sham potential (for the input density).
Specify the Kohn-Sham potential for computing the Kohn-Sham orbital energies and error with
[E,DE] = obj.getEnergy('orbital',V);
V
is a compatible Kohn-Sham potential
showEnergy
Display the DFT energy components with
obj.showEnergy('DFT');
- This forces the computation of the one-body density and its associated Kohn-Sham potential.
Display the Kohn-Sham orbital energies and errors with either
obj.showEnergy;
obj.showEnergy('orbital');
- The energy and error the same as in
getEnergy
. - This also forces the computation of the one-body density and its associated Kohn-Sham potential.
Examples
Create a spin-polarized DFT system
First we define the discretization domain and set of atomic centers in the molecular system
x = -20:.1:15;
A1 = QMol_Va_softCoulomb('name','atom 1','charge',3,'position',-3);
A2 = QMol_Va_softCoulomb('name','atom 2','charge',3,'position',2);
Next, we define the external, Hartree, and exchange-correlation (here only exchange) potentials
Vext= QMol_DFT_Vext('atom',{A1,A2});
Vh = QMol_DFT_Vh_conv;
Vxc = QMol_DFT_Vx_LDA_exp;
We can now create the spin-polarized DFT object, initialize
it, and access the run-time documentation
DFT = QMol_DFT_spinPol( ...
'xspan', x, ...
'occupation', {[1 1 1],[1 1]},...
'externalPotential', Vext, ...
'HartreePotential', Vh, ...
'exchangeCorrelationPotential', Vxc);
DFT.initialize;
DFT.showDocumentation;
yielding
=== Theory ===============================================================
* Density-functional theory (DFT) spin polarized (SP)
SP-DFT level of theory, using the Kohn-Sham formalism [Kohn 1695].
V-01.21.000 (06/17/2024) F. Mauger
* The variational DFT model matches the canonical Hamiltonian formalism
describing the time evolution of the system [Mauger 2024].
V-01.21.000 (06/17/2024) F. Mauger
=== Discretization =======================================================
* Domain discretization Cartesian grid
Grid = -20:0.1:15
Size = 351 (3 x 3 x 3 x 13) points
V-01.21.000 (06/17/2024) F. Mauger
=== External potential ===================================================
* External-potential functional
V-01.21.000 (06/17/2024) F. Mauger
* Atom-like center(s)
> atom 1, parameterized as (soft Coulomb)
Z = 3.00 | a = 1.00 | X0 = -3.00
> atom 2, parameterized as (soft Coulomb)
Z = 3.00 | a = 1.00 | X0 = 2.00
* Soft-Coulomb potential [Javanainen 1988] (soft Coulomb)
Parameterized as V(x) = -Z ./ sqrt( (x-X0).^2 + a^2 ).
V-01.21.000 (06/17/2024) F. Mauger
=== DFT potential(s) =====================================================
* Hartree-potential functional explicit convolution
Interaction pot. = @(x)1./sqrt(x.^2+2) (elec.-elec.)
V-01.21.000 (06/17/2024) F. Mauger
* 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
=== System model =========================================================
* Electronic structure Kohn-Sham orbitals
Up-spin occ. = 1.00 | 1.00 | 1.00
Down-spin = 1.00 | 1.00
Total charge = 3.00 (up) + 2.00 (down) = 5.00 (electrons)
=== 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).
[Javanainen 1988] J. Javanainen, J.H. Eberly, and Q. Su, "Numerical
simulations of multiphoton ionization and above-threshold electron
spectra," Physical Review A 38, 3430 (1988).
[Kohn 1965] W. Kohn and L.J. Sham, "Self-Consistent Equations Including
Exchange and Correlation Effects," Phys. Rev. 140, A1133 (1965).
[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).
[Mauger 2024b] F. Mauger and C. Chandre, "QMol-grid: A MATLAB package
for quantum-mechanical simulations in atomic and molecular systems,"
arXiv:2406.17938 (2024).
We can also display the estimated memory footprint for the object
DFT.getMemoryProfile(true);
* Domain discretization
> domain 2.7 KB
> gradient 5.5 KB
> Laplacian 2.7 KB
> Laplacian (velocity gauge) 5.5 KB
* Kohn-Sham orbitals
> spin up 16.5 KB
> spin down 11.0 KB
* One-body density
> density 5.5 KB
> gradient 5.5 KB
* Kohn-Sham potential 5.5 KB
* Kohn-Sham potential gradient 5.5 KB
* External functional
> potential 2.7 KB
> potential gradient 2.7 KB
* Hartree functional 5.5 KB
* Exchange functional (LDA exponential)
Compute the DFT ground state
To compute the DFT
object ground state, we use the QMol_DFT_SCF_Anderson
class
SCF = QMol_DFT_SCF_Anderson;
SCF.solveSCF(DFT);
that prints out
=== Build density-functional-theory (DFT) model ==========================
* Discretization OK
* Kohn-Sham orbitals OK
* External potential OK
* Hartree potential OK
* Exchange-correlation potential OK
=== Self-consistent-field (SCF) methods ==================================
* Eigen-state solver for DFT Hamiltonians MATLAB eigs function
Tolerance = 1e-12
Max. iter. = 300
Basis dim. = 100
V-01.21.000 (06/17/2024) F. Mauger
* Self-consistent-field (SCF) Anderson's mixing
DFT-SCF solver using an Anderson's mixing scheme [Anderson 1965], as
described in [Johnson 1988].
Tolerance = 1e-10
Max. iter. = 100
Mix. coeff. = 0.5
Mix. mode = density
Conv. test = density
V-01.21.000 (06/17/2024) F. Mauger
=== References ===========================================================
[Anderson 1965] D.G. Anderson, "Iterative procedures for nonlinear
integral equations," Journal of the ACM 12, 547 (1965).
[Johnson 1988] D. D. Johnson, "Modified Broyden's method for
accelerating convergence in self-consistent calculations," Physical
Review B 38, 12807 (1988).
[Mauger 2024b] F. Mauger and C. Chandre, "QMol-grid: A MATLAB package
for quantum-mechanical simulations in atomic and molecular systems,"
arXiv:2406.17938 (2024).
=== Funding ==============================================================
The original development of the QMol-grid toolbox, and its (TD)DFT
features, was supported by the U.S. Department of Energy, Office of
Science, Office of Basic Energy Sciences, under Award No. DE-SC0012462.
Addition of the (TD)SE features was supported by the National Science
Foundation under Grant No. 2207656.
=== SCF iterations =======================================================
Iter. Orbital energies (-eV) Error
----- ----------------------------------------------------- --------
0 35.48 | 35.04 | 15.80 7.674e-02
35.09 | 34.75 4.750e-02
1 35.81 | 35.33 | 16.31 8.606e-03
35.40 | 35.04 3.102e-03
2 35.82 | 35.34 | 16.31 4.073e-03
35.41 | 35.05 1.129e-03
3 35.83 | 35.35 | 16.32 8.860e-04
35.43 | 35.07 3.922e-04
(...)
20 35.84 | 35.36 | 16.32 8.152e-11
35.43 | 35.07 4.297e-11
21 35.84 | 35.36 | 16.32 8.659e-11
35.43 | 35.07 1.666e-11
22 35.84 | 35.36 | 16.32 4.233e-11
35.43 | 35.07 8.028e-12
------------------------------------------------------------------------
Kohn-Sham orbitals converged to tolerance
=== Orbital energies =====================================================
Orbital Occ. (elec.) Energy (-eV) Error(a.u.)
------- ------------ ------------ -----------
1 1.00 35.836 6.546e-12
2 1.00 35.356 6.117e-12
3 1.00 16.322 1.084e-11
------- ------------ ------------ -----------
1 1.00 35.432 6.116e-12
2 1.00 35.071 6.027e-12
------------------------------------------------------------------------
=== DFT-component energies ===============================================
Component Energy (a.u.) Energy (eV) [ spin up/down (eV) ]
----------- ------------- ------------- ---------------------
Kinetic 1.187 32.287 [ 19.96/ 12.32 ]
External -15.029 -408.949 [ -236.93/ -172.01 ]
Hartree 4.830 131.441
Exch.-corr. -1.376 -37.448
----------- ------------- -------------
Total -10.388 -282.669
----------------------------------------------
##########################################################################
To finish with, we can plot resulting molecular orbitals
figure; hold on
plot(DFT.xspan,DFT.KSO.KSOup(:,1),'-' ,'LineWidth',2,'DisplayName','MO #1 (up)')
plot(DFT.xspan,DFT.KSO.KSOup(:,2),'-' ,'LineWidth',2,'DisplayName','MO #2 (up)')
plot(DFT.xspan,DFT.KSO.KSOup(:,3),'-' ,'LineWidth',2,'DisplayName','MO #3 (up)')
plot(DFT.xspan,DFT.KSO.KSOdw(:,1),'--','LineWidth',2,'DisplayName','MO #1 (down)')
plot(DFT.xspan,DFT.KSO.KSOdw(:,2),'--','LineWidth',2,'DisplayName','MO #2 (down)')
xlabel('position (a.u.)'); xlim(DFT.xspan([1 end]));
ylabel('orbital')
legend show
Basis-set discretization example
We briefly revisit the DFT model above but using a basis set discretization. First we define the vectors from which the basis set is to be built
% Domain and atomic centers
x = -20:.1:15;
A1 = QMol_Va_softCoulomb('name','atom 1','charge',3,'position',-3);
A2 = QMol_Va_softCoulomb('name','atom 2','charge',3,'position',2);
% Common shape for atomic orbitals
AO = @(s,n,x0,x) (x(:)-x0).^n .*exp(-(x(:)-x0).^2 * .5/s^2);
% Atomic orbital basis
V = [AO(1.3,0,A1.position,x),AO(1.7,1,A1.position,x),AO(0.8,2,A1.position,x), ...
AO(1.3,0,A2.position,x),AO(1.7,1,A2.position,x),AO(0.8,2,A2.position,x)];
% Orthonormalize the basis
disc= QMol_disc_basis('xspan',x,'basis',V);
disc.orthonormalizeBasis;
The last command orthonormalizes the atomic-orbital basis, and updates disc
with the result.
We can now create the DFT object, like we did in the grid-discretization model above, but specifying the basis-set discretization disc
instead of the domain
Vext= QMol_DFT_Vext('atom',{A1,A2});
Vh = QMol_DFT_Vh_conv;
Vxc = QMol_DFT_Vx_LDA_exp;
DFT = QMol_DFT_spinPol( ...
'discretization', disc, ...
'occupation', {[1 1 1],[1 1]},...
'externalPotential', Vext, ...
'HartreePotential', Vh, ...
'exchangeCorrelationPotential', Vxc);
Next, we check the model using the run-time documentation
DFT.initialize;
DFT.showDocumentation;
which gives (we only show the section that is different from above)
(...)
=== Discretization =======================================================
* Domain discretization basis set on a Cartesian grid
Grid = -20:0.1:15
Size = 351 (3 x 3 x 3 x 13) points
Basis = 6 vectors
V-01.21.000 (06/17/2024) F. Mauger
(...)
We can also look at the memory footprint for the basis-set DFT model
DFT.getMemoryProfile(true);
* Domain discretization
> domain 2.7 KB
> gradient 5.5 KB
> Laplacian 2.7 KB
> Laplacian (velocity gauge) 5.5 KB
> basis 16.5 KB
> gradient matrix 288 B
> Laplacian matrix 288 B
> Laplacian matrix (velocity gauge) 576 B
> reconstructed orbitals 27.4 KB
* Kohn-Sham orbitals (basis set)
> spin up 288 B
> spin down 192 B
* One-body density
> density 5.5 KB
> gradient 5.5 KB
* Kohn-Sham potential 576 B
* External functional
> potential 2.7 KB
> potential gradient 2.7 KB
* Hartree functional 5.5 KB
* Exchange functional (LDA exponential)
Note the additional lines for the basis set and associated gradient and Laplacian matrices compared to above. Finally, we compute the ground state
SCF = QMol_DFT_SCF_Anderson;
SCF.solveSCF(DFT);
which yields (once again, we only show the part of the output that are different from above)
(...)
=== Self-consistent-field (SCF) methods ==================================
* Eigen-state solver for DFT Hamiltonians MATLAB eig function
using a direct diagonalization of the DFT Hamiltonian matrix.
V-01.21.000 (06/17/2024) F. Mauger
* Self-consistent-field (SCF) Anderson's mixing
DFT-SCF solver using an Anderson's mixing scheme [Anderson 1965], as
described in [Johnson 1988].
Tolerance = 1e-10
Max. iter. = 100
Mix. coeff. = 0.5
Mix. mode = density
Conv. test = density
V-01.21.000 (06/17/2024) F. Mauger
(...)
=== SCF iterations =======================================================
Iter. Orbital energies (-eV) Error
----- ----------------------------------------------------- --------
0 36.13 | 35.68 | 15.61 3.940e-02
35.70 | 35.37 3.811e-02
1 36.31 | 35.85 | 15.85 2.087e-03
35.88 | 35.56 7.452e-04
2 36.31 | 35.85 | 15.85 1.025e-03
35.88 | 35.56 3.452e-04
3 36.31 | 35.85 | 15.84 1.283e-04
35.88 | 35.56 2.012e-05
(...)
15 36.31 | 35.85 | 15.84 1.312e-10
35.88 | 35.56 2.447e-10
16 36.31 | 35.85 | 15.84 2.598e-11
35.88 | 35.56 8.995e-11
17 36.31 | 35.85 | 15.84 1.132e-11
35.88 | 35.56 3.852e-11
------------------------------------------------------------------------
Kohn-Sham orbitals converged to tolerance
=== Orbital energies =====================================================
Orbital Occ. (elec.) Energy (-eV) Error(a.u.)
------- ------------ ------------ -----------
1 1.00 36.311 2.070e-12
2 1.00 35.848 2.531e-12
3 1.00 15.843 2.146e-12
------- ------------ ------------ -----------
1 1.00 35.879 2.864e-12
2 1.00 35.560 8.799e-13
------------------------------------------------------------------------
=== DFT-component energies ===============================================
Component Energy (a.u.) Energy (eV) [ spin up/down (eV) ]
----------- ------------- ------------- ---------------------
Kinetic 1.033 28.116 [ 17.12/ 11.00 ]
External -14.746 -401.258 [ -231.14/ -170.12 ]
Hartree 4.734 128.813
Exch.-corr. -1.352 -36.802
----------- ------------- -------------
Total -10.331 -281.130
----------------------------------------------
##########################################################################
Compared to the grid discretization above, the basis-set orbital energies are within about 0.5 eV but the total DFT energy is higher (as expected). Finally, we plot the new set of orbitals
% Reconstruct orbitals on grid
KSO = disc.DFT_reconstructOrbital(DFT.KSO);
% Plot results
figure; hold on
plot(DFT.xspan,KSO.KSOup(:,1),'-' ,'LineWidth',2,'DisplayName','MO #1 (up)')
plot(DFT.xspan,KSO.KSOup(:,2),'-' ,'LineWidth',2,'DisplayName','MO #2 (up)')
plot(DFT.xspan,KSO.KSOup(:,3),'-' ,'LineWidth',2,'DisplayName','MO #3 (up)')
plot(DFT.xspan,KSO.KSOdw(:,1),'--','LineWidth',2,'DisplayName','MO #1 (down)')
plot(DFT.xspan,KSO.KSOdw(:,2),'--','LineWidth',2,'DisplayName','MO #2 (down)')
xlabel('position (a.u.)'); xlim(DFT.xspan([1 end]));
ylabel('orbital')
legend show
Test suite
For consistency with the rest of the QMol-grid package, QMol_DFT_spinPol
defines an associated test suite. Run the test suite for the class in normal or summary mode respectively with
QMol_test.test('DFT_spinPol');
QMol_test.test('-summary','DFT_spinPol');
For developers
For internal use QMol_DFT_spinPol
defines additional transient properties. These cannot be edited with the set
method but can be directly edited by classes in the QMol-grig package.
rho
One-body density placeholder [ density handle object (default []) ]
- Some methods require local computation of the one-body density before performing their own computation. In such cases, they should use this local density placeholder and avoid the allocation of another density object.
rho
is up for grab by any class in the QMol-grid package (Access=?QMol_suite
). One should not assume that it retains meaningful values outside of a given method where it is used.
Vks
Kohn-Sham potential placeholder [ density handle object (default []) ]
- Like for the density, use this placeholder when a local computation of the Kohn-Sham potential is required in some computation.
Vks
is up for grab by any class in the QMol-grid package (Access=?QMol_suite
). One should not assume that it retains meaningful values outside of a given method where it is used.
DVks
Kohn-Sham potential gradient placeholder [ density handle object (default []) ]
- Like for the density, use this placeholder when a local computation of the Kohn-Sham potential gradient is required in some computation.
DVks
is up for grab by any class in the QMol-grid package (Access=?QMol_suite
). One should not assume that it retains meaningful values outside of a given method where it is used.
For memory profiling (getMemoryProfile
), the class also defined the following method (with (Hidden,Access = ?QMol_DFT)
attributes)
getDiscCopy
Returns a minimally initialized discretization object
disc = getDiscCopy(obj);
- If the domain discretization is implicitly defined via
x
, it is converted into aQMol_disc
object, otherwise returns a copy of the Domain discretization. In either cases, the outputdisc
is not initialized to limit memory use.
Notes
The results displayed in this documentation page were generated using version 01.21 of the QMol-grid package.
QMol_DFT_spinPol
was introduced in version 01.00- Version 01.10 moved handling of the one-body density spatial derivatives to
QMol_DFT_density
- Version 01.10 introduced a separate class for the Kohn-Sham potential gradient
QMol_DFT_Vks_grad
getMemoryProfile
was introduced in version 01.10