Python scripts for calculating Fukui Indexes

One of the most popular posts in this blog has to do with calculating Fukui indexes, however, when dealing with a large number of molecules, our described methodology can become cumbersome since it requires to manually extract the population analysis from two or three different output files and then performing the arithmetic on them separately with a spreadsheet or something.

Our new team member Ricardo Loaiza has written a python script that takes the three aforementioned files and yields a .csv file with the calculated Fukui indexes, and it even points out which of the atoms exhibit the largest values so if you have a large molecule you don’t have to manually check for them. We have also a batch version which takes all the files in any given directory and performs the Fukui calculations for each, provided it can find file triads with the naming requirements described below.

Output files must be named filename.log (the N electrons reference state), filename_plus.log (the state with N+1 electrons) and filename_minus.log (the N-1 electrons state). Another restriction is that so far these scripts only work with NBO population analysis as provided by the NBO3.1 program available in the various versions of Gaussian. I imagine the listing is similar in NBO5.x and NBO6.x and so it should work if you do the population analysis with them.

The syntax for the single molecule version is:

python filename.log filename_minus.log filename_plus.log

For the batch version is:


(Por Lote means In Batch in Spanish.)

These scripts are available via GitHub. We hope you find them useful, and you do please let us know whether here at the comments section or at our GitHub site.


About joaquinbarroso

Computational and theoretical chemist in his early forties, in love with life, science, baseball, and literature. Science literacy makes us responsible citizens, it is therefore a scientific duty to talk, write, and engage with the general public; as Feynman said, if you find science boring, your learning from the wrong teacher. "Make like a molecule and react!"

Posted on December 20, 2017, in Coding, Computational Chemistry, DFT, Fukui, Gaussian, NBO, NBO, White papers and tagged , , , , , , , , , , , , . Bookmark the permalink. 4 Comments.

  1. Dear Dr. Barroso,
    thanks a lot for the very useful Python script to calculate Fukui indices and the information on the Blog page, How to calculate Fukui indices

    I would like to point out a possible inconsistency of usage of the symbols f+, f- for the Fukui indices between the Blog page and the GitHub page

    In your Blog page, we read:

    “…which atoms in a molecule have a larger tendency to either loose or accept an electron, which we chemist interpret as which are more prone to undergo a nucleophilic or an electrophilic attack, respectively”

    And it seems clear that:
    – larger tendency to lose an electron corresponds to doing a nucleophilic attack
    – larger tendency to accept an electron corresponds to doing an electrophilic attack

    Unfortunately, it is not fully clear whether the atom is doing the attack or it is subjected to the attack.
    I guess some ambiguity stems from the use of the verb “undergo”.
    According to, undergo means “to experience” but mainly in the sense of “to be subjected to”.

    Considering the information that you provide in the rest of the page, It seems clear to me that the atom is doing the attack.
    For example, in the case of a nucleophilic attack, the atom is acting as a nucleophile, having a larger tendency to lose (donate or share) an electron.

    This seems also consistent with the definition of the Fukui indices indicated on the Blog page:

    Electrophilicity of atom A in molecule M (of N electrons)
    fA+ = PA(N+1)-PA(N)

    Nucleophilicity of atom A in molecule M (of N electrons)
    fA– = PA(N)-PA(N-1)

    So, for example, a large fA- means that on atom A we observe a large change in population when we remove one electron from the molecule.
    The atom with the largest change has the larger tendency to lose an electron, so it is the most nucleophilic.
    Therefore, correctly, f- indicates the nucleophilicity of that atom.

    On the GitHub page
    we read
    “The spreadsheet will also display the highest values for the f+ (nucleophilicity) and f- (electrophilicity) functions”

    So now I am confused.

    Sorry for the long message and, again, thank you very much indeed for your attention!


    • Dear Corrado,
      Thank you very much for pointing this issue, I agree that it is confusing and I most likely got it wrong at some point. What I usually do is use the phrase “being susceptible to a nucleo/electro philic attack”. If I remember correctly, there is another answer in this post claiming the opposite but I can’t remember what we were trying to specify on the github page.
      I promise to take a look at it soon.

      Thanks for commenting!

  2. Sudip Kumar Das

    Hi, I am having trouble using your python script. I am using the Gaussian output file for Fukui index calculation. Can you help me with that?

  1. Pingback: How to calculate Fukui indices | Dr. Joaquin Barroso's Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: