Project

General

Profile

Bug #2157

gmx_spatial pbc error

Added by Alexey Anikeenko over 2 years ago. Updated almost 2 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
analysis tools
Target version:
-
Affected version - extra info:
Affected version:
Difficulty:
simple
Close

Description

When used with -pbc option gmx spatial always produces fatal error:

% gmx spatial -f -s -pbc
...
-------------------------------------------------------
Program:     gmx spatial, version 2016.3
Source file: src/gromacs/pbcutil/rmpbc.cpp (line 100)

Fatal error:
Structure or trajectory file has more atoms (2319) than the topology (1)

Problem is that the return value of read_first_frame() function is used later for rmpbc initialization,
but it does not actually return number of atoms.

Possible fix:

--- gmxana.orig/gmx_spatial.cpp 2016-07-09 07:55:38.000000000 +0700
+++ gmxana/gmx_spatial.cpp      2017-04-14 20:07:37.988999350 +0700
@@ -181,7 +181,8 @@
     get_index(atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &nidxp, &indexp, &grpnmp);

     /* The first time we read data is a little special */
-    natoms = read_first_frame(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &fr, flags);
+    read_first_frame(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &fr, flags);
+    natoms = fr.natoms;

     /* Memory Allocation */
     MINBIN[XX] = MAXBIN[XX] = fr.x[0][XX];

gmx_spatial_pbc.patch (559 Bytes) gmx_spatial_pbc.patch Alexey Anikeenko, 04/14/2017 03:25 PM

Associated revisions

Revision a464aad0 (diff)
Added by Erik Lindahl almost 2 years ago

Fix PBC error in gmx_spatial

Fix provided by Alexey Anikeenko.

Fixes #2157.

Change-Id: I2ac8a4ffac5acb0f3e432036ded3b380d720a719

Revision c67aef95 (diff)
Added by Mark Abraham almost 2 years ago

Fix return values of frame-reading functions

This function was based on read_first_x that returned the number of
atoms, and was documented to do the same, but has always returned a
logical boolean about whether a frame has been read. This led to
aspects of gmx spatial and gmx trjcat -demux being broken.

Fixed by returning a proper bool, and fixing the remaining logic that
used the return value in a non-boolean sense.

Refs #2157

Change-Id: Ic871b56f68c7dbc654ab11b34ff82932353e6ceb

History

#1 Updated by Gerrit Code Review Bot almost 2 years ago

Gerrit received a related patchset '1' for Issue #2157.
Uploader: Erik Lindahl ()
Change-Id: gromacs~release-2018~I2ac8a4ffac5acb0f3e432036ded3b380d720a719
Gerrit URL: https://gerrit.gromacs.org/7341

#2 Updated by Erik Lindahl almost 2 years ago

  • Status changed from New to Fix uploaded

#3 Updated by Mark Abraham almost 2 years ago

There is a more systematic abuse of the return value of read_first_frame(), but fortunately it is not frequent and easily fixed

#4 Updated by Gerrit Code Review Bot almost 2 years ago

Gerrit received a related patchset '1' for Issue #2157.
Uploader: Mark Abraham ()
Change-Id: gromacs~release-2018~Ic871b56f68c7dbc654ab11b34ff82932353e6ceb
Gerrit URL: https://gerrit.gromacs.org/7346

#5 Updated by Erik Lindahl almost 2 years ago

  • Status changed from Fix uploaded to Resolved

#6 Updated by Erik Lindahl almost 2 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF