@Override
    public DescriptorValue calculate(IAtomContainer container) {
        boolean[] originalFlag4 = new boolean[container.getAtomCount()];
        for (int i = 0; i < originalFlag4.length; i++) {
            originalFlag4[i] = container.getAtom(i).getFlag(CDKConstants.VISITED);
        }
        if (checkAromaticity) {
            try {
                AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(container);
                Aromaticity.cdkLegacy().apply(container);
            } catch (CDKException e) {
                return getDummyDescriptorValue(e);
            }
        }
        int largestPiSystemAtomsCount = 0;
        List<IAtom> startSphere;
        List<IAtom> path;
        //Set all VisitedFlags to False
        for (int i = 0; i < container.getAtomCount(); i++) {
            container.getAtom(i).setFlag(CDKConstants.VISITED, false);
        }
        //logger.debug("Set all atoms to Visited False");
        for (int i = 0; i < container.getAtomCount(); i++) {
            //Possible pi System double bond or triple bond, charge, N or O (free electron pair)
            //logger.debug("atom:"+i+" maxBondOrder:"+container.getMaximumBondOrder(atoms[i])+" Aromatic:"+atoms[i].getFlag(CDKConstants.ISAROMATIC)+" FormalCharge:"+atoms[i].getFormalCharge()+" Charge:"+atoms[i].getCharge()+" Flag:"+atoms[i].getFlag(CDKConstants.VISITED));
            if ((container.getMaximumBondOrder(container.getAtom(i)) != IBond.Order.SINGLE
                    || Math.abs(container.getAtom(i).getFormalCharge()) >= 1
                    || container.getAtom(i).getFlag(CDKConstants.ISAROMATIC)
                    || container.getAtom(i).getSymbol().equals("N") || container.getAtom(i).getSymbol().equals("O"))
                    && !container.getAtom(i).getFlag(CDKConstants.VISITED)) {
                //logger.debug("...... -> Accepted");
                startSphere = new ArrayList<IAtom>();
                path = new ArrayList<IAtom>();
                startSphere.add(container.getAtom(i));
                try {
                    breadthFirstSearch(container, startSphere, path);
                } catch (CDKException e) {
                    return getDummyDescriptorValue(e);
                }
                if (path.size() > largestPiSystemAtomsCount) {
                    largestPiSystemAtomsCount = path.size();
                }
            }

        }
        // restore original flag values
        for (int i = 0; i < originalFlag4.length; i++) {
            container.getAtom(i).setFlag(CDKConstants.VISITED, originalFlag4[i]);
        }

        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(), new IntegerResult(
                largestPiSystemAtomsCount), getDescriptorNames());
    }
@ Override public DescriptorValue calculate ( IAtomContainer container ) { boolean [ ] originalFlag4 = new boolean [ container . getAtomCount ( ) ] ; for ( int i = 0 ; i < originalFlag4 . length ; i ++ ) { originalFlag4 [ i ] = container . getAtom ( i ) . getFlag ( CDKConstants . VISITED ) ; } if ( checkAromaticity ) { try { AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( container ) ; Aromaticity . cdkLegacy ( ) . apply ( container ) ; } catch ( CDKException e ) { return getDummyDescriptorValue ( e ) ; } } int largestPiSystemAtomsCount = 0 ; List < IAtom > startSphere ; List < IAtom > path ; for ( int i = 0 ; i < container . getAtomCount ( ) ; i ++ ) { container . getAtom ( i ) . setFlag ( CDKConstants . VISITED , false ) ; } for ( int i = 0 ; i < container . getAtomCount ( ) ; i ++ ) { if ( ( container . getMaximumBondOrder ( container . getAtom ( i ) ) != IBond . Order . SINGLE || Math . abs ( container . getAtom ( i ) . getFormalCharge ( ) ) >= 1 || container . getAtom ( i ) . getFlag ( CDKConstants . ISAROMATIC ) || container . getAtom ( i ) . getSymbol ( ) . equals ( "N" ) || container . getAtom ( i ) . getSymbol ( ) . equals ( "O" ) ) && ! container . getAtom ( i ) . getFlag ( CDKConstants . VISITED ) ) { startSphere = new ArrayList < IAtom > ( ) ; path = new ArrayList < IAtom > ( ) ; startSphere . add ( container . getAtom ( i ) ) ; try { breadthFirstSearch ( container , startSphere , path ) ; } catch ( CDKException e ) { return getDummyDescriptorValue ( e ) ; } if ( path . size ( ) > largestPiSystemAtomsCount ) { largestPiSystemAtomsCount = path . size ( ) ; } } } for ( int i = 0 ; i < originalFlag4 . length ; i ++ ) { container . getAtom ( i ) . setFlag ( CDKConstants . VISITED , originalFlag4 [ i ] ) ; } return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new IntegerResult ( largestPiSystemAtomsCount ) , getDescriptorNames ( ) ) ; }
Calculate the count of atoms of the largest pi system in the supplied {@link IAtomContainer}.

<p>The method require one parameter:
<ol>
<li>if checkAromaticity is true, the method check the aromaticity,
<li>if false, means that the aromaticity has already been checked
</ol>

@param container The {@link IAtomContainer} for which this descriptor is to be calculated
@return the number of atoms in the largest pi system of this AtomContainer
@see #setParameters