Skip to content

Instantly share code, notes, and snippets.

@gilleain
Created July 7, 2010 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gilleain/466798 to your computer and use it in GitHub Desktop.
Save gilleain/466798 to your computer and use it in GitHub Desktop.
import org.junit.Test;
import org.openscience.cdk.Atom;
import org.openscience.cdk.AtomContainer;
import org.openscience.cdk.CDKConstants;
import org.openscience.cdk.interfaces.IAtomContainer;
import org.openscience.cdk.interfaces.IBond;
import signature.chemistry.MoleculeSignature;
public class AdapterTest {
@Test
public void benzene() {
IAtomContainer benzene = new AtomContainer();
benzene.addAtom(new Atom("C"));
benzene.addAtom(new Atom("C"));
benzene.addAtom(new Atom("C"));
benzene.addAtom(new Atom("C"));
benzene.addAtom(new Atom("C"));
benzene.addAtom(new Atom("C"));
benzene.addBond(0, 1, IBond.Order.SINGLE);
benzene.addBond(1, 2, IBond.Order.SINGLE);
benzene.addBond(2, 3, IBond.Order.SINGLE);
benzene.addBond(3, 4, IBond.Order.SINGLE);
benzene.addBond(4, 5, IBond.Order.SINGLE);
benzene.addBond(5, 0, IBond.Order.SINGLE);
for (IBond bond : benzene.bonds()) {
bond.setFlag(CDKConstants.ISAROMATIC, true);
}
signature.chemistry.Molecule mol =
CDKMoleculeSignatureAdapter.convert(benzene);
MoleculeSignature molSig = new MoleculeSignature(mol);
System.out.println(molSig.toCanonicalString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment