polarity_number#

skfp.descriptors.polarity_number(mol: Mol, distance_matrix: ndarray | None = None, carbon_only: bool = False) int#

Polarity Number.

Calculates the Polarity Number [1] [2], defined as the total number of unordered pairs of vertices (atoms) in a molecular graph that are separated by a graph distance of exactly 3. It provides information about the structural connectivity of a molecule.

Parameters:
  • mol (RDKit Mol object) – The molecule for which the Polarity Number is to be calculated.

  • distance_matrix (np.ndarray, optional) – Precomputed distance matrix. If not provided, it will be calculated using RDKit.

  • carbon_only (bool, default=False) – Whether to consider only carbon-carbon distances. If True, the distance matrix will be filtered to include only rows and columns corresponding to carbon atoms.

References

Examples

>>> from rdkit.Chem import MolFromSmiles
>>> from skfp.descriptors import polarity_number
>>> mol = MolFromSmiles("C1=CC=CC=C1")  # Benzene
>>> polarity_number(mol)
3