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