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.
...
{
plan,
options,
nrows,
nnz,
nnzLocal,
numColLocal,
colptrLocal,
rowindLocal,
HnzvalLocal,
isSIdentity,
SnzvalLocal,
&info );
options.isSymbolicFactorize = 0;
options.isInertiaCount = 0;
plan,
options,
numElectronExact,
&muPEXSI,
&numElectronPEXSI,
&muMinInertia,
&muMaxInertia,
&numTotalInertiaIter,
&numTotalPEXSIIter,
&info );
}
- 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.