code: @Override
      public double validate(IMolecularFormula formula) throws CDKException {
          logger.info("Start validation of ", formula);
  
          if (formula.getCharge() == null) {
              return 0.0;
          } else if (formula.getCharge() == charge) {
              return 1.0;
          } else {
              return 0.0;
          }
      }
docs: Validate the charge of this IMolecularFormula.
  
  @param formula   Parameter is the IMolecularFormula
  @return          A double value meaning 1.0 True, 0.0 False