@ Override public DescriptorValue calculate ( IAtom atom , IAtomContainer org ) { if ( atom . getProperty ( CHARGE_CACHE ) == null ) { IAtomContainer copy ; try { copy = org . clone ( ) ; } catch ( CloneNotSupportedException e ) { return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( Double . NaN ) , NAMES ) ; } for ( IAtom a : org . atoms ( ) ) { if ( a . getImplicitHydrogenCount ( ) == null || a . getImplicitHydrogenCount ( ) != 0 ) { logger . error ( "Hydrogens must be explict for MMFF charge calculation" ) ; return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( Double . NaN ) , NAMES ) ; } } if ( ! mmff . assignAtomTypes ( copy ) ) logger . warn ( "One or more atoms could not be assigned an MMFF atom type" ) ; mmff . partialCharges ( copy ) ; mmff . clearProps ( copy ) ; // cache charges for ( int i = 0 ; i < org . getAtomCount ( ) ; i ++ ) { org . getAtom ( i ) . setProperty ( CHARGE_CACHE , copy . getAtom ( i ) . getCharge ( ) ) ; } } return new DescriptorValue ( getSpecification ( ) , getParameterNames ( ) , getParameters ( ) , new DoubleResult ( atom . getProperty ( CHARGE_CACHE , Double . class ) ) , NAMES ) ; }
The method returns partial charges assigned to an heavy atom through MMFF94 method . It is needed to call the addExplicitHydrogensToSatisfyValency method from the class tools . HydrogenAdder .