code: public static double calculateAverageBondLength(IChemModel model) {
  
          // empty models have to have a scale
          IAtomContainerSet moleculeSet = model.getMoleculeSet();
          if (moleculeSet == null) {
              IReactionSet reactionSet = model.getReactionSet();
              if (reactionSet != null) {
                  return calculateAverageBondLength(reactionSet);
              }
              return 0.0;
          }
  
          return calculateAverageBondLength(moleculeSet);
      }
docs: Calculate the average bond length for the bonds in a chem model.
  
  @param model the model for which to calculate the average bond length
  @return the average bond length