Examples of AtomContainer


Examples of org.openscience.cdk.AtomContainer

        }

        // MDLV3000 reading
        if (cor.accepts(IAtomContainer.class) && chemModel==null) {
            // try to read a Molecule
                IAtomContainer mol = (AtomContainer) cor.read(new AtomContainer());
                if(mol!=null )
                    try{
                        IAtomContainerSet newSet = new AtomContainerSet();
                        newSet.addAtomContainer(mol);
                        chemModel = new ChemModel();
View Full Code Here

Examples of org.openscience.cdk.AtomContainer

     * (non-Javadoc)
     * @see org.openscience.cdk.renderer.ISelection#getConnectedAtomContainer()
     */
    public IAtomContainer getConnectedAtomContainer() {
       
        IAtomContainer ac = new AtomContainer();
        if (atoms.size() != 0) {
           ac = atoms.get(0).getBuilder().newInstance(IAtomContainer.class);
           for (IAtom atom : atoms) {
              ac.addAtom(atom);
           }
        }
       
        for (IBond bond : bonds) {
           ac.addBond(bond);
        }
       
        return ac;
    }
View Full Code Here

Examples of org.openscience.cdk.AtomContainer

     * Tests element name is correctly passed to InChI.
     *
     * @throws Exception
     */
    @Test public void testGetInchiFromChlorineAtom() throws Exception {
        IAtomContainer ac = new AtomContainer();
        ac.addAtom(new Atom("Cl"));
        gen.setHydrogensNotAdded(true);
        Assert.assertEquals(gen.generateInchi(ac).getInChI(), "InChI=1S/Cl");
        gen.setHydrogensNotAdded(false);

    }
View Full Code Here

Examples of org.openscience.cdk.AtomContainer

     * Tests charge is correctly passed to InChI.
     *
     * @throws Exception
     */
    @Test public void testGetInchiFromLithiumIon() throws Exception {
        IAtomContainer ac = new AtomContainer();
        IAtom a = new Atom("Li");
        a.setFormalCharge(+1);
        ac.addAtom(a);
        gen.setHydrogensNotAdded(true);
        Assert.assertEquals(gen.generateInchi(ac).getInChI(), "InChI=1S/Li/q+1");
        gen.setHydrogensNotAdded(false);

    }
View Full Code Here

Examples of org.openscience.cdk.AtomContainer

    * Tests isotopic mass is correctly passed to InChI.
    *
    * @throws Exception
    */
    @Test public void testGetInchiFromChlorine37Atom() throws Exception {
        IAtomContainer ac = new AtomContainer();
        IAtom a = new Atom("Cl");
        a.setMassNumber(37);
        ac.addAtom(a);
        gen.setHydrogensNotAdded(true);
        Assert.assertEquals(gen.generateInchi(ac).getInChI(), "InChI=1S/Cl/i1+2");
        gen.setHydrogensNotAdded(false);
    }
View Full Code Here

Examples of org.openscience.cdk.AtomContainer

     * Tests implicit hydrogen count is correctly passed to InChI.
     *
     * @throws Exception
     */
    @Test public void testGetInchiFromHydrogenChlorideImplicitH() throws Exception {
        IAtomContainer ac = new AtomContainer();
        IAtom a = new Atom("Cl");
        a.setImplicitHydrogenCount(1);
        ac.addAtom(a);
        Assert.assertEquals(gen.generateInchi(ac).getInChI(), "InChI=1S/ClH/h1H");
    }
View Full Code Here

Examples of org.openscience.cdk.AtomContainer

     * Tests single bond is correctly passed to InChI.
     *
     * @throws Exception
     */
    @Test public void testGetInchiFromEthane() throws Exception {
        IAtomContainer ac = new AtomContainer();
        IAtom a1 = new Atom("C");
        IAtom a2 = new Atom("C");
        a1.setImplicitHydrogenCount(3);
        a2.setImplicitHydrogenCount(3);
        ac.addAtom(a1);
        ac.addAtom(a2);
        ac.addBond(new Bond(a1, a2, CDKConstants.BONDORDER_SINGLE));
        InChI inchi = gen.generateInchi(ac);
        Assert.assertEquals(inchi.getInChI(), "InChI=1S/C2H6/c1-2/h1-2H3");
        Assert.assertEquals("InChIKey=OTMSDBZUPAUEDD-UHFFFAOYSA-N", inchi.getKey());
    }
View Full Code Here

Examples of org.openscience.cdk.AtomContainer

     * Tests double bond is correctly passed to InChI.
     *
     * @throws Exception
     */
    @Test public void testGetInchiFromEthene() throws Exception {
        IAtomContainer ac = new AtomContainer();
        IAtom a1 = new Atom("C");
        IAtom a2 = new Atom("C");
        a1.setImplicitHydrogenCount(2);
        a2.setImplicitHydrogenCount(2);
        ac.addAtom(a1);
        ac.addAtom(a2);
        ac.addBond(new Bond(a1, a2, CDKConstants.BONDORDER_DOUBLE));
        Assert.assertEquals(gen.generateInchi(ac).getInChI(), "InChI=1S/C2H4/c1-2/h1-2H2");
    }
View Full Code Here

Examples of org.openscience.cdk.AtomContainer

     * Tests triple bond is correctly passed to InChI.
     *
     * @throws Exception
     */
    @Test public void testGetInchiFromEthyne() throws Exception {
        IAtomContainer ac = new AtomContainer();
        IAtom a1 = new Atom("C");
        IAtom a2 = new Atom("C");
        a1.setImplicitHydrogenCount(1);
        a2.setImplicitHydrogenCount(1);
        ac.addAtom(a1);
        ac.addAtom(a2);
        ac.addBond(new Bond(a1, a2, CDKConstants.BONDORDER_TRIPLE));
        Assert.assertEquals(gen.generateInchi(ac).getInChI(), "InChI=1S/C2H2/c1-2/h1-2H");
    }
View Full Code Here

Examples of org.openscience.cdk.AtomContainer

     * @throws Exception
     */
    @Test public void testGetInchiEandZ12Dichloroethene2D() throws Exception {

        // (E)-1,2-dichloroethene
        IAtomContainer acE = new AtomContainer();
        IAtom a1E = new Atom("C", new Point2d(2.866, -0.250));
        IAtom a2E = new Atom("C", new Point2d(3.732, 0.250));
        IAtom a3E = new Atom("Cl", new Point2d(2.000, 2.500));
        IAtom a4E = new Atom("Cl", new Point2d(4.598, -0.250));
        a1E.setImplicitHydrogenCount(1);
        a2E.setImplicitHydrogenCount(1);
        acE.addAtom(a1E);
        acE.addAtom(a2E);
        acE.addAtom(a3E);
        acE.addAtom(a4E);

        acE.addBond(new Bond(a1E, a2E, CDKConstants.BONDORDER_DOUBLE));
        acE.addBond(new Bond(a1E, a3E, CDKConstants.BONDORDER_SINGLE));
        acE.addBond(new Bond(a2E, a4E, CDKConstants.BONDORDER_SINGLE));
       
        Assert.assertEquals(gen.generateInchi(acE).getInChI(), "InChI=1S/C2H2Cl2/c3-1-2-4/h1-2H/b2-1+");
       
        // (Z)-1,2-dichloroethene
        IAtomContainer acZ = new AtomContainer();
        IAtom a1Z = new Atom("C", new Point2d(2.866, -0.440));
        IAtom a2Z = new Atom("C", new Point2d(3.732, 0.060));
        IAtom a3Z = new Atom("Cl", new Point2d(2.000, 0.060));
        IAtom a4Z = new Atom("Cl", new Point2d(3.732, 1.060));
        a1Z.setImplicitHydrogenCount(1);
        a2Z.setImplicitHydrogenCount(1);
        acZ.addAtom(a1Z);
        acZ.addAtom(a2Z);
        acZ.addAtom(a3Z);
        acZ.addAtom(a4Z);

        acZ.addBond(new Bond(a1Z, a2Z, CDKConstants.BONDORDER_DOUBLE));
        acZ.addBond(new Bond(a1Z, a3Z, CDKConstants.BONDORDER_SINGLE));
        acZ.addBond(new Bond(a2Z, a4Z, CDKConstants.BONDORDER_SINGLE));
       
        Assert.assertEquals(gen.generateInchi(acZ).getInChI(), "InChI=1S/C2H2Cl2/c3-1-2-4/h1-2H/b2-1-");

    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.