@ Override public DescriptorValue calculate ( IAtom atom , IAtomContainer ac ) { // FIXME: for now I'll cache a few modified atomic properties, and restore them at the end of this method Double originalCharge = atom . getCharge ( ) ; String originalAtomtypeName = atom . getAtomTypeName ( ) ; Integer originalNeighborCount = atom . getFormalNeighbourCount ( ) ; Integer originalValency = atom . getValency ( ) ; IAtomType . Hybridization originalHybridization = atom . getHybridization ( ) ; Double originalBondOrderSum = atom . getBondOrderSum ( ) ; Order originalMaxBondOrder = atom . getMaxBondOrder ( ) ; if ( ! isCachedAtomContainer ( ac ) ) { try { AtomContainerManipulator . percieveAtomTypesAndConfigureAtoms ( ac ) ; } catch ( CDKException e ) { new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( Double . NaN ) , NAMES , e ) ; } if ( lpeChecker ) { LonePairElectronChecker lpcheck = new LonePairElectronChecker ( ) ; try { lpcheck . saturate ( ac ) ; } catch ( CDKException e ) { new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( Double . NaN ) , NAMES , e ) ; } } if ( maxIterations != - 1 ) pepe . setMaxGasteigerIters ( maxIterations ) ; if ( maxResonStruc != - 1 ) pepe . setMaxResoStruc ( maxResonStruc ) ; try { peoe . assignGasteigerMarsiliSigmaPartialCharges ( ac , true ) ; List < Double > peoeAtom = new ArrayList < Double > ( ) ; for ( Iterator < IAtom > it = ac . atoms ( ) . iterator ( ) ; it . hasNext ( ) ; ) peoeAtom . ( it . next ( ) . getCharge ( ) ) ; for ( Iterator < IAtom > it = ac . atoms ( ) . iterator ( ) ; it . hasNext ( ) ; ) it . next ( ) . setCharge ( 0.0 ) ; pepe . assignGasteigerPiPartialCharges ( ac , true ) ; for ( int i = 0 ; i < ac . getAtomCount ( ) ; i ++ ) cacheDescriptorValue ( ac . getAtom ( i ) , ac , new DoubleResult ( peoeAtom . get ( i ) + ac . getAtom ( i ) . getCharge ( ) ) ) ; } catch ( Exception e ) { new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( Double . NaN ) , NAMES , e ) ; } } // restore original props atom . setCharge ( originalCharge ) ; atom . setAtomTypeName ( originalAtomtypeName ) ; atom . setFormalNeighbourCount ( originalNeighborCount ) ; atom . setValency ( originalValency ) ; atom . setHybridization ( originalHybridization ) ; atom . setMaxBondOrder ( originalMaxBondOrder ) ; atom . setBondOrderSum ( originalBondOrderSum ) ; return getCachedDescriptorValue ( atom ) != null ? new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , getCachedDescriptorValue ( atom ) , NAMES ) : null ; }
The method returns partial total charges assigned to an heavy atom through PEOE method . It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools . HydrogenAdder .