From: Riccardo S. <sab...@si...> - 2009-06-29 09:14:02
|
Hi, i'm a PhD student from italy and i'm writing a modelling application for nano-structures that will be used as an editing tools for a DFT code developed by my college (and others...). I started to use Jmol as a viewer and i'm writing to the list 'cause i found some problems and i'd like the have a discussion about my integration strategy. I first explain the approach used in the code (the code will be released as open source, if anyone need to see the source i'll be glad to share). The software will be able to open files containg several different atomic configurations. All the editing and modelling part is done with tables of atomic positions and with other tools (not visual) and JMol is used only as a visualization tool and as a picking tools (trough findNearestAtomIndex(x, y)). In the DFT calculation is very common to import tens, or even hunderds, of different configurations and then scroll along all of them. Plus in the software i'm finishing i've implemented a way to store objects or visualization details (specific atoms color, distances....) in a specific configuration. To let this work properly and without annoying time delays i've implemented this conceptual architecture. ------------------------------------------------ 1) loads the new conf [not jmol] 2) if the conf is connected to the one visualized (same atoms, same cell): 2.a) delete drawing objects "draw ID * DELETE" [evalString() method] 2.b) store the view point getProperty("getProperty", "orientationInfo", "") [evalString() method] 2.b) calculate the translation vector for each atom 2.c) translate the atomos with "atomno=***; translateSelected {x,y,z}" [evalString() method] 2.d) paint the objects contained in the new conf [evalString() method] 2.e) restore the viewpoint and other view directives contained in the new conf [evalString() method] 3) if the conf is completely new 3.a) produce a new string in the XYZ format and send it to the code trough openStringInline() method 3.b) paint new objects [evalString() method] 3.c) set the conf. specific visualization options [evalString() method] ------------------------------------------------ Now, BEFORE and AFTER any evalString() and openStringInline() i've decided to check if jmol object was running or busy trough a very easy call public void waitUntilFree() { while (jmolViewer.isScriptExecuting()) { try { Thread.sleep(100); } catch (InterruptedException e) { e.printStackTrace(); } } } This architecture works quite good and let's me scroll very fast between different configurations (new ones and the ones only with the atoms displaed in new positions). But still some problems appear when a configuration has some obects to draw. Sometimes the code breaks and gives this specific error Exception in thread "QueueThread0" java.lang.NullPointerException at org.jmol.viewer.Viewer.loadShape(Unknown Source) This happens when i try to send in the openStringInline() method and i can't reproduce it with everytime. Sometimes happens, some other times the code works flawlessy !! Do you have any idea why this error comes out ? And, in general, do you have any reccomandations how to implement in a better way the integration between jmol, maybe with threads ? And, very last question, i saw in the last cvs version the findNearestAtomIndex(x, y) was not anymore a public function and i had to redeclare it, is there any plans to remove it ? I REALLY REALLY hope not, it's extremeluy important for integratin jmol !! Thanks for the help, Riccardo ---------------------------------------------------------------- SISSA Webmail https://webmail.sissa.it/ Powered by Horde http://www.horde.org/ |