[gmx-users] merge .gro, .top files

Tsjerk Wassenaar tsjerkw at gmail.com
Tue Dec 18 09:30:04 CET 2012


Hi KT,

If you mean concatenating frames in .gro files, you can use trjcat or just
cat. If you mean merging the coordinates, it's a wee bit more complicated.
Since you also ask for top files, I guess that's the case. Here's a snippet
of python code that will do the trick:

#!/usr/bin/env python

import sys

f = [open(i).readlines() for i in sys.argv[1:]]
print "Merged gro file\n%5d" % (sum([len(i) for i in f]) - 3*len(f))
print "".join(["".join(i[2:-1]) for i in f]),
print f[0][-1]


For the top files, it is necessary to ensure all the moleculetypes are
#included, and that the [ molecules ] listing under [ system ] has the
right number and order of the molecules in the merged gro file. There's no
tool for that that I know of.

Cheers,

Tsjerk


On Tue, Dec 18, 2012 at 6:18 AM, Kieu Thu Nguyen <kieuthu2212 at gmail.com>wrote:

> Dear All,
>
> I don't know which tools used to merge 2 files .gro, 2 files .top ?
> Can i use trjcat ?
>
> Thanks !
> KT
> --
> gmx-users mailing list    gmx-users at gromacs.org
> http://lists.gromacs.org/mailman/listinfo/gmx-users
> * Please search the archive at
> http://www.gromacs.org/Support/Mailing_Lists/Search before posting!
> * Please don't post (un)subscribe requests to the list. Use the
> www interface or send it to gmx-users-request at gromacs.org.
> * Can't post? Read http://www.gromacs.org/Support/Mailing_Lists
>



-- 
Tsjerk A. Wassenaar, Ph.D.

post-doctoral researcher
Biocomputing Group
Department of Biological Sciences
2500 University Drive NW
Calgary, AB T2N 1N4
Canada



More information about the gromacs.org_gmx-users mailing list