From: Robert H. <ha...@st...> - 2009-02-17 03:01:44
|
Frankly, I can't help you with 11.2. That was so long ago, and the code has changed so much, who knows what bug that could be. So this discussion assumes at least 11.6; I'm using 11.7. I don't think you can use JmolSimpleViewer for these purposes. Any particular reason you are using that rather than JmolViewer itself? JmolViewer includes a method, setModeMouse(int mode) that allows you to close out the viewer and start a new one; JmolSimpleViewer does not. /** * NOTE: for APPLICATION AND APPLET call * * setModeMouse(JmolConstants.MOUSE_NONE); * * before setting viewer=null * * in order to remove references to display window in listeners and hoverWatcher Failure to do that will certainly cause the effect you describe. As for openStringInline(), that should work fine. But the sequence you describe really should not work: viewer.openStringInline("<cif string>", true)); viewer.evalString(strScript); String strError = viewer.getOpenFileError(); The first creates a model, the second adds a script to a queue, and the third -- well, here's the note I made to myself: // The following was NOT what you think it was: // abstract public String getOpenFileError(); // Somewhere way back when, "openFile" became a method that did not create // the model set, but just an intermediary AtomSetCollection called the "clientFile" // (and did not necessarily close the file) // then "getOpenFileError()" actually created the model set, deallocated the file open thread, // and closed the file. That could be 11.2.... I took that out, because it should never be used, at least not in any recent version of Jmol. In Jmol 11.6 or 11.7 it's way easier than this. All you would need is: viewer.evalString("data \"model\"\n" + cifString + "\nend \"model\"\n" + strScript); There should be no memory issues, provided you use viewer.setModeMouse(JmolConstants.MOUSE_NONE); prior to disposing of the frame. Bob -- Robert M. Hanson Professor of Chemistry St. Olaf College 1520 St. Olaf Ave. Northfield, MN 55057 http://www.stolaf.edu/people/hansonr phone: 507-786-3107 If nature does not answer first what we want, it is better to take what answer we get. -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900 |