PEXSI
 All Classes Namespaces Files Functions Variables Typedefs Pages
Solving Kohn-Sham density functional theory: II

In a DFT calculation, the information of the symbolic factorization can be reused for different \((H,S)\) matrix pencil if the sparsity pattern does not change. An example routine is given in driver_ksdft.c, which solves a fake DFT problem by taking a Hamiltonian matrix from examples/lap2dr.matrix.

Here is the structure of the code using the simple driver routine.

...
{
/* Perform DFT calculation as in the previous note */
/* Update and obtain another set of H and S */
/* Solve the problem once again without symbolic factorization */
plan,
options,
nrows,
nnz,
nnzLocal,
numColLocal,
colptrLocal,
rowindLocal,
HnzvalLocal,
isSIdentity,
SnzvalLocal,
&info );
// No need to perform symbolic factorization
options.isSymbolicFactorize = 0;
// Given a good guess of the chemical potential, no need to perform
// inertia counting.
options.isInertiaCount = 0;
// Optional update mu0, muMin0, muMax0 in PPEXSIOptions
plan,
options,
numElectronExact,
&muPEXSI,
&numElectronPEXSI,
&muMinInertia,
&muMaxInertia,
&numTotalInertiaIter,
&numTotalPEXSIIter,
&info );
/* Postprocessing */
}
Note
The built-in heuristics in PPEXSIDFTDriver may not be optimal. It handles only one \((H,S)\) pair at a time, and does not accept multiple matrix pairs \(\{(H_l,S_l)\}\) as in the case of spin-orbit polarized calculations. For expert users and developers, it should be relatively easy to dig into the driver routine, and only use SymbolicFactorizeRealSymmetricMatrix (for symbolic factorization), CalculateNegativeInertiaReal (for inertia counting), and CalculateFermiOperatorReal (for one-shot PEXSI calculation) to improve heuristics and extend the functionalities.