# Problem for merging two proteins and membrane in the same box

**URL:** <https://gromacs.bioexcel.eu/t/problem-for-merging-two-proteins-and-membrane-in-the-same-box/5361>\
**Category:** User discussions\
**Created:** [December 5, 2022, 7:03am UTC](https://gromacs.bioexcel.eu/t/problem-for-merging-two-proteins-and-membrane-in-the-same-box/5361 "2022-12-05T07:03:00Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlatl77791](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@rlatl77791](https://gromacs.bioexcel.eu/u/rlatl77791)\
**Post date:** [December 5, 2022, 7:03am UTC](https://gromacs.bioexcel.eu/t/problem-for-merging-two-proteins-and-membrane-in-the-same-box/5361/1 "2022-12-05T07:03:00Z")

</div>

GROMACS version: 2020.1-1  
GROMACS modification: No  
Here post your question

**Dear GROMACS experts**  
**Thanks for the tutorial and question&answers in the forum, I succeed to simulate peptide in DPPC membrane**  
**Now I tried to run 2 peptides in DPPC membrane.**

**However, when I tried to use ‘grompp’ commend,**  
**; gmx grompp -f minim\_inflategro.mdp -c system\_inflated.gro -p topol.top -r system\_inflated.gro -o system\_inflated\_em.tpr**

**an error message appeared.**  
;  
ERROR 1 [file strong\_posre.itp, line 212]:  
Atom index (208) in position\_restraints out of bounds (1-207).  
This probably means that you have inserted topology section  
“position\_restraints”  
in a part belonging to a different molecule than you intended to.  
In that case move the “position\_restraints” section to the right molecule.

According to the manual, this error appeared when placing position restraint files for multiple molecules out of order.  
[https://manual.gromacs.org/current/user-guide/run-time-errors.html](https://manual.gromacs.org/current/user-guide/run-time-errors.html)

**So I modified topol.top files from**

; Include forcefield parameters  
#include “gromos53a6\_lipid.ff/forcefield.itp”

; Include chain topologies  
#include “topol\_Protein\_chain\_A.itp”  
#include “topol\_Protein\_chain\_B.itp”

; Strong position restraints for InflateGRO  
#ifdef STRONG\_POSRES  
#include “strong\_posre.itp”  
#endif

; Include DPPC chain topology  
#include “dppc.itp”

; Include water topology  
#include “gromos53a6\_lipid.ff/spc.itp”

#ifdef POSRES\_WATER  
; Position restraint for each water oxygen  
[position\_restraints]  
; i funct fcx fcy fcz  
1 1 1000 1000 1000  
#endif

; Include topology for ions  
#include “gromos53a6.ff/ions.itp”

**to**

; Include forcefield parameters  
#include “gromos53a6\_lipid.ff/forcefield.itp”

; Include chain topologies  
#include “topol\_Protein\_chain\_A.itp”  
#ifdef POSRES  
#include “posre\_Protein\_chain\_A.itp”  
#endif

#include “topol\_Protein\_chain\_B.itp”  
#ifdef POSRES  
#include “posre\_Protein\_chain\_B.itp”  
#endif

; Strong position restraints for InflateGRO  
#ifdef STRONG\_POSRES  
#include “strong\_posre.itp”  
#endif

; Include DPPC chain topology  
#include “dppc.itp”

; Include water topology  
#include “gromos53a6\_lipid.ff/spc.itp”

#ifdef POSRES\_WATER  
; Position restraint for each water oxygen  
[position\_restraints]  
; i funct fcx fcy fcz  
1 1 1000 1000 1000  
#endif

; Include topology for ions  
#include “gromos53a6.ff/ions.itp”

**But same error message still is appearing, and I cannot find what I’m missing.**  
**Could you spare me some advice?**  
**Thanks for spare time and attention.**

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [December 5, 2022, 7:58pm UTC](https://gromacs.bioexcel.eu/t/problem-for-merging-two-proteins-and-membrane-in-the-same-box/5361/2 "2022-12-05T19:58:04Z")

</div>

If you have multiple chains, you have to generate multiple restraint topologies, one for each. Note how the standard `posre.itp` files are set up in the topology. You can’t have a single restraint topology for multiple `[moleculetype]` definitions.

---

<div class="post-metadata">

**Author:** ![rlatl77791](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@rlatl77791](https://gromacs.bioexcel.eu/u/rlatl77791)\
**Post date:** [December 6, 2022, 5:00pm UTC](https://gromacs.bioexcel.eu/t/problem-for-merging-two-proteins-and-membrane-in-the-same-box/5361/3 "2022-12-06T17:00:46Z")

</div>

Thank you for your kind answer jalemkul.  
However, sorry. I still cannot understand it.

Yes. I have to generate multiple restraint topologies, one for each of ‘topol\_Protein\_chain\_A.itp’ and ‘topol\_Protein\_chain\_B.itp’

It is why I changed

; Include chain topologies  
#include “topol\_Protein\_chain\_A.itp”  
#include “topol\_Protein\_chain\_B.itp”

to

; Include chain topologies  
#include “topol\_Protein\_chain\_A.itp”  
#ifdef POSRES  
#include “posre\_Protein\_chain\_A.itp”  
#endif

#include “topol\_Protein\_chain\_B.itp”  
#ifdef POSRES  
#include “posre\_Protein\_chain\_B.itp”  
#endif

Isn’t what I did is same as what you advised…?

ps. When I tried to use ‘grompp’ commend to the 2 peptides without membrane, It normally worked.  
Does it mean that I should have defined posre to ‘dppc.itp’? But topol.top of KALP3 tutorial worked well without specific posre definition to ‘dppc.itp’…

[topol file of 2 peptides without membrane.top](https://gromacs.bioexcel.eu/uploads/short-url/mlWkiL5dRav7Emw2aUzliKEDAsw.top) (1.1 KB)

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [December 6, 2022, 5:44pm UTC](https://gromacs.bioexcel.eu/t/problem-for-merging-two-proteins-and-membrane-in-the-same-box/5361/4 "2022-12-06T17:44:24Z")

</div>

This is the problem?

> [@rlatl77791](#):
>
> ; Strong position restraints for InflateGRO  
> #ifdef STRONG\_POSRES  
> #include “strong\_posre.itp”  
> #endif

What `pdb2gmx` wrote for you is fine. But you can’t have another restraint topology that tries to apply to both of the chains. You need to change what is done in the tutorial (which is a very simple system) and generate two new “strong” restraint files and `#include` them the same way as the “standard” restraints. Valid atom numbers in each restraint topology are from 1…N, where N is the number of atoms in a given `[moleculetype]` - you cannot use `genrestr` to generate restraints for multiple molecules (as its help description warns).

---

<div class="post-metadata">

**Author:** ![rlatl77791](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@rlatl77791](https://gromacs.bioexcel.eu/u/rlatl77791)\
**Post date:** [December 9, 2022, 6:21am UTC](https://gromacs.bioexcel.eu/t/problem-for-merging-two-proteins-and-membrane-in-the-same-box/5361/5 "2022-12-09T06:21:33Z")

</div>

Sorry for the late report. I needed time to try what I understood through your advice…  
But my trials are failed.

I understand that your advice as…

1. What I did to autonomously generate restraint file (which contains 2 chains restraint) through \*.gro file (which contains 2 chain atom information) is wrong. I need to manually generate 2 strong restraint files because each restraint file needs for each chain.
2. I need to properly include those strong restraint files in topol.top

However, I cannot find solutions for both problems.

1. To generate strong restraint files, I need .gro files. But after pdb2gmx commend, only one .gro files could be generated. (because the original .pdb file consists of dimer.)  
Should I divide the original .pdb file to generate 2 \*.gro files and 2 strong restraint files?  
In that case, I guess that I could do it.

2. To properly include two strong constraints in topol.top, I tried to test most of the possible combinations of scripts.  
However, all trials resulted in errors.

ERROR 1 [file minim\_inflategro.mdp, line 18]:  
Parameter “define” doubly defined

or

ERROR 1 [file strong\_posre.itp, line 212]:  
Atom index (208) in position\_restraints out of bounds (1-207).  
This probably means that you have inserted topology section  
“position\_restraints”  
in a part belonging to a different molecule than you intended to.  
In that case move the “position\_restraints” section to the right molecule.

—example1—  
; Include chain topologies  
#include “topol\_Protein\_chain\_A.itp”  
#include “topol\_Protein\_chain\_B.itp”

; Strong position restraints for InflateGRO  
#ifdef STRONG\_POSRES  
#include “strong\_posre.itp”  
#endif

—example2—  
; Include chain topologies  
#include “topol\_Protein\_chain\_A.itp”  
#ifdef POSRES  
#include “posre\_Protein\_chain\_A.itp”  
#endif

#include “topol\_Protein\_chain\_B.itp”  
#ifdef POSRES  
#include “posre\_Protein\_chain\_B.itp”  
#endif

; Strong position restraints for InflateGRO  
#ifdef STRONG\_POSRES  
#include “strong\_posre.itp”  
#endif

—example3—  
; Include chain topologies  
#include “topol\_Protein\_chain\_A.itp”  
#include “topol\_Protein\_chain\_B.itp”

; Include Position restraint file  
#ifdef POSRES  
#include “posre\_Protein\_chain\_A.itp”  
#include “posre\_Protein\_chain\_B.itp”  
#endif

; Strong position restraints for InflateGRO  
#ifdef STRONG\_POSRES  
#include “strong\_posre\_A.itp”  
#include “strong\_posre\_B.itp”  
#endif

—example4—  
; Include chain topologies  
#include “topol\_Protein\_chain\_A.itp”  
#ifdef STRONG\_POSRES  
#include “strong\_posre\_A.itp”  
#endif

#include “topol\_Protein\_chain\_B.itp”  
#ifdef STRONG\_POSRES  
#include “strong\_posre\_B.itp”  
#endif

—example5—  
; Include chain topologies  
#include “topol\_Protein\_chain\_A.itp”  
#ifdef POSRES  
#include “posre\_Protein\_chain\_A.itp”  
#endif

#include “topol\_Protein\_chain\_B.itp”  
#ifdef POSRES  
#include “posre\_Protein\_chain\_B.itp”  
#endif

—example6—  
#include “topol\_Protein\_chain\_A.itp”  
#include “topol\_Protein\_chain\_B.itp”  
#endif

; Strong position restraints for InflateGRO  
#ifdef STRONG\_POSRES  
#include “strong\_posre\_A.itp”  
#endif

—example7—  
; Include chain topologies  
#include “topol\_Protein\_chain\_A.itp”  
#include “topol\_Protein\_chain\_B.itp”

; Strong position restraints for InflateGRO  
#include “strong\_posre\_A.itp”  
#include “strong\_posre\_B.itp”  
#endif

Sorry for the slow understanding.  
But May I ask you to write an example of the solution to 2nd problem?  
I think that I cannot find the solution to this problem with my novice understanding.

Thanks always for spare time and attention.

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [December 10, 2022, 3:14am UTC](https://gromacs.bioexcel.eu/t/problem-for-merging-two-proteins-and-membrane-in-the-same-box/5361/6 "2022-12-10T03:14:58Z")

</div>

> [@rlatl77791](#):
>
> To generate strong restraint files, I need .gro files. But after pdb2gmx commend, only one .gro files could be generated. (because the original .pdb file consists of dimer.)  
> Should I divide the original .pdb file to generate 2 \*.gro files and 2 strong restraint files?  
> In that case, I guess that I could do it.

This is correct.

Below is the correctly formatted topology construct. Note that the strong restraints are simply `#included` identically to the standard restraints, under a different flag.

```auto
; Include chain topologies
#include “topol_Protein_chain_A.itp”
#ifdef POSRES
#include “posre_Protein_chain_A.itp”
#endif
; Strong position restraints for InflateGRO
#ifdef STRONG_POSRES
#include “strong_posre_chain_A.itp”
#endif

#include “topol_Protein_chain_B.itp”
#ifdef POSRES
#include “posre_Protein_chain_B.itp”
#endif
; Strong position restraints for InflateGRO
#ifdef STRONG_POSRES
#include “strong_posre_chain_B.itp”
#endif

```

---

<div class="post-metadata">

**Author:** ![rlatl77791](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@rlatl77791](https://gromacs.bioexcel.eu/u/rlatl77791)\
**Post date:** [December 10, 2022, 9:48am UTC](https://gromacs.bioexcel.eu/t/problem-for-merging-two-proteins-and-membrane-in-the-same-box/5361/7 "2022-12-10T09:48:21Z")

</div>

> [@rlatl77791](#):
>
> gmx grompp -f minim\_inflategro.mdp -c system\_inflated.gro -p topol.top -r system\_inflated.gro -o system\_inflated\_em.tpr

It is hard to express my thanks to your enormous support with my English. Just thanks a lot!

---

<div class="post-metadata">

**Author:** ![hg2023](https://avatars.discourse-cdn.com/v4/letter/h/edb3f5/32.png) [@hg2023](https://gromacs.bioexcel.eu/u/hg2023)\
**Post date:** [March 9, 2023, 9:20pm UTC](https://gromacs.bioexcel.eu/t/problem-for-merging-two-proteins-and-membrane-in-the-same-box/5361/8 "2023-03-09T21:20:53Z")

</div>

If we cant merge different chain itp files into one file , why we have -merge function in pdb2gmx. I am getting confused about -merge function and it’s benefit. Because description says it is for merging multiple chains into one molecule.

Thanks in advance!

---

<div class="post-metadata">

**Author:** ![jalemkul](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/jalemkul/32/18_2.png) [@jalemkul](https://gromacs.bioexcel.eu/u/jalemkul)\
**Post date:** [March 10, 2023, 2:36am UTC](https://gromacs.bioexcel.eu/t/problem-for-merging-two-proteins-and-membrane-in-the-same-box/5361/9 "2023-03-10T02:36:50Z")

</div>

The `-merge` option is mostly useful when there are actual bonds between chains, e.g. intermolecular disulfides. In fact, it’s required in that case. It’s not required for anything else, though might be useful in these kinds of cases where custom restraints are needed.
