From: Jerome Henin (jhenin_at_vitae.cmm.upenn.edu)
Date: Mon Sep 11 2006 - 12:05:04 CDT

Hi Arturas,

Try this procedure:

source pbctools.tcl
source pbcwrap.tcl

proc center-and-wrap { refSelText wrapSelText} {
    set total [atomselect top all]
    set ref [atomselect top $refSelText]
    set nf [molinfo top get numframes]
    puts [format "%i frames\n" $nf]
    # Center the reference system around (0, 0, 0)
    for {set f 0} {$f < $nf} {incr f} {
        $ref frame $f
        $total frame $f
        $total moveby [vecinvert [measure center $ref]]
    }
    puts "Reference is centered. Wrapping \"$wrapSelText\"..."
    pbcwrap -sel $wrapSelText -first first -last last
    $ref delete
    $total delete
}

On Monday 11 September 2006 11:39, Arturas Ziemys wrote:
> Hi,
>
> Does anybody know how to recenter the box of trajectory from NAMD to
> certain molecule ? I have same molecule in my box and, naturaly, it is
> "flighing" all around in the box. I want to make it centered in my
> trajectory and wrapped.
>
> Any clues or help ???
>
>
> I tried to use pbcwrap: each frame I calculate center and cell dimensions.
> Later I calculate origin (take 1/2 length of box dimensions and substract
> it from {xyz} of my target molekule's center) for wraping the system.
> However I got very strange behaviour - does not help.
>
> GROMACS's tools also has no help.
>
> With best
> Arturas Z.