Java Code Examples for org.openscience.cdk.interfaces.IAtomContainer#contains()
The following examples show how to use
org.openscience.cdk.interfaces.IAtomContainer#contains() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Utility.java From ReactionDecoder with GNU Lesser General Public License v3.0 | 6 votes |
/** * * @param ringBond * @param singleRings * @return */ public static int getNeighbourBondOrderCountFromRing(IBond ringBond, IRingSet singleRings) { int minValue = 9999; for (IAtomContainer ring : singleRings.atomContainers()) { int value = 0; if (ring.contains(ringBond.getAtom(0)) && ring.contains(ringBond.getAtom(1))) { for (IBond bond : ring.bonds()) { if (bond.contains(ringBond.getAtom(0)) || bond.contains(ringBond.getAtom(1))) { value += bond.getOrder().numeric(); } } } if (value < minValue) { minValue = value; } } return minValue; }
Example 2
Source File: Utility.java From ReactionDecoder with GNU Lesser General Public License v3.0 | 6 votes |
/** * * @param ringBond * @param singleRings * @return */ public static IRingSet getSmallestRingSet(IBond ringBond, IRingSet singleRings) { IRingSet rs = new RingSet(); for (IAtomContainer ring : singleRings.atomContainers()) { if (ring.contains(ringBond.getAtom(0)) && ring.contains(ringBond.getAtom(1))) { if (rs.getAtomContainerCount() == 0) { rs.addAtomContainer(ring); continue; } for (IAtomContainer smallestRing : rs.atomContainers()) { if (ring.getAtomCount() == smallestRing.getAtomCount()) { if (!rs.contains(ring)) { rs.addAtomContainer(ring); } } else if (ring.getAtomCount() < smallestRing.getAtomCount()) { rs.removeAllAtomContainers(); rs.addAtomContainer(ring); } } } } return rs; }
Example 3
Source File: StereoFilter.java From ReactionDecoder with GNU Lesser General Public License v3.0 | 5 votes |
private synchronized double getRingMatch(IRingSet rings, IAtomContainer atoms) { double score = 0.0; for (IAtom a : atoms.atoms()) { for (IAtomContainer ring : rings.atomContainers()) { if (ring.contains(a)) { score += 10; } else { score -= 10; } } } return score; }
Example 4
Source File: CaseHandler.java From ReactionDecoder with GNU Lesser General Public License v3.0 | 5 votes |
private boolean findAndChipBond(IAtomContainer container, IAtomContainer referenceContainer) { boolean flag = false; if (container != null) { for (IBond bond : container.bonds()) { if ((bond.getAtom(0).getSymbol().equalsIgnoreCase("O") && bond.getAtom(1).getSymbol().equalsIgnoreCase("C")) || (bond.getAtom(0).getSymbol().equalsIgnoreCase("C") && bond.getAtom(1).getSymbol().equalsIgnoreCase("O"))) { if (!bond.getAtom(0).getFlag(ISAROMATIC) && !bond.getAtom(1).getFlag(ISAROMATIC)) { if (referenceContainer.contains(bond)) { IAtom atom = bond.getAtom(0).getSymbol().equalsIgnoreCase("C") ? bond.getAtom(0) : bond.getAtom(1); List<IBond> neighbourhoodBonds = referenceContainer.getConnectedBondsList(atom); flag = false; for (IBond neighbourhoodBond : neighbourhoodBonds) { if (neighbourhoodBond.contains(atom) && !neighbourhoodBond.getFlag(ISINRING)) { if ((neighbourhoodBond.getAtom(0).getSymbol().equalsIgnoreCase("O") && neighbourhoodBond.getAtom(1).getSymbol().equalsIgnoreCase("C")) || (neighbourhoodBond.getAtom(0).getSymbol().equalsIgnoreCase("C") && neighbourhoodBond.getAtom(1).getSymbol().equalsIgnoreCase("O"))) { flag = true; } } } if (flag) { referenceContainer.removeBond(bond); break; } } } } } } return flag; }
Example 5
Source File: Utility.java From ReactionDecoder with GNU Lesser General Public License v3.0 | 5 votes |
/** * * @param bond * @param molset * @return */ protected static String getMoleculeID(IBond bond, IAtomContainerSet molset) { for (IAtomContainer mol : molset.atomContainers()) { if (mol.contains(bond)) { return mol.getID(); } } return null; }
Example 6
Source File: Utility.java From ReactionDecoder with GNU Lesser General Public License v3.0 | 5 votes |
/** * * @param atom * @param molset * @return */ protected static String getMoleculeID(IAtom atom, IAtomContainerSet molset) { for (IAtomContainer mol : molset.atomContainers()) { if (mol.contains(atom)) { return mol.getID(); } } return null; }
Example 7
Source File: Utility.java From ReactionDecoder with GNU Lesser General Public License v3.0 | 5 votes |
/** * * @param bond * @param molset * @return */ protected static IAtomContainer getAtomContainer(IBond bond, IAtomContainerSet molset) { for (IAtomContainer mol : molset.atomContainers()) { if (mol.contains(bond)) { return mol; } } return null; }
Example 8
Source File: Utility.java From ReactionDecoder with GNU Lesser General Public License v3.0 | 5 votes |
/** * * @param atom * @param molset * @return */ protected static IAtomContainer getAtomContainer(IAtom atom, IAtomContainerSet molset) { for (IAtomContainer mol : molset.atomContainers()) { if (mol.contains(atom)) { return mol; } } return null; }
Example 9
Source File: BEMatrix.java From ReactionDecoder with GNU Lesser General Public License v3.0 | 5 votes |
private double getFreeValenceElectrons(IAtom a) throws CDKException { double freeValEle = 0; for (int i = 0; i < myMoleculeSet.getAtomContainerCount(); i++) { IAtomContainer mol = myMoleculeSet.getAtomContainer(i); if (mol.contains(a)) { freeValEle = ValencyCalculator.getFreeValenceElectrons(mol, a, withoutH); } } return freeValEle; }