Package org.openscience.cdk.interfaces

Examples of org.openscience.cdk.interfaces.IAtomContainerSet


     *
     * @param model the model to draw.
     * @return a rectangle in screen space.
     */
    public Rectangle calculateDiagramBounds(IChemModel model) {
        IAtomContainerSet moleculeSet = model.getMoleculeSet();
        IReactionSet reactionSet = model.getReactionSet();
        if ((moleculeSet == null && reactionSet == null)) {
            return new Rectangle();
        }

View Full Code Here


        return this.calculateScreenBounds(
                Renderer.calculateBounds(moleculeSet));
    }

    public static Rectangle2D calculateBounds(IChemModel chemModel) {
        IAtomContainerSet moleculeSet = chemModel.getMoleculeSet();
        IReactionSet reactionSet = chemModel.getReactionSet();
        Rectangle2D totalBounds = null;
        if (moleculeSet != null) {
            totalBounds = Renderer.calculateBounds(moleculeSet);
        }
View Full Code Here

        return totalBounds;
    }

    public static Rectangle2D calculateBounds(IReaction reaction) {
        // get the participants in the reaction
        IAtomContainerSet reactants = reaction.getReactants();
        IAtomContainerSet products = reaction.getProducts();
        if (reactants == null || products == null) {
            return null;
        }

        // determine the bounds of everything in the reaction
View Full Code Here

     @param model the model for which to calculate the average bond length
     */
    public static double calculateAverageBondLength(IChemModel model) {

        // empty models have to have a scale
        IAtomContainerSet moleculeSet = model.getMoleculeSet();
        if (moleculeSet == null) {
            IReactionSet reactionSet = model.getReactionSet();
            if (reactionSet != null) {
                return Renderer.calculateAverageBondLength(reactionSet);
            }
View Full Code Here

        return averageBondModelLength / reactionSet.getReactionCount();
    }

    public static double calculateAverageBondLength(IReaction reaction) {

        IAtomContainerSet reactants = reaction.getReactants();
        double reactantAverage = 0.0;
        if (reactants != null) {
            reactantAverage =
                    Renderer.calculateAverageBondLength(reactants)
                    / reactants.getAtomContainerCount();
        }

        IAtomContainerSet products = reaction.getProducts();
        double productAverage = 0.0;
        if (products != null) {
            productAverage =
                    Renderer.calculateAverageBondLength(products)
                    / products.getAtomContainerCount();
        }

        if (productAverage == 0.0 && reactantAverage == 0.0) {
            return 1.0;
        } else {
View Full Code Here

        chooser.showSaveDialog(jcpPanel);
        File outFile = chooser.getSelectedFile();
        System.out.println(outFile);
        List<IAtomContainer> molecules= jcpPanel.get2DHub().getRGroupHandler().getrGroupQuery().getAllConfigurations();
        if (molecules.size() > 0) {
          IAtomContainerSet molSet = molecules.get(0).getBuilder().newInstance(IAtomContainerSet.class);
          for (IAtomContainer mol : molecules) {
            molSet.addAtomContainer(mol);
          }
          SDFWriter sdfWriter = new SDFWriter(new FileWriter(outFile));
          sdfWriter.write(molSet);
          sdfWriter.close();
        }
View Full Code Here

  public IRenderingElement generate(IReaction reaction, JChemPaintRendererModel model) {
    ElementGroup diagram = new ElementGroup();
        Color color = model.getForeColor();
   
    IAtomContainerSet reactants = reaction.getReactants();
    if(reactants.getAtomContainerCount()>0){
            Rectangle2D totalBoundsReactants = Renderer.calculateBounds(reactants);
            Rectangle2D bounds1 =
                Renderer.calculateBounds(reactants.getAtomContainer(0));
            double axis = totalBoundsReactants.getCenterY();
            for (int i = 1; i < reaction.getReactantCount(); i++) {
              Rectangle2D bounds2 =
                  Renderer.calculateBounds(reactants.getAtomContainer(i));
              diagram.add(makePlus(bounds1, bounds2, axis, color));
              bounds1 = bounds2;
            }
    }
       
        IAtomContainerSet products = reaction.getProducts();
        if(products.getAtomContainerCount()>0){
            Rectangle2D totalBoundsProducts = Renderer.calculateBounds(products);
            double axis = totalBoundsProducts.getCenterY();
            Rectangle2D bounds1 = Renderer.calculateBounds(products.getAtomContainer(0));
            for (int i = 1; i < reaction.getProductCount(); i++) {
              Rectangle2D bounds2 =
                  Renderer.calculateBounds(products.getAtomContainer(i));
             
              diagram.add(makePlus(bounds1, bounds2, axis, color));
              bounds1 = bounds2;
            }
        }
View Full Code Here

        }
        BufferedWriter out = new BufferedWriter(new FileWriter(outFile));

        String eol=System.getProperty("line.separator");
        if (object instanceof IChemModel) {
            IAtomContainerSet mSet = ((IChemModel) object).getMoleculeSet();
            for (IAtomContainer atc : mSet.atomContainers()) {
                InChI inchi = InChITool.generateInchi(atc);
                out.write(inchi.getInChI()+eol);
                out.write(inchi.getAuxInfo()+eol);
                out.write(inchi.getKey()+eol);
            }
View Full Code Here

        if (cow != null && askIOSettings())
        {
            cow.addChemObjectIOListener(new SwingGUIListener(jcpPanel, IOSetting.Importance.HIGH));
        }
        Iterator<IAtomContainer> containers = ChemModelManipulator.getAllAtomContainers(model).iterator();
        IAtomContainerSet som = model.getBuilder().newInstance(IAtomContainerSet.class);
        while (containers.hasNext()) {
            //Clone() is here because the SMILESWriter sets valencies and we don't
            //want these changes visible
            som.addAtomContainer((IAtomContainer) containers.next().clone());
        }   
        cow.write(som);
        cow.close();
        if(jcpPanel instanceof JChemPaintPanel)
            ((JChemPaintPanel)jcpPanel).setTitle(jcpPanel.getChemModel().getID());
View Full Code Here

  public IAtomContainerSet getMoleculeSet (IChemModel chemModel) throws CDKException {

    if (rGroupQuery==null || rGroupQuery.getRootStructure() == null || rGroupQuery.getRootStructure().getAtomCount()==0)
      throw new CDKException( "The R-group is empty");

    IAtomContainerSet moleculeSet = chemModel.getBuilder().newInstance(IAtomContainerSet.class);
    moleculeSet.addAtomContainer(rGroupQuery.getRootStructure());
    chemModel.setMoleculeSet(moleculeSet);
    for (int rgrpNum : sortRGroupNumbers()) {
      RGroupList rgrpList = rGroupQuery.getRGroupDefinitions().get(rgrpNum);
      for (RGroup rgrp : rgrpList.getRGroups()) {
        chemModel.getMoleculeSet().addAtomContainer(rgrp.getGroup());
View Full Code Here

TOP

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

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.