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 周锐 阅读(506) 评论(0)  编辑  收藏 所属分类: ChemistryOpenbabel

只有注册用户登录后才能发表评论。


网站导航: