/// <summary> /// Retrieves first relevant atom type based on SMARTS pattern that matches atom /// </summary> /// <param name="atom"></param> /// <returns>Crippen Atom Type key if atom matches a pattern, otherwise empty string.</returns> public static string GetCrippenKey(this OBAtom atom) { var element = atom.GetCrippenAtomType(); if (string.IsNullOrEmpty(element)) { throw new Exception(string.Format("Crippen atom type could not be determined for {0}", atom.GetAtomicNum())); } var keys = CrippenConstants.CrippenContributions.Where(g => g.Key.Contains(element)).Select(g => g.Key); foreach (var key in keys) { foreach (var pattern in CrippenConstants.GetSmarts(key)) { if (atom.MatchesSMARTS(pattern)) { return(key); } } } return(string.Empty); }