Chemistry Toolkit Rosetta Wiki

Molecular Connectivity Indices (MCIs), also known as Kier-Hall connectivity indices were useful molecular descriptors for predicting properties for chemicals.

To calculate these MCIs, the connectivity count for each atom needs to be obtained. This is easily facilitated by openbabel module, to give the atom.valence info:

# take the p,p'-DDT as an input SMILES

from pybel import *
from openbabel import *
mol = readstring("smi","c(ccc(c1)Cl)(c1)C(c(ccc(c2)Cl)c2)C(Cl)(Cl)Cl") # p,p'-DDT

for atom in mol.atoms:

actually we use atom.idx to match the index and the valence (connectivity) of the current atom

for atom in mol.atoms:

For later convenience, a dictionary could be created for the idx and valence info

idx_valDict = dict()
for atom in mol.atoms:
    idx_valDict[atom.idx] = atom.valence

The zero order MCI (MCI0) only considers each atom itself, therefore

MCI0 = 0
for atom in mol.atoms:
    MCI0 = MCI0 + atom.valence ** (-0.5)

The first order MCI (MCI1) considers bonded atoms, therefore we need to firstly find out all bonds.

Without using the lower-level OBMol, we can use SMARTS code:

# get bonds info of mol, SMARTS: *~*
bonds = Smarts("*~*").findall(mol)
MCI1 = 0

# the previously defined dictionary would be useful here ^_^
for bond in bonds:
    MCI1 = MCI1 + (idx_valDict[bond[0]]*idx_valDict[bond[1]]) ** (-0.5)


The spirit of second order MCI would be similar: it considers atoms within an angle.

Therefore, we could use angle SMARTS to match all triple tuples. I'll leave this to the readers for exercise.