void OEMolecularFormula(std::string &str, const OEMolBase &mol, bool hydrogenisotopic=false)

This function calculates the molecular formula for the given molecule, return the result in the str argument. The component elements of the molecular formula are listed in Hill order. This function determines the cumulative molecular formula, so elements from different connected components are summed. To generate a “dot disconnected” molecular formula, this function should be used to generate the formula for each component or part, and the results concatenated together as appropriate. If the ‘hydrogenisotopic’ parameter is true, and the molecule contains any atoms of deuterium or tritium, then the output molecular formula will represent them as D or T as appropriate. By default hydrogens isotopes are summed together as H.