private static IAtomContainer RecomputeHydrogens(IAtomContainer mol, IAtomContainer atomContainer, List <IAtom> remove, CDKObjectMap map) { // Recompute hydrogen counts of neighbours of removed Hydrogens. foreach (var aRemove in remove) { // Process neighbours. foreach (var iAtom in atomContainer.GetConnectedAtoms(aRemove)) { if (!map.TryGetValue(iAtom, out IAtom neighb)) { continue; // since for the case of H2, neight H has atom heavy atom neighbor } //Added by Asad if (!(neighb is IPseudoAtom)) { neighb.ImplicitHydrogenCount = (neighb.ImplicitHydrogenCount ?? 0) + 1; } else { neighb.ImplicitHydrogenCount = 0; } } } return(mol); }
public override ICDKObject Clone(CDKObjectMap map) { if (map == null) { throw new ArgumentNullException(nameof(map)); } if (map.TryGetValue(this, out IAtom clone)) { return(clone); } clone = (Atom)base.Clone(map); map.Add(this, clone); return(clone); }
public override ICDKObject Clone(CDKObjectMap map) { if (map == null) { throw new ArgumentNullException(nameof(map)); } if (map.TryGetValue(this, out IBond iclone)) { return(iclone); } var clone = (Bond)base.Clone(map); // clone all the Atoms if (atoms != null) { clone.InitAtoms(atoms.Select(n => (IAtom)n?.Clone(map))); } map.Add(this, clone); return(clone); }