Adding an extra input for electric field in mdp files

I’m an undergraduate student from Peking University. In my current work, I found it necessary to add two electric fields in one dimension at the same time, so I made this plugin. Hopefully it will help other people if they have similar needs.

Brief description of tools/files:

This is a gromacs plugin made to add an extra input for constant electric field in .mdp file.

Current gromacs (up to gromacs-2023) only support one electric field input in each dimension (x, y, z). However, it is necessary to add two electric field components in one dimension simultaneously, eg. adding a constant transmembrane potential and a oscillating field. Currently, this can only be done by building a double-layer system to produce the transmembrane potential, which definitely increases computational cost.

Here, an easy and direct solution is provided, as an extra input for constant electric field is added. To use this, simply add

constant-electric-field-x = Ex

constant-electric-field-y = Ey

constant-electric-field-z = Ez

to your .mdp file, where Ex, Ey, Ez are the electric fields to add in that dimension in V/nm.

This plugin needs to be added to gromacs source file folder before compiling. Run INSTALL to include this into the source code, and then compile gromacs.

Thanks for your use!


GitHub - Citric1acid/GromacsPlugin: A plugin for Gromacs that adds an extra input for constant electric field in .mdp file (for gromacs 2023)

GitHub - Citric1acid/GromacsPlugin at for_lower_versions (for gromacs 2022 or lower)

Contact person (name and email address):

Zigang Song

How the work has been tested/reviewed:

It has been tested on gromacs 2023 and 2022.3. It works well in my current project, and gives desired results.

Note: it passes all gromacs unit tests except test 48, but that’s because the mdp output has changed as well, which doesn’t affect its performance.