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

void org::openscience::cdk::modeling::forcefield::Torsions::setMMFF94TorsionsParameters ( IAtomContainer  molecule,
Map  parameterSet 
) throws Exception [inline]

Set MMFF94 constants V1, V2 and V3 for each i-j, j-k and k-l bonded pairs in the molecule.

Parameters:
moleculeThe molecule like an AtomContainer object.
parameterSetMMFF94 parameters set
Exceptions:
ExceptionDescription of the Exception

Definition at line 102 of file Torsions.java.

References org::openscience::cdk::tools::manipulator::BondManipulator::getAtomArray(), org::openscience::cdk::tools::manipulator::AtomContainerManipulator::getBondArray(), org::openscience::cdk::modeling::builder3d::MMFF94ParametersCall::getTorsionData(), and org::openscience::cdk::modeling::builder3d::MMFF94ParametersCall::initialize().

Referenced by org::openscience::cdk::modeling::forcefield::MMFF94EnergyFunction::MMFF94EnergyFunction().

                                                                                                          {

            //logger.debug("setMMFF94TorsionsParameters");

        // looks like we need the bonds in an array for the rest of the class
        bond = new IBond[molecule.getBondCount()];
        int counter = 0;
        Iterator bonds = molecule.bonds().iterator();
        while (bonds.hasNext()) {
            IBond aBond = (IBond) bonds.next();
            bond[counter] = aBond;
            counter++;
        }
                
            for (int b=0; b<bond.length; b++) {
                  atomInBond = BondManipulator.getAtomArray(bond[b]);
                  bondConnectedBefore = AtomContainerManipulator.getBondArray(molecule.getConnectedBondsList(atomInBond[0]));
                  if (bondConnectedBefore.length > 1) {
                        bondConnectedAfter = AtomContainerManipulator.getBondArray(molecule.getConnectedBondsList(atomInBond[1]));
                        if (bondConnectedAfter.length > 1) {
                              for (int bb=0; bb<bondConnectedBefore.length; bb++) {
                                    if (bondConnectedBefore[bb].compare(bond[b])) {}
                                    else {
                                          for (int ba=0; ba<bondConnectedAfter.length; ba++) {
                                                if (bondConnectedAfter[ba].compare(bond[b])) {}
                                                else {
                                                      if (bondConnectedBefore[bb].isConnectedTo(bondConnectedAfter[ba])) {}
                                                      else {
                                                            torsionNumber += 1;
                                                            //logger.debug("atomi(" + torsionNumber + ") : " + bondConnectedBefore[bb].getConnectedAtom(atomInBond[0]).getAtomTypeName());
                                                            //logger.debug("atomj(" + torsionNumber + ") : " + atomInBond[0].getAtomTypeName());
                                                            //logger.debug("atomk(" + torsionNumber + ") : " + atomInBond[1].getAtomTypeName());
                                                            //logger.debug("atoml(" + torsionNumber + ") : " + bondConnectedAfter[ba].getConnectedAtom(atomInBond[1]).getAtomTypeName());
                                                      }     
                                                }
                                          }
                                    }
                              }
                        }
                  }
            }
            //logger.debug("torsionNumber = " + torsionNumber);

            List torsionsData = null;
            MMFF94ParametersCall pc = new MMFF94ParametersCall();
            pc.initialize(parameterSet);
            
            v1 = new double[torsionNumber];
            v2 = new double[torsionNumber];
            v3 = new double[torsionNumber];

            torsionAtomPosition = new int[torsionNumber][];

            String torsionType;
            int m = -1;
            for (int b=0; b<bond.length; b++) {
                  atomInBond = BondManipulator.getAtomArray(bond[b]);
                  bondConnectedBefore = AtomContainerManipulator.getBondArray(molecule.getConnectedBondsList(atomInBond[0]));
                  if (bondConnectedBefore.length > 1) {
                        bondConnectedAfter = AtomContainerManipulator.getBondArray(molecule.getConnectedBondsList(atomInBond[1]));
                        if (bondConnectedAfter.length > 1) {
                              for (int bb=0; bb<bondConnectedBefore.length; bb++) {
                                    if (bondConnectedBefore[bb].compare(bond[b])) {}
                                    else {
                                          for (int ba=0; ba<bondConnectedAfter.length; ba++) {
                                                if (bondConnectedAfter[ba].compare(bond[b])) {}
                                                else {
                                                      if (bondConnectedBefore[bb].isConnectedTo(bondConnectedAfter[ba])) {}
                                                      else {
                                                            m += 1;
                                                            torsionAtomPosition[m] = new int[4];
                                                            torsionAtomPosition[m][0] = molecule.getAtomNumber(bondConnectedBefore[bb].getConnectedAtom(atomInBond[0]));
                                                            torsionAtomPosition[m][1] = molecule.getAtomNumber(atomInBond[0]);
                                                            torsionAtomPosition[m][2] = molecule.getAtomNumber(atomInBond[1]);
                                                            torsionAtomPosition[m][3] = molecule.getAtomNumber(bondConnectedAfter[ba].getConnectedAtom(atomInBond[1]));
                                                      
                                                            /*System.out.println("torsion " + m + " : " + bondConnectedBefore[bb].getConnectedAtom(atomInBond[0]).getFlag(CDKConstants.ISINRING) + "(" + torsionAtomPosition[m][0] + "), " + 
                                                                        atomInBond[0].getFlag(CDKConstants.ISINRING) + "(" + torsionAtomPosition[m][1] + "), " + atomInBond[1].getFlag(CDKConstants.ISINRING) + "(" + torsionAtomPosition[m][2] + "), " + 
                                                                        bondConnectedAfter[ba].getConnectedAtom(atomInBond[1]).getFlag(CDKConstants.ISINRING) + "(" + torsionAtomPosition[m][3] + ")");           
                                                          */
                                                            /*System.out.println("torsionAtomPosition[" + m + "]: " + bondConnectedBefore[bb].getConnectedAtom(atomInBond[0]).getSymbol() 
                                                                  + ", "+ atomInBond[0].getSymbol() + ", " + atomInBond[1].getSymbol() + ", " 
                                                                  + bondConnectedAfter[ba].getConnectedAtom(atomInBond[1]).getSymbol());
                                                          */
 
                                                            torsionType = "0";
                                                            if (bond[b].getProperty("MMFF94 bond type").toString() == "1") {
                                                                  torsionType = "1";
                                                            }
                                                            else if ((bond[b].getProperty("MMFF94 bond type").toString() == "0") & 
                                                                        ((bondConnectedBefore[bb].getProperty("MMFF94 bond type").toString() == "1") |
                                                                        (bondConnectedAfter[ba].getProperty("MMFF94 bond type").toString() == "1"))) {
                                                                  torsionType = "2";
                                                            }

                                                            /*System.out.println("torsion " + m + " : " + torsionType + " " + bondConnectedBefore[bb].getConnectedAtom(atomInBond[0]).getAtomTypeName() + "(" + torsionAtomPosition[m][0] + "), " + 
                                                            atomInBond[0].getAtomTypeName() + "(" + torsionAtomPosition[m][1] + "), " + atomInBond[1].getAtomTypeName() + "(" + torsionAtomPosition[m][2] + "), " + 
                                                            bondConnectedAfter[ba].getConnectedAtom(atomInBond[1]).getAtomTypeName() + "(" + torsionAtomPosition[m][3] + ")");
                                                            */
                                                            torsionsData = pc.getTorsionData(torsionType, bondConnectedBefore[bb].getConnectedAtom(atomInBond[0]).getAtomTypeName(), 
                                                                        atomInBond[0].getAtomTypeName(), atomInBond[1].getAtomTypeName(), bondConnectedAfter[ba].getConnectedAtom(atomInBond[1]).getAtomTypeName());
                                                      
                                                            //logger.debug("torsionsData " + m + ": " + torsionsData);
                                                            v1[m] = ((Double) torsionsData.get(0)).doubleValue();
                                                            v2[m] = /*(-1) * */((Double) torsionsData.get(1)).doubleValue();
                                                            v3[m] = ((Double) torsionsData.get(2)).doubleValue();

                                                      }
                                                }     
                                          }
                                    }
                              }
                        }
                  }
            }

            phi = new double[torsionNumber];

            this.moleculeCurrentCoordinates = new GVector(3 * molecule.getAtomCount());
            for (int i=0; i<moleculeCurrentCoordinates.getSize(); i++) {
                  this.moleculeCurrentCoordinates.setElement(i,1E10);
            } 

            this.changeAtomCoordinates = new boolean[molecule.getAtomCount()];

      }

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