public IAtom configureMM2BasedAtom(IAtom atom, String hoseCode, boolean hetRing) throws NoSuchAtomTypeException {
        //logger.debug("CONFIGURE MM2 ATOM");
        List<Pattern> atomTypePattern = null;
        MM2BasedAtomTypePattern atp = new MM2BasedAtomTypePattern();
        atomTypePattern = atp.getAtomTypePatterns();
        Double d_tmp = null;
        Pattern p = null;
        String ID = "";
        boolean atomTypeFlag = false;

        if (atom instanceof IPseudoAtom) {
            return atom;
        }

        hoseCode = removeAromaticityFlagsFromHoseCode(hoseCode);

        String[] ids = {"C", "Csp2", "C=", "Csp", "HC", "O", "O=", "N", "Nsp2", "Nsp", "F", "CL", "BR", "I", "S", "S+",
                ">SN", "SO2", "SI", "LP", "HO", "CR3R", "HN", "HOCO", "P", "B", "BTET", "HN2", "C.", "C+", "GE", "SN",
                "PB", "SE", "TE", "D", "NPYD", "CE3R", "N+", "NPYL", "Oar", "Sthi", "N2OX", "HS", "=N=", "NO3", "OM",
                "HN+", "OR", "Car", "HE", "NE", "AR", "KR", "XE", "", "", "", "MG", "PTET", "FE", "FE", "NI", "NI",
                "CO", "CO", "", "", "OX", "OK", "C++", "N=C", "NPD+", "N+=", "N2OX"};

        for (int j = 0; j < atomTypePattern.size(); j++) {
            p = (Pattern) atomTypePattern.get(j);
            Matcher mat = p.matcher(hoseCode);
            if (mat.matches()) {
                ID = ids[j];
                //CHECK Rings 1,2,8,9? Thiole 44? AZO 9? Radical - ? Amid 23/enol 21?
                if (j == 0) {
                    //csp3
                    if (atom.getFlag(CDKConstants.ISINRING)) {
                        if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(3))) {
                            ID = ids[21];
                        } else if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(6))
                                && atom.getFlag(CDKConstants.ISAROMATIC)) {
                            ID = ids[1];
                        } else if (atom.getFlag(CDKConstants.ISAROMATIC)) {
                            ID = ids[1];
                        }
                    }
                } else if (j == 1) {
                    //csp2
                    if (atom.getFlag(CDKConstants.ISINRING)) {
                        if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(6))
                                && atom.getFlag(CDKConstants.ISAROMATIC)) {
                        } else if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(3))) {
                            ID = ids[37];
                        } else {
                            ID = ids[1];
                        }
                    }
                    p = (Pattern) atomTypePattern.get(2);
                    //COOH
                    mat = p.matcher(hoseCode);
                    if (mat.matches() && !atom.getFlag(CDKConstants.ISINRING)) {
                        ID = ids[2];
                    }

                } else if (j == 5) {
                    //OH/Ether
                    if (atom.getFlag(CDKConstants.ISINRING)) {
                        if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(3))) {
                            ID = ids[48];
                            //EPOXY
                        } else if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))
                                && atom.getFlag(CDKConstants.ISAROMATIC)) {
                            ID = ids[40];
                        } else {
                            ID = ids[5];
                        }
                    }
                } else if (j == 7) {
                    //n sp3
                    if (atom.getFlag(CDKConstants.ISINRING) && atom.getFlag(CDKConstants.ISAROMATIC)) {
                        if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(5))) {
                            ID = ids[39];
                        }
                    }
                    //Amid
                    p = (Pattern) atomTypePattern.get(77);
                    mat = p.matcher(hoseCode);
                    if (mat.matches() && !atom.getFlag(CDKConstants.ISINRING)) {
                        ID = ids[8];
                    }
                } else if (j == 8) {
                    //nsp2
                    if (atom.getFlag(CDKConstants.ISINRING)) {
                        if (atom.getProperty("RING_SIZE").equals(Integer.valueOf(6))) {
                            ID = ids[36];
                        }
                    }
                    p = (Pattern) atomTypePattern.get(36);
                    //AZO
                    mat = p.matcher(hoseCode);
                    if (mat.matches() && !atom.getFlag(CDKConstants.ISINRING)) {
                        ID = ids[36];
                    }

                } else if (j == 43) {
                    //h thiol
                    d_tmp = (Double) atom.getProperty("MAX_BOND_ORDER");
                    if (d_tmp.doubleValue() > 1) {
                        ID = ids[4];
                    }
                } else if (j == 20) {
                    //h alcohol,ether
                    p = (Pattern) atomTypePattern.get(76);
                    //Enol
                    mat = p.matcher(hoseCode);
                    if (mat.matches() && !atom.getFlag(CDKConstants.ISINRING)) {
                        ID = ids[27];
                    }
                    p = (Pattern) atomTypePattern.get(23);
                    //COOH
                    mat = p.matcher(hoseCode);
                    if (mat.matches() && !atom.getFlag(CDKConstants.ISINRING)) {
                        ID = ids[23];
                    }
                } else if (j == 22) {
                    p = (Pattern) atomTypePattern.get(75);
                    //Amid
                    mat = p.matcher(hoseCode);
                    if (mat.matches()) {
                        ID = ids[27];
                    }
                }

                atomTypeFlag = true;
                //logger.debug("Atom Symbol:" + atom.getSymbol() + " MATCH AtomType> " + ID + " HoseCode>" + hoseCode + " ");
                break;
            }//IF
        }//for end
        if (atomTypeFlag) {
            atomTypeFlag = false;
            return setAtom(atom, ID);
        } else {
            throw new NoSuchAtomTypeException("Atom is unkown: Symbol:" + atom.getSymbol()
                    + " does not MATCH AtomType. HoseCode:" + hoseCode);
        }
    }
public IAtom configureMM2BasedAtom ( IAtom atom , String hoseCode , boolean hetRing ) throws NoSuchAtomTypeException { List < Pattern > atomTypePattern = null ; MM2BasedAtomTypePattern atp = new MM2BasedAtomTypePattern ( ) ; atomTypePattern = atp . getAtomTypePatterns ( ) ; Double d_tmp = null ; Pattern p = null ; String ID = "" ; boolean atomTypeFlag = false ; if ( atom instanceof IPseudoAtom ) { return atom ; } hoseCode = removeAromaticityFlagsFromHoseCode ( hoseCode ) ; String [ ] ids = { "C" , "Csp2" , "C=" , "Csp" , "HC" , "O" , "O=" , "N" , "Nsp2" , "Nsp" , "F" , "CL" , "BR" , "I" , "S" , "S+" , ">SN" , "SO2" , "SI" , "LP" , "HO" , "CR3R" , "HN" , "HOCO" , "P" , "B" , "BTET" , "HN2" , "C." , "C+" , "GE" , "SN" , "PB" , "SE" , "TE" , "D" , "NPYD" , "CE3R" , "N+" , "NPYL" , "Oar" , "Sthi" , "N2OX" , "HS" , "=N=" , "NO3" , "OM" , "HN+" , "OR" , "Car" , "HE" , "NE" , "AR" , "KR" , "XE" , "" , "" , "" , "MG" , "PTET" , "FE" , "FE" , "NI" , "NI" , "CO" , "CO" , "" , "" , "OX" , "OK" , "C++" , "N=C" , "NPD+" , "N+=" , "N2OX" } ; for ( int j = 0 ; j < atomTypePattern . size ( ) ; j ++ ) { p = ( Pattern ) atomTypePattern . get ( j ) ; Matcher mat = p . matcher ( hoseCode ) ; if ( mat . matches ( ) ) { ID = ids [ j ] ; if ( j == 0 ) { if ( atom . getFlag ( CDKConstants . ISINRING ) ) { if ( atom . getProperty ( "RING_SIZE" ) . equals ( Integer . valueOf ( 3 ) ) ) { ID = ids [ 21 ] ; } else if ( atom . getProperty ( "RING_SIZE" ) . equals ( Integer . valueOf ( 6 ) ) && atom . getFlag ( CDKConstants . ISAROMATIC ) ) { ID = ids [ 1 ] ; } else if ( atom . getFlag ( CDKConstants . ISAROMATIC ) ) { ID = ids [ 1 ] ; } } } else if ( j == 1 ) { if ( atom . getFlag ( CDKConstants . ISINRING ) ) { if ( atom . getProperty ( "RING_SIZE" ) . equals ( Integer . valueOf ( 6 ) ) && atom . getFlag ( CDKConstants . ISAROMATIC ) ) { } else if ( atom . getProperty ( "RING_SIZE" ) . equals ( Integer . valueOf ( 3 ) ) ) { ID = ids [ 37 ] ; } else { ID = ids [ 1 ] ; } } p = ( Pattern ) atomTypePattern . get ( 2 ) ; mat = p . matcher ( hoseCode ) ; if ( mat . matches ( ) && ! atom . getFlag ( CDKConstants . ISINRING ) ) { ID = ids [ 2 ] ; } } else if ( j == 5 ) { if ( atom . getFlag ( CDKConstants . ISINRING ) ) { if ( atom . getProperty ( "RING_SIZE" ) . equals ( Integer . valueOf ( 3 ) ) ) { ID = ids [ 48 ] ; } else if ( atom . getProperty ( "RING_SIZE" ) . equals ( Integer . valueOf ( 5 ) ) && atom . getFlag ( CDKConstants . ISAROMATIC ) ) { ID = ids [ 40 ] ; } else { ID = ids [ 5 ] ; } } } else if ( j == 7 ) { if ( atom . getFlag ( CDKConstants . ISINRING ) && atom . getFlag ( CDKConstants . ISAROMATIC ) ) { if ( atom . getProperty ( "RING_SIZE" ) . equals ( Integer . valueOf ( 5 ) ) ) { ID = ids [ 39 ] ; } } p = ( Pattern ) atomTypePattern . get ( 77 ) ; mat = p . matcher ( hoseCode ) ; if ( mat . matches ( ) && ! atom . getFlag ( CDKConstants . ISINRING ) ) { ID = ids [ 8 ] ; } } else if ( j == 8 ) { if ( atom . getFlag ( CDKConstants . ISINRING ) ) { if ( atom . getProperty ( "RING_SIZE" ) . equals ( Integer . valueOf ( 6 ) ) ) { ID = ids [ 36 ] ; } } p = ( Pattern ) atomTypePattern . get ( 36 ) ; mat = p . matcher ( hoseCode ) ; if ( mat . matches ( ) && ! atom . getFlag ( CDKConstants . ISINRING ) ) { ID = ids [ 36 ] ; } } else if ( j == 43 ) { d_tmp = ( Double ) atom . getProperty ( "MAX_BOND_ORDER" ) ; if ( d_tmp . doubleValue ( ) > 1 ) { ID = ids [ 4 ] ; } } else if ( j == 20 ) { p = ( Pattern ) atomTypePattern . get ( 76 ) ; mat = p . matcher ( hoseCode ) ; if ( mat . matches ( ) && ! atom . getFlag ( CDKConstants . ISINRING ) ) { ID = ids [ 27 ] ; } p = ( Pattern ) atomTypePattern . get ( 23 ) ; mat = p . matcher ( hoseCode ) ; if ( mat . matches ( ) && ! atom . getFlag ( CDKConstants . ISINRING ) ) { ID = ids [ 23 ] ; } } else if ( j == 22 ) { p = ( Pattern ) atomTypePattern . get ( 75 ) ; mat = p . matcher ( hoseCode ) ; if ( mat . matches ( ) ) { ID = ids [ 27 ] ; } } atomTypeFlag = true ; break ; } } if ( atomTypeFlag ) { atomTypeFlag = false ; return setAtom ( atom , ID ) ; } else { throw new NoSuchAtomTypeException ( "Atom is unkown: Symbol:" + atom . getSymbol ( ) + " does not MATCH AtomType. HoseCode:" + hoseCode ) ; } }
Configures an atom to a mm2 based atom type

@param  atom              atom to be configured
@param  hoseCode          the 4 sphere hose code of the atom
@return                   atom
@exception  NoSuchAtomTypeException  atomType is not known