Пример #1
0
 private static void ParseMMFFPPROP(Stream ins, MmffProp[] props)
 {
     using (var br = new StreamReader(ins, Encoding.UTF8))
     {
         string line;
         while ((line = br.ReadLine()) != null)
         {
             if (line.Length == 0 || line[0] == '*')
             {
                 continue;
             }
             var cols = Strings.Tokenize(line);
             if (cols.Count != 9)
             {
                 throw new IOException("Malformed MMFFPROP.PAR file.");
             }
             int type = int.Parse(cols[0], NumberFormatInfo.InvariantInfo);
             props[type] = new MmffProp(int.Parse(cols[1], NumberFormatInfo.InvariantInfo),
                                        int.Parse(cols[2], NumberFormatInfo.InvariantInfo),
                                        int.Parse(cols[3], NumberFormatInfo.InvariantInfo),
                                        int.Parse(cols[4], NumberFormatInfo.InvariantInfo),
                                        int.Parse(cols[5], NumberFormatInfo.InvariantInfo),
                                        int.Parse(cols[6], NumberFormatInfo.InvariantInfo),
                                        int.Parse(cols[7], NumberFormatInfo.InvariantInfo),
                                        int.Parse(cols[8], NumberFormatInfo.InvariantInfo));
         }
     }
 }
Пример #2
0
        /// <summary>
        /// see. MMFF Part V - p 620, a nonstandard bond-type index of “1” is
        /// assigned whenever a single bond (formal bond order 1) is found: (a)
        /// between atoms i and j of types that are not both aromatic and for which
        /// ”sbmb” entries of ”1” appear in Table I; or (b) between pairs of atoms
        /// belonging to different aromatic rings (as in the case of the connecting
        /// C-C bond in biphenyl).
        /// </summary>
        public int GetBondCls(int type1, int type2, int bord, bool barom)
        {
            MmffProp prop1 = properties[CheckType(type1)];
            MmffProp prop2 = properties[CheckType(type2)];

            // non-arom atoms with sbmb (single-bond-multi-bond)
            if (bord == 1 && !prop1.arom && prop1.sbmb && !prop2.arom && prop2.sbmb)
            {
                return(1);
            }
            // non-arom bond between arom atoms
            if (bord == 1 && !barom && prop1.arom && prop2.arom)
            {
                return(1);
            }
            return(0);
        }