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 周銳 閱讀(546) 評論(0)  編輯  收藏 所屬分類: ChemistryOpenbabel
          主站蜘蛛池模板: 万山特区| 哈密市| 长寿区| 佛坪县| 乐昌市| 乌鲁木齐市| 兴义市| 疏勒县| 嘉善县| 江永县| 巴南区| 西安市| 丹寨县| 乐至县| 吴川市| 马龙县| 左贡县| 新乡县| 凤凰县| 安泽县| 金沙县| 仁化县| 寻乌县| 台东市| 曲水县| 遂川县| 山阳县| 东至县| 昆明市| 阿城市| 诸城市| 阆中市| 湖州市| 阳谷县| 廉江市| 南部县| 新和县| 深水埗区| 陈巴尔虎旗| 桂东县| 西华县|