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

DescriptorValue org::openscience::cdk::qsar::descriptors::atompair::PiContactDetectionDescriptor::calculate ( IAtom  first,
IAtom  second,
IAtomContainer  atomContainer 
) [inline]

The method returns if two atoms have pi-contact.

Parameters:
atomContainerAtomContainer
Returns:
true if the atoms have pi-contact

Implements org::openscience::cdk::qsar::IAtomPairDescriptor.

Definition at line 148 of file PiContactDetectionDescriptor.java.

References org::openscience::cdk::interfaces::IAtomContainerSet::atomContainers(), org::openscience::cdk::interfaces::IChemObject::clone(), org::openscience::cdk::interfaces::IAtomContainer::contains(), org::openscience::cdk::graph::invariant::ConjugatedPiSystemsDetector::detect(), org::openscience::cdk::interfaces::IAtomContainer::getAtom(), org::openscience::cdk::interfaces::IAtomContainer::getAtomNumber(), org::openscience::cdk::AtomContainer::getConnectedAtomsList(), getDescriptorNames(), getParameterNames(), getParameters(), getSpecification(), isANeighboorsInAnAtomContainer(), and org::openscience::cdk::tools::manipulator::AtomContainerManipulator::percieveAtomTypesAndConfigureAtoms().

                                                                                               {
        IAtomContainer ac;
        try {
            ac = (IAtomContainer) atomContainer.clone();
        } catch (CloneNotSupportedException e) {
            return getDummyDescriptorValue(e);
        }
        IAtom clonedFirst = ac.getAtom(atomContainer.getAtomNumber(first));
        IAtom clonedSecond = ac.getAtom(atomContainer.getAtomNumber(first));

        Molecule mol = new Molecule(ac);
        if (checkAromaticity) {
            try {
                AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(mol);
                CDKHueckelAromaticityDetector.detectAromaticity(mol);
            } catch (CDKException e) {
                return getDummyDescriptorValue(e);
            }
        }
        boolean piContact = false;
        int counter = 0;

        if(acold!=ac){
          acold=ac;
          acSet = ConjugatedPiSystemsDetector.detect(mol);
        }
        java.util.Iterator<IAtomContainer> detected = acSet.atomContainers().iterator();

        java.util.List<IAtom> neighboorsFirst = mol.getConnectedAtomsList(clonedFirst);
        java.util.List<IAtom> neighboorsSecond = mol.getConnectedAtomsList(clonedSecond);

        while (detected.hasNext()) {
            IAtomContainer detectedAC = detected.next();
            if (detectedAC.contains(clonedFirst) && detectedAC.contains(clonedSecond)) {
                counter += 1;
                break;
            }
            if (isANeighboorsInAnAtomContainer(neighboorsFirst, detectedAC) && isANeighboorsInAnAtomContainer(neighboorsSecond, detectedAC)) {
                counter += 1;
                break;
            }
        }

        if (counter > 0) {
            piContact = true;
        }
        return new DescriptorValue(getSpecification(), getParameterNames(), getParameters(),
                new BooleanResult(piContact), getDescriptorNames());
    }

Here is the call graph for this function:


Generated by  Doxygen 1.6.0   Back to index