[gmx-users] Re: mass center of each molecule

Mark Abraham Mark.Abraham at anu.edu.au
Mon Aug 13 14:39:07 CEST 2012


On 13/08/2012 10:03 PM, akn wrote:
> Dear Justin,
>
> Thank you very much for your answer.
>
> I specified each molecule individually in index file and I used trjconv -sep
> command
> to seperate the system each step (conf1.gro, conf2.gro, conf3.gro,
> conf4.gro). Then
> I used script that you suggested, it was as;
>
>   groups=`grep "^\[" index.ndx | wc -l`
>
> for ((i=1; i<$groups; i++)); do   echo $((i++)) $i | g_traj -s topol.tpr -f
> conf$i.gro
> -n index.ndx -ox coord.xvg -com; done
>
>
> and I obtained the center of mass of each molecule at each step in seperate
> files.
> For example; if the system has 5 molecules and the run has 4 steps, I obtain
> 20
> seperate files. However, I want to collect the center of mass of all
> molecules
> at all steps in only a file as following example;
>
>
> step  molecule index     x               y               z
>      0    0      1.15126297     -0.83798647      0.58398923
>      0    1      0.68224833      0.74993176      1.84797615
>      0    2      2.97914942      0.11095256      2.61386881
>      0    3      4.65560905     -0.26363975      0.17970542
>      0    4      0.56267048      1.31953148      0.91372036
>      0    5      1.82333602     -1.24385819      1.63649468
>      1    0      1.15081591     -0.83159143      0.58321940
>      1    1      0.68357557      0.76482290      1.84911002
>      1    2      2.97913055      0.11320974      2.61105259
>      1    3      4.65727424     -0.26322810      0.17973330
>      1    4      0.56043944      1.32080373      0.90883115
>      1    5      1.82315477     -1.24656235      1.63910681
>      2    0      1.15238968     -0.82695173      0.58273344
>      2    1      0.68630303      0.77769022      1.85014673
>      2    2      2.97731032      0.11649037      2.61009124
>      2    3      4.65780877     -0.26399845      0.18205542
>      2    4      0.55785475      1.32480364      0.90410962
>      2    5      1.82237425     -1.25034522      1.64005468
>      3    0      1.15513001     -0.82180588      0.58414463
>      3    1      0.69432865      0.79014913      1.85176367
>      3    2      2.97255177      0.12185169      2.60981656
>      3    3      4.65625400     -0.26611685      0.18777379
>      3    4      0.55652912      1.33345131      0.89997690
>      3    5      1.82007758     -1.25560496      1.63930391
>
>
> How can I do this by using shell script in gromacs?

The Unix tool cat does file concatenation. g_traj -xvg none might help 
prepare for that.

Mark



More information about the gromacs.org_gmx-users mailing list