Package org.openscience.cdk.interfaces

Examples of org.openscience.cdk.interfaces.IAtomContainer


  // OK
  public void moveTo(IBond bond, Point2d point) {
    if (bond != null) {
      if (getUndoRedoFactory() != null && getUndoRedoHandler() != null) {
        IAtomContainer undoRedoContainer = chemModel.getBuilder()
            .newInstance(IAtomContainer.class);
        undoRedoContainer.addAtom(bond.getAtom(0));
        undoRedoContainer.addAtom(bond.getAtom(1));
        Vector2d end = new Vector2d();
        end.sub(point, bond.getAtom(0).getPoint2d());
        IUndoRedoable undoredo = getUndoRedoFactory().getMoveAtomEdit(
            undoRedoContainer, end, "Move atom");
        getUndoRedoHandler().postEdit(undoredo);
View Full Code Here


    * 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

     * 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

   */
  public IBond addBond(IAtom fromAtom, IAtom toAtom, IBond.Stereo stereo,
      IBond.Order order) {
    IBond newBond = chemModel.getBuilder().newInstance(IBond.class,fromAtom, toAtom, order,
        stereo);
    IAtomContainer fromContainer = ChemModelManipulator
        .getRelevantAtomContainer(chemModel, fromAtom);
    IAtomContainer toContainer = ChemModelManipulator
        .getRelevantAtomContainer(chemModel, toAtom);

    // we need to check if this merges two atom containers or not
    if (fromContainer != toContainer) {
      fromContainer.add(toContainer);
View Full Code Here

          chemModel.getReactionSet(), "Clear Panel");
      getUndoRedoHandler().postEdit(undoredo);
    }
    if (chemModel.getMoleculeSet() != null) {
      IAtomContainerSet molSet = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
      IAtomContainer ac = chemModel.getBuilder().newInstance(IAtomContainer.class);
      molSet.addAtomContainer(ac);
      chemModel.setMoleculeSet(molSet);

    }
    if (chemModel.getReactionSet() != null)
View Full Code Here

     * 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

      diagramGenerator.setMolecule(builder.newInstance(IAtomContainer.class,container));
    }

    try {
      diagramGenerator.generateExperimentalCoordinates();
      IAtomContainer cleanedMol = diagramGenerator.getMolecule();
      // now copy/paste coordinates
      for (int i = 0; i < cleanedMol.getAtomCount(); i++) {
        container.getAtom(i).setPoint2d(
            cleanedMol.getAtom(i).getPoint2d());
      }
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
View Full Code Here

    // the molecule set should not be null, but just in case...
    if (set == null) {
      set = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
      chemModel.setMoleculeSet(set);
    }
    IAtomContainer newAtomContainer = chemModel.getBuilder().newInstance(IAtomContainer.class);
    if (chemModel.getMoleculeSet().getAtomContainer(0).getAtomCount() == 0)
      newAtomContainer = (IAtomContainer) chemModel.getMoleculeSet()
          .getAtomContainer(0);
    else
      chemModel.getMoleculeSet().addAtomContainer(newAtomContainer);
    newAtomContainer.add(ring);
    updateAtoms(ring, ring.atoms());
    structureChanged();
    if (undoable && getUndoRedoFactory() != null
        && getUndoRedoHandler() != null) {
      IUndoRedoable undoredo = getUndoRedoFactory()
View Full Code Here

     * 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

    // the molecule set should not be null, but just in case...
    if (set == null) {
      set = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
      chemModel.setMoleculeSet(set);
    }
    IAtomContainer newAtomContainer = chemModel.getBuilder().newInstance(IAtomContainer.class);
    if (chemModel.getMoleculeSet().getAtomContainer(0).getAtomCount() == 0)
      newAtomContainer = (IAtomContainer) chemModel.getMoleculeSet()
          .getAtomContainer(0);
    else
      chemModel.getMoleculeSet().addAtomContainer(newAtomContainer);
    newAtomContainer.add(ring);
    updateAtoms(ring, ring.atoms());
    structureChanged();
    if (undoable && getUndoRedoFactory() != null
        && getUndoRedoHandler() != null) {
      IUndoRedoable undoredo = getUndoRedoFactory()
View Full Code Here

TOP

Related Classes of org.openscience.cdk.interfaces.IAtomContainer

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.