6.7 About providing Fock/KS matrix to Multiwfn¶
Some functions of Multiwfn, such as orbital localization, biorthogonalization, and ETS-NOCV analysis, can evaluate energies of the resulting new orbitals (i.e. expectation of Fock or KS operator), which, however, requires one-electron effective Hamiltonian matrix, namely Fock or Kohn-Sham (KS) matrix. Also, some functions like plotting COHP need this kind of matrix. This matrix can be directly generated by Multiwfn based on orbital energies, expansion coefficients and overlap matrix, however you can also let Multiwfn directly load the matrix from a file, the following files are acceptable:
(1) Plain text file containing Fock/KS matrix¶
In this file, the matrix elements should be recorded in a lower-triangular form, namely the structure of the file should be (closed-shell case)
F(1,1) F(2,1) F(2,2) F(3,1) F(3,2) F(3,3) ... F(nbasis,nbasis)
where nbasis is the total number of basis functions, and F is Fock/KS matrix. For unrestricted open-shell case, the file should contain alpha and beta Fock/KS matrix elements (Fa and Fb, respectively) in a lower-triangular form, that is
Fa(1,1) Fa(2,1) Fa(2,2) Fa(3,1) Fa(3,2) Fa(3,3) ... Fa(nbasis,nbasis)
Fb(1,1) Fb(2,1) Fb(2,2) Fb(3,1) Fb(3,2) Fb(3,3) ... Fb(nbasis,nbasis)
The format of the data in the file is fully free, only the number of data is important.
The Fock/KS matrix may be obtained from output file of quantum chemistry codes. For example, you can use IOp(5/33=3) in Gaussian or NPRINT=5 keyword in GAMESS-US to print the matrix in each SCF cycle, then you can use your own code to convert the matrix printed at last time to the aforementioned format.
It is worth to note that subfunction 17 of main function 100 is able to directly generate Fock/KS matrix based on energies and coefficients of the current orbitals and export the matrix in the aforementioned format to a plain text file, see Section 3.100.17 for detail. Therefore, as long as you have a wavefunction file containing molecular orbitals, you can obtain the file carrying Fock/KS matrix anytime.
(2) .47 file of NBO code¶
You can ask Gaussian to produce .47 file, which is input file of stand-alone version of NBO code. Multiwfn is able to directly read Fock/KS matrix from the $FOCK field in this file. Generating .47 file via Gaussian is easy, just run an input file like this:
Then MY_FILE.47 will be generated in C: folder once the calculation is finished, it carries Fock/KS matrix at B3LYP/6-31G* level.
(3) ORCA output file¶
In ORCA input file, if you add a line %output Print[P_Iter_F] 1, then Fock/KS matrix at each SCF cycle will be printed, Multiwfn will load the matrix printed last time, which corresponds to the matrix of converged wavefunction.
(4) .mwfn file¶
As mentioned in Section 2.5 and my introductory paper about mwfn format, namely ChemRxiv (2020) DOI: 10.26434/chemrxiv.11872524, the .mwfn file is able to carry a Fock/KS matrix. Multiwfn can directly load Fock/KS matrix from this kind of file if this matrix is available in the file.
(5) CP2K .csr file¶
CP2K is able to export various matrices including KS matrix to .csr file. To export KS matrix, add the following lines into &FORCE_EVAL/&DFT section
After completing the task, you will find a .csr file containing KS matrix has been exported in current folder.