[Prev] Thread [Next]  |  [Prev] Date [Next]

Re: [Jmol-users] finding documentation on the state variables Robert Hanson Fri Feb 03 08:08:46 2012

On Mon, Jan 30, 2012 at 5:07 PM, Ted Cohen <[EMAIL PROTECTED]> wrote:

> Hello Jmol community!
> Is that even what you call them?
Is what even what you call what?

> I am using Jmol in a web page with the javascript interface;
> I needed to get the current value of a few state variables
> to initialize the controls that I created to match the state
> of the molecule loaded in the Jmol applet.
> Currently, I do a show state command and then parse the output to
> get what I need but my app will break if the layout
> of the "show state" response  ever changes.
> Recent activity on this list has highlighted a facility
> much more suited to my needs. Apparently I can poll state
> variables directly for exactly the information that I
> want (and no more) with the certainty that my app won't break
> in future releases of Jmol. An example of such a state variable
> that has been discussed recently is "_spinning". I have searched
> to find documentation of this state variable in particular, hoping
> to find a list containing the name and description of every
> state variable but have not been able to find such a thing.

They are called "read-only" variables. I had not considered calling them
state variables, but in a sense I suppose that is what they are. However,
they certainly do not in and of themselves define the state the way you
would expect perhaps with variables of that name. To see them, use:

show _?

I've updated that description in the documentation. I noticed quite a few
of these missing. So thanks for pointing us to this omission.

> Right off the bat, I would be looking to know the spin
> rate on each axis and the value for wireframe, spacefill
> and dots but over the long haul, I am sure that there are
> may more variables that I will want to reference.  Where can
> I look to see what variables are available?
While it can possibly be informative to consider the spin rate on each
axis, spin is far more interesting than that. The original spin idea was
window-based and, as you mention there, based on fixed axes. But now that
we can spin around a molecular axis, that's a bit more involved. We can
expose anything you want if you ask. Still, the best way is via the state.
Probably the simplest way to get that is still:

 show state/"set spin"

which will give you just one line to parse.

Robert M. Hanson
Professor of Chemistry
St. Olaf College
1520 St. Olaf Ave.
Northfield, MN 55057
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
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
Jmol-users mailing list