code: public IMolecularFormula isValid(IMolecularFormula formula) {
          logger.info("Generating the validity of the molecular formula");
  
          if (formula.getIsotopeCount() == 0) {
              logger.error("Proposed molecular formula has not elements");
              return formula;
          }
  
          Iterator<IRule> iterRules = rules.iterator();
          try {
              while (iterRules.hasNext()) {
                  IRule rule = iterRules.next();
                  double result = rule.validate(formula);
                  formula.setProperty(rule.getClass(), result);
  
              }
          } catch (CDKException e) {
              e.printStackTrace();
          }
  
          return formula;
      }
docs: Validate if a IMolecularFormula is valid. The results of each IRule which
  has to be applied is put into IMolecularFormula as properties. To extract
  the result final as the product of rule's result use
  {@link #isValidSum(IMolecularFormula)}.
  
  @param  formula      The IMolecularFormula value
  @return formulaWith  The IMolecularFormula with the results for each
  IRule into properties
  @see                 #isValidSum(IMolecularFormula)