From: JeJoon Yeon (sonicturbulent_at_gmail.com)
Date: Wed May 13 2015 - 16:22:06 CDT

There was mistake in previous email. My for-loop looks like

for { set i 0 } { $i <= $nf } { incr i } {
set a [atomselect top "index < 1338 and name Si and y>9 and within 5 of
atom O]
set all [atomselect top all]
$all frame $i
$a set name C
$a set type C
$a set element C

But I still think my way of writing is wrong...

2015-05-13 14:44 GMT-04:00 Josh Vermaas <vermaas2_at_illinois.edu>:

> Also, you need to make sure your for loop is doing this sanely. Here is
> how I'd approach it:
>
> set a [atomselect top "index < 1338 and name Si and y>9 and within 5 of
> atom O]
> set t [atomselect top all]
>
> for { set i 0 } { $i < [molinfo top get numframes] } { incr i } {
>
> $a frame $i ; #changes the frame the selection will be based on
> $a update ; #Rechecks that its selecting the right stuff
> $a set name C
> $a set type C
> $a set element C
>
> }
>
> However name, type, and element are not per-frame fields, so you do know
> that you'll be changing it for all of them, right?
> -Josh
>
>
> On 05/13/2015 01:07 PM, Maxim Belkin wrote:
>
>> Hi,
>>
>> Have you tried the following?
>>
>> animate write xyz output.xyz beg 0 end -1 waitfor all
>>
>> Maxim
>>
>>
>> On May 13, 2015, at 12:53 PM, JeJoon Yeon <sonicturbulent_at_gmail.com>
>>> wrote:
>>>
>>> Hello all
>>>
>>> I can swap specific atoms for a single frame xyz only. Like
>>>
>>> mol new test.xyz type xyz waitfor all
>>> set a [atomselect top "index < 1338 and name Si and y>9 and within 5 of
>>> atom O]
>>> $a set name C
>>> $a set type C
>>> $a set element C
>>> set t [atomselect top all]
>>> $t writexyz swapped.xyz
>>>
>>>
>>> But how can I do this with multiple frame? I tried to use for loop but
>>> 1) Sometimes it causes error
>>> 2) Sometimes it swaps the specific atoms for all frames, but the
>>> criteria is based on only last frame's xyz position.
>>>
>>> So I don't know what to do anymore. Can anyone help or modify that
>>> single frame code to work for multiple frames? Is this coming from read /
>>> write problem?
>>>
>>> Thanks
>>>
>>> Best,
>>>
>>
>>
>