From: Maxim Belkin (mbelkin_at_ks.uiuc.edu)
Date: Wed Feb 05 2014 - 14:30:37 CST

Ali,

You should have catdcd in your plugins folder, for example on Linux, it should be here:

<vmd_folder>/plugins/LINUXAMD64/bin/catdcd4.0/

Maxim

On Feb 5, 2014, at 2:20 PM, Ali Alizadeh <ali.alizadehmoj_at_gmail.com> wrote:

>
> Dear Maxim,
>
> I really appreciate. I have tried a lot to build such these trajectories since two months ago, I hope I can do this by editing your code.
>
> I really do not know what this error is. I just know, in my tk console catdcd is not known but catdcdList is known.
>
>
> On Wed, Feb 5, 2014 at 8:53 AM, Maxim Belkin <mbelkin_at_ks.uiuc.edu> wrote:
> Ali,
>
> What is ‘catdcdList’? From what I see, it gets called instead of catdcd. Run 'which catdcd’ and post the result here.
> Here is a web-link to catdcd: https://www-s.ks.uiuc.edu/Development/MDTools/catdcd/
> Usually, when you call it with wrong arguments, you’ll get more helpful information then what you got.
>
>
> Back to your code for “complex” trajectories. Your code is doing something weird - not what you describe. It’ll be easier and faster if you start from scratch.
>
> Right now, I can think of a following way to achieve want you want for “complex” trajectories.
>
> 1. Load your “complex” trajectory:
>
> set xmol [mol load psf psf_file.psf]
> mol addfile trajectory.trr waitfor all $xmol
>
> 2. Create another molecule with X atoms (X - is the number of molecules whose centers of masses you want to track):
>
> set ntracked 100
> set ymol [mol new atoms $ntracked]; # change 100 to be the number of molecules
> set mov ""
> for {set i 0} {$i < $ntracked} {incr i} { lappend mov [atomselect $ymol "index $i”] }
> set all [atomselect $ymol all]
> $all set radius 1.0
> $all delete
> animate write psf com_traj.psf $ymol
>
> 3. Create list of selections of your real molecules, for example, for water molecules you could do something like:
>
> set water [atomselect $xmol "water"]
> set resids [lsort -unique [$water get resid]]
> $water delete
> set sel ""
> foreach resid $resids { lappend sel [atomselect $xmol "water and resid $resid"] }
>
> 4. Loop over trajectory frames, find center of masses of each real molecule and move atoms created in step 2 to computed locations:
>
> for {set i 0} {$i < [molinfo $xmol get numframes]} {incr i} {
> animate dup $ymol
> set atomindex 0
> foreach selection $sel {
> $selection frame $i
> set center [measure center $selection weight mass]
> [lindex $mov $atomindex] moveto $center
> incr atomindex
> }
> }
> animate write dcd com_traj.dcd $ymol
>
> 5. Delete all selection to clear-up memory
> foreach selection [atomselect list] { $selection delete }
>
>
>
> Maxim
>
>
> On Feb 5, 2014, at 5:31 AM, Ali Alizadeh <ali.alizadehmoj_at_gmail.com> wrote:
>
>> Dear Maxim,
>>
>> I've got below error when I wanted to write new trr as you said.
>>
>> catdcd -otype trr -o output.trr -i index.txt traj_nvt.lammpstrj:
>>
>> wrong # args: should be "catdcdList dcdFileNames outFile indexFile stride"
>>
>> -----------
>>
>>
>>
>>
>> On Wed, Feb 5, 2014 at 1:30 AM, Maxim Belkin <mbelkin_at_ks.uiuc.edu> wrote:
>> Hi Ali,
>>
>> If you want to save centers of mass of water molecules only, you should use the fact that its COM is very close to its oxygen atom. Then, you can simply extract trajectories of all water oxygens from your TRR file. To do that:
>>
>> 1. Load your psf/pdb or just pdb file into VMD
>>
>> 2. Make a selection of necessary oxygens, like:
>> set sel [atomselect top “name OH2”]; # or set sel [atomselect top “oxygen”]
>>
>> 3. Write their indices:
>> set ch [open “oxygen_indices.txt” w]
>> puts $ch [$sel get index]
>> close ch
>>
>> 4. Use catdcd to extract trajectory for those oxygen atoms
>> catdcd -otype TRR -o output.trr -i oxygen_indices.txt your_input_file.trr
>>
>> Try that and let us know if it works for you.
>>
>> Maxim
>>
>>
>>
>> On Feb 4, 2014, at 3:21 PM, Ali Alizadeh <ali.alizadehmoj_at_gmail.com> wrote:
>>
>>> Dear Axel,
>>>
>>> I asked you a question about saving COM trajectory fro atomic trajectories. I've written this code but I can not save the coordination of each atom as a standard COM
>>>
>>> trajectory. This code can calculate the COM of each atom in each frame. I need your advice for building COM trajectory. My simulation box includes 500 water
>>>
>>> molecules.
>>>
>>> -------------
>>>
>>> set file [open "COM.xyz" w]
>>> set nf [molinfo top get numframes]
>>> for {set i 0} {$i <=$nf} {incr i} {animate dup frame $i
>>> animate goto $i} {
>>> puts $file "500"
>>> puts $file "frame $i"
>>> puts "frame $i"
>>> for {set x 0} {$x <=1500} {incr x 3} {
>>> set sel [atomselect top "index $x" frame $i]
>>> set com [measure center $sel weight [$sel get mass]]
>>> puts $file "C $com"
>>> }
>>>
>>> }
>>>
>>> close $file
>>>
>>> ---------------------
>>>
>>>
>>>
>>> On Mon, Dec 9, 2013 at 7:56 PM, Ali Alizadeh <ali.alizadehmoj_at_gmail.com> wrote:
>>>
>>> Dear Axel,
>>>
>>> Thank you for your complete and useful reply. I'll try to write each separately and then combine them.
>>>
>>>
>>> On Mon, Dec 9, 2013 at 8:21 AM, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:
>>> On Mon, Dec 9, 2013 at 4:55 PM, Ali Alizadeh <ali.alizadehmoj_at_gmail.com> wrote:
>>> > Dear Axel,
>>> >
>>> > Thank you very much for your reply.
>>> >
>>> > I know I am ready for scripting but If possible I need some guides. I have
>>> > found I can calculate the COM of molecules but I do not know how I can
>>> >
>>> > save them and write in to standard trajectory.
>>>
>>> here is the recipe in 'vmd shorthand':
>>> you need to build a new molecule with "mol new atoms ###" where ### is
>>> the number of molecules, create a selection for this molecule
>>> containing all atoms with atomselect, and then loop over the existing
>>> trajectory, collect the COMs in a list of xyz coordinate triples,
>>> create a new frame in the new molecule with "animate dup", then step
>>> the selection to that frame and assign the coordinate list to the {x y
>>> z} property.
>>>
>>> once the loop is complete, you can save the new molecule as a .dcd or
>>> similar file. for easier processing, you may assign some other
>>> properties (type, name, mass, etc.) to the atoms in the molecule and
>>> write out a .psf file as well.
>>>
>>> more detailed explanations for all those steps are in the users guide
>>> and some examples for parts of these tasks are in some of the
>>> available tutorials as well. each step by itself is fairly simple, the
>>> complications come from having to combine and properly assemble all of
>>> them. you are better off first writing small test scriptlets where you
>>> practice each feature and piece separately until you are confident to
>>> know what you are doing. any more detailed guide would be the same as
>>> writing the script directly.
>>>
>>> axel.
>>>
>>> >
>>> >
>>> > On Mon, Dec 9, 2013 at 6:32 AM, Axel Kohlmeyer <akohlmey_at_gmail.com> wrote:
>>> >>
>>> >> Possible? Yes.
>>> >> Automatic? No.
>>> >>
>>> >> It would require quite a bit of custom vmd scripting. Not very difficult,
>>> >> but you would have to combine different pieces of scripting that have been
>>> >> discussed before.
>>> >>
>>> >> Axel.
>>> >> --
>>> >> Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0
>>> >> International Centre for Theoretical Physics, Trieste. Italy.
>>> >> ________________________________
>>> >> From: Ali Alizadeh <ali.alizadehmoj_at_gmail.com>
>>> >> Sender: owner-vmd-l_at_ks.uiuc.edu
>>> >> Date: Mon, 9 Dec 2013 16:39:30 +0330
>>> >> To: Vmd l<vmd-l_at_ks.uiuc.edu>
>>> >> Subject: vmd-l: Atomic trajectory to COM trajectory,
>>> >>
>>> >>
>>> >> Dear All users,
>>> >>
>>> >> I have done an NVT ensemble with LAMMPS package. I have saved its
>>> >> trajectory in trr format.
>>> >>
>>> >> Now, I want to convert that atomic trajectory to trajectory of center of
>>> >> mass of molecules. Is it
>>> >>
>>> >> possible? Does any body have experience? I want to do this for calculation
>>> >> of density and g(r)
>>> >>
>>> >> values of COMs in VMD. Can I save the coordinates of atomic trajectory of
>>> >> atoms as COM
>>> >>
>>> >> trajectory?
>>> >>
>>> >>
>>> >> --
>>> >> Sincerely
>>> >>
>>> >> Ali Alizadeh
>>> >
>>> >
>>> >
>>> >
>>> > --
>>> > Sincerely
>>> >
>>> > Ali Alizadeh
>>>
>>>
>>>
>>> --
>>> Dr. Axel Kohlmeyer akohlmey_at_gmail.com http://goo.gl/1wk0
>>> International Centre for Theoretical Physics, Trieste. Italy.
>>>
>>>
>>>
>>> --
>>> Sincerely
>>>
>>> Ali Alizadeh
>>>
>>>
>>>
>>> --
>>> Sincerely
>>>
>>> Ali Alizadeh
>>
>>
>>
>>
>> --
>> Sincerely
>>
>> Ali Alizadeh
>
>
>
>
> --
> Sincerely
>
> Ali Alizadeh