[I have a feeling I accidentally sent this out before it was finished.
This is the final version.]
Nico, I'm done with 11.1.15 and propose making it 11.2.0 release
candidate. I'm still catching very minor issues, but they are coming
down to the very simplest things to fix now.
USING VARIABLES IN JMOL
-----------------------
The standard way of defining selection sets is still in place. "@x" is
the same as "define x" at the beginning of a command:
@x oxygen and atomno < 3;select x
define atoms1 within(hkl,{1 1 1}); center atoms1
In addition, one still can name objects that are drawn with DRAW,
ISOSURFACE, LCAOCARTOON, MO, and PMESH:
draw line1 {atomno=1} {atomno=2}
draw plane1 PLANE PERP line1$
But now we have nine data types:
1. atom expressions
2. bond expressions
3. booleans
4. integers
5. decimal numbers
6. strings
7. points in space
8. planes in space
9. named objects
All commands can now use the same syntax in relation to
atom/bond sets, points, planes, and other objects.
The recommended syntax will be:
1. ATOM EXPRESSIONS
-------------------
{atom expression}
{atom expression}[n] # selects only item n
{atom expression}[n][m] # selects items n through m
({i j k:l}) # OVERALL atom indices, starting with 0
select { (oxygen or atomno < 3) and molecule=1 }
center {oxygen}[3]
draw line1 {oxygen}[1] {oxygen}[2]
select ({0:8 10 12})
connect {oxygen}[1] {oxygen}[2] double
measure {carbon}[3] {carbon}[4] "%a1--%a2 %VALUE %UNITS"
<note>
Note: No use of comma as OR is allowed within braces. You may use commas
in coordinates:
x = {1,2,3}
but the Chime method of addressing residues as
select 1,2,3
is not allowed in this new syntax. You can still use that old syntax,
but if you use the
new syntax, you must use OR:
select {1 or 2 or 3}
This is important in terms of distinguishing between:
center {1, 2, 3} # the coordinate point {1.0 2.0 3.0}
center {1 or 2 or 3} # the first three residues
or
select within(3.0, {1, 2, 3})
select within(3.0, {1 or 2 or 3})
I would suggest that use of comma in any of these situattions be DEPRECATED.
Comma should be used only between parameters in a function:
select within(3.0, {1 2 3})
just reads a lot better.
</note>
2. BOND EXPRESSIONS (new)
-------------------------
One of the really new things here is the ability to address bonds and
sets of bonds.
connected(dMin, dMax, "type",{atoms1},{atoms2}) # like the connect
command, a list of bonds
{atom expression}.bonds # specifically the bonds associated with
these atoms
{atom expression}.bonds[2] # specifically the second of these
[{i j k:l}] # OVERALL atom indices, starting with 0
The .bonds modifier operates based on the setting of set BONDMODE
OR/AND. The connected() function returns a set of bonds. This can be
used in the SELECT command to select specific bonds:
x = {oxygen or carbon}.bonds.ident; message %{x}
select connected(1.2,1.3,{oxygen},{carbon}); connect double red;
select [{0:10}]; color green; wireframe 0.10
3. BOOLEANS
-----------
Just standard operating procedures here. There are some nuances of mixed
type that I won't get into here.
moreOx = ({oxygen} > 2)
haveChain = (substructure("[CH2][CH2][CH2]") > 0);
4. INTEGERS (new)
-----------------
x = (3 + 5) * 8 # 64
x = 3 / 2 # 1
x = {oxygen} + {nitrogen}
x = {carbon} / 2
ringCount = ( 2 * {_C} + {_N} + 2 - {_H} ) / 2.0 -
connected("double")/2 - connected("triple")
5. DECIMAL NUMBERS (new)
------------------------
x = 3.50
x = 3.50E-3
x = {carbon} / 2.0
6. STRING PARAMETERS
--------------------
"in quotes"
select within(1.0,3.0, "single",{oxygen},{carbon})
select within("AGGGA")
x = "this number of oxygen atoms is " + {oxygen}.size
Note that there is automatic conversion of string numbers to actual
numbers based on left-preference:
x = 3 + "3.5" # 6
x = 3.2 + "3.5" # 6.7
but:
x = "3.5" + 3.2 # "3.53.2"
7. POINTS IN SPACE
------------------
{x y z} # cartesian coordinates
{i/j k/l m/n} # fractional coordinates
Coordinates can be given a integers, reals, or fractions.
center {0 0 0}
draw line {2.0 3.0 5.0} {C5}
unitcell {1/2 1/2 1/2}
8. PLANES IN SPACE
------------------
{a b c d} # standard format -- ax + by + cz + d = 0
hkl {h k l} # Miller indices
xy, xz, yz # in context, of course!
x=?, y=?, z=? # where ? is some number
mo 3 PLANE xy
isosurface plane1 PLANE {1 1 1 0}
isosurface plane2 HKL {2 1 0}
isosurface plane3 PLANE xy
9. DEFINED VARIABLES
--------------------
In math, just use the variable name:
x = 3
y = x + 5
select {oxygen}[x]
If x is an atom or bond set, add "_set" to the name to address the set
itself:
x = {oxygen}
select {x_set or nitrogen}
x = {carbon}.bonds or connected(1.2,1.5,{_O},{_C})
connect {x_set} double
color {x_set} white; wireframe 0.02
In addition, in just about any place in any command, a parameter can be
replaced
by variable by prefixing the variable name with an @ sign:
bradius = 0.5
select *;wireframe @bradius
This does not apply to strings:
x="testing"; echo "this is my @x string"
echos just "this is my @x string". But there are two ways around this
limitation. First, you can define a variable and just use it:
x = "testing"
y = "this is my "+ x + " string"
echo @y
echos "this is my testing string"
In addition, we have;
message @x
label @x
etc.
The second method is to use %{x} in a message or echo (not a label).
This substitutes the value of x at that position in the label and allows
for a more general introduction of anything that can be evaluated:
message there are %{{oxygen}.size} oxygen atoms.
Note that for echo text, which might be showing in the applet window,
the values are DYNAMIC. Here's a pretty strange script:
load caffeine.xyz
set echo top left
echo %{{oxygen}[1].distance({oxygen}[2])}
message _here; if ({oxygen}[1].distance({oxygen}[2]) > 0.1)
select {oxygen}[1]
if ({oxygen}[1].x > {oxygen}[2].x)
translateSelected {-0.1 0 0}
else
translateSelected {0.1 0 0}
endif
if ({oxygen}[1].y > {oxygen}[2].y)
translateSelected {0 -0.1 0}
else
translateSelected {0 0.1 0}
endif
if ({oxygen}[1].z > {oxygen}[2].z)
translateSelected {0 0 -0.1}
else
translateSelected {0 0 0.1}
endif
refresh
goto _here
endif
echo Contact!
10. NAMED OBJECTS (as in 11.0)
------------------------------
Named objects are addressed using $ before the name:
draw line1 {_O}[1] {_O}[2]
draw line2 PERP $line1
center $line1
----------------------------
Bob Hanson
-------------------------------------------------------------------------
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