Commit [r19287] Maximize Restore History

___JmolVersion="14.1.8"

bug fix: interpretation of x and @x in select commands and {...} phrases
-- Variable substitution has been unintuitive and inconsistent.
For instance:

x = "C or T"

select @x -- works fine
print {@x} -- fails

The problem is the use of @ to reference the variable NAMED BY another
variable within a math expression (print context) but not a select context.
For instance:

y = 3
x = "y"
print x --> "y"
print @x --> 3

Such referencing is important for math expressions, but the
extension of this to atom expressions is not necessary and
not generally useful.
-- This fix simplifies the situation by not allowing variable-variable
referencing within atom expressions bounded by braces, just like
within implicit atom expression commands (select, display, hide, delete, etc.).
-- The result is much more intuitive. The following do exactly what
you think they would do:

x = "A or T"
select @x
print {@x}

-- The current way of doing this, by defining a temporary atom
expression using the DEFINE (or @) command still works:

x = "A or T"
@y @x
select y same as select @x

-- Note that the difference between "select x" and "select @x"
may be significant:

ala = "cys"

select ala --> selects all alanines
select @ala --> selects all cysteines

hansonr 2014-02-08

changed /trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java
/trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java Diff Switch to side-by-side view
Loading...