posts - 431,  comments - 344,  trackbacks - 0

          package com.founder.openbabel;

          import org.openbabel.OBConversion;
          import org.openbabel.OBMol;
          import org.openbabel.OBSmartsPattern;

          public class Test {

           public static void main(String[] args) {
                  // Initialise
                  System.loadLibrary("openbabel_java");

                  // Read molecule from SMILES string
                  OBConversion conv = new OBConversion();
                  OBMol mol = new OBMol();
                  conv.SetInFormat("smi");
                  conv.ReadString(mol, "C(Cl)(=O)CCC(=O)Cl");

                  // What are the indices of the carbon atoms
                  // of the acid chloride groups?
                  OBSmartsPattern acidpattern = new OBSmartsPattern();
                  acidpattern.Init("C(=O)Cl");
                  long t1 = System.currentTimeMillis();
                  boolean flag = acidpattern.Match(mol);
                  long t2 = System.currentTimeMillis();
                  System.out.println("Cost time:" + (t2-t1) + "ms");
                  System.out.println(flag);
              }

          }

          posted on 2009-10-21 08:55 周銳 閱讀(543) 評論(0)  編輯  收藏 所屬分類: ChemistryOpenbabel
          主站蜘蛛池模板: 南澳县| 阿图什市| 岳普湖县| 密云县| 上栗县| 白沙| 闵行区| 旬邑县| 藁城市| 广丰县| 乳山市| 三台县| 靖远县| 武邑县| 福州市| 兴宁市| 灌阳县| 渭南市| 天全县| 从化市| 乐陵市| 乌兰察布市| 灌阳县| 延寿县| 威宁| 洪雅县| 三明市| 原平市| 裕民县| 灌云县| 广河县| 罗山县| 海晏县| 大石桥市| 涿州市| 全椒县| 广饶县| 盐边县| 察雅县| 尼勒克县| 翁牛特旗|