Replace/exchange molecules

GROMACS version: 2020
GROMACS modification: Yes/No


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,

Hi Mehrnoosh,

AFAIK there’s no such specialized functionality in Gromacs. There’s the membed 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.


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.