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

Tsjerk Wassenaar tsjerkw at gmail.com
Wed Dec 26 12:39:55 CET 2012


Hi KT,

To update the number of atoms in a merged .gro file, assuming a single
frame and no empty lines after the box definition, you have to replace the
second line with the number of lines minus three:

sed '2s/^.*$/'$(wc -l file.gro)'/' file.gro > out.gro

Cheers,

Tsjerk

On Tue, Dec 25, 2012 at 7:33 AM, Kieu Thu Nguyen <kieuthu2212 at gmail.com>wrote:

> But i don't see file "gromacs_topology_merger.py" in the web Vedat gave me.
>
> Tsjerk, can you give me the script for updating the number of atoms ? I
> searched in google, but i have not found it yet. It's really my stupid
> question, but i don't know why.
>
> Thanks !
> Best regards,
>
> KT
>
>
> On Tue, Dec 18, 2012 at 6:43 PM, Kieu Thu Nguyen <kieuthu2212 at gmail.com
> >wrote:
>
> > thank all so much :-)
> >
> > KT
> >
> > On Tue, Dec 18, 2012 at 4:12 PM, Vedat Durmaz <durmaz at zib.de> wrote:
> >
> >> there's also an executable topology merger available written in python
> >> called "gromacs_topology_merger.py" as part of a the software package
> >> "ZIBMolPy" designed for conformational analysis at
> >>
> >> https://github.com/CMD-at-ZIB/**ZIBMolPy<
> https://github.com/CMD-at-ZIB/ZIBMolPy>
> >>
> >> given (in the same directory) a topology file "topol.top" (argument 1)
> >> and two (or more) itp files "mol1.itp" and "mol2.itp" included in the
> top
> >> file, the tool writes out a new topology file (argument 2) merging the
> >> first two molecules from the include sequence of which itp files are
> given.
> >>
> >> note: the number of molecules to be merged should be 1 in the [
> molecules
> >> ] section. if one of them is meant to appear multiple times in the
> merged
> >> topology, the process needs to be repeated accordingly.
> >>
> >> vedat
> >>
> >>
> >> Am 18.12.2012 09:38, schrieb Erik Marklund:
> >>
> >> 18 dec 2012 kl. 09.30 skrev Tsjerk Wassenaar:
> >>>
> >>> 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.
> >>>>
> >>> In principle you could use grompp for checking that. It would print out
> >>> a heap of warinngs/notes/errors if structure file and topology don't
> match.
> >>>
> >>> Erik
> >>>
> >>> 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<
> http://lists.gromacs.org/mailman/listinfo/gmx-users>
> >>>>> * Please search the archive at
> >>>>> http://www.gromacs.org/**Support/Mailing_Lists/Search<
> 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<
> 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
> >>>> --
> >>>> gmx-users mailing list    gmx-users at gromacs.org
> >>>> http://lists.gromacs.org/**mailman/listinfo/gmx-users<
> http://lists.gromacs.org/mailman/listinfo/gmx-users>
> >>>> * Please search the archive at http://www.gromacs.org/**
> >>>> Support/Mailing_Lists/Search<
> 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<
> http://www.gromacs.org/Support/Mailing_Lists>
> >>>>
> >>> ------------------------------**-----------------
> >>> Erik Marklund, PhD
> >>> Dept. of Cell and Molecular Biology, Uppsala University.
> >>> Husargatan 3, Box 596,    75124 Uppsala, Sweden
> >>> phone:    +46 18 471 6688        fax: +46 18 511 755
> >>> erikm at xray.bmc.uu.se
> >>> http://www2.icm.uu.se/molbio/**elflab/index.html<
> http://www2.icm.uu.se/molbio/elflab/index.html>
> >>>
> >>>
> >> --
> >> gmx-users mailing list    gmx-users at gromacs.org
> >> http://lists.gromacs.org/**mailman/listinfo/gmx-users<
> http://lists.gromacs.org/mailman/listinfo/gmx-users>
> >> * Please search the archive at http://www.gromacs.org/**
> >> Support/Mailing_Lists/Search<
> 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<
> http://www.gromacs.org/Support/Mailing_Lists>
> >>
> >
> >
> --
> 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