Gmx genion for drude compatible gromacs code

Hi,

I think there’s a bug with gmx genion for drude version of the code.
I cannot replace solvent molecules with ion ones by using the straightforward command as
gmx genion -s .tpr -nn 5 -np 5
It actually replace solvent molecules but in this way (just the final part of the .gro output):

2097NA SOD20064 2.828 2.593 7.286
2097NA DSOD20065 2.828 2.593 7.286
2098NA SOD20066 2.124 3.724 7.219
2098NA DSOD20067 2.124 3.724 7.219
2099NA SOD20068 4.065 3.388 7.120
2099NA DSOD20069 4.065 3.388 7.120
2100NA SOD20070 3.033 1.509 7.443
2100NA DSOD20071 3.033 1.509 7.443
2101NA SOD20072 1.689 1.029 5.202
2101NA DSOD20073 1.689 1.029 5.202
2099NA OH220074 0.000 0.000 0.000
2099NA H120075 0.000 0.000 0.000
2105CL CLA20076 0.848 4.061 5.991
2105CL DCLA20077 0.848 4.061 5.991
2106CL CLA20078 1.217 3.156 6.389
2106CL DCLA20079 1.217 3.156 6.389
2100NA H120080 0.000 0.000 0.000
2100NA H220081 0.000 0.000 0.000
2100NA OM20082 0.000 0.000 0.000
2100NA DOH220083 0.000 0.000 0.000

Even if it prints out nicely:

Reading file ions.tpr, VERSION 2016-dev (single precision)
Reading file ions.tpr, VERSION 2016-dev (single precision)
4437 shells detected, will add polarizable ions.
Will try to add 5 NA ions and 5 CL ions.
Select a continuous group of solvent molecules
Group 0 ( System) has 20113 elements
Group 1 ( Other) has 10878 elements
Group 2 ( DECA) has 10878 elements
Group 3 ( Water) has 9235 elements
Group 4 ( SOL) has 9235 elements
Group 5 ( non-Water) has 10878 elements
Select a group: 4
Selected 4: ‘SOL’
Number of (5-atomic) solvent molecules: 1847
Replacing solvent molecule 185 (atom 11803) with NA
Replacing solvent molecule 514 (atom 13448) with NA
Replacing solvent molecule 405 (atom 12903) with NA
Replacing solvent molecule 1683 (atom 19293) with NA
Replacing solvent molecule 1719 (atom 19473) with NA
Replacing solvent molecule 293 (atom 12343) with CL
Replacing solvent molecule 612 (atom 13938) with CL
Replacing solvent molecule 81 (atom 11283) with CL
Replacing solvent molecule 377 (atom 12763) with CL
Replacing solvent molecule 1607 (atom 18913) with CL

Thank you in advance
Matteo

Please email me the .tpr file. This bug should have been fixed years ago so I can’t imagine why it’s popping up.

I’m having trouble getting the fix merged into the git repo, so until I get that sorted out, just change line 270 of src/gromacs/gmxana/gmx_genion.cpp from

j = starta+(2*npi)+(2*nni);

to

j = starta+(2*np)+(2*nni);

and recompile.

Thank you Justin for your fast input,

Anyway I still encounter a segmentation fault error when I try to add iodide ions.
Fine with fluoride, chloride and bromide.

Cheers
Matteo

Fixed. I had a rather obvious omission in the enum for iterating over the atom names. I think the push to the git repo was successful, so please try to pull the code and recompile. If not, please let me know. Or adjust line 125 in gmx_genion.cpp:

enum    { eiLI, eiK, eiNA, eiRB, eiCS, eiMG, eiCA, eiZN, eiSR, eiBA, eiF, eiCL, eiBR, eiI, eiNR };

The first entry (eiLI) was missing, causing the match to iodine to be NULL.

Please note that you are in the complete wild west here, so beware. We have never looked at the interactions of halides with other cations, and we suspect that the halides are over-polarized. You may get weird behavior. We’ve been looking closely at ions for a long time, and making a lot of refinements, starting with cation interactions with biomolecular groups. Dealing with Cl- and the others is next on the list, because we know they have a tendency to over-polarize; this leads to spurious attraction to cations at sufficiently high concentrations.