@ Override public DescriptorValue calculate ( IAtomContainer container ) { double bpol = 0 ; int atomicNumber0 ; int atomicNumber1 ; double difference ; try { IsotopeFactory ifac = Isotopes . getInstance ( ) ; IElement element0 ; IElement element1 ; String symbol0 ; String symbol1 ; for ( IBond bond : container . bonds ( ) ) { IAtom atom0 = bond . getBegin ( ) ; IAtom atom1 = bond . getEnd ( ) ; symbol0 = atom0 . getSymbol ( ) ; symbol1 = atom1 . getSymbol ( ) ; element0 = ifac . getElement ( symbol0 ) ; element1 = ifac . getElement ( symbol1 ) ; atomicNumber0 = element0 . getAtomicNumber ( ) ; atomicNumber1 = element1 . getAtomicNumber ( ) ; difference = polarizabilities [ atomicNumber0 ] - polarizabilities [ atomicNumber1 ] ; bpol += Math . abs ( difference ) ; } // after going through the bonds, we go through the atoms and see if they have // implicit H's and if so, consider the associated "implicit" bonds. Note that // if the count is UNSET, we assume it is 0 for ( IAtom atom : container . atoms ( ) ) { int impH = atom . getImplicitHydrogenCount ( ) == CDKConstants . UNSET ? 0 : atom . getImplicitHydrogenCount ( ) ; IElement elem = ifac . getElement ( atom . getSymbol ( ) ) ; int atnum = elem . getAtomicNumber ( ) ; difference = Math . abs ( polarizabilities [ atnum ] - polarizabilities [ 1 ] ) * impH ; bpol += difference ; } return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( bpol ) , getDescriptorNames ( ) ) ; } catch ( Exception ex1 ) { logger . debug ( ex1 ) ; return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( Double . NaN ) , getDescriptorNames ( ) , new CDKException ( "Problems with IsotopeFactory due to " + ex1 . toString ( ) , ex1 ) ) ; } }
This method calculate the sum of the absolute value of the difference between atomic polarizabilities of all bonded atoms in the molecule