add a demo

This commit is contained in:
Greg Landrum
2008-01-20 22:02:54 +00:00
parent 476c765cff
commit 2829141a8b
6 changed files with 208 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
public class main {
static {
try {
System.loadLibrary("RDKFuncs");
} catch (UnsatisfiedLinkError e) {
System.err.println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n" + e);
System.exit(1);
}
}
public static void main(String argv[]) {
String smiles="c1ccccc1";
//RDKitMol mol= RDKFuncs.MolFromSmiles(smiles);
ROMol mol= RDKFuncs.MolFromSmiles(smiles);
long nAtoms = mol.getNumAtoms();
System.out.println("nAtoms: " + nAtoms);
System.out.println("smi: " + RDKFuncs.MolToSmiles(mol));
System.out.println("atom: " + mol.getAtomWithIdx(0).getAtomicNum());
System.out.println("bond: " + mol.getBondWithIdx(0).getIdx());
System.out.println("bond: " + mol.getBondWithIdx(0).getBondType());
System.out.println("hss: " + RDKFuncs.HasSubstructMatch(mol,RDKFuncs.MolFromSmarts("c")));
System.out.println("hss: " + RDKFuncs.HasSubstructMatch(mol,RDKFuncs.MolFromSmarts("C")));
}
}