Jmol users -- comments appreciated.

Something Miguel and I talked with LONG ago is now possible with Jmol: 
The ability to "query" Jmol and get simple, direct answers. I actually 
didn't realize that this is where it was going until I played with it, 
but I think it's really true. Take a look at #23 at 
http://www.stolaf.edu/academics/chemapps/jmol/docs/examples-11/new.htm 
and tell me if you agree.

It turns out that the scripting language we have been using can be 
thought of as a QUERY language. All it needed was a bit of a arithmetic 
makeover, and there you go. What I'll describe here is equally valid for 
the app as the applet. In the application or applet, one simply enters 
from the console

x = ........

followed by your query; in the applet you can also use a new Jmol.js 
command, without "x=":

var info = jmolEvaluate("........")

In the case of lists containing several lines, an alternative syntax may 
be helpful when at the console:

message %{......}

This simply says, "Send me a message that is the result of this 
calculation within the braces."
This list is suitable for clipping.

Oh, and if you are the APPLICATION console, very handy in certain cases 
will be:

write VAR variableName fileName

For example:

x = {*}.ident
write VAR x atoms.txt


I'll use the console syntax here. If using JavaScript, remove "x=". The 
PDB example on that page also uses a jmolScriptWait() prior to 
jmolEvaluate to define two variables that are then evaluated using the 
jmolEvaluate() function, but most of the others are simple single-liners.

I've only started to think about applications, and I really hope some of 
you will see this as a solution to one or more of your problems and help 
develop some of those applications further and share them with us. 
Almost certainly, as you do this, you will come up with additional ideas 
that either can't be done now or there is no EASY way to do them. Please 
let me know. That's how we can develop this further.

Also, one nuance is that "boolean variables" (True/False answers) cannot 
be turned into numeric ones, so you will see below

ans = ......

when the answer would be TRUE or FALSE. The following will throw an error:

x = 3
x = (5 < 7)

You can unset a variable, though, and then you can re-use it.

x = 3
initialize  # all variables unset
x = (5 < 7)

or

x = 3
x = none      # just x reset
x = (5 < 7)

[I can see that we need a

reset x

comand. Very easy. Will do.]


OK, so queries are questions. I'll simply list some questions and follow 
each by the script that would fill the ........ above to give the 
answer. Note that when this is typed into the console, the answer is 
reported directly in the window.

How many residues are there?

x = {*.CA}


<comment>

Note that x here is a number -- the NUMBER of alpha carbons, but the 
variable ~x is automaticallly set for you, and that variable is the set 
of atoms, suitable, for example, for:

select ~x; color white;

</comment>



Are there any helices? If so, how many residues are there of the helix type?

x = {*.CA and helix}



Are there any hydrogens in this model?

ans = ({_H} > 0)


What is the degree of unsaturation of this simple organic compound?

x = (2 * {_C} + 2 + {_N} - {_H,_Cl,_I,_Br})/2


How far away is molecule 1 from molecule 2, center-to-center?

x = ({molecule=1}.xyz).distance({molecule=2}.xyz)



What atoms are connected to iron?

set bondmode OR
x = {_Fe}.bonds.ident

How many bonds are there in this model?

x = {*}.bonds


What are the bond lengths to iron (in Angstroms), listed with their atoms?

set bondmode OR;
x = {_Fe}.bonds.label("%a1 %a2 %LENGTH")

What is the AVERAGE bond length to iron from sulfur?
This one I don't have an easy direct way of answering, but the following 
works:

save bonds
connect (_Fe) (not _S) delete
x = {_Fe}.bonds.length
restore bonds


What is the difference in average Fe-S length between the two iron atoms?

save bonds
connect (_Fe) (not _S) delete
x = {_Fe}[1].bonds.length - {_Fe}[2].bonds.length
restore bonds


What residues, in the format [xxx]nn, are within 5.0 Angstroms of the 
the FIRST iron atom?

x = {*.CA and within (group, within(5.0, (_Fe)[1]))}.label("[%n]%r")


What is the XYZ file equivalent for the selected atoms?

x = "" + {selected} + "\n\n"+{selected}.label("%-2a %10.5x %10.5y %10.5z");


What is the MOL file equivalent for the selected atoms?

x = 
"line1\nline2\nline3\n"+(""+{selected})%-3+(""+{selected}.bonds)%-3+"  
0  0  0\n"
+{selected}.labels("%-10.4x%-10.4y%-10.4z %2e  0  0  0  0  0")
+{selected}.bonds.labels("%3D1%3D2%3ORDER  0  0  0")


What is the PDB file equivalent for this structure?

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")');
x = pdbAtomData + pdbHeteroData


What atoms are in the 110 Miller index plane?

x = {within(hkl, {1 1 0})}.ident

What is the symmetry site of those atoms?

x = {within(hkl, {1 1 0})}.label("%a %S")


As you can see, I think we are onto something quite useful here. 
Basically, anything that you can select for you can now use as the basis 
of a query, and answers for one query can be fed into answers for another.

I know, you want documentation.... For that I need a volunteer.

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

Reply via email to