Jmol developers:

I just finished modifying Eval and Compiler in a pretty substantial way 
and thought I should let people know in case you have any familiarity 
with this code or start seeing strangenesses.

Formerly, when a command line was parsed by Compiler, any expression 
that was found was turned into Reverse Polish Notation (RPN) -- all the 
parentheses were removed, and a statement such as the following:

select ([CYS].CA/3 or atomno < 3)

became

select [CYS] *.CA */3 and and atomno < 3 or

Now, there's nothing wrong with this -- it is very efficient. But since 
I added an RPN processor for SET/IF math, and since those expressions 
also include atom expressions, we no longer need to produce RPN in the 
Compiler. A few rearranged lines, and the compiler now outputs quite nicely:


select ( [CYS] and *.CA and */3 or atomno < 3 )

That is, no order change; no RPN.  Eval now simply evaluates each of 
these tokens as a BitSet of atoms and feeds the expression in order to 
the Rpn class processor, same as with math.

 From a programming point of view, the bonus is that we have full 
control over operator precedence and can very easily introduce 
additional operators if we so choose. The user-end bonus is that we can 
look at commands using

set debugscript on

and see pretty much exactly what we have input, and when there is an 
error in the command that is not due to an expression, the command still 
looks correct in the debugging.

Beyond that, the changes aren't really significant -- no additional 
functionality, just some streamlining of operation. I think the 
processing is probably slightly less efficient, but I don't think it is 
noticeable.

I did end up adding

 x = "".load("filename")

 x = "test\ntest1".lines

 pt = x.find("test1")

 write VAR x "filename"

which together allow some interesting additional line-based text 
manipulation.

For example, here's PDB output of the selected atoms (commands would be 
each on one line, not wrapped):

pdbAtomData = {selected and not hetero}.label("ATOM  %5i %-4a%1A%3n 
%1c%4R%1E"
    +"   %8.3x%8.3y%8.3z%6.2Q%6.2b          %2e%2C")

pdbHeteroData = {selected and hetero}.label("HETATM%5i %-4a%1A%3n %1c%4R%1E"
    +"   %8.3x%8.3y%8.3z%6.2Q%6.2b          %2e%2C")

pdbFile = pdbAtomData + pdbHeteroData
write VAR pdbFile "test.pdb"


This did require a couple of new % options that are not in  Jmol 10 or 11.0.



Bob









-------------------------------------------------------------------------
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-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to