From: Peter Freddolino (petefred_at_ks.uiuc.edu)
Date: Fri Feb 09 2007 - 10:48:49 CST

Erm, that inner loop should be "$csel set user", not "$csel set beta"

Peter Freddolino wrote:
> Sure you can; the best way is to load them as two separate molecules,
> and then map the forces from one file onto the user field of the other
> (since the user field can store time-variant data for atoms). So
> assuming you have the files
>
> coords.xyz -- coordinates of interest
> forces.xyz -- xyz file with forces
>
> and they have the same number of atoms and such, you could do the following:
>
>
> set allsel [atomselect 0 all] ;# assuming mol 0 is coords
> set forcesel [atomselect 1 all]
>
> for {set i 0} {$i < [molinfo get numframes]} {incr i} {
> $forcesel frame $i
>
> foreach atomind [$allsel get index] force [$forcesel get {x y z}] {
> set csel [atomselect 0 "index $index" frame $i]
> set forcemag [veclength $force]
> $csel set beta $forcemag
> $csel delete
> }
> }
>
> $allsel delete
> $forcesel delete
>
> You can then get the picture you want by coloring the atoms by the user
> field, making sure you have "update color every frame" checked in the
> trajectory tab of the graphical representations menu.
>
> Peter
>
> Adrian Koh wrote:
>
>> Hi,
>>
>> I know this been asked countless of times, but I couldn't seem to get
>> the gist of it. I have a .xyz trajectory file (containing the
>> positions of atoms for every frame, 250 frames in all). And I have
>> another .xyz file (containing the atomic resultant forces on every
>> atom, for the 250 frames). Would I be able to combine the two files,
>> request VMD to plot the positions of the atoms with the corresponding
>> color codes based on the magnitude of the atomic resultant force, all
>> in one single animation?
>>
>> How do I do it?
>>
>> Thanks!
>>
>>
>> Best Regards,
>> Adrian.
>>
>>
>>