Bob,
I'm having problems with save/restore state with models that originated
with a load inline. The state script needs the original load string.
I've been operating on the assumption that if my original onload script
for the applet contains a var mod1 = "", then mod1 is global. If I do a
load @mod1 with mod1 containing coordinate data, then a subsequent state
save does, indeed, produce a script that indicates a need for mod1,
@mod1 actually. If I haven't messed with mod1, shouldn't this still be
around for a subsequent restore? I keep getting a can't find string data
error on the restore.
I've always been a bit confused about the role of "var" and Jmol Script
globals. I use the above approach (initial declaration) to maintain
variable continuity between JavaScript functions, but this in not
working on state restore. As an example of mod1 acting globally, the
following duplication of a model works:
function dupMod() {
if (moData) {return; }
var modTxt = "echo Copying model data...;mod1 = '" +
jmolGetPropertyAsString("extractModel", "all") + "'";
jmolScript(modTxt); setTimeout("dupMod2()", 1000);
}
function dupMod2() {
var modelTxt = "" + jmolGetPropertyAsString("extractModel", "all")
+ "";
var scpt = "var i = {*}.atomIndex.max + 1;var t =
{*}.atomIndex.min;select within(branch, {atomIndex = i},
{atomIndex=t});var x = {selected}.size;var y={*}.size;var z = y - x;";
scpt += "if (y > 40 || z != 0){echo This feature is limited to a
single model with|less than 40 atoms.;delay 3;echo;}";
scpt += "else{var sz = 3;if (y > 4){sz = 4};if (y > 10){sz = 5};if
(y > 30){sz = 7};set appendNew false;";
scpt += "select *;translateSelected {...@sz @sz 0};load APPEND '@mod1';";
scpt += "mod1='';hover off;}";
mepsData = false;
jmolScript(scpt);
doUFF(1);
setTimeout("lnkSwitch()", 1000);
}
Any suggestions?
Otis
--
Otis Rothenberger
chemagic.com
------------------------------------------------------------------------------
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users