5.7 Make use of cubegen utility in Gaussian package to reduce computational time¶
When number of your CPU cores is very limited (less than 10), calculation speed of ESP by internal code of Multiwfn is not as fast as the cubegen utility in Gaussian package. In this circumstance, you can allow Multiwfn to invoke cubegen to calculate ESP data to reduce the overall time-consuming. Even if you have large number of CPU cores, if you need to calculate grid data of ESP (e.g. using main function 5), the time cost by internal ESP code of Multiwfn is still higher compared to allowing Multiwfn to invoke cubegen.
The way of making use of cubegen during analyses of ESP is rather easy: Set "cubegenpath" parameter in settings.ini file to actual path of cubegen executable file (For example, "D:\study\G16W\cubegen.exe" in Windows platform or "/sob/g16/cubegen" in Linux platform). Then if you use .fch/fchk/chk file as input file of Multiwfn, cubegen will be automatically invoked by Multiwfn at the right time to calculate ESP data.
Availability¶
Below cases and functions currently support invoking cubegen to evaluate ESP:
-
Plotting curve map of ESP (main function 3)
-
Plotting plane map of ESP (main function 4)
-
All functions that request grid data of ESP (e.g. using main function 5 to evaluate grid data of ESP, using main function 17 to perform basin analysis for ESP, using subfunction 14 of main function 200 to perform domain analysis for ESP)
-
Calculating ESP fitting atomic charges such as CHELPG, MK and RESP (via corresponding subfunctions in main function 7)
-
Calculating TrEsp charges (see Section 4.A.9 on how to do this)
-
Quantitative molecular surface analysis with ESP as mapped function (main function 12)
Although many other functions in Multiwfn also need ESP information, they do not support utilizing cubegen because only very few numbers of points are needed to be calculated.
Even if you are not a Gaussian user, as long as the quantum chemistry program you used can produce .mwfn or .molden file, or you are using GAMESS-US/Firefly, you can also benefits from cubegen, because by subfunction 2 of main function 100, Multiwfn can convert the loaded .mwfn/.molden/.gms file to .fch file. Then, if you use the .fch file as input file, cubegen can be invoked during ESP calculation. It is worth to note that the examples/scripts/gbw2fch.sh is a Bash shell script that converts all .gbw files of ORCA to .fch file by automatically invoking orca_2mkl in ORCA package and Multiwfn command.
Notes¶
-
The wavefunction invoked by cubegen used for evaluating ESP comes from density matrix in .fch/fchk file. This file may contain more than one density matrices, by default the SCF density matrix is used. The type of density matrix employed can be chosen by "cubegendenstype" parameter in settings.ini. For example, if a .fch file was produced via "# MP2/cc-pVTZ density" keyword, then the file will contain both SCF density matrix and MP2 density matrix. If you want to calculate ESP at MP2 level by means of cubegen, you should change the value of "cubegendenstype" from the default "SCF" to "MP2".
-
When you are dealing with very large .fch/fchk file, running cubegen via Multiwfn may be failed. Commonly, this is because the memory to be allocated by cubegen exceeded default upper limit. To solve this problem, you can run for example
export GAUSS_MEMDEF=4GBin you console before performing your analysis, in this case the limit of memory will be increased to 4GB, which is absolutely large enough. -
This feature is fully compatible with the cubegen in Gaussian 09 and 16 packages. For cubegen in Gaussian 16, the number of CPU cores assigned for cubegen is identical to the "nthreads" parameter in settings.ini file. However, since parallel implementation of cubegen in Gaussian 09 seems buggy, only one CPU core will be employed for it. Multiwfn judges whether it is G09 or G16 cubegen by checking if there is "g16" or "G16" string in the "cubegenpath".
-
Even though you have modified current wavefunction via some functions of Multiwfn, e.g. using subfunction 26 of main function 6 to manually change orbital occupation numbers, the ESP calculated by cubegen still corresponds to the original wavefunction, since the density matrix in the input file was not modified. If you indeed want to calculate ESP based on modified wavefunction via cubegen, you should first use subfunction 2 of main function 100 to export .fch file, the SCF density matrix in this file will correspond to the density matrix constructed by current wavefunction, and thus then you can use this .fch file as input file to carry out ESP analyses.
Why Multiwfn crashes when invoking cubegen?¶
If Multiwfn crashes when (or after) invoking cubegen, there are three common reasons:
(1) The .fch/fchk file is problematic or inappropriate, for example:
-
The file does not contain wavefunction information (e.g. the one produced by ONIOM task with forcefield as low method)
-
The file contains wavefunction but does not contain density matrix of expected type. For example, you require cubegen to deal with MP2 density matrix, but current file only contains SCF density matrix
-
The file is corrupted. For example, incomplete file transfer, formchk does not work normally
(2) The wavefunction is quite large but you did not properly define the "GAUSS_MEMDEF".
(3) The cubegen is too old to be compatible with the fch/fchk file, you need to upgrade the Gaussian.
The outputted information of cubegen is dumped to nouseout file in current folder. If you are confused why the invoked cubegen cannot run normally, you can try to manually examine this file.