Package org.openscience.cdk.layout

Examples of org.openscience.cdk.layout.StructureDiagramGenerator


      e.printStackTrace();
    }
  }
 
  private IMolecule getMoleculeStructure(IMolecule inputMol) throws Exception {
    StructureDiagramGenerator sdg = new StructureDiagramGenerator();
    IMoleculeSet originalMols = ConnectivityChecker.partitionIntoMolecules(inputMol);
    MoleculeSet mols = new MoleculeSet();
    for(int i=0;i<originalMols.getMoleculeCount();i++) {
      IMolecule mol = originalMols.getMolecule(i);
      sdg.setMolecule(mol);
      //sdg.setMolecule(new Molecule(th.getTemplateAt(6)));
      sdg.setTemplateHandler(th);
      sdg.generateCoordinates();
      mols.addMolecule(sdg.getMolecule());
    }
    if(mols.getMoleculeCount() == 0) return null;
    sdg = null;
    return getMoleculeForMoleculeRange(0, mols.getMoleculeCount()-1, mols);
  }
View Full Code Here


            }
        }

        if(generateCoordinates){
            // now generate 2D coordinates
            StructureDiagramGenerator sdg = new StructureDiagramGenerator();
            sdg.setTemplateHandler(new TemplateHandler(moleculeSet.getBuilder()));
            try {
                sdg.setMolecule(molecule);
                sdg.generateCoordinates();
                molecule = sdg.getMolecule();
            } catch (Exception exc) {
                JOptionPane.showMessageDialog(chemPaintPanel, GT.get("Structure could not be generated"));
                throw new CDKException(
                        "Cannot depict structure");
            }
View Full Code Here

     *
     * @param molecules
     * @throws Exception
     */
    private static void generate2dCoordinates(List<IAtomContainer> molecules) {
        StructureDiagramGenerator sdg = new StructureDiagramGenerator();
        for (int atIdx = 0; atIdx < molecules.size(); atIdx++) {
            IAtomContainer mol = molecules.get(atIdx);
            sdg.setMolecule(mol.getBuilder().newInstance(IAtomContainer.class,mol));
            try {
                sdg.generateCoordinates();
            } catch (Exception e) {
                e.printStackTrace();
            }
            IAtomContainer ac = sdg.getMolecule();
            for(int i=0;i<ac.getAtomCount();i++){
                mol.getAtom(i).setPoint2d(ac.getAtom(i).getPoint2d());
            }
        }
    }
View Full Code Here

                        toPaste = new FixBondOrdersTool().kekuliseAromaticRings(toPaste);

                        IAtomContainerSet mols = ConnectivityChecker.partitionIntoMolecules(toPaste);
                        for(int i=0;i<mols.getAtomContainerCount();i++)
                        {
                            StructureDiagramGenerator sdg =
                                new StructureDiagramGenerator((IAtomContainer)mols.getAtomContainer(i));

                            sdg.setTemplateHandler(
                                    new TemplateHandler(toPaste.getBuilder())
                            );
                            sdg.generateCoordinates();
                        }
                        //SMILES parser sets valencies, unset
                        for(int i=0;i<toPaste.getAtomCount();i++){
                            toPaste.getAtom(i).setValency(null);
                        }
View Full Code Here

  public static void generateNewCoordinates(IAtomContainer container) {
    IChemObjectBuilder builder = DefaultChemObjectBuilder
        .getInstance();

    if (diagramGenerator == null) {
      diagramGenerator = new StructureDiagramGenerator();
      diagramGenerator.setTemplateHandler(new TemplateHandler(builder));
    }
    if (container instanceof IAtomContainer) {
      diagramGenerator.setMolecule((IAtomContainer) container);
    } else {
View Full Code Here

            ChemFile chemFile = (ChemFile)reader.read((ChemObject)new ChemFile());
            atc= ChemFileManipulator.getAllAtomContainers(chemFile).get(0);
            atc.setProperty(CDKConstants.TITLE, null);

            // Generate coordinates for the atom container
            StructureDiagramGenerator sdg =
                new StructureDiagramGenerator((IAtomContainer)atc);
            sdg.generateCoordinates();


        } finally {

            //Always delete any temporary files
View Full Code Here

TOP

Related Classes of org.openscience.cdk.layout.StructureDiagramGenerator

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.