public String generate(int[] atomIdxs) {

        if (atomIdxs == null)
            throw new NullPointerException("No atom indexes provided");
        if (atomIdxs.length == 0)
            return null; // makes sense?

        // special case
        if (atomIdxs.length == 1 && mode == MODE_EXACT)
            return aexpr[atomIdxs[0]];

        // initialize traversal information
        Arrays.fill(rbnds, 0);
        Arrays.fill(avisit, 0);
        for (int atmIdx : atomIdxs)
            avisit[atmIdx] = -1;

        // first visit marks ring information
        numVisit = 1;
        for (int atomIdx : atomIdxs) {
            if (avisit[atomIdx] < 0)
                markRings(atomIdx, -1);
        }

        // reset visit flags and generate
        numVisit = 1;
        for (int atmIdx : atomIdxs)
            avisit[atmIdx] = -1;

        // second pass builds the expression
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < atomIdxs.length; i++) {
            if (avisit[atomIdxs[i]] < 0) {
                if (i > 0) sb.append('.');
                encodeExpr(atomIdxs[i], -1, sb);
            }
        }

        return sb.toString();
    }
public String generate ( int [ ] atomIdxs ) { if ( atomIdxs == null ) throw new NullPointerException ( "No atom indexes provided" ) ; if ( atomIdxs . length == 0 ) return null ; if ( atomIdxs . length == 1 && mode == MODE_EXACT ) return aexpr [ atomIdxs [ 0 ] ] ; Arrays . fill ( rbnds , 0 ) ; Arrays . fill ( avisit , 0 ) ; for ( int atmIdx : atomIdxs ) avisit [ atmIdx ] = - 1 ; numVisit = 1 ; for ( int atomIdx : atomIdxs ) { if ( avisit [ atomIdx ] < 0 ) markRings ( atomIdx , - 1 ) ; } numVisit = 1 ; for ( int atmIdx : atomIdxs ) avisit [ atmIdx ] = - 1 ; StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < atomIdxs . length ; i ++ ) { if ( avisit [ atomIdxs [ i ] ] < 0 ) { if ( i > 0 ) sb . append ( '.' ) ; encodeExpr ( atomIdxs [ i ] , - 1 , sb ) ; } } return sb . toString ( ) ; }
Generate a SMARTS for the substructure formed of the provided
atoms.

@param atomIdxs atom indexes
@return SMARTS, null if an empty array is passed