public boolean partialCharges(IAtomContainer mol) {

        int[][] adjList = mol.getProperty(MMFF_ADJLIST_CACHE);
        GraphUtil.EdgeToBondMap edgeMap = mol.getProperty(MMFF_EDGEMAP_CACHE);

        if (adjList == null || edgeMap == null)
            throw new IllegalArgumentException("Invoke assignAtomTypes first.");

        effectiveCharges(mol);
        
        for (int v = 0; v < mol.getAtomCount(); v++) {

            IAtom atom = mol.getAtom(v);
            String symbType = atom.getAtomTypeName();
            final int thisType = mmffParamSet.intType(symbType);

            // unknown
            if (thisType == 0)
                continue;

            double pbci = mmffParamSet.getPartialBondChargeIncrement(thisType).doubleValue();

            for (int w : adjList[v]) {

                int otherType = mmffParamSet.intType(mol.getAtom(w).getAtomTypeName());

                // unknown
                if (otherType == 0)
                    continue;

                IBond bond = edgeMap.get(v, w);
                int bondCls = mmffParamSet.getBondCls(thisType, otherType, bond.getOrder().numeric(), bond.getProperty(MMFF_AROM) != null);
                BigDecimal bci = mmffParamSet.getBondChargeIncrement(bondCls, thisType, otherType);
                if (bci != null) {
                    atom.setCharge(atom.getCharge() - bci.doubleValue());
                }
                else {
                    // empirical BCI
                    atom.setCharge(atom.getCharge() + (pbci - mmffParamSet.getPartialBondChargeIncrement(otherType).doubleValue()));
                }
            }
        }

        return true;
    }
public boolean partialCharges ( IAtomContainer mol ) { int [ ] [ ] adjList = mol . getProperty ( MMFF_ADJLIST_CACHE ) ; GraphUtil . EdgeToBondMap edgeMap = mol . getProperty ( MMFF_EDGEMAP_CACHE ) ; if ( adjList == null || edgeMap == null ) throw new IllegalArgumentException ( "Invoke assignAtomTypes first." ) ; effectiveCharges ( mol ) ; for ( int v = 0 ; v < mol . getAtomCount ( ) ; v ++ ) { IAtom atom = mol . getAtom ( v ) ; String symbType = atom . getAtomTypeName ( ) ; final int thisType = mmffParamSet . intType ( symbType ) ; if ( thisType == 0 ) continue ; double pbci = mmffParamSet . getPartialBondChargeIncrement ( thisType ) . doubleValue ( ) ; for ( int w : adjList [ v ] ) { int otherType = mmffParamSet . intType ( mol . getAtom ( w ) . getAtomTypeName ( ) ) ; if ( otherType == 0 ) continue ; IBond bond = edgeMap . get ( v , w ) ; int bondCls = mmffParamSet . getBondCls ( thisType , otherType , bond . getOrder ( ) . numeric ( ) , bond . getProperty ( MMFF_AROM ) != null ) ; BigDecimal bci = mmffParamSet . getBondChargeIncrement ( bondCls , thisType , otherType ) ; if ( bci != null ) { atom . setCharge ( atom . getCharge ( ) - bci . doubleValue ( ) ) ; } else { atom . setCharge ( atom . getCharge ( ) + ( pbci - mmffParamSet . getPartialBondChargeIncrement ( otherType ) . doubleValue ( ) ) ) ; } } } return true ; }
Assign the partial charges, all existing charges are cleared.
Atom types must be assigned first.

@param mol molecule
@return charges were assigned
@see #effectiveCharges(IAtomContainer)
@see #assignAtomTypes(IAtomContainer)