On 02/07/2014 05:51 PM, Robert Hanson wrote:
> OK, so there is something subtle going on here with the variables. I think
> you are hitting a bug fix, actually. So how does this work?
>
> *load =1crnx = "cys"print xcysprint @xselect x0 atoms selectedselect @x36
> atoms selected*
> What is going on here?
>
> a) *print x* does just that. It prints "cys".
>
> b) *print @x* says "print the contents of the variable named by x." Since
> the variable "cys" is not defined, the answer is the empty string.
>
> c) *select x* would be fine if x is defined to be an actual atom set, but
> it is not. It is a string. So nothing is selected.
>
> d) *select @x* is a command with a variable argument. When it is executed,
> "cys" is first substituted in for "@x". The result is
>
>
> * select "cys" *
> which works just fine.
>
> So, what happens with:
>
>
> *print {@selection_expression}.size*
> ?
>
> Well, as the command is parsed, *selection_expression* is evaluated and
> found to be "proteinogenic AND *:A". The command then *looks for a variable
> by that name* and of course finds nothing. So the answer is "no atoms."
>
But why does "print {proteinogenic AND *:A}.size" then still works as in
version 11.6.8 and results in "2781"?
So obviously within '{}.size' there is not just looked for atom set
names but also for atom expressions.
And why does 'x="protein"; print {@x}.size' also not work, although
'protein' is an atom set name?
For me the changes don't look like a bug fix but like a feature removal
that reduces consistency in the use of variables.
Let's compare the two systems and first take a look at the
documentation. It says:
"Variables may be assigned using standard mathematical expressions and
used throughout Jmol in virtually any script command to substitute for
parameters using the syntax @varName or @{math expression}"
In both systems (11.6.8 and 14.0.5) it is possible to provide atom
expressions within variables instead of providing the atom expression
directly, e.g.:
selection_expression = "proteinogenic AND *:" + "A";
select @selection_expression
In both systems an atom expression can be used within '{}.size', e.g.:
print {proteinogenic AND *:A}.size
In 11.6.8 the atom expression can also be contained within a variable,
like in other commands, but in 14.0.5 it can not.
Doesn't the system of 11.6.8 look more consistent to you too?
I hope you will not say that the working of 'print {proteinogenic AND
*:A}.size' is another bug that has to be removed.
I was really glad that atom expressions within variables removed the
need to define an atom set first and then use it. This helped to make
several complex scripts less complex and more readable.
So this feature removal called "bug fix" will break a number of my
scripts and will require quite some adaptations to make them work again.
Regards,
Rolf
--
Rolf Huehne
Postdoc
Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
Beutenbergstrasse 11
07745 Jena, Germany
Phone: +49 3641 65 6205
Fax: +49 3641 65 6210
E-Mail: [email protected]
Website: http://www.fli-leibniz.de
Scientific Director: Prof. Dr. K. Lenhard Rudolph
Head of Administration: Dr. Daniele Barthel
Chairman of Board of Trustees: Dennys Klein
VAT No: DE 153 925 464
Register of Associations: No. 230296, Amtsgericht Jena
Tax Number: 162/141/08228
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users