Package org.openscience.cdk

Examples of org.openscience.cdk.Atom


      }
    }

    if(mol == null && request.getParameter("element") != null && (request.getParameter("element").length() > 0)) {
      String elemSymbol = request.getParameter("element");
      Atom a = new Atom(elemSymbol);
      a.setPoint2d(new Point2d(0.0, 0.0));
      mol = new Molecule();
      mol.addAtom(a);
      makeStructure = false;
    }
   
View Full Code Here


      if(!a.getSymbol().equals("Si")) continue;
      int c = (int)mol.getBondOrderSum(a);
      if(a.getFormalCharge() == 1 || a.getFormalCharge() == -1) c += 1;
      int hr = 4 - c;
      for(int j=0;j<hr;j++) {
        IAtom ha = new Atom("H");
        isotopeFactory.configure(ha);
        IBond b = new Bond(a, ha);
        mol.addAtom(ha);
        mol.addBond(b);
      }
View Full Code Here

          isBridgehead = false;
          break;
        }
      }
      if(isBridgehead) {
        IAtom newH = new Atom("H");
        mol.addAtom(newH);
       
      }
    }
   
View Full Code Here

     *
     * @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

     *
     * @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

    *
    * @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

     *
     * @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

     *
     * @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");
View Full Code Here

     *
     * @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

     *
     * @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

TOP

Related Classes of org.openscience.cdk.Atom

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.