Hi all,

I started working with loading multiple files simultaneously in Jmol. 
The reason is mainly to be able to switch very fast between different 
structures and not to display them simultaneously.

For selections the setting 'set selectAllModels FALSE' will be able to 
help to prevent unwanted selections in other loaded structures while 
working with one of them (after the bug there is removed, see other thread).
But I ran into a problem with the 'display/hide' commands because they 
always act on all loaded structures and I couldn't find a way to prevent 
this.

Q: Is there a simple way to prevent this?

If not, it would be very helpful if an option similar to 'set 
selectAllModels FALSE' would be avilable.

I tried to build replacement functions for 'display' and 'hide' (see 
below) but one problem there is that 'display BONDS' always acts on all 
bonds in all structures and I couldn't find a way to prevent this.

Another problem is that I havn't understood the syntax of 'display 
[{default: ...}]' from the scripting documentation so that I couldn't 
even try to mimic it yet.

And a disadvantage is that I would always have to monitor the 
'display/hide' commands in future versions for any changes like 
additional keywords and check if my replacements still work as expected 
or if they must be expanded.

----- 'display' command substitution ----------------
function getFileNumberList(atomBitset) {
   if (atomBitset.type != "bitset") {
     atomBitset = {visible};
   }
   var fileNumberInfo = atomBitset.file.all.count();
   var fileNumberList = [];

   if (fileNumberInfo.type == "array") {
     for (var i from [1, fileNumberInfo.size]) {
       var fileNumber = fileNumberInfo[i].[1];
       fileNumberList.push(fileNumber);
     }
   }
   return fileNumberList;
}

function display(keyword, atomExpression) {
   var oneParameter = false;
   if (atomExpression == "") {  # only one parameter?
     atomExpression = keyword;
     oneParameter = true;
   }
   var atomExpressionUpperCase = ("" + atomExpression) % 9999;  # 
convert to upper case
   if (atomExpressionUpperCase == "ADD" || atomExpressionUpperCase == 
"REMOVE") {
     print "ERROR: no atom expression provided in call of 'display' 
command or keyword '" + atomExpressionUpperCase + "' provided as second 
parameter instead of first";
   } else if (atomExpressionUpperCase == "BONDS") {
     display BONDS;
   } else {
     if (oneParameter == false) {
       var keywordUpperCase = ("" + keyword) % 9999;  # convert to upper 
case
       if (keywordUpperCase == "ADD" || kewordUpperCase == "REMOVE") {
         atomExpression = keywordUpperCase + " " + atomExpression;
         display @atomExpression;
       } else if (keywordUpperCase == "BONDS") {
         print "ERROR: no atom expression allowed for keyword 'BONDS' in 
command 'display'";
       }
     } else {
       var fileNumberList = getFileNumberList;
       atomExpression = "(displayed and file!=fileNumberList) or " + 
atomExpression;
       display @atomExpression;
     }
   }
}
-----------------------------------------------------

Regards,
Rolf

-- 

Rolf Huehne
Postdoc

Leibniz Institute on Aging - Fritz Lipmann Institute (FLI)
Beutenbergstrasse 11
07745 Jena, Germany

Phone:   +49 3641 65 6205
Fax:     +49 3641 65 6210
E-Mail:  rhue...@leibniz-fli.de
Website: http://www.leibniz-fli.de

           Scientific Director: Prof. Dr. K. Lenhard Rudolph
        Head of Administration: Dr. Daniele Barthel
Chairman of Board of Trustees: Burkhard Zinner

VAT No: DE 153 925 464
Register of Associations: No. 230296, Amtsgericht Jena
Tax Number: 162/141/08228


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to