Try to parse the given compound formula string.

        Logs a warning if the formula could not be parsed.

def _try_parse_formula(self, compound_id, s):
        """Try to parse the given compound formula string.

        Logs a warning if the formula could not be parsed.
        """
        s = s.strip()
        if s == '':
            return None

        try:
            # Do not return the parsed formula. For now it is better to keep
            # the original formula string unchanged in all cases.
            formula.Formula.parse(s)
        except formula.ParseError:
            logger.warning('Unable to parse compound formula {}: {}'.format(
                compound_id, s))

        return s