Paul,
It's just that you can't mix variables into definitions that way. One
way around the problem is to create the script command first as a
variable, then execute it. Here is what I would do:
var s = "define interieur cell={2 2 2}";
for (var i=1; i<4; i=i+1);
for (var j=1; j<4; j=j+1);
for (var k=1; k<4; k=k+1);
if (((i!=2) OR (j!=2)) OR (k!=2));
s = s + " &!cell={"+i+" "+j+" "+k+"}";
end if;
end for;
end for;
end for;
print s;
script inline s
(Note the OR instead of AND -- I think that is what you really want.)
Bob
Paul Pillot wrote:
> Dear Jmolers,
> I tried today my first Jmol script implementing loops. The goal here
> is to select the atoms of a central cell which are not shared by any
> of the neighbouring cells.
> Here is my script :
> define interieur (cell={2 2 2});
> for (var i=1; i<4; i=i+1);
> for (var j=1; j<4; j=j+1);
> for (var k=1; k<4; k=k+1);
> if (((i!=2) AND (j!=2)) AND (k!=2)); define interieur (interieur and
> not cell={i j k});
> end if;
> end for;
> end for;
> end for;
>
> I got this message :
> script compiler ERROR: { number number number } expected | ---- |
> define interieur (interieur and not cell={i j k}); end if; end for;
> end for; end for; <<<<
>
> I tried with a simpler script :
> var i=1
> select cell={i 1 1}
>
> ...and got the same error :
> script compiler ERROR: { number number number } expected | ---- |
> select cell={i 1 1}
>
> Is there something wrong in the way the variables are used here ? Is
> there a way to force these variables to be recognised as numbers ?
>
> Thanks in advance,
> Paul
>
>------------------------------------------------------------------------
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Microsoft
>Defy all challenges. Microsoft(R) Visual Studio 2008.
>http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Jmol-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
If nature does not answer first what we want,
it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users