Well, wouldn't you know it? What started out as a simple idea turned into
quite a challenge. But I think I'm done, and I am very interested in
extensive testing. Sorry, Angel -- you may have to rewrite your book!

OK, so there are two major new pieces in Jmol 11.7.40 (see files in
http://chemapps.stolaf.edu/jmol/docs/examples-11)

1. Major clean-up of the code in regard to atom properties. We had three
different sections of code all doing about the same thing - getting atom
properties:

 label %x
 select atomno > 3
 print {*}.atomno.all

Now these are all consolidated, and as I did that I tried to fill out the
matrix shown at
http://chemapps.stolaf.edu/jmol/docs/index.htm?ver=11.8#atomproperties. I
think there is some checking to do of that, but it's pretty complete. I
hadn't realized there were quite so many atom properties! You will see one
very new thing:

label %[atomname] %[occupancy]

in addition to the older

 label %a %q

So there's no absolute limit to the number of such parameters. You will see
quite a few new options there that weren't there last week.

2. In line for and if. In Java and JavaScript you can do in-line IF
commands:

   x = (something == this ? that : theOtherThing)

And in Excel you can use:

  if(a3 > 3, H34, D100)

Well, it's a little different in Jmol, but you can now do it as well -- just
use semicolons to separate the parts. (question marks and colons and commas
are already in use):

  ans = if( ifTrue ; thenThis ; elseThis )

When I am working with Jmol I tend to do a lot with lists. My undergraduate
researcher, Steven, and I were finding this morning that there could be a
use for processing sets of atoms in parallel. So rather than

  b = [1 2 3]
  c = ["red" "green" "blue"]

  n = {*}.length
  for (var i = 1; i <= n; i = i + 1)
     if ({*}[i].x < b[1]);
        {*}[i].color = c[1];
     else if ({*}[i].x < b[2]);
        {*}[i].color = c[2];
     else
        {*}[i].color = c[3];
     endif
  end for


Perhaps we could just use and "inline FOR" command:

  b = [2 5 8]
  c = ["red" "green" "blue"]
  pt = {1 1 1}
  {*}.color =  for (x;{*}; if(x.distance(pt) < b[1];c[1];if(x.distance(pt) <
b[2]; c[2]; c[3] )))

Or, perhaps it would be nice to color atoms based on their minimum bond
length:

 {*}.property_minbond = for(x;{*}; x.bonds.length.min)
 color property_minbond
 label %3.2[property_minbond]

Or to have an atom's radius based on its temperature:

tmax = {*}.temperature.max
tmin =  {*}.temperature.min
{*}.radius = for(x;{*};(x.temperature - tmin) / (tmax - tmin))

That mirrors:

  myvar = select(x; {*}; x.whatever > x.something)

which was introduced in 11.5.40.

It's a little odd, I realize, but I think it could come in handy. Definitely
a work in progress, so be on the alert for strange behaviors if you start
using Jmol 11.7.40. (I don't recommend it quite yet for general use, but I
would like to see a few others give it a work-out.) I think we're close to
calling this 11.8 now -- there are quite a few additions since 11.6. Maybe
by the end of July? Get those feature requests in!

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-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to