C squared population analysis

From cclib

(Redirected from C squared)

C-squared population analysis (CSPA) 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 can be written in terms of the molecular orbital coefficients:

 \Phi_{ai} = \frac{c^2_{ai}}{\sum_k c^2_{ki}}.

The CSPA class available from cclib.method performs C-squared population analysis and can be used as follows:

from cclib.method import CSPA
from cclib.parser import Gaussian

p=Gaussian("mycalc.out")
p.parse()

m=CSPA(p)
m.calculate()

After the calculate() method is called, the following attributes are available:

  • aoresults: a Numeric array[3] with spin, molecular orbital, and atomic/fragment orbitals as the axes (aoresults[0][45][0] gives the contribution of the 1st atomic/fragment orbital to the 46th alpha/restricted molecular orbital)
  • fragresults: a Numeric array[3] with spin, molecular orbital, and atoms as the axes (atomresults[1][23][4] gives the contribution of the 5th atomic/fragment orbital to the 24th beta molecular orbital)
  • fragcharges: a Numeric array[1] with the number of (partial) electrons in each atom (atomcharges[2] gives the number of electrons on the 3rd atom)

Custom fragments

Calling the calculate method without an argument treats each atom as a fragment in the population analysis. An optional argument can be passed - a list of lists - containing the atomic orbital numbers to be included in each fragment. Calling with this additional argument is useful if one is more interested in the contributions of certain orbitals, such as metal d, to the molecular orbitals. For example:

from cclib.method import CSPA
from cclib.parser import Gaussian

p = Gaussian("mycalc.out")
p.parse()

m = CSPA(p)
m.calculate([[0,1,2,3,4],[5,6],[7,8,9]]) #fragment one is made from basis functions 0-4
                                         #fragment two is made from basis functions 5&6
                                         #fragment three is made from basis functions 7-9

Custom progress

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

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

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

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