private static void makeReferencesExplicitForBond(IBond bond) { int selfCounter = 0; bond.setProperty(prefix + ":self:" + selfCounter++, "chemical:covalentBond"); bond.setProperty(prefix + ":field:order", "chemical:bondOrder"); }
private static void makeReferencesExplicitForBond(IBond bond) { int selfCounter = 0; bond.setProperty(prefix + ":self:" + selfCounter++, "chemical:covalentBond"); bond.setProperty(prefix + ":field:order", "chemical:bondOrder"); }
while (keys.hasNext()) { String key = keys.next(); currentBond.setProperty(key, currentBondProperties.get(key));
while (keys.hasNext()) { String key = keys.next(); currentBond.setProperty(key, currentBondProperties.get(key));
bfrag.addAtom(atom); bfrag.addBond(0, 1, cut.getOrder()); bfrag.getBond(0).setProperty(CUT_BOND, cut); efrag.addAtom(atom); efrag.addBond(0, 1, cut.getOrder()); efrag.getBond(0).setProperty(CUT_BOND, cut);
bfrag.addAtom(atom); bfrag.addBond(0, 1, cut.getOrder()); bfrag.getBond(0).setProperty(CUT_BOND, cut); efrag.addAtom(atom); efrag.addBond(0, 1, cut.getOrder()); efrag.getBond(0).setProperty(CUT_BOND, cut);
DescriptorValue value = ((IBondDescriptor) descriptor).calculate(bond, molecule); if (value.getException() == null) bond.setProperty(speclist.get(i), value); else { logger.error("Could not calculate descriptor value for: ", descriptor.getClass().getName());
DescriptorValue value = ((IBondDescriptor) descriptor).calculate(bond, molecule); if (value.getException() == null) bond.setProperty(speclist.get(i), value); else { logger.error("Could not calculate descriptor value for: ", descriptor.getClass().getName());
getReactionCenterSet().add(affectedBondReactants.getAtom(0)); getReactionCenterSet().add(affectedBondReactants.getAtom(1)); affectedBondReactants.setProperty(BOND_CHANGE_INFORMATION, BOND_CLEAVED); BondChange bondChange = new BondChange(affectedBondReactants, pBond); getBondChangeList().add(bondChange); getReactionCenterSet().add(affectedBondProducts.getAtom(0)); getReactionCenterSet().add(affectedBondProducts.getAtom(1)); affectedBondProducts.setProperty(BOND_CHANGE_INFORMATION, BOND_FORMED); BondChange bondChange = new BondChange(eBond, affectedBondProducts); getBondChangeList().add(bondChange);
/** * Tests whether the custom bond properties survive the CML round-trip * @throws Exception * * @cdk.bug 1930029 */ @Test public void testBondProperty() throws Exception { String[] key = {"customBondProperty1", "customBondProperty2"}; String[] value = {"true", "false"}; IAtomContainer mol = TestMoleculeFactory.makeBenzene(); for (Iterator<IBond> it = mol.bonds().iterator(); it.hasNext();) { IBond b = it.next(); for (int i = 0; i < key.length; i++) b.setProperty(key[i], value[i]); } IAtomContainer roundTrippedMol = CMLRoundTripTool.roundTripMolecule(convertor, mol); //Assert.assertEquals(convertor.cdkMoleculeToCMLMolecule(mol).toXML(), // convertor.cdkMoleculeToCMLMolecule(roundTrippedMol).toXML()); for (Iterator<IBond> it = roundTrippedMol.bonds().iterator(); it.hasNext();) { IBond b = it.next(); for (int i = 0; i < key.length; i++) { Object actual = b.getProperty(key[i]); Assert.assertNotNull(actual); Assert.assertEquals(value[i], actual); } } }
/** * Convenience method for labelling all stereo elements. The {@link * CIP_CHIRALITY} is determined for each element and stored as as {@link * String} on the {@link CDKConstants#CIP_DESCRIPTOR} property key. * Atoms/bonds that are not stereocenters have no label assigned and the * property will be null. * * @param container structure to label */ public static void label(IAtomContainer container) { for (IStereoElement stereoElement : container.stereoElements()) { if (stereoElement instanceof ITetrahedralChirality) { ITetrahedralChirality tc = (ITetrahedralChirality) stereoElement; tc.getChiralAtom().setProperty(CDKConstants.CIP_DESCRIPTOR, getCIPChirality(container, tc).toString()); } else if (stereoElement instanceof IDoubleBondStereochemistry) { IDoubleBondStereochemistry dbs = (IDoubleBondStereochemistry) stereoElement; dbs.getStereoBond() .setProperty(CDKConstants.CIP_DESCRIPTOR, getCIPChirality(container, dbs).toString()); } } }
eBond.setProperty(BOND_CHANGE_INFORMATION, BOND_CLEAVED); affectedBondReactants = eBond; pBond.setProperty(BOND_CHANGE_INFORMATION, BOND_FORMED); affectedBondProducts = pBond; IBond pBond = connectedProductBondsList.iterator().next(); eBond.setProperty(BOND_CHANGE_INFORMATION, PSEUDO_BOND); pBond.setProperty(BOND_CHANGE_INFORMATION, BOND_FORMED); affectedBondReactants = eBond; affectedBondProducts = pBond; IBond pBond = new Bond(psudoAtom, productAtom, SINGLE); eBond.setProperty(BOND_CHANGE_INFORMATION, BOND_CLEAVED); pBond.setProperty(BOND_CHANGE_INFORMATION, PSEUDO_BOND);
/** * Convenience method for labelling all stereo elements. The {@link * CIP_CHIRALITY} is determined for each element and stored as as {@link * String} on the {@link CDKConstants#CIP_DESCRIPTOR} property key. * Atoms/bonds that are not stereocenters have no label assigned and the * property will be null. * * @param container structure to label */ public static void label(IAtomContainer container) { for (IStereoElement stereoElement : container.stereoElements()) { if (stereoElement instanceof ITetrahedralChirality) { ITetrahedralChirality tc = (ITetrahedralChirality) stereoElement; tc.getChiralAtom().setProperty(CDKConstants.CIP_DESCRIPTOR, getCIPChirality(container, tc).toString()); } else if (stereoElement instanceof IDoubleBondStereochemistry) { IDoubleBondStereochemistry dbs = (IDoubleBondStereochemistry) stereoElement; dbs.getStereoBond() .setProperty(CDKConstants.CIP_DESCRIPTOR, getCIPChirality(container, dbs).toString()); } } }
bond.setProperty("MMFF94 bond type", bondType);
bond.setProperty("MMFF94 bond type", bondType);
chemObj.setFlag(CDKConstants.ISAROMATIC, true); for (IBond bond : aromBonds) bond.setProperty(MMFF_AROM, true);
chemObj.setFlag(CDKConstants.ISAROMATIC, true); for (IBond bond : aromBonds) bond.setProperty(MMFF_AROM, true);
getReactionCenterSet().add(affectedBondReactants.getAtom(0)); getReactionCenterSet().add(affectedBondReactants.getAtom(1)); affectedBondReactants.setProperty(BOND_CHANGE_INFORMATION, bondChangeInformation); getReactionCenterSet().add(affectedBondProducts.getAtom(0)); getReactionCenterSet().add(affectedBondProducts.getAtom(1)); affectedBondProducts.setProperty(BOND_CHANGE_INFORMATION, bondChangeInformation); getReactionCenterSet().add(affectedBondReactants.getAtom(0)); getReactionCenterSet().add(affectedBondReactants.getAtom(1)); affectedBondReactants.setProperty(BOND_CHANGE_INFORMATION, bondChangeInformation); getReactionCenterSet().add(affectedBondProducts.getAtom(0)); getReactionCenterSet().add(affectedBondProducts.getAtom(1)); affectedBondProducts.setProperty(BOND_CHANGE_INFORMATION, bondChangeInformation); getReactionCenterSet().add(affectedBondReactants.getAtom(0)); getReactionCenterSet().add(affectedBondReactants.getAtom(1)); affectedBondReactants.setProperty(BOND_CHANGE_INFORMATION, bondChangeInformation); getReactionCenterSet().add(affectedBondProducts.getAtom(0)); getReactionCenterSet().add(affectedBondProducts.getAtom(1)); affectedBondProducts.setProperty(BOND_CHANGE_INFORMATION, bondChangeInformation);
@Test public void unIsolated() { IAtomContainer methyl = new AtomContainer(); methyl.addAtom(atomAt("C", new Point2d(0, 0))); methyl.addAtom(atomAt("H", new Point2d(0, 1))); methyl.addAtom(atomAt("H", new Point2d(0, -1))); methyl.addAtom(atomAt("H", new Point2d(1, 0))); methyl.addAtom(atomAt("H", new Point2d(-1, 0))); methyl.addBond(0, 1, IBond.Order.SINGLE); methyl.addBond(0, 2, IBond.Order.SINGLE); methyl.addBond(0, 3, IBond.Order.SINGLE); methyl.addBond(0, 4, IBond.Order.SINGLE); methyl.getAtom(0).setProperty(StandardGenerator.HIGHLIGHT_COLOR, Color.RED); methyl.getBond(0).setProperty(StandardGenerator.HIGHLIGHT_COLOR, Color.RED); SymbolVisibility visibility = SelectionVisibility.disconnected(SymbolVisibility.iupacRecommendations()); assertFalse(visibility.visible(methyl.getAtom(0), methyl.getConnectedBondsList(methyl.getAtom(0)), new RendererModel())); }