@ Override public DescriptorValue calculate ( IAtomContainer atomContainer ) { double zagreb = 0 ; for ( IAtom atom : atomContainer . atoms ( ) ) { if ( atom . getSymbol ( ) . equals ( "H" ) ) continue ; int atomDegree = 0 ; List < IAtom > neighbours = atomContainer . getConnectedAtomsList ( atom ) ; for ( IAtom neighbour : neighbours ) { if ( ! neighbour . getSymbol ( ) . equals ( "H" ) ) { atomDegree += 1 ; } } zagreb += ( atomDegree * atomDegree ) ; } return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( zagreb ) , getDescriptorNames ( ) ) ; }
Evaluate the Zagreb Index for a molecule .