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

IRingSet org::openscience::cdk::modeling::builder3d::ForceFieldConfigurator::assignAtomTyps ( IMolecule  molecule ) throws CDKException [inline]

Method assigns atom types to atoms (calculates sssr and aromaticity)

Returns:
sssrf set
Exceptions:
CDKExceptionProblems detecting aromaticity or making hose codes.

Definition at line 245 of file ForceFieldConfigurator.java.

References org::openscience::cdk::interfaces::IRingSet::contains(), org::openscience::cdk::ringsearch::SSSRFinder::findSSSR(), org::openscience::cdk::tools::manipulator::RingSetManipulator::getAllAtomContainers(), org::openscience::cdk::interfaces::IAtomContainerSet::getAtomContainer(), org::openscience::cdk::interfaces::IAtomContainerSet::getAtomContainerCount(), org::openscience::cdk::tools::HOSECodeGenerator::getHOSECode(), org::openscience::cdk::interfaces::IRingSet::getRings(), org::openscience::cdk::interfaces::IRing::getRingSize(), org::openscience::cdk::CDKConstants::ISALIPHATIC, isHeteroRingSystem(), org::openscience::cdk::CDKConstants::ISINRING, org::openscience::cdk::tools::manipulator::AtomContainerManipulator::percieveAtomTypesAndConfigureAtoms(), org::openscience::cdk::interfaces::IChemObject::setFlag(), org::openscience::cdk::interfaces::IChemObject::setProperty(), and org::openscience::cdk::tools::manipulator::RingSetManipulator::sort().

Referenced by org::openscience::cdk::charges::MMFF94PartialCharges::assignMMFF94PartialCharges(), org::openscience::cdk::modeling::builder3d::ModelBuilder3D::generate3DCoordinates(), and org::openscience::cdk::modeling::forcefield::GeometricMinimizer::setMMFF94Tables().

                                                                             {
            IAtom atom = null;
            String hoseCode = "";
            HOSECodeGenerator hcg = new HOSECodeGenerator();
            int NumberOfRingAtoms = 0;
            IRingSet ringSetA = null;
            IRingSet ringSetMolecule = new SSSRFinder(molecule).findSSSR();
            boolean isInHeteroRing = false;
            try {
                  AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(molecule);
                  CDKHueckelAromaticityDetector.detectAromaticity(molecule);
            } catch (Exception cdk1) {
                  throw new CDKException(
                "AROMATICITYError: Cannot determine aromaticity due to: " +
                cdk1.getMessage(), cdk1
            );
            }

            for (int i = 0; i < molecule.getAtomCount(); i++) {
                  atom = molecule.getAtom(i);
                  if (ringSetMolecule.contains(atom)) {
                        NumberOfRingAtoms = NumberOfRingAtoms + 1;
                        atom.setFlag(CDKConstants.ISINRING, true);
                        atom.setFlag(CDKConstants.ISALIPHATIC, false);
                        ringSetA = ringSetMolecule.getRings(atom);
                        RingSetManipulator.sort(ringSetA);
                        IRing sring = (IRing) ringSetA.getAtomContainer(ringSetA.getAtomContainerCount()-1);
                        atom.setProperty("RING_SIZE", Integer.valueOf(sring.getRingSize()));
                        isInHeteroRing = false;
                        Iterator<IAtomContainer> containers = RingSetManipulator.getAllAtomContainers(ringSetA).iterator();
                        while (!isInHeteroRing && containers.hasNext()) {
                              isInHeteroRing = isHeteroRingSystem(containers.next());
                        }
                  } else {
                        atom.setFlag(CDKConstants.ISALIPHATIC, true);
                        atom.setFlag(CDKConstants.ISINRING, false);
                        isInHeteroRing = false;
                  }
                  atom.setProperty("MAX_BOND_ORDER", new Double(molecule.getMaximumBondOrder(atom).ordinal()+1));

                  try {
                        hoseCode = hcg.getHOSECode(molecule, atom, 3);
                        //logger.debug("HOSECODE GENERATION: ATOM "+i+" HoseCode: "+hoseCode+" ");
                  } catch (CDKException ex1) {
                        System.out.println("Could not build HOSECode from atom " + i + " due to " + ex1.toString());
                        throw new CDKException("Could not build HOSECode from atom "+ i + " due to " + ex1.toString(), ex1);
                  }
                  try {
                        configureAtom(atom, hoseCode, isInHeteroRing);
                  } catch (CDKException ex2) {
                        System.out.println("Could not final configure atom " + i + " due to " + ex2.toString());
                        throw new CDKException("Could not final configure atom due to problems with force field", ex2);
                  }
            }
            
//          IBond[] bond = molecule.getBonds();
            String bondType;
        for (IBond bond : molecule.bonds()) {

                  //logger.debug("bond[" + i + "] properties : " + molecule.getBond(i).getProperties());
                  bondType = "0";
                  if (bond.getOrder() == IBond.Order.SINGLE) {
                        if ((bond.getAtom(0).getAtomTypeName().equals("Csp2")) &
                              ((bond.getAtom(1).getAtomTypeName().equals("Csp2")) | (bond.getAtom(1).getAtomTypeName().equals("C=")))) {
                              bondType = "1";
                        }
                              
                        if ((bond.getAtom(0).getAtomTypeName().equals("C=")) &
                              ((bond.getAtom(1).getAtomTypeName().equals("Csp2")) | (bond.getAtom(1).getAtomTypeName().equals("C=")))) {
                              bondType = "1";}
                              
                        if ((bond.getAtom(0).getAtomTypeName().equals("Csp")) &
                              (bond.getAtom(1).getAtomTypeName().equals("Csp"))) {
                              bondType = "1";}
                  }
//                molecule.getBond(i).setProperty("MMFF94 bond type", bondType);
            bond.setProperty("MMFF94 bond type", bondType);
            //logger.debug("bond[" + i + "] properties : " + molecule.getBond(i).getProperties());
            }

            return ringSetMolecule;
      }

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