/** * Sets the atomsToUnPlaced attribute of the ModelBuilder3D object. */ private void setAtomsToUnPlaced(IAtomContainer molecule) { for (int i = 0; i < molecule.getAtomCount(); i++) { molecule.getAtom(i).setFlag(CDKConstants.ISPLACED, false); } }
/** * Marks all the atoms in the given AtomContainer as not placed * *@param ac The AtomContainer whose atoms are to be marked */ static public void markNotPlaced(IAtomContainer ac) { for (int f = 0; f < ac.getAtomCount(); f++) { ac.getAtom(f).setFlag(CDKConstants.ISPLACED, false); } }
/** * Marks all the atoms in the given AtomContainer as placed * *@param ac The AtomContainer whose atoms are to be marked */ static public void markPlaced(IAtomContainer ac) { for (int f = 0; f < ac.getAtomCount(); f++) { ac.getAtom(f).setFlag(CDKConstants.ISPLACED, true); } }
private static IAtomContainer setVisitedFlagsToFalse(IAtomContainer atomContainer) { for (int i = 0; i < atomContainer.getAtomCount(); i++) { atomContainer.getAtom(i).setFlag(CDKConstants.VISITED, false); } return atomContainer; }
/** * Marks all the atoms in the given AtomContainer as not placed * *@param ac The AtomContainer whose atoms are to be marked */ static public void markNotPlaced(IAtomContainer ac) { for (int f = 0; f < ac.getAtomCount(); f++) { ac.getAtom(f).setFlag(CDKConstants.ISPLACED, false); } }
private static IAtomContainer setVisitedFlagsToFalse(IAtomContainer atomContainer) { for (int i = 0; i < atomContainer.getAtomCount(); i++) { atomContainer.getAtom(i).setFlag(CDKConstants.VISITED, false); } return atomContainer; }
/** * Sets the atomsToUnVisited attribute of the ModelBuilder3D object. */ private void setAtomsToUnVisited(IAtomContainer molecule) { for (int i = 0; i < molecule.getAtomCount(); i++) { molecule.getAtom(i).setFlag(CDKConstants.VISITED, false); } }
private static void markRingAtomsAndBondsAromatic(IAtomContainer container) { for (IAtom atom : container.atoms()) atom.setFlag(CDKConstants.ISAROMATIC, true); for (IBond bond : container.bonds()) bond.setFlag(CDKConstants.ISAROMATIC, true); } }
private static void markRingAtomsAndBondsAromatic(IAtomContainer container) { for (IAtom atom : container.atoms()) atom.setFlag(CDKConstants.ISAROMATIC, true); for (IBond bond : container.bonds()) bond.setFlag(CDKConstants.ISAROMATIC, true); } }
private static boolean isInRingSize(IAtom atom, int size) { for (IAtom a : atom.getContainer().atoms()) a.setFlag(CDKConstants.VISITED, false); return isInRingSize(atom, null, atom, 1, size); }
/** * clean the flags CDKConstants.REACTIVE_CENTER from the molecule. * * @param ac */ private void cleanFlagReactiveCenter(IAtomContainer ac) { for (int j = 0; j < ac.getAtomCount(); j++) ac.getAtom(j).setFlag(CDKConstants.REACTIVE_CENTER, false); for (int j = 0; j < ac.getBondCount(); j++) ac.getBond(j).setFlag(CDKConstants.REACTIVE_CENTER, false); } }
static IAtom atom(String symbol, int h, boolean arom) { IAtom a = new Atom(symbol); a.setImplicitHydrogenCount(h); a.setFlag(CDKConstants.ISAROMATIC, arom); return a; }
protected static void resetFlags(IAtomContainer atomContainer) { for (int f = 0; f < atomContainer.getAtomCount(); f++) { atomContainer.getAtom(f).setFlag(CDKConstants.VISITED, false); } for (int f = 0; f < atomContainer.getBondCount(); f++) { atomContainer.getBond(f).setFlag(CDKConstants.VISITED, false); } }
private static void traverseRings(IAtomContainer mol, IAtom atom, IBond prev) { atom.setFlag(CDKConstants.VISITED, true); prev.setFlag(CDKConstants.VISITED, true); for (IBond bond : mol.getConnectedBondsList(atom)) { IAtom nbr = bond.getOther(atom); if (!nbr.getFlag(CDKConstants.VISITED)) traverseRings(mol, nbr, bond); else bond.setFlag(CDKConstants.VISITED, true); } }
private static void traverseRings(IAtomContainer mol, IAtom atom, IBond prev) { atom.setFlag(CDKConstants.VISITED, true); prev.setFlag(CDKConstants.VISITED, true); for (IBond bond : mol.getConnectedBondsList(atom)) { IAtom nbr = bond.getOther(atom); if (!nbr.getFlag(CDKConstants.VISITED)) traverseRings(mol, nbr, bond); else bond.setFlag(CDKConstants.VISITED, true); } }
@Test public void testViaFlags() throws Exception { IAtomContainer molecule = TestMoleculeFactory.makeBenzene(); for (Iterator atoms = molecule.atoms().iterator(); atoms.hasNext();) { ((IAtom) atoms.next()).setFlag(CDKConstants.ISAROMATIC, true); } Assert.assertEquals(6, ((IntegerResult) descriptor.calculate(molecule).getValue()).intValue()); } }
@Test public void aromaticAtom() throws Exception { IAtom a = new Atom("C"); a.setImplicitHydrogenCount(0); a.setFlag(CDKConstants.ISAROMATIC, true); assertTrue(new CDKToBeam().toBeamAtom(a).aromatic()); }
@Test(expected = IllegalArgumentException.class) public void aromaticCompoundsAreRejected() { IAtomContainer container = new AtomContainer(); container.addAtom(new Atom("C")); container.getAtom(0).setImplicitHydrogenCount(4); container.getAtom(0).setFlag(CDKConstants.ISAROMATIC, true); INSTANCE.symbolicTypes(container); }
@Test public void testAllHeavyAtomsPlaced_IAtomContainer() { IAtomContainer ac = makeAlphaPinene(); Assert.assertFalse(new AtomPlacer3D().allHeavyAtomsPlaced(ac)); for (IAtom atom : ac.atoms()) { atom.setFlag(CDKConstants.ISPLACED, true); } Assert.assertTrue(new AtomPlacer3D().allHeavyAtomsPlaced(ac)); }
@Test public void testGetPlacedHeavyAtoms_IAtomContainer_IAtom() { IAtomContainer ac = makeAlphaPinene(); IAtomContainer acplaced = new AtomPlacer3D().getPlacedHeavyAtoms(ac, ac.getAtom(0)); Assert.assertEquals(0, acplaced.getAtomCount()); ac.getAtom(1).setFlag(CDKConstants.ISPLACED, true); acplaced = new AtomPlacer3D().getPlacedHeavyAtoms(ac, ac.getAtom(0)); Assert.assertEquals(1, acplaced.getAtomCount()); }