User a11e9761d6
28-11-2011 23:47:25
Hi,
We're using a Java servlet to render molecule images, and adamantane is drawn as shown in the attachment, which our users don't like. However, when we view adamantane in the Marvin applet it is drawn correctly (a more "3D" rendering).
We're running JChem and Marvin version 5.7, and the relevant code used by the servlet is below. How can we generate adamantane images that look like the applet?
Thanks,
Krishna
(edited to add the second image)
this.molecule = MolImporter.importMol(smiles);
this.molecule.dearomatize();
MDocument document = molecule.getDocument();
if (document == null) {
document = new MDocument(molecule);
}
MolPrinter printer = new MolPrinter(document);
printer.setChiralitySupport(StereoConstants.CHIRALITYSUPPORT_ALL); // Display R/S Flags
printer.setScale(printer.maxScale(bounds)); // fit image in the rectangle
printer.setBackgroundColor(Color.decode(backgroundColor)); // to prevent white hallows around elements
// Then we call .paint on the printer
User 870ab5b546
29-11-2011 22:16:10
When you import a SMILES structure, it is in 0D, and Marvin will display the atoms according to an internal algorithm that places atoms so that the projection in the XY plane looks best -- atoms placed at a reasonable distance from one another with reasonable bond angles.
If you do a 3D clean on your molecule after you import it, Marvin will do a 3D minimization of the structure. When it displays the result, it may be that some atoms are close to one another or overlap in the XY plane. But your scientists can rotate the 3D structure manually to get the best view.
User a11e9761d6
30-11-2011 02:04:52
Thanks for responding, bobgr. Everything you say makes sense, but I still don't see how to get Marvin to draw the molecule as desired. If I add a 3D clean to the code I posted, it comes out looking really bad, and since I'm serving static images, the user will not be able to rotate it.
I don't think any fancy cleaning should be required: when I paste the SMILES "CC12CC3CC(CC(C3)C1)C2" directly into the Marvin applet, it renders the molecule correctly right away. What is the applet doing that I'm not?
User 870ab5b546
30-11-2011 02:15:11
Not sure, but you can try doing a 2D clean instead. I doubt it will make a difference from display of 0D, but it may.
We used to deliver static images, too, but we found that it was far better to use MarvinView, for a whole host of reasons. (You can copy the MRV from MarvinView, you can rotate the picture, you can lanuch MarvinSpace from it, etc.)
User a11e9761d6
30-11-2011 21:56:20
I tried the 2D clean, but it did not change the image (it still looks like the 'bad' attachment).
Maybe some ChemAxon personel can help me understand what the applet is doing to generate the correct rendering? Obviously Marvin is capable of drawing the molecule correctly, and I'm surprised that the default behavior for the applet is different that the default behavior when calling the API directly.
User a11e9761d6
07-12-2011 07:24:11
We just redeployed the servlet with a full set of jars and the problem appears to be gone. Hah!
ChemAxon 5433b8e56b
09-12-2011 10:09:17
Hi Khrisna,
I am so sorry for the very long response time, we could not have to test this issue immediatelly after your report, and after that we missed this topic unfortunatelly in the rush relates to the upcoming releases.
Anyway, I am glad to hear that, it is working.
Best regards, and sorry for the inconvenience, and thank you for your patience.
Istvan