Rolf, you are definitely pushing the limit there, I think. What exactly
happens inside the loop you are really interested in using? If it is
anything much, then the looping itself is going to be insignificant
compared to the other processing.

I probably will regret suggesting this, but something to consider might be
a hybrid, where you retrieve key Jmol variables into JavaScript, run
whatever in Javascript, then put them back (if desired). The example below
is for an integer:

<script>
var _vi = jmolApplet0._applet.viewer.g.htUserVariables.get("i")
var i = _vi.intValue
// Object { index: 2147483647, flags: 3, myName: "i", tok: 2, intValue: 0 }
// then do anything with that you want, and finally
_vi.intValue = ....
</script>

Other Jmol types will work -- after all, it's *all *JavaScript. (This could
not be done with the Java applet, of course.)

Jmol variable types include

  public final static int integer    =  2;
  public final static int decimal    =  3;
  public final static int string     =  4;

  public final static int hash       =  6;  // associative array; Hashtable
  public final static int varray     =  7;  // List<ScriptVariable>
  public final static int point3f    =  8;
  public final static int point4f    =  9;
  public final static int bitset     =  10;

  public final static int matrix3f   = 11;
  public final static int matrix4f   = 12;
  public final static int listf      = 13;       // listf "list-float" is
specifically for xxx.all.bin,
  public final static int context    = 14;
  public final static int barray     = 15; // byte array


Believe it or not, you can change variables from one type to another this
way, though I would not necessarily recommend doing that.

var _vi = jmolApplet0._applet.viewer.g.htUserVariables.get("i");
var i = _vi.intValue;
_vi.tok = 2; // now Jmol's "i" variable is a float!
_vi.value = new Float(i);

The Jmol JAVASCRIPT command could be used to mix and match Jmol scripting
with JavaScript.

Mind you, _applet.viewer.g.htUserVariables  is NOT a public entity -- I
reserve the right to change its name at any time!

​Bob
------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to