public static double getTotalCharge(IAtomContainer atomContainer) {
        double charge = 0.0;
        for (IAtom atom : atomContainer.atoms()) {
            // we assume CDKConstant.UNSET is equal to 0
            Double thisCharge = atom.getCharge();
            if (thisCharge != CDKConstants.UNSET) charge += thisCharge;
        }
        return charge;
    }
public static double getTotalCharge ( IAtomContainer atomContainer ) { double charge = 0.0 ; for ( IAtom atom : atomContainer . atoms ( ) ) { Double thisCharge = atom . getCharge ( ) ; if ( thisCharge != CDKConstants . UNSET ) charge += thisCharge ; } return charge ; }
Get the summed charge of all atoms in an AtomContainer

@param  atomContainer The IAtomContainer to manipulate
@return The summed charges of all atoms in this AtomContainer.