Mulliken population analysis

Mulliken population analysis can be used to determine and interpret the electron density of a molecule. The contribution of the a-th atomic orbital to the i-th molecular orbital in this method is written in terms of the molecular orbital coefficients, c, and the overlap matrix, S:

$$ \Phi_{ai} = \sum_b c_{ai} c_{bi} S_{ab} $$

The MPA class available from cclib.method performs Mulliken population analysis and can be used as follows:

from cclib.method import MPA from cclib.parser import ccopen

d=ccopen("mycalc.out").parse m=MPA(d) m.calculate

After the calculate method is called, the following attributes are available:
 * aoresults: a three dimensional array with spin, molecular orbital, and atomic orbitals as the axes, so that aoresults[0][45][0] gives the contribution of the 1st atomic orbital to the 46th alpha/restricted molecular orbital,
 * fragresults: a three dimensional array with spin, molecular orbital, and atoms as the axes, so that fragresults[1][23][4] gives the contribution of the 5th fragment orbitals to the 24th beta molecular orbital)
 * fragcharges: a vector with the number of (partial) electrons in each fragment, so that fragcharges[2] gives the number of electrons in the 3rd fragment.

Custom fragments
The calculate method chooses atoms as the fragments by default, and optionally accepts a list of lists containing the atomic orbital numbers (e.g. [[0,1,2],[3,4,5,6],...]) of arbitrary fragments. Calling it in this way is useful if one is more interested in the contributions of groups of atoms or even certain orbitals or orbital groups, such as metal d, to the molecular orbitals. In this case, fragresults and fragcharges reflect the chosen groups of atomic orbitals instead of atoms.

Custom progress
The Mulliken class also can take a progress class as an argument so that the progress of the calculation can be monitored:

from cclib.method import Mulliken from cclib.parser import Gaussian from cclib.progress import TextProgress import logging

progress=TextProgress d=Gaussian("mycalc.out",progress,logging.ERROR).parse

m=Mulliken(p,progress,logging.ERROR) m.calculate