def formula(zma): """ Generate a stoichiometric formula dictionary from a Z-Matrix. :param zma: Z-Matrix :type zma: automol Z-Matrix data structure :type: dict[str: int] """ syms = symbols(zma) fml = util.formula_from_symbols(syms) return fml
def formula(geo): """ Generate a stoichiometric formula dictionary from a molecular geometry. :param geo: molecular geometry :type geo: automol geometry data structure :type: dict[str: int] """ symbs = symbols(geo) fml = util.formula_from_symbols(symbs) return fml
def formula(gra): """ Generate a stoichiometric formula dictionary from a molecular graph. :param gra: molecular graph :type gra: automol graph data structure :type: dict[str: int] """ gra = explicit(gra) syms = atom_symbols(gra).values() fml = util.formula_from_symbols(syms) return fml
def to_formula(rdm): """ Generate a molecular formula dictionary from an RDKit molecule object. :param rdm: molecule object :type rdm: RDKit molecule object :rtype: dict[str:int] """ rdm = _rd_chem.AddHs(rdm) atms = rdm.GetAtoms() syms = [rda.GetSymbol() for rda in atms] fml = util.formula_from_symbols(syms) return fml