public static double calculateAverageBondLength(IReaction reaction) {

        IAtomContainerSet reactants = reaction.getReactants();
        double reactantAverage = 0.0;
        if (reactants != null) {
            reactantAverage = calculateAverageBondLength(reactants) / reactants.getAtomContainerCount();
        }

        IAtomContainerSet products = reaction.getProducts();
        double productAverage = 0.0;
        if (products != null) {
            productAverage = calculateAverageBondLength(products) / products.getAtomContainerCount();
        }

        if (productAverage == 0.0 && reactantAverage == 0.0) {
            return 1.0;
        } else {
            return (productAverage + reactantAverage) / 2.0;
        }
    }
public static double calculateAverageBondLength ( IReaction reaction ) { IAtomContainerSet reactants = reaction . getReactants ( ) ; double reactantAverage = 0.0 ; if ( reactants != null ) { reactantAverage = calculateAverageBondLength ( reactants ) / reactants . getAtomContainerCount ( ) ; } IAtomContainerSet products = reaction . getProducts ( ) ; double productAverage = 0.0 ; if ( products != null ) { productAverage = calculateAverageBondLength ( products ) / products . getAtomContainerCount ( ) ; } if ( productAverage == 0.0 && reactantAverage == 0.0 ) { return 1.0 ; } else { return ( productAverage + reactantAverage ) / 2.0 ; } }
Calculate the average bond length for the bonds in a reaction.

@param reaction the reaction to use
@return the average bond length