Package org.openscience.cdk

Examples of org.openscience.cdk.AtomContainer


     */
    @Test
    public void testGetInchiFromLandDAlanine3D() throws Exception {
       
        // L-Alanine
        IAtomContainer acL = new AtomContainer();
        IAtom a1L = new Atom("C", new Point3d(-0.358, 0.819, 20.655));
        IAtom a2L = new Atom("C", new Point3d(-1.598, -0.032, 20.905));
        IAtom a3L = new Atom("N", new Point3d(-0.275, 2.014, 21.574));
        IAtom a4L = new Atom("C", new Point3d(0.952, 0.043, 20.838));
        IAtom a5L = new Atom("O", new Point3d(-2.678, 0.479, 21.093));
        IAtom a6L = new Atom("O", new Point3d(-1.596, -1.239, 20.958));
        a1L.setImplicitHydrogenCount(1);
        a3L.setImplicitHydrogenCount(2);
        a4L.setImplicitHydrogenCount(3);
        a5L.setImplicitHydrogenCount(1);
        acL.addAtom(a1L);
        acL.addAtom(a2L);
        acL.addAtom(a3L);
        acL.addAtom(a4L);
        acL.addAtom(a5L);
        acL.addAtom(a6L);
       
        acL.addBond(new Bond(a1L, a2L, CDKConstants.BONDORDER_SINGLE));
        acL.addBond(new Bond(a1L, a3L, CDKConstants.BONDORDER_SINGLE));
        acL.addBond(new Bond(a1L, a4L, CDKConstants.BONDORDER_SINGLE));
        acL.addBond(new Bond(a2L, a5L, CDKConstants.BONDORDER_SINGLE));
        acL.addBond(new Bond(a2L, a6L, CDKConstants.BONDORDER_DOUBLE));
       
        Assert.assertEquals(gen.generateInchi(acL).getInChI(), "InChI=1S/C3H7NO2/c1-2(4)3(5)6/h2H,4H2,1H3,(H,5,6)/t2-/m0/s1");
       
       
        // D-Alanine
        IAtomContainer acD = new AtomContainer();
        IAtom a1D = new Atom("C", new Point3d(0.358, 0.819, 20.655));
        IAtom a2D = new Atom("C", new Point3d(1.598, -0.032, 20.905));
        IAtom a3D = new Atom("N", new Point3d(0.275, 2.014, 21.574));
        IAtom a4D = new Atom("C", new Point3d(-0.952, 0.043, 20.838));
        IAtom a5D = new Atom("O", new Point3d(2.678, 0.479, 21.093));
        IAtom a6D = new Atom("O", new Point3d(1.596, -1.239, 20.958));
        a1D.setImplicitHydrogenCount(1);
        a3D.setImplicitHydrogenCount(2);
        a4D.setImplicitHydrogenCount(3);
        a5D.setImplicitHydrogenCount(1);
        acD.addAtom(a1D);
        acD.addAtom(a2D);
        acD.addAtom(a3D);
        acD.addAtom(a4D);
        acD.addAtom(a5D);
        acD.addAtom(a6D);
       
        acD.addBond(new Bond(a1D, a2D, CDKConstants.BONDORDER_SINGLE));
        acD.addBond(new Bond(a1D, a3D, CDKConstants.BONDORDER_SINGLE));
        acD.addBond(new Bond(a1D, a4D, CDKConstants.BONDORDER_SINGLE));
        acD.addBond(new Bond(a2D, a5D, CDKConstants.BONDORDER_SINGLE));
        acD.addBond(new Bond(a2D, a6D, CDKConstants.BONDORDER_DOUBLE));
       
                                                             //"InChI=1S/C3H7NO2/c1-2(4)3(5)6/h2H,4H2,1H3,(H,5,6)/t2-/m1/s1");
        Assert.assertEquals(gen.generateInchi(acL).getInChI(), "InChI=1S/C3H7NO2/c1-2(4)3(5)6/h2H,4H2,1H3,(H,5,6)/t2-/m0/s1");

    }
View Full Code Here


                    closestBond );

            IChemObjectSelection curSel = chemModelRelay.getRenderer().getRenderer2DModel().getSelection();
            IChemObjectSelection sel = null;
            if (shiftPressed && curSel != null && curSel.isFilled()) {
                IAtomContainer container = new AtomContainer(curSel.getConnectedAtomContainer());               
                if (singleSelection instanceof IAtom) {
                    IAtom atom = (IAtom) singleSelection;
                    if (!container.contains(atom))  container.addAtom(atom);
                    else container.removeAtom(atom);
                } else if (singleSelection instanceof IBond) {
                    IBond bond = (IBond) singleSelection;
                    if (!container.contains(bond))  container.addBond(bond);
                    else container.addBond(bond);
                }
                LogicalSelection logSel = new LogicalSelection(LogicalSelection.Type.ALL);
                logSel.select(container);
                sel = logSel;
            } else {
View Full Code Here

TOP

Related Classes of org.openscience.cdk.AtomContainer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.