Indexing issue and grompp

GROMACS version: 2021.2
GROMACS modification: No
Here post your question

I have indexing issue in the xtc file format.
my topol.to top file has the following items:

; Compound      #mols
IAUM           18642
protein        XXXX; i have intentionally changed the Proteins to XXXX
W           3798848
NA               1714

in the mdp file, I try to just output my NP, protein and ions in the xtc file:

nstxtcout                = 10000  ; Output frequency for .xtc file
xtc_precision            = 100
xtc-grps                 =IAUM-Pro-ion ;IAUM protein IONs_all

to do so, I make a group in my index file called “IAUM-Pro-ion”. I also double checked to make sure the index numbers do match and I only have IAUM, protein and ION in the system!

However, when I try to use trjconv to convert xtc to gro file, using the same index file and the same group as shown below ( Group 18 ( IAUM-Pro-ion) has 444023 elements ), I get error of mismatching numbers.

gmx trjconv -f nvt-production-30fs.xtc -s nvt-production-30fs.tpr -o nvt-production-30fs-c.gro -pbc mol -n index.ndx 
                     :-) GROMACS - gmx trjconv, 2021.2 (-:

                            GROMACS is written by:
     Andrey Alekseenko              Emile Apol              Rossen Apostolov     
         Paul Bauer           Herman J.C. Berendsen           Par Bjelkmar       
       Christian Blau           Viacheslav Bolnykh             Kevin Boyd        
     Aldert van Buuren           Rudi van Drunen             Anton Feenstra      
    Gilles Gouaillardet             Alan Gray               Gerrit Groenhof      
       Anca Hamuraru            Vincent Hindriksen          M. Eric Irrgang      
      Aleksei Iupinov           Christoph Junghans             Joe Jordan        
    Dimitrios Karkoulis            Peter Kasson                Jiri Kraus        
      Carsten Kutzner              Per Larsson              Justin A. Lemkul     
       Viveca Lindahl            Magnus Lundborg             Erik Marklund       
        Pascal Merz             Pieter Meulenhoff            Teemu Murtola       
        Szilard Pall               Sander Pronk              Roland Schulz       
       Michael Shirts            Alexey Shvetsov             Alfons Sijbers      
       Peter Tieleman              Jon Vincent              Teemu Virolainen     
     Christian Wennberg            Maarten Wolf              Artem Zhmurov       
                           and the project leaders:
        Mark Abraham, Berk Hess, Erik Lindahl, and David van der Spoel

Copyright (c) 1991-2000, University of Groningen, The Netherlands.
Copyright (c) 2001-2019, The GROMACS development team at
Uppsala University, Stockholm University and
the Royal Institute of Technology, Sweden.
check out http://www.gromacs.org for more information.

GROMACS is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License
as published by the Free Software Foundation; either version 2.1
of the License, or (at your option) any later version.

GROMACS:      gmx trjconv, version 2021.2
Executable:   /usr/local/gromacs/bin/gmx
Data prefix:  /usr/local/gromacs
Working dir:  /home/mkhatami/uoft/gromacs/Au-C6-1ao6-1hzh-1d3k/all-elastic/full-structures/80nmbox/006-nvt-production-large-freeze
Command line:
  gmx trjconv -f nvt-production-30fs.xtc -s nvt-production-30fs.tpr -o nvt-production-30fs-c.gro -pbc mol -n index.ndx

Note that major changes are planned in future for trjconv, to improve usability and utility.
Will write gro: Coordinate file in Gromos-87 format
Reading file nvt-production-30fs.tpr, VERSION 2021.2 (single precision)
Reading file nvt-production-30fs.tpr, VERSION 2021.2 (single precision)
Select group for output
Group     0 (         System) has 4242871 elements
Group     1 (          Other) has 3819204 elements
Group     2 (           IAUM) has 18642 elements
Group     3 (              W) has 3798848 elements
Group     4 (            ION) has  1714 elements
Group     5 (        Protein) has 423667 elements
Group     6 (      Protein-H) has 423667 elements
Group     7 (        C-alpha) has     0 elements
Group     8 (       Backbone) has     0 elements
Group     9 (      MainChain) has     0 elements
Group    10 (   MainChain+Cb) has     0 elements
Group    11 (    MainChain+H) has     0 elements
Group    12 (      SideChain) has 423667 elements
Group    13 (    SideChain-H) has 423667 elements
Group    14 (    Prot-Masses) has 423667 elements
Group    15 (    non-Protein) has 3819204 elements
Group    16 (          W_ION) has 3800562 elements
Group    17 (       IONs_all) has  1714 elements
Group    18 (   IAUM-Pro-ion) has 444023 elements
Group    19 ( IAUM-Pro-modif) has 442339 elements
Select a group: 18
Selected 18: 'IAUM-Pro-ion'
Reading frame       0 time    0.000   
Precision of nvt-production-30fs.xtc is 0.01 (nm)

-------------------------------------------------------
Program:     gmx trjconv, version 2021.2
Source file: src/gromacs/tools/trjconv.cpp (line 921)

Fatal error:
Index[442309] 4241158 is larger than the number of atoms in the
trajectory file (444023). There is a mismatch in the contents
of your -f, -s and/or -n files.

For more information and tips for troubleshooting, please check the GROMACS
website at http://www.gromacs.org/Documentation/Errors
-------------------------------------------------------

The interesting part is that when I make an new group (Group 19 ( IAUM-Pro-modif) has 442339 elements) including some water indices and removing the ions the code creates the gro file.

Is it a bug in the grompp? or am I doing something wrong?

Best,
Mohammad

Hi,
Maybe I have missed it, but did you use the same file to build the index file and to start the simulation?
Thank you
Alessandra

Hi Alessandra @alevilla,
Thanks for your reply.
Yes, I believe did.
Best,
Mohammad

Why don’t you create an index file after creating a gro file from xtc? Then you can pass that index file to extract the required items.