/// <summary> /// The method is a proton descriptor that evaluates if a proton is joined to a conjugated system. /// </summary> /// <param name="atom">The <see cref="IAtom"/> for which the <see cref="Result"/> is requested</param> /// <returns><see langword="true"/> if the proton is bonded to a conjugated system</returns> public Result Calculate(IAtom atom) { var clonedAtom = clonedAtomContainer.Atoms[container.Atoms.IndexOf(atom)]; bool isProtonInPiSystem = false; if (atom.AtomicNumber.Equals(AtomicNumbers.H)) { var detected = acSet.GetEnumerator(); var neighboors = clonedAtomContainer.GetConnectedAtoms(clonedAtom); foreach (var neighboor in neighboors) { while (detected.MoveNext()) { var detectedAC = detected.Current; if (detectedAC != null && detectedAC.Contains(neighboor)) { isProtonInPiSystem = true; break; } } } } return(new Result(isProtonInPiSystem)); }