fuellib.gcm.gani.GaniDecomposer

class fuellib.gcm.gani.GaniDecomposer(method, table_groups, first_order_groups)

Bases: Decomposer

Decomposer for first and second order Gani-Constantinou groups.

Initialize the decomposer with a GCM’s group data.

Parameters:
  • method (str) – Display name of the GCM used in error messages.

  • table_groups (Index) – Group names that are columns of the GCM parameter table.

  • first_order_groups (Sequence[tuple[str, str]]) – (group name, SMARTS) pairs ordered by priority.

Methods

context

Build the shared prefix of every decomposition error message.

first_order_counts

Count first order groups, requiring that they cover every atom.

parse_smarts

Parse a SMARTS pattern used to decompose a molecule.

parse_smiles

Validate and parse a SMILES string.

second_order_counts

Count second order groups from SMARTS patterns and non-aromatic rings.

second_order_counts(mol, smiles)

Count second order groups from SMARTS patterns and non-aromatic rings.

Parameters:
  • mol (Mol) – The parsed molecule.

  • smiles (str) – The SMILES string being decomposed, used in error messages.

Returns:

A mapping of second order group name to its number of occurrences.

Return type:

dict[str, int]