# Replace/exchange molecules

**URL:** <https://gromacs.bioexcel.eu/t/replace-exchange-molecules/1475>\
**Category:** User discussions\
**Created:** [January 21, 2021, 12:37pm UTC](https://gromacs.bioexcel.eu/t/replace-exchange-molecules/1475 "2021-01-21T12:37:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mehr](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/mehr/32/547_2.png) [@mehr](https://gromacs.bioexcel.eu/u/mehr)\
**Post date:** [January 21, 2021, 12:37pm UTC](https://gromacs.bioexcel.eu/t/replace-exchange-molecules/1475/1 "2021-01-21T12:37:18Z")

</div>

GROMACS version: 2020  
GROMACS modification: Yes/No

Hi,

Is it possible to replace a molecule with another one in Gromacs?  
I tried to use _gmx insert-molecule -replace_, but it replaces the new molecule by removing more than one molecule from the simulation box. Is it possible to just replace one by one with Gromacs? The system is bilayers and I want to replace a single lipid with the other one.

Thank you in advance for any suggestion.

Best regards,  
Mehrnoosh

---

<div class="post-metadata">

**Author:** ![milosz.wieczor](https://avatars.discourse-cdn.com/v4/letter/m/b19c9b/32.png) [@milosz.wieczor](https://gromacs.bioexcel.eu/u/milosz.wieczor)\
**Post date:** [January 21, 2021, 1:40pm UTC](https://gromacs.bioexcel.eu/t/replace-exchange-molecules/1475/2 "2021-01-21T13:40:17Z")

</div>

Hi Mehrnoosh,

AFAIK there’s no such specialized functionality in Gromacs. There’s the [membed](https://pubmed.ncbi.nlm.nih.gov/20336801/) functionality for embedding things into an existing membrane patch, which might do the job for you (used to be a separate tool, now is incorporated into mdrun); not 100% sure if it works for lipids though, as it was designed for proteins.

But I guess you only want to change the headgroups? Here some scripting could also do, especially if they are similar.

Best,  
Miłosz

---

<div class="post-metadata">

**Author:** ![mehr](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/mehr/32/547_2.png) [@mehr](https://gromacs.bioexcel.eu/u/mehr)\
**Post date:** [January 21, 2021, 2:06pm UTC](https://gromacs.bioexcel.eu/t/replace-exchange-molecules/1475/3 "2021-01-21T14:06:35Z")

</div>

Hi Miłosz :)  
I just wanted to be sure that Gromacs is unable to do this, before going to write a script… I will also check the membed and see if it can help. Thanks a lot.

Best,  
Mehrnoosh
