Package org.openscience.cdk.interfaces

Examples of org.openscience.cdk.interfaces.IAtomContainer.addAtom()


    // add the first atom in the new bond
    String atomType = getController2DModel().getDrawElement();
    IAtom atom = addAtomWithoutUndo(atomType, worldCoordinate,
        makePseudoAtom);
    undoRedoContainer.addAtom(atom);

    // add the second atom to this
    IAtom newAtom = addAtomWithoutUndo(atomType, atom, makePseudoAtom);
    undoRedoContainer.addAtom(newAtom);
View Full Code Here


        makePseudoAtom);
    undoRedoContainer.addAtom(atom);

    // add the second atom to this
    IAtom newAtom = addAtomWithoutUndo(atomType, atom, makePseudoAtom);
    undoRedoContainer.addAtom(newAtom);

    IAtomContainer atomContainer = ChemModelManipulator
        .getRelevantAtomContainer(getIChemModel(), newAtom);

    IBond newBond = atomContainer.getBond(atom, newAtom);
View Full Code Here

  public void moveTo(IAtom atom, Point2d worldCoords) {
    if (atom != null) {
      if (getUndoRedoFactory() != null && getUndoRedoHandler() != null) {
        IAtomContainer undoRedoContainer = chemModel.getBuilder()
            .newInstance(IAtomContainer.class);
        undoRedoContainer.addAtom(atom);
        Vector2d end = new Vector2d();
        end.sub(worldCoords, atom.getPoint2d());
        IUndoRedoable undoredo = getUndoRedoFactory().getMoveAtomEdit(
            undoRedoContainer, end, "Move atom");
        getUndoRedoHandler().postEdit(undoredo);
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

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

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

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

    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

     */
    @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");
    }
   
    /**
     * Tests radical state is correctly passed to InChI.
View Full Code Here

        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

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.