Logo Search packages:      
Sourcecode: cdk version File versions  Download package

IAtomContainer org::openscience::cdk::charges::MMFF94PartialCharges::assignMMFF94PartialCharges ( IAtomContainer  ac ) throws Exception [inline]

Main method which assigns MMFF94 partial charges

Parameters:
acAtomContainer
Returns:
AtomContainer with MMFF94 partial charges as atom properties
Exceptions:
ExceptionPossible Exceptions

Definition at line 73 of file MMFF94PartialCharges.java.

References org::openscience::cdk::modeling::builder3d::ForceFieldConfigurator::assignAtomTyps(), org::openscience::cdk::interfaces::IAtomContainer::atoms(), org::openscience::cdk::interfaces::IAtomType::getAtomTypeName(), org::openscience::cdk::interfaces::IAtom::getCharge(), org::openscience::cdk::interfaces::IAtomContainer::getConnectedAtomsList(), org::openscience::cdk::interfaces::IChemObject::getID(), org::openscience::cdk::modeling::builder3d::ForceFieldConfigurator::getParameterSet(), org::openscience::cdk::modeling::builder3d::ForceFieldConfigurator::setForceFieldConfigurator(), and org::openscience::cdk::interfaces::IChemObject::setProperty().

Referenced by org::openscience::cdk::qsar::descriptors::atomic::PartialTChargeMMFF94Descriptor::calculate().

                                                                                           {
            ForceFieldConfigurator ffc = new ForceFieldConfigurator();
            ffc.setForceFieldConfigurator("mmff94");
            ffc.assignAtomTyps((IMolecule)ac);
            Map<String,Object> parameterSet = ffc.getParameterSet();
            // for this calculation,
            // we need some values stored in the vector "data" in the
            // hashtable of these atomTypes:          
            double charge = 0;
            double formalCharge = 0;
            double formalChargeNeigh = 0;
            double theta = 0;
            double sumOfFormalCharges = 0;
            double sumOfBondIncrements = 0;
            IAtom thisAtom = null;
            List<IAtom> neighboors;
            Object data = null;
            Object bondData = null;
            Object dataNeigh = null;
            java.util.Iterator<IAtom> atoms = ac.atoms().iterator();
            while(atoms.hasNext()) {
                  //logger.debug("ATOM "+i+ " " +atoms[i].getSymbol());
                  thisAtom = atoms.next();
                  data = parameterSet.get("data"+thisAtom.getAtomTypeName());
                  neighboors = ac.getConnectedAtomsList(thisAtom);
                  formalCharge = thisAtom.getCharge();
                  theta = (Double)((List)data).get(5);
                  charge = formalCharge * (1 - (neighboors.size() * theta));
                  sumOfFormalCharges = 0;
                  sumOfBondIncrements = 0;
            for (IAtom neighboor : neighboors) {
                IAtom neighbour = (IAtom) neighboor;
                dataNeigh = parameterSet.get("data" + neighbour.getAtomTypeName());
                if (parameterSet.containsKey("bond" + thisAtom.getAtomTypeName() + ";" + neighbour.getAtomTypeName())) {
                    bondData = parameterSet.get("bond" + thisAtom.getAtomTypeName() + ";" + neighbour.getAtomTypeName());
                    sumOfBondIncrements -= (Double) ((List)bondData).get(4);
                } else
                if (parameterSet.containsKey("bond" + neighbour.getAtomTypeName() + ";" + thisAtom.getAtomTypeName())) {
                    bondData = parameterSet.get("bond" + neighbour.getAtomTypeName() + ";" + thisAtom.getAtomTypeName());
                    sumOfBondIncrements += (Double) ((List)bondData).get(4);
                } else {
                    // Maybe not all bonds have pbci in mmff94.prm, i.e. C-N
                    sumOfBondIncrements += (theta - (Double) ((List)dataNeigh).get(5));
                }


                dataNeigh = parameterSet.get("data" + neighbour.getID());
                formalChargeNeigh = neighbour.getCharge();
                sumOfFormalCharges += formalChargeNeigh;
            }
            charge += sumOfFormalCharges * theta;
                  charge += sumOfBondIncrements;
                  thisAtom.setProperty("MMFF94charge", charge);
                  //logger.debug( "CHARGE :"+thisAtom.getProperty("MMFF94charge") );
            }
            return ac;
      }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated by  Doxygen 1.6.0   Back to index