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

Tsjerk Wassenaar tsjerkw at gmail.com
Thu Dec 27 09:39:33 CET 2012

Actually, merge.py takes care of it already. If you use that, the sed
command shouldn't be needed.

Did you perhaps mean updating the numbers of molecules in the topology? I
don't have an easy solution for that. Unless for the case where you have
1.gro/1.top and 2.gro/2.top, with all moleculetypes in 2.top already
#included in 1.top. Then you can do:

merge.py 1.gro 2.gro > merged.gro
cp 1.top merged.top
sed -n '/^ *\[ *molecules/,${/^ *[/d;p}' 2.top >> merged.top

On a Mac you may need to install GNU sed for that.

Hope it helps,


On Dec 27, 2012 1:47 AM, "Kieu Thu Nguyen" <kieuthu2212 at gmail.com> wrote:

Do you mean that i have to add the line "sed '2s/^.*$/'$(wc -l file.gro)'/'
file.gro > out.gro" into the old script merge.py ?

On Wed, Dec 26, 2012 at 6:39 PM, Tsjerk Wassenaar <tsjerkw at gmail.com>
wrote: > Hi KT, > > To upda...

More information about the gromacs.org_gmx-users mailing list