public static void main(String[] args) { Example4 ef = new Example4(); try { final String molS = "C1C2=CC=CC=C2C3=C4CC5=CC=CC=C5C4=C6CC7=CC=CC=C7C6=C13"; Molecule mol = MolImporter.importMol(molS); PolarizabilityPlugin plugin = new PolarizabilityPlugin(); plugin.setMolecule(mol); plugin.run(); ArrayList values = new ArrayList(); java.text.NumberFormat nf = java.text.NumberFormat.getInstance(); nf.setMaximumFractionDigits(3); for (int i = 0; i < mol.getAtomCount(); i++) { values.add(Float.valueOf(nf.format(((Double) plugin.getResult(i)).floatValue()))); } mol.hydrogenize(true); for (int i = 0; i < mol.getExplicitHcount(); i++) { values.add(new Double(0)); } ef.setPlugin(plugin); JFrame frame = ef.createSpaceFrame(mol, values); frame.setTitle("Polarizability"); java.net.URL u = ef.getClass().getResource("/chemaxon/marvin/space/gui/mspace16.gif"); frame.setIconImage( Toolkit.getDefaultToolkit().createImage((java.awt.image.ImageProducer) u.getContent())); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }
private static void saveImage(String notation, String imageFilePath) throws NotationException, MonomerException, StructureException, JDOMException, IOException { String complexNotation = SimpleNotationParser.getComplextNotationForRNA(notation); String smiles = ComplexNotationParser.getComplexPolymerSMILES(complexNotation); Molecule mol = MolImporter.importMol(smiles); Image image = (Image) mol.toObject("image"); new SaveAsPNG(image, imageFilePath); }
public static void main(String[] args) throws IOException { // Import a molecule from smiles Molecule mol = MolImporter.importMol("O=C1NC=CC=C1"); mol.setDim(0); // Call basic aromatization method mol.aromatize(MoleculeGraph.AROM_BASIC); System.out.println("Aromatic: " + isAromatic(mol)); // Call general aromatization method mol.aromatize(MoleculeGraph.AROM_GENERAL); System.out.println("Aromatic: " + isAromatic(mol)); }