Just a few comments here:
Be aware that I just recently fixed a bug in point(....,true) as well as
atom.sxyz. So use the latest SourceForge version of Jmol 14.4 if you
utilize those functions.
function getScreenBoundary could be simply the following, which executes
far faster:
function getScreenBoundary(atomSet) {
return [atomSet.sx.all.min, atomSet.sx.all.max, atomSet.sy.all.min,
atomSet.sy.all.max]
}
The reason your script is working without refresh is that the script checks
{visible}. This check triggers the setting of screen coordinates for an
atom. If that had been just a variable name, it would not have worked, and
you would need REFRESH.
I find that JmolData does not work as expected and requires a bug fix to
get this work. Not sure why/how it is working for you both. I have had to
fix JmolData.jar to make the following work:
// script t3.spt
function getScreenBoundary(atomSet) {
refresh
return [atomSet.sx.all.min, atomSet.sx.all.max,
atomSet.sy.all.min, atomSet.sy.all.max]
}
var margin=15;
var startZoom = 60
var atoms = {visible}
zoom @atoms @startZoom;
rotate best;
var sxInfo = getScreenBoundary(atoms);
print format("JSON",sxInfo)
var c=0;
while (sxInfo[2] < _width-margin
&& sxInfo[1] > margin
&& sxInfo[4] < _height-margin
&& sxInfo[3] > margin) {
zm=startZoom+c;
zoom @atoms @zm;
if (++c>100) break;
sxInfo = getScreenBoundary(atoms);
}
print format("JSON",sxInfo)
print "c=" + c;
print show("zoom")
//------ Headless Jmol call ----------------------------
//java -jar JmolData.jar -p -g800x800 -J 'load =1deh; script "t3.spt"'
//------------------------------------------------------
// result:
//C:\jmol-dev\bobtest>jmoldata -g800x800 -p -J "load =1deh; script t3.spt"
//[ 123.0,380.0,171.0,329.0 ]
//[ 22.0,486.0,107.0,390.0 ]
//c=48
//zoom 107.0
I also note the oddity that the -p option allows "show" output for
JmolData.
Bob
------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users