Jmol developer list:
11.1.6 is ready to go when Nico is ready. This version implements some
compiler/script ideas I'd like to bounce off you. I discovered that with
just a few choice additions of code, we can have some pretty interesting
capability to work with variables in Jmol. I realize this isn't complete
(no + or - here, no increment or decrement) -- but I think it might be
helpful.
SET
---
x = 3
test = "testing"
n = (selected) #(atom expression) means "count of"
are now equivalent to
set x 3
set test "testing"
set n (selected) # just the number of selected
Just giving "SET" by itself now produces something like this:
allowembeddedscripts = true;
autobond = true;
axesorientationrasmol = false;
backgroundcolor = "black";
bondradiusmilliangstroms = 150;
bondtolerance = 0.45;
defaultcolorscheme = "Jmol";
defaults = "Jmol";
minbonddistance = 3.0;
percentvdwatom = 20;
perspectivedepth = true;
showaxes = false;
showboundbox = false;
showhydrogens = true;
showmeasurements = true;
vibrationperiod = 0.5;
vibrationscale = 0.5;
zerobasedxyzrasmol = false;
All of which you could execute exactly as written there.
I just thought this was easy to do (3 lines of code), and looks nice.
IF
--
Braces here mean "number of atoms" matching that atom expression. Simple
comparisons are possible:
if {_N} > {_O};message "There are more nitrogens than oxygens";
or more complicated ones as well. It is just using the same syntax
engine as SELECT:
if !({_N} > 3 && {_O} > 3);
select _O;
color yellow;
else;
select _N;
color yellow;
endif;
if (minBondDistance < 0.6);
minBondDistance = 0.6;
connect;
endif;
That sort of thing. No string omparisons yet, just numeric and boolean.
ECHO and MESSAGE
----------------
echo %{variableName}
replaces the variable with its set value. I think I might add a few more
of these that would change automatically. The one I added was
"_modelNumber".
So, for example, if you had an animation, and you
set echo top left
echo "Model %{_modelNumber}
animation on
you will see that number change as the frames change.
The idea is to make some of this echoing of variables less
JavaScript-intensive.
echo %{(atom expression)}
If the "variable name" is in parentheses inside the braces, then it is
instead
evaluated as an atom expression, and the number of matching atoms is
returned.
This will update automatically. For example:
slab on
echo "# clickable atoms: %{(clickable)}"
changes as you change the slab with the mouse (CTRL-SHIFT-LEFT-drag).
I decided NOT to allow this capability for atom labels, because it would
be rather
intensive during rendering if there were many of these to check.
Thoughts?
Bob
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Jmol-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers