code: public static Rectangle2D calculateBounds(IChemModel chemModel) {
          IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
          IReactionSet reactionSet = chemModel.getReactionSet();
          Rectangle2D totalBounds = new Rectangle2D.Double();
          if (moleculeSet != null) {
              totalBounds = totalBounds.createUnion(calculateBounds(moleculeSet));
          }
          if (reactionSet != null) {
              totalBounds = totalBounds.createUnion(calculateBounds(reactionSet));
          }
          return totalBounds;
      }
docs: Calculate the bounding rectangle for a chem model.
  
  @param chemModel the chem model to use
  @return the bounding rectangle of the chem model