Created
July 7, 2010 14:55
-
-
Save gilleain/466798 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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