@SuppressWarnings("unchecked") private Iterator<IAtom> atoms() { if (stack[sptr].iter == null) stack[sptr].iter = mol.atoms().iterator(); return stack[sptr].iter; }
@Override public boolean isSaturated(IAtomContainer atomContainer) throws CDKException { for (IAtom atom : atomContainer.atoms()) { if (!isSaturated(atom, atomContainer)) return false; } return true; }
private int getHCount(IAtomContainer molecule) { int count = 0; for (IAtom atom : molecule.atoms()) { if (atom.getSymbol().equalsIgnoreCase("H")) { ++count; } } return count; }
private int countNitrogenInRing(IAtomContainer ring) { int c = 0; for (IAtom ringAtom : ring.atoms()) { if (ringAtom.getSymbol().equals("N")) c++; } return c; }
private static boolean ringIsAromatic(IAtomContainer ring) { for (IAtom atom : ring.atoms()) { if (!atom.getFlag(CDKConstants.ISAROMATIC)) return false; } return true; }
/** * The exact mass of an FragmentAtom is defined as the sum of exact masses * of the IAtom's in the fragment. */ @Override public Double getExactMass() { double totalMass = 0.0; for (IAtom atom : fragment.atoms()) { totalMass += atom.getExactMass(); } return totalMass; }
/** * The exact mass of an FragmentAtom is defined as the sum of exact masses * of the IAtom's in the fragment. */ @Override public Double getExactMass() { double totalMass = 0.0; for (IAtom atom : fragment.atoms()) { totalMass += atom.getExactMass(); } return totalMass; }
private static boolean isAllAtomsAromatic(IAtomContainer ring) { for (IAtom atom : ring.atoms()) { if (!atom.getFlag(CDKConstants.ISAROMATIC)) { return false; } } return true; }
private void writeAtoms(IAtomContainer molecule) throws Exception { Iterator<IAtom> atoms = molecule.atoms().iterator(); while (atoms.hasNext()) { IAtom atom = (IAtom) atoms.next(); writeAtom(atom); writer.write(" mol.addAtom(" + atom.getID() + ");"); writer.write('\n'); } }
private int countHeteroInRing(IAtomContainer ring) { int c = 0; for (IAtom ringAtom : ring.atoms()) { if (!ringAtom.getSymbol().equals("C") && !ringAtom.getSymbol().equals("H")) c++; } return c; }
@Override public IAtomType[] findMatchingAtomTypes(IAtomContainer atomContainer) throws CDKException { IAtomType[] types = new IAtomType[atomContainer.getAtomCount()]; int typeCounter = 0; for (IAtom atom : atomContainer.atoms()) { types[typeCounter] = findMatchingAtomType(atomContainer, atom); typeCounter++; } return types; }
private void markSideChains(IAtomContainer atomContainer) { for (IAtom atom : atomContainer.atoms()) { if (!isring(atom) && !islinker(atom)) atom.setProperty(IS_SIDECHAIN_ATOM, true); } }
/** * Counts aromatic atoms in a molecule. * @param mol molecule for which to count aromatic atoms. */ private int countAromaticAtoms(IAtomContainer mol) { int aromCount = 0; for (IAtom atom : mol.atoms()) { if (atom.getFlag(CDKConstants.ISAROMATIC)) aromCount++; } return aromCount; }
private void markSideChains(IAtomContainer atomContainer) { for (IAtom atom : atomContainer.atoms()) { if (!isring(atom) && !islinker(atom)) atom.setProperty(IS_SIDECHAIN_ATOM, true); } }
private void convertCMLToCDKHydrogenCounts() { for (IAtom atom : currentMolecule.atoms()) { if (atom.getImplicitHydrogenCount() != null) { int explicitHCount = AtomContainerManipulator.countExplicitHydrogens(currentMolecule, atom); if (explicitHCount != 0) { atom.setImplicitHydrogenCount(atom.getImplicitHydrogenCount() - explicitHCount); } } } }
protected void encodePaths(IAtomContainer mol, int depth, BitSet fp, int size) throws CDKException { State state = new State(mol, fp, size, depth+1); for (IAtom atom : mol.atoms()) { state.numPaths = 0; state.visit(atom); traversePaths(state, atom, null); state.unvisit(atom); } }
/** {@inheritDoc} */ @Override public IRenderingElement generate(IAtomContainer container, RendererModel model) { ElementGroup elementGroup = new ElementGroup(); for (IAtom atom : container.atoms()) { elementGroup.add(MarkedElement.markupAtom(this.generate(container, atom, model), atom)); } return elementGroup; }
private void setCoordinatesToZero(IAtomContainer mol) { for (IAtom atom : mol.atoms()) { atom.setPoint3d(new Point3d(0.0, 0.0, 0.0)); } }
private void findAndConfigureAtomTypesForAllAtoms(IAtomContainer container) throws Exception { CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(container.getBuilder()); Iterator<IAtom> atoms = container.atoms().iterator(); while (atoms.hasNext()) { IAtom atom = atoms.next(); IAtomType type = matcher.findMatchingAtomType(container, atom); if (type != null) AtomTypeManipulator.configure(atom, type); } }
@Test public void hydrogenAsFirstAtomInEthane() throws Exception { SmilesParser smipar = new SmilesParser(SilentChemObjectBuilder.getInstance()); IAtomContainer ethane = smipar.parseSmiles("[H]C([H])([H])C([H])([H])[H]"); AtomContainerManipulator.percieveAtomTypesAndConfigureAtoms(ethane); ModelBuilder3D mb3d = ModelBuilder3D.getInstance(SilentChemObjectBuilder.getInstance()); mb3d.generate3DCoordinates(ethane, false); for (IAtom atom : ethane.atoms()) assertNotNull(atom.getPoint3d()); }