Dave, you're in luck! This mathematical language is pretty powerful.
x = "-0.1, 3.4, 5.2"
echo The energy of this one is: %{x.split(",")[_modelnumber]} eV
What this does is:
1. create a list that includes the three STRINGS "-0.1", "3.4" and "5.2"
x.split(",")
2. selects from that list the element corresponding to the current modelnumber.
x.split(",")[_modelnumber]
3. echo that number.
echo .... %{x.split(",")[_modelnumber]}
Or, if you want that in Joules:
echo That is, %{((0.0 + x.split(",")[_modelnumber]) * 1.6E-19)%-2} joules
This is funky:
1. our number, as a string:
x.split(",")[_modelnumber]
2. our number, as a decimal, in eV:
(0.0 + x.split(",")[_modelnumber])
3. our number, as a decimal, in Joules:
(0.0 + x.split(",")[_modelnumber]) * 1.6E-19
4. our number, as a decimal, in Joules, in scientific notation rounded
to 2 decimal places:
((0.0 + x.split(",")[_modelnumber]) * 1.6E-19)%-2
5. Finally, in context:
echo That is, %{((0.0 + x.split(",")[_modelnumber]) * 1.6E-19)%-2} joules
Right?
Bob
On 3/28/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'd like to associate a property with a numerical value
> to every model loaded in Jmol, and then have it 'echo'
> when the frame changes.
> e.g. I have a file containing three frames, and I know that
> the energies of the frames are (-0.1, 3.4, 5.2) respectively.
>
> I'd like to be able to give a command like
> 'echo %{_modelEnergy}', so that the energies are displayed and updated
> when I change the frame. An alternative would be to somehow create
> an array @energies, and do something like 'echo @energies[_modelNumber]'
>
> It this possible? I've looked at the 'data' command and at
> creating arrays like x = "-0.1 3.4 5.2" as described in the docs, but
> can't get anything to work. Hopefully I've missed some syntax or trick.
>
> Thanks,
>
> Dave
> --
> Dave Evans
> [EMAIL PROTECTED]
> http://www.davidaevans.org
>
>
> -------------------------------------------------------------------------
> 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-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
-------------------------------------------------------------------------
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-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users