Gmx density - error in electrons.dat - measuring electron membrane density

GROMACS version: 2018.4
GROMACS modification: No
I have a problem. I want to create Membrane electron density profiles. My membrane consists of POPC and POPG. I want to create density profile only for POPC. I used this command:
gmx density -s step7_production.tpr -f step7_production.xtc -n density_POPC.ndx -ei electrons.dat -o density_POPC.xvg -d z -sl 200 -ng 3 -dens electron
Then I choose 6 ,7, 8 and get an error

Select 3 groups to calculate density for:
Group     0 (         System) has  9240 elements
Group     1 (          Other) has  9240 elements
Group     2 (           POPG) has  1524 elements
Group     3 (           POPC) has  4824 elements
Group     4 (           TIP3) has  2880 elements
Group     5 (            POT) has    12 elements
Group     6 (POPC_&_N_C12_C13_C14_C15_C11) has   216 elements
Group     7 (POPC_&_P_O13_O14_O12_O11) has   180 elements
Group     8 (POPC_&_O21_O22_O31_O32) has   144 elements
Select a group: 6
Selected 6: 'POPC_&_N_C12_C13_C14_C15_C11'
Select a group: 7
Selected 7: 'POPC_&_P_O13_O14_O12_O11'
Select a group: 8
Selected 8: 'POPC_&_O21_O22_O31_O32'

Program:     gmx density, version 2018.4
Source file: src/gromacs/gmxana/gmx_density.cpp (line 117)

Fatal error:
Invalid line in datafile at line 1

For more information and tips for troubleshooting, please check the GROMACS
website at

electrons.dat (859 Bytes)
Processing: membrane.txt…
membrane.dat (427.8 KB)
I don’t know what is wrong with my first line. I add in attachments .gro file (membrane.dat) and electrons file (electrons.dat).

The beginning of electrons .dat looks like that


I have 134 atoms in POPC and the number of electrons for each atom. What I should change in electrons.dat?

I have noticed that you have an extra line at the end of electrons.dat. I am not sure that this is the problem, but you can try to remove it and you can add a space before and after character ‘=’.

1 Like

Thank you so much adding space before and after character ‘=’ solved my problem.