From: Joao Ribeiro (jribeiro_at_ks.uiuc.edu)
Date: Thu Jul 11 2019 - 09:23:32 CDT

Dear Surya,

 

So, to correctly do what you want, you do need to correct a few things. Here is the fixed loop

 

for {set x 17} {$x > 8} {incr x -1} {

    $sel moveby [list 0 0 $x]

    $sel writexyz Sep_$x.xyz

}

 

If you do “{0 0 $x}”, the “$x” never gets assigned with the value of the variable x; you cannot increment floating numbers, please use integer or increment the floating numbers manually inside the loop. I don’t know you have defined the sel1 variable in previous lines but is not set in the lines that you sent us.

 

I hope this helps.

 

Best,

 

João

 

From: <owner-vmd-l_at_ks.uiuc.edu> on behalf of surya narayanan chandrasekaran <sonofsunsurya_at_gmail.com>
Date: Thursday, July 11, 2019 at 5:36 AM
To: <vmd-l_at_ks.uiuc.edu>
Subject: vmd-l: vmd moveby command inside loop

 

Hi,

       I was trying a simple for loop inside my script that need to give variable to move command.

 

for {set x 17.1} {$x > 8} {incr x - 1} {
    $sel moveby {0 0 $x}
    $sel1 writexyz Sep_$x.xyz
}

 

But I am getting error. "atomselection moveby: translation vector can only be of length 3" or

"atomselect moveby: non-numeric in vector"

 

I tried "$x", puts, [expr $x]

 

-- 
Warm regards,
Surya