Bug #2231

convert-tpr aborts when saving subset of the system

Added by Justin Lemkul over 3 years ago. Updated about 3 years ago.

analysis tools
Target version:
Affected version - extra info:
Affected version:


We're running into a strange issue in which convert-tpr fails to save a subset of a system. A colleague is trying to reduce trajectory volume after the fact by saving only non-H coordinates. This is fine for the trajectory using trjconv, but making a matching .tpr file is failing. The attached test case reproduces the problem, which has been observed with 5.1.4 (by my colleague) and in 2016.3 (by me, using these files). Weirdly, convert-tpr works just fine on two different Mac computers (which have MacPorts gcc-4.7.4 and Homebrew gcc 6.2.0) but fails on Linux systems that compiled the code with gcc-4.8.4 or gcc-4.9.2. We don't have anything newer for the Linux systems yet (and likely won't), so this is all we can test.

Running convert-tpr through valgrind shows a lot of memory leaks, so I suspect something is getting corrupted along the way. Text from the output and the full command are given below:

$ ~/software/gromacs/2016.3/bin/gmx convert-tpr -s 4jv7_silcs.1.gc.30.res.tpr -n selection.1.ndx -o test.tpr
                   :-) GROMACS - gmx convert-tpr, 2016.3 (-:

                            GROMACS is written by:
     Emile Apol      Rossen Apostolov  Herman J.C. Berendsen    Par Bjelkmar
 Aldert van Buuren   Rudi van Drunen     Anton Feenstra    Gerrit Groenhof
 Christoph Junghans   Anca Hamuraru    Vincent Hindriksen Dimitrios Karkoulis
    Peter Kasson        Jiri Kraus      Carsten Kutzner      Per Larsson
  Justin A. Lemkul   Magnus Lundborg   Pieter Meulenhoff    Erik Marklund
   Teemu Murtola       Szilard Pall       Sander Pronk      Roland Schulz
  Alexey Shvetsov     Michael Shirts     Alfons Sijbers     Peter Tieleman
  Teemu Virolainen  Christian Wennberg    Maarten Wolf
                           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-2017, The GROMACS development team at
Uppsala University, Stockholm University and
the Royal Institute of Technology, Sweden.
check out 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 convert-tpr, version 2016.3
Executable:   /home/jalemkul/software/gromacs/2016.3/bin/gmx
Data prefix:  /home/jalemkul/software/gromacs/2016.3
Working dir:  /home/jalemkul/test/kaushik/test_scripts_cleanup
Command line:
  gmx convert-tpr -s 4jv7_silcs.1.gc.30.res.tpr -n selection.1.ndx -o test.tpr

Reading toplogy and stuff from 4jv7_silcs.1.gc.30.res.tpr
Reading file 4jv7_silcs.1.gc.30.res.tpr, VERSION 5.1.4 (single precision)
Note: file tpx version 103, software tpx version 110
5000 steps (5 ps) remaining from first run.
Group     0 (         System) has 18230 elements
Group     1 (        Protein) has  1690 elements
Group     2 (      Protein-H) has   854 elements
Group     3 (        C-alpha) has    85 elements
Group     4 (       Backbone) has   255 elements
Group     5 (      MainChain) has   399 elements
Group     6 (   MainChain+Cb) has   480 elements
Group     7 (    MainChain+H) has   573 elements
Group     8 (      SideChain) has  1117 elements
Group     9 (    SideChain-H) has   455 elements
Group    10 (    Prot-Masses) has  1690 elements
Group    11 (    non-Protein) has 16540 elements
Group    12 (          Other) has  1729 elements
Group    13 (            BEN) has   312 elements
Group    14 (            PRP) has   288 elements
Group    15 (            AAL) has   259 elements
Group    16 (            MEO) has   216 elements
Group    17 (            FOR) has   204 elements
Group    18 (            IMI) has   225 elements
Group    19 (            MAM) has   225 elements
Group    20 (          Water) has 14811 elements
Group    21 (            SOL) has 14811 elements
Group    22 (      non-Water) has  3419 elements
Group    23 (            !H*) has  6540 elements
Select a group: 23
Selected 23: '!H*'
Will write subset !H* of original tpx containing 6540 atoms
Reduced block      cgs from  18230 to   6540 index-,  18230 to   6540 a-entries
Reduced block     mols from   5173 to   5173 index-,  18230 to   6540 a-entries
Reduced block    excls from  18230 to  18230 index-,  76398 to  31801 a-entries
gmx: malloc.c:3697: _int_malloc: Assertion `(unsigned long) (size) >= (unsigned long) (nb)' failed.
Aborted (core dumped)

The fault comes from the reduce_rvec() function trying to snew(ptr, gnx). I can't determine why. Saving a smaller subset (e.g. C-alpha) passes this point but then fails at reduce_atom() or reduce_ilist().

test_scripts_cleanup.tar.gz (1.14 MB) test_scripts_cleanup.tar.gz Files to reproduce the issue Justin Lemkul, 08/16/2017 03:37 PM


#1 Updated by Paul Bauer about 3 years ago

Just tried to reproduce this on the release-2018 branch and there it seems to work fine with gcc-4.8. Can you try it again with release-2018?

Also available in: Atom PDF