On 11/19/2010 09:49 AM, Martin Slavík wrote:
>   Hello,
> 
> I want to compute atom and bond density in a BoundBox.
> 
> How I compute BoundBox volume and assign it to variable?
> 
> I have found:
> 
> getProperty boundBoxInfo
> with output
> 
> boundBoxInfo.center  {0.13364983 0.025449991 -0.023100138}
> boundBoxInfo.vector   {2.06035 1.45675 2.2005}
> boundBoxInfo.corner1                    {2.1939998 1.4822 2.1773999}
> boundBoxInfo.corner0                    {-1.9267001 -1.4313 -2.2236001}
> 
> and show BOUNDBOX
> with output:
> boundbox corners {-4.2960005 -7.088 -5.024} {4.3 7.088 5.0200005} # volume = 
> 1223.9308
> 
>   But I do not know how to extract information and assign it  to variable, 
> e.g. 
> BoundBoxVolume. Can anybody help me with it?
> 

A compact version (tested with Jmol 12.0.22) would be the following:

~BoundBoxVolume = script("show boundbox").split(" ")[0].trim();

For clarity you could split it up into several commands:

~BoundBoxInfo     = script("show boundbox");
~boundBoxWordList = ~BoundBoxInfo.split(" ");
~BoundBoxVolume   = ~BoundBoxWordList[0].trim();

So first the whole boundbox information is written into a variable.
Then the information is splitted into words (separated by space).
Finally the last word (the volume) is taken and stripped of whitespace.

But be careful if you update to newer Jmol versions. Since the output of
the "show boundbox" command might occasionally change you should put
this on your checklist for installing new Jmol versions.

Regards,
Rolf

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to