From: Josh Vermaas (vermaas2_at_illinois.edu)
Date: Wed Apr 10 2013 - 11:10:03 CDT

Yup. Aligning can be done a number of ways, but the easiest to
understand is the measure fit command, which gives you a 4x4 move matrix
that when applied will minimize the RMSD between two selections. A
minimal set of commands to try in the tkconsole to show you how it works
would be:

mol new 1D1H ; # This is a NMR structure of hanatoxin if people are curious
#Pick an arbitrary reference point
set ref [atomselect top "resid 34" frame 0]
set all [atomselect top "all"]
for { set i 0 } { $i < [molinfo top get numframes] } { incr i } {
    $all frame $i
    set sel [atomselect top "resid 34" frame $i]
    set movematrix [measure fit $sel $ref]
    $all move $movematrix
    $sel delete
}

Note that this aligns the structure to a particular residue (in my case
34). From there you can adapt the idea to your own script, taking
particular care to delete atomselections made inside a loop.

-Josh

On 04/10/2013 10:41 AM, Yarrow Madrona wrote:
> Thank you Josh,
>
> I have also realized that I really need to align all molecules before
> converting to PDBs however, I cannot find a command for doing this. I
> wrote a log file "log align.log" while I aligned the molecules over the
> trajectory for a smaller dcd file. However when I look in the log file it
> only says:
>
> menu rmsdtt off
> menu rmsdtt on
>
> followed by a buch of rotate commands.
>
> There is nothing referencing my selection (resname HEME). Do you know how
> to do the alignment in a script?
>
> I'm sorry for asking so many questinos. I know some python scripting but
> tcl is new to me.
>
> -Yarrow
>
>
>> I was writing by memory and didn't actually test the code first
>> (whoops). The reason my implementation only writes one frame is because
>> I goofed the syntax for the animate delete call, and it dies after
>> writing the first pdb. The script should read:
>>
>> mol new test.psf
>> set nowater [atomselect top "not water"]
>> for {set i 0} {$i < 10} {incr i} {
>> animate read dcd CIN-SUM-every10.dcd beg $i end $i waitfor all
>> $nowater writepdb WT_$i.pdb
>> animate delete *all*
>> }
>> exit
>>
>> That'll teach me from not looking up syntax first. :(
>> -Josh
>>
>> On 04/09/2013 07:50 PM, Yarrow Madrona wrote:
>>> Hi Josh,
>>>
>>> Thanks for your help. For some reason your script only writes out the
>>> first pdb and not the rest. This is what I am using:
>>>
>>> mol new test.psf
>>> set nowater [atomselect top "not water"]
>>> set nf [molinfo top get numframes]
>>> for {set i 0} {$i < 10} {incr i} {
>>> animate read dcd CIN-SUM-every10.dcd beg $i end $i waitfor all
>>> $nowater writepdb WT_$i.pdb
>>> animate delete
>>> }
>>> exit
>>>
>>>
>>>
>>>
>>>
>>>
>>>> Another option is to run VMD in text mode. Make a simple script
>>>> (script.tcl) like this:
>>>>
>>>> mol new psffile.psf
>>>> set nowater [atomselect top "not water"]
>>>> for { set i 0 } { $i < 70000 } { incr i } {
>>>> animate read dcd dcdfile.dcd beg $i end $i waitfor all
>>>> $sel writepdb $i.pdb
>>>> animate delete
>>>> }
>>>> exit
>>>>
>>>> This will go through each frame one by one and write it to its own pdb,
>>>> while never keeping more than 1 frame in memory. You can then run it
>>>> from the command line with something like:
>>>>
>>>> vmd -dispdev text -e script.tcl (see
>>>> http://www.ks.uiuc.edu/Research/vmd/current/ug/node207.html for more on
>>>> using the command line to start vmd, including the extra step required
>>>> on windows)
>>>>
>>>> -Josh
>>>>
>>>> On 04/09/2013 01:12 AM, peter.schmidtke_at_fr.netgrs.com wrote:
>>>>> Hey,
>>>>>
>>>>> Consider using ambertools ptraj for instance, which could do the pdb
>>>>> export.
>>>>>
>>>>> Best regards.
>>>>>
>>>>> Peter
>>>>>
>>>>> -----Message d'origine-----
>>>>> De : owner-vmd-l_at_ks.uiuc.edu [mailto:owner-vmd-l_at_ks.uiuc.edu] De la
>>>>> part
>>>>> de Yarrow Madrona
>>>>> Envoyé : mardi 9 avril 2013 01:43
>>>>> À : VMD mailing list
>>>>> Objet : Re: vmd-l: how to convert dcd to pdbs in command line
>>>>>
>>>>> Hello,
>>>>>
>>>>> I am trying to convert a dcd to a series of pdb's without opening the
>>>>> VMD GUI. The reason is that I don't have enough ram to store the DCD
>>>>> (70,000
>>>>> frames) into memory. VMD always crashes unless I use a truncated DCD.
>>>>> I
>>>>> would like to use all frames since the frames will be analyzed by
>>>>> another software (Caver3.0). Is there a way to tell vmd to write out
>>>>> all
>>>>> PDBs in the command line (preferably without water although I can
>>>>> remove
>>>>> those later)?
>>>>>
>>>>> Thank you
>>>>>
>>>>>
>>>>> --
>>>>> Yarrow Madrona
>>>>>
>>>>> Graduate Student
>>>>> Molecular Biology and Biochemistry Dept.
>>>>> University of California, Irvine
>>>>> Natural Sciences I, Rm 2403
>>>>> Irvine, CA 92697
>>>>>
>>>>>
>>>>>
>>>>>
>>
>