[gmx-users] Reordering of water molecules with Na+ ions coordinates in xtc file

chris.neale at utoronto.ca chris.neale at utoronto.ca
Thu Dec 30 18:14:48 CET 2010


Dear Leila:

Perhaps I took the long way around, but I am not aware of any such  
tool. You can make custom modifications to things like trjconv as  
follows.

!!! Please note: I didn't test this except to see that it compiles.  
You should run some analyses before and after switching the order to  
check that the file hasn't been corrupted.

This is done with gromacs 4.0.7.

cd src/tools
cp gmx_trjconv.c ../../exec/share/gromacs/template/my_tool.c

####### Add the following text to the bottom of the my_tool.c file:

int
main(int argc,char *argv[])
{
   return gmx_trjconv(argc,argv);
}


####### Now go to line 1246 of the file and replace this:

               for(i=0; i<nout; i++) {
                 copy_rvec(fr.x[index[i]],frout.x[i]);
                 if (bVels && fr.bV) {
                   copy_rvec(fr.v[index[i]],frout.v[i]);
                 }
                 if (bForce && fr.bF) {
                   copy_rvec(fr.f[index[i]],frout.f[i]);
                 }
               }

####### with this:

               for(i=0; i<=1866; i++) {
                 copy_rvec(fr.x[index[i]],frout.x[i]);
               }
               for(i=24085; i<=24098; i++) {
                 copy_rvec(fr.x[index[i]],frout.x[i-22218]);
               }
               for(i=1867; i<=24084; i++) {
                 copy_rvec(fr.x[index[i]],frout.x[i+14]);
               }

               for(i=0; i<nout; i++) {
                 if (bVels && fr.bV) {
                   copy_rvec(fr.v[index[i]],frout.v[i]);
                 }
                 if (bForce && fr.bF) {
                   copy_rvec(fr.f[index[i]],frout.f[i]);
                 }
               }
             }

####### That's not going to modify the forces and velocities, but I  
assume that this will be ok for you. If you need them, you can add  
that part by analogy.

####### Now create the makefile:

sed "s/template/my_tool/g" Makefile.x86_64-unknown-linux-gnu >  
Makefile.my_tool

####### now compile it:

make -f Makefile.my_tool

-- original message --

Dear gromacs users

My simulation system contains protein, dna, water molecules and Na+
ions respectively.

I want to reorder water molecules with Na+ ions in final xtc file as

at first

1-1867                       complex (protein and dna)
1868 - 24085              SOL (water molecules)
24086 - 24099            Na+ (ions)

after reordering

1-1867                       complex (protein and dna)
1868 -1881                 Na+ (ions)
1882 - 24099              SOL (water molecules)

How to do that?

I need to this reordering to obtain amber trajectory file (mdcrd) by VMD.

any help and suggestion will highly appreciated.





More information about the gromacs.org_gmx-users mailing list