Bug #783

g_mdmat invalid xvg output for legend. OR: g_mdmat, g_analyze, g_enemat output xmgr xvg format for xmgrace?

Added by Luke Goodsell about 6 years ago. Updated over 3 years ago.

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


Using g_mdmat from GROMACS 4.5.4, the xvg output file formats the legend metadata in a way that xmgrace 5.1.22 does not understand, complaining of "Unallocated set: LEGEND STRING ..." for each legend entry.

Example g_mdmat command:

g_mdmat \
-f testout/20110720-1614/trajectory.trr \
-s tpr/hasyn_0001.tpr \
-n gro/hasyn_0001.ndx \
-mean testout/20110720-1614/mdmat_mean.xpm \
-frames testout/20110720-1614/mdmat_frames.xpm \
-no testout/20110720-1614/mdmat_num.xvg

The xvg file produced formats the legend as:

@ legend string 0 "Total/mean" 
@ legend string 1 "Total" 
@ legend string 2 "Mean" 
@ legend string 3 "# atoms" 
@ legend string 4 "Mean/# atoms" 

but xmgrace wants

@ s0 legend "Total/mean" 
@ s1 legend "Total" 
@ s2 legend "Mean" 
@ s3 legend "# atoms" 
@ s4 legend "Mean/# atoms" 

... which is how the other g_ utilities that I've used generate it.

I'm not confident enough to suggest a diff, but the string "legend string" appears in these files:
src/tools/gmx_analyze.c lines 552 553
src/tools/gmx_enemat.c lines 417 419 421
src/tools/gmx_mdmat.c lines 324-328

src/tools/gmx_saltbr.c line 252 -- this seems to only be output for xmgr, as (I think) is correct. Maybe that's the problem with g_mdmat?
src/gmxlib/xvgr.c line 358 -- again, only for xmgr

My guess is that g_analyze, g_enemat and g_mdmat are producing xmgr format xvg files when they should output xmgrace files.

Associated revisions

Revision 71b52b1b (diff)
Added by Mark Abraham over 6 years ago

Moved heuristic neighbor-list code into mdlib

IssueID #783

Revision c6619dee (diff)
Added by Mark Abraham over 6 years ago

Moved iterated-constraints code into mdlib

IssueID #783

Revision 865dd11c (diff)
Added by Mark Abraham over 6 years ago

Moved various support functions for do_md into mdlib

IssueID #783

Revision 75f84652 (diff)
Added by Erik Lindahl over 3 years ago

Make sure figure legends are adapted to xmgr/xmgrace

A few programs were not using the xvgr_legend call. g_mdmat
has been modified to use it, and for g_analyse and g_enemat
I at least fixed the existing direct-writing code by adding
a conditional.

Fixes #783.

Change-Id: I782af539b93737b570f266ba744e718fbd846e5f


#1 Updated by Roland Schulz about 5 years ago

Yes you are correct. Those tools should use the function xvgr_legend instead of printing directly. That way the format is correct for both programs. Could you please upload a patch to

#2 Updated by Roland Schulz almost 5 years ago

  • Priority changed from Normal to Low

#3 Updated by Gerrit Code Review Bot over 3 years ago

Gerrit received a related patchset '1' for Issue #783.
Uploader: Erik Lindahl ()
Change-Id: I782af539b93737b570f266ba744e718fbd846e5f
Gerrit URL:

#4 Updated by Erik Lindahl over 3 years ago

  • Status changed from New to Fix uploaded
  • Affected version set to 4.6.x

#5 Updated by Erik Lindahl over 3 years ago

  • Status changed from Fix uploaded to Resolved
  • % Done changed from 0 to 100

#6 Updated by Erik Lindahl over 3 years ago

  • Status changed from Resolved to Closed

Also available in: Atom PDF