private List < InvPair > createInvarLabel ( IAtomContainer atomContainer ) { Iterator < IAtom > atoms = atomContainer . atoms ( ) . iterator ( ) ; IAtom a ; StringBuffer inv ; List < InvPair > vect = new ArrayList < InvPair > ( ) ; while ( atoms . hasNext ( ) ) { a = ( IAtom ) atoms . next ( ) ; inv = new StringBuffer ( ) ; inv . append ( atomContainer . getConnectedAtomsList ( a ) . size ( ) + ( a . getImplicitHydrogenCount ( ) == CDKConstants . UNSET ? 0 : a . getImplicitHydrogenCount ( ) ) ) ; //Num connections inv . append ( atomContainer . getConnectedAtomsList ( a ) . size ( ) ) ; //Num of non H bonds inv . append ( PeriodicTable . getAtomicNumber ( a . getSymbol ( ) ) ) ; Double charge = a . getCharge ( ) ; if ( charge == CDKConstants . UNSET ) charge = 0.0 ; if ( charge < 0 ) //Sign of charge inv . append ( 1 ) ; else inv . append ( 0 ) ; //Absolute charge inv . append ( ( int ) Math . abs ( ( a . getFormalCharge ( ) == CDKConstants . UNSET ? 0.0 : a . getFormalCharge ( ) ) ) ) ; //Hydrogen count inv . append ( ( a . getImplicitHydrogenCount ( ) == CDKConstants . UNSET ? 0 : a . getImplicitHydrogenCount ( ) ) ) ; vect . add ( new InvPair ( Long . parseLong ( inv . toString ( ) ) , a ) ) ; } return vect ; }
Create initial invariant labeling corresponds to step 1