Feature #2188

Masses missing from TNG specification

Added by Richard Gowers almost 4 years ago. Updated over 3 years ago.

Target version:



I've been playing around with the tng format and noticed that there is no block_id for masses. For analysis this is pretty fundamental to have.

Have I missed where it's stored, or is it a deliberate choice to save space in the file?

You could probably guess the mass for most "mainstream" forcefields, but for others (weird names and/or coarse-grained?) it is required. Something like a mapping of atomtype to mass might be a low-space way of providing this.


Associated revisions

Revision c6c1346e (diff)
Added by Magnus Lundborg over 3 years ago

Added data block for atom masses.

Added a block ID for atom masses and a test for reading
and writing.

Also made a minor update to the test for writing partial
charges to keep it in line with the test for atom masses.

Fixes #2188.

Change-Id: I4a227016af6b14590165ce8f458859a743cdb744


#1 Updated by Berk Hess almost 4 years ago

  • Tracker changed from Bug to Feature
  • Status changed from New to Accepted
  • Priority changed from Normal to High

I agree we need masses. These should be stored in the tng file, not looked up based on atomtype, since that is asking for trouble.
I don't know why these were not planned from the start. It should be easy to add those to the tng_atom struct. I don't know if that requires a file format specification change.
The main issue is that we currently don't have anyone responsible for tng.

#2 Updated by Max Linke almost 4 years ago

I think the easiest would be to add a mass group similar to groups for charges and occupancies. I can add a small patch for the tng library.

Can I also submit that on gerrit for tng?

#3 Updated by Magnus Lundborg almost 4 years ago

  • Project changed from GROMACS to TNG trajectory library
  • Assignee set to Magnus Lundborg

This should be quite straight-forward to add. It will just be a matter of adding another block type for atom masses (similar to e.g. charges, as Max said above). Then the masses can be constant during the simulation (the most common scenario) or change over time. The new data block will of course be readable also by older versions of the library, but the data block ID will not be defined in the library header (of older versions of the library).

I could try looking into it next week.

#4 Updated by Berk Hess over 3 years ago

Somewhat unrelated, at the GROMACS workshop it was said that TNG has the atoms and bonds of the system. To me, and maybe others, that gave the impression that GROMACS stores all that information in the tng file. But I can't find anything in the code. Is the situation that the TNG format supports it, but mdrun currently only writes x,v,f and box?

#5 Updated by Magnus Lundborg over 3 years ago

Unless something is broken the molecule system, with atoms and bonds, should be written by gmx_tng_prepare_md_writing().

#6 Updated by Berk Hess over 3 years ago

I missed that. I was searching for charges, but those are not stored. We should store charges and masses in tng.

#7 Updated by Magnus Lundborg over 3 years ago

Definitely. There is now a patch (not merged) for the masses data block in TNG.

Writing charges and masses from GROMACS should be reasonably quick to implement.

#8 Updated by Anonymous over 3 years ago

  • Status changed from Accepted to Resolved

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

Gerrit received a related patchset '1' for Issue #2188.
Uploader: Magnus Lundborg ()
Change-Id: gromacs~master~I7dd80d7b6281b2c3710fb541fa3cee6fbdcb2256
Gerrit URL:

Also available in: Atom PDF