@ Override public DescriptorValue calculate ( IAtom atom , IAtomContainer ac ) { neighboors = ac . getConnectedAtomsList ( atom ) ; IAtomContainer clone ; try { clone = ( IAtomContainer ) ac . clone ( ) ; } catch ( CloneNotSupportedException e ) { return getDummyDescriptorValue ( e ) ; } try { peoe = new GasteigerMarsiliPartialCharges ( ) ; peoe . setMaxGasteigerIters ( 6 ) ; // HydrogenAdder hAdder = new HydrogenAdder(); // hAdder.addExplicitHydrogensToSatisfyValency(mol); peoe . assignGasteigerMarsiliSigmaPartialCharges ( clone , true ) ; } catch ( Exception exception ) { return getDummyDescriptorValue ( exception ) ; } IAtom localAtom = clone . getAtom ( ac . indexOf ( atom ) ) ; neighboors = clone . getConnectedAtomsList ( localAtom ) ; // we assume that an atom has a mxa number of protons = MAX_PROTON_COUNT // if it has less, we pad with NaN DoubleArrayResult protonPartialCharge = new DoubleArrayResult ( MAX_PROTON_COUNT ) ; assert ( neighboors . size ( ) < MAX_PROTON_COUNT ) ; protonPartialCharge . add ( localAtom . getCharge ( ) ) ; int hydrogenNeighbors = 0 ; for ( IAtom neighboor : neighboors ) { if ( neighboor . getSymbol ( ) . equals ( "H" ) ) { hydrogenNeighbors ++ ; protonPartialCharge . add ( neighboor . getCharge ( ) ) ; } } int remainder = MAX_PROTON_COUNT - ( hydrogenNeighbors + 1 ) ; for ( int i = 0 ; i < remainder ; i ++ ) protonPartialCharge . ( Double . NaN ) ; return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , protonPartialCharge , getDescriptorNames ( ) ) ; }
The method returns partial charges assigned to an heavy atom and its protons through Gasteiger Marsili It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools . HydrogenAdder .