10
$\begingroup$

I have generated MOs of a molecular system and I need to recreate its electronic density via $\rho(r)=\sum_{A_i}|\psi_i(\mathbf{r})|^2$ where $A$ is a set of occupied MOs. I am trying to do this via extracting each MO individually in Gaussian16 Cubegen utility:

cubegen 16 MO=${i} input.fchk MO${i}.cube

I am looking for post-processing codes which can manipulate gaussian cube data, i.e., square and summation, preferably in a batch-processing fashion. For the codes I know, Gaussian's Cubman can add only two cubes files at a time; another code has issues with Gaussian's MO cube file format. I tried to understand PySCF implementation, but I am not able to fully grasp it. If someone has a simpler, standalone implementation for such a code, please let me know in the answers below.

$\endgroup$
  • $\begingroup$ +1. By the way, we have a GAUSSIAN Chat Room would you mind saying hello there so that we can have you there as a member of the chat room? $\endgroup$ – Nike Dattani Aug 1 at 16:15
7
$\begingroup$

Multiwfn

Multiwfn is a great tool for cube file analysis and wfn file analysis that can probably do almost everything you want to do. It is capable of doing math between cube files, outputting that file and then continuing to do more math. I believe it also allows for custom formulas to be input into the source code in some straightforward way (I have never needed to) then use it for convenience.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ +1. I'm glad this problem got solved for the user so quickly! Maybe this is a question where we want to enforce this policy: mattermodeling.meta.stackexchange.com/a/126/5. In that case you can focus on one of Multiwfn or ASE and give someone else a chance at explaining ASE in more detail. Whatever rep you think you might lose due to only talking about Multiwfn, you'll gain from this becoming a Hot Network Question. $\endgroup$ – Nike Dattani Aug 1 at 17:51
  • 1
    $\begingroup$ If someone wants to provide a better explanation of either tool, I will expand either of mine and remove the one they do. I just wanted to provide a good answer for the moment with the two tools I have used for this purpose. $\endgroup$ – Tristan Maxson Aug 1 at 17:55
  • $\begingroup$ @TristanMaxson Thanks for your answer. I checked Multiwfn options and its I/O seems to be in the same fashion as G16 (ex: sobereva.com/wfnbbs/viewtopic.php?id=157). I am not sure if Mutliwfn would allow batch processing of multiple cube files. I'll try the ASE option and let you know. $\endgroup$ – mykd Aug 1 at 18:20
  • 1
    $\begingroup$ What type of batch processing would you like to do exactly? Can you provide an example task that matches what you really would like to do as a batch process? $\endgroup$ – Tristan Maxson Aug 1 at 18:31
  • $\begingroup$ @TristanMaxson For ex., I have ~200 cube files, so instead of sending arguments to code again and again, it would be really convenient if a list of relevant cube files could be directly parsed to the code without any further intervention from the user. $\endgroup$ – mykd Aug 1 at 18:57
6
$\begingroup$

TheoDORE

Dealing with cube files is fairly easy as long as they all have the same grid definition. A cube file is basically just a long vector of numbers and you can add and multiply them as you wish. You can for example check lib_util.py of the TheoDORE package. This might do what you want in a simple scriptable form. Maybe the lin_comb routine does what you want. Or you can write an analagous routine for adding squared values.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ +1. We became a Hot Network Question! $\endgroup$ – Nike Dattani Aug 2 at 16:22
4
$\begingroup$

Why the need to reprocess .cube files, when you can

  1. generate a cube straight away for the electron density with cubegen (see Density=Type in the cubegen documentation or
  2. skip the cube files altogether and use the formatted checkpoint file for visualization, allowing an adaptable level of resolution and avoiding a huge amount of unnecessary storage?

There are a bunch of programs that can read Gaussian formatted checkpoint files, e.g. Avogadro and IQmol, and visualize loads of properties.

| cite | improve this answer | |
$\endgroup$
  • 1
    $\begingroup$ Hi Susi, thanks for your response. I know I can use *.fchk file to visualize orbitals or electron density, but I need to use the cube files in a further procedure where I cannot use a *.fchk file. Hence, I was asking help for this roundabout way. $\endgroup$ – mykd Aug 3 at 9:05
  • $\begingroup$ Um, why couldn't you use fchk files in a further procedure? The fchk contains all the information a cube file does, and more, and in a much more compact form... You can reproduce cubes from fchk files, but not the other way around! $\endgroup$ – Susi Lehtola Aug 3 at 9:15
  • 2
    $\begingroup$ Going further, I need to transform or change the contributions of MOs. to the electron density of the system. Plus I used Gaussian16 for testing purposes, but I might need to work to ORCA or NWchem as the situation demands. Across all the CompChem platforms the definition of *.cube file remains consistent and that's why I am using it. Also there is little to no description about the *.fchk format and its content, online or in Gaussian manual. $\endgroup$ – mykd Aug 3 at 9:33
  • 2
    $\begingroup$ Transforming orbitals is extremely simple if you have the orbital coefficient matrices, which are accessible in the checkpoint file, or from a number of programs such as Psi4 and PySCF straight via Python. Cube files are very bad for anything quantitative, since the resolution is insufficient for anything except well-bound valence electrons. $\endgroup$ – Susi Lehtola Aug 4 at 12:46
  • $\begingroup$ Hi Susi, is there anyway I can discuss with you privately? I rather not fully explain what my final target is on a public forum. $\endgroup$ – mykd Aug 4 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.