SO glad you found that, Egon. I had broken it, for sure. That is one of the
most powerful aspects of Jmol math -- and I forgot all about it! Should be
fixed now. See http://chemapps.stolaf.edu/jmol/docs/examples-11/new.htm

FINALLY I think I have brought the Jmol scripting language up a notch. The
latest addition is full brace support and the Java/JavaScript-style inline
IF and FOR:

These are all equivalent in Jmol starting with Jmol 11.7.40:

(1)

 if (5 > 3)
     print "5 > 3"
 else
    print "no"
 endif


(2)

 if (5 > 3) {
     print "5 > 3"
 } else {
    print "no"
 }

(3)

  if (5 > 3) ; print "5 > 3" ; else ; print "no" ; endif

(4)

 if (5 > 3) {  print "5 > 3" } else { print "no" }

(5)

print if( 5> 3; "5 > 3" ; "no")

(6)

print (5 > 3 ? "5 > 3" : "no")


Something for everybody there, I think!


That combined with the ability to write your own functions and use them in
the select command:

function myfunc(_x) {
 return sqrt(_x.x*_x.x + _x.y*_x.y + _x.z*_x.z)
}

select {*.ca} (myfunc < 10.0);spacefill on


pretty much lets you do anything with the data.


The inline FOR command looks similar, but it uses the semicolon notation
exclusively:


for (var x = 1; x < {*}; x = x + 1){  {*}[x].radius = ({*}[x].temperature <
10 ? 1 : 0)}

Finally, the inline SELECT command might also be useful:

print select(x; {*.ca}; myfunc(x) < 10.0)


Bob

-- 
Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
http://www.stolaf.edu/people/hansonr
phone: 507-786-3107


If nature does not answer first what we want,
it is better to take what answer we get.

-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
OpenSolaris 2009.06 is a cutting edge operating system for enterprises 
looking to deploy the next generation of Solaris that includes the latest 
innovations from Sun and the OpenSource community. Download a copy and 
enjoy capabilities such as Networking, Storage and Virtualization. 
Go to: http://p.sf.net/sfu/opensolaris-get
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to