/leaflets2ndx

NDX Groups for Membrane Leaflets

Primary LanguageCMIT LicenseMIT

leaflets2ndx: NDX Groups for Membrane Leaflets

leaflets2ndx groups selected membrane lipids based on their residue names and membrane leaflet they occupy. Creates an ndx group for each such group.

Dependencies

leaflets2ndx requires you to have groan library installed. You can get groan from here. See also the installation instructions for groan.

Installation

  1. Run make groan=PATH_TO_GROAN to create a binary file leaflets2ndx that you can place wherever you want. PATH_TO_GROAN is a path to the directory containing groan library (containing groan.h and libgroan.a).
  2. (Optional) Run make install to copy the the binary file leaflets2ndx into ${HOME}/.local/bin.

Options

Usage: leaflets2ndx -c GRO_FILE [OPTION]...

OPTIONS
-h               print this message and exit
-c STRING        gro file to read
-n STRING        ndx file to read (optional, default: index.ndx)
-s STRING        selection of membrane lipids (default: Membrane)
-p STRING        selection of lipid head identifiers (default: name PO4)
-o STRING        output ndx file (optional)
-e               also create empty ndx groups (optional)

Use groan selection language to select membrane lipids (flag -s) and lipid head identifiers (flag -p). Note that the selection of atoms -s is used to calculate membrane center and to correctly assign the lipids into the individual membrane leaflets. Therefore, it must include a sufficient number of sufficiently well distributed lipid atoms. The actual assignement of each lipid molecule to leaflet is done by comparing the z-position of the 'lipid head' (flag -p) to the z-position of the membrane center.

Note that the option -o is optional. If it is not supplied, the generated ndx groups are printed into standard output (usually the terminal). Note that if the specified output file matches the path to any existing file, the newly created ndx groups are appended to the end of the file. In case the file does not exist, it is created and the ndx groups are written into it.

The input (-n) and output (-o) ndx file can be the same file. In that case, the new ndx groups are added to the end of the original ndx file and the original ndx groups are not modified in any way.

Examples

leaflets2ndx -c md.gro

The program will read md.gro and index.ndx (default option of the flag -n). Then it will select all atoms of ndx group Membrane (default option of the flag -s) and treat them as membrane lipids. For each lipid residue, the program will identify its 'head' ('phosphate') using the lipid head identifier name PO4 (default option of the flag -p). Based on the position of the 'lipid head', the lipids are assigned into leaflets. Lipids located in the same leaflet and sharing the same residue name are then grouped into one ndx group. The individual ndx groups are written into standard output (i.e. terminal).

Let's suppose that file md.gro contains a membrane composed of POPC, DOPE and POPI lipids (all included in an ndx group Membrane). There are 256 POPC lipids in each membrane leaflet, 120 DOPE lipids in the lower leaflet, 60 DOPE lipids in the upper leaflet and 64 POPI lipids in the upper leaflet. In that case, leaflets2ndx will print out 7 ndx groups: POPC_lower (containing all atoms of the 256 POPC lipids that are located in the lower leaflet of the membrane), POPC_upper (containing 256 POPC lipids from the upper leaflet), DOPE_lower (containing 120 DOPE lipids from the lower leaflet), DOPE_upper (containing 60 DOPE lipids from the upper leaflet), POPI_upper (containing 64 POPI lipids from the upper leaflet), and finally Upper and Lower containing all lipids of the upper and lower leaflets, respectively.

As there are no POPI lipids located in the lower leaflet, POPI_lower group will not be printed. If you want leaflets2ndx to also print out empty ndx groups, use flag -e.

leaflets2ndx -c md.gro -p "name P" -s "resname POPC" -n my_index_file.ndx -o new_index.ndx

The program will read md.gro and my_index_file.ndx. It will consider atoms corresponding to the selection resname POPC to be membrane lipids and it will use atoms named P as lipid heads. The ndx groups will be written into a newly created ndx file new_index.ndx.

leaflets2ndx -c md.gro -p "name P" -s "resname POPC" -n my_index_file.ndx -o my_index_file.ndx

Same as above, but the new ndx files will be appended to my_index_file.ndx. Ndx groups already present in this file will not be changed. Note that leaflets2ndx expects the ndx file to end with a newline character.

Limitations

Assumes that the bilayer has been built in the xy-plane (i.e. the bilayer normal is oriented along the z-axis).

Will NOT generate correct ndx groups when applied to systems with curved bilayers or vesicles.

Assumes that the simulation box is rectangular and that periodic boundary conditions are applied in all three dimensions.

Always uses center of geometry, not center of mass.

When appending to a file, expects the file to end with a newline character.

Only tested on Linux. Probably will not work on anything that is not UNIX-like.