Openbabel子结构匹配

Openbabel子结构匹配

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);
    }

}

你可能感兴趣的:(Openbabel子结构匹配)