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
          主站蜘蛛池模板: 宝山区| 专栏| 会昌县| 安化县| 衡阳市| 西丰县| 扎囊县| 浙江省| 龙门县| 黔南| 永胜县| 阜新| 乌审旗| 扎兰屯市| 武隆县| 全州县| 华宁县| 德保县| 正阳县| 富源县| 宝丰县| 繁峙县| 麻阳| 水城县| 乾安县| 女性| 新津县| 永年县| 堆龙德庆县| 大足县| 尚义县| 封丘县| 中卫市| 郴州市| 西吉县| 麻阳| 碌曲县| 龙井市| 云梦县| 河源市| 咸丰县|