[gmx-users] swapping the co-ordinates

Mark Abraham Mark.Abraham at anu.edu.au
Sat Dec 2 22:14:02 CET 2006


Dinesh Pinisetty wrote:
> 
> 
> 
> Hello,
>       I am curious to know if its possible to swap the co-ordinates in .gro
> file, using GROMACS. I have a .gro file, now I want to swap 'x' and 'z'
> co-ordinates keeping the 'y' coordinates same.

Now that I think about it, literally cut and paste is easiest... but not 
in the way that you think!

You'll need to go and measure the column widths by hand, but here's what 
you want to do...

cut -c 1-10 file.gro > prefix.txt
cut -c 11-20 file.gro > x.txt
cut -c 21-30 file.gro > middle.txt
cut -c 31-40 file.gro > z.txt
cut -c 41-50 file.gro > end.txt
paste -d '' prefix.txt z.txt middle.txt x.txt end.txt > new.gro

Ta-da. Use "man cut" and "man paste" for more info.

Mark



More information about the gromacs.org_gmx-users mailing list