[gmx-users] segmentation fault-g_spatial

Christopher Neale chris.neale at mail.utoronto.ca
Thu Jun 28 18:56:36 CEST 2012

Dear D.M.

I wrote g_spatial and Justin is correct that you simply need to use a larger number for -nab.

It's not a "bug" per se, it is simply that I didn't write the program to do two loops through
the input trajectory (one to determine the required bins and then allocate memory and
then another loop to count the values). So it is just quick and dirty coding, but when -nab is 
sufficiently large it will not be wrong.

Here is what happens: let's say that you have a cubic box. You then use trjconv to do a
fitting in which you rotate the box differently in different frames. Now the length of the 
new x-axis in a frame could be the length of the diagonal of your box, which is substantially 
longer. This is why you need to ask the program to allocate memory for additional bins 
(which will be written out to your cube file, making it larger, so you don't want to set -nab 
too much larger than is necessary). Pressure coupling also influences this, but not as much.

Note that if you make your bins half as large (for higher resolution) then you will need to 
double the value that you provide to -nab.

I usually use -nab 50. You may need a larger value if you use smaller bins or a very rectangular 
system which you rotate before running through g_spatial. You may also have to use very large 
values of -nab if you do a fitting on a system  where your central group is not centered (use the 
suggested trjconv preparation listed in g_spatial -h).

Finally, if you are using incredibly small bin sizes, then you might really be running into an 
out-of-memory condition, although that should not result in a segfault as the program should 
exit cleanly if it can not allocate the required memory.


---- Forwarded Message -----
From: delara aghaie <d_aghaie at yahoo.com>
To: Discussion list for GROMACS users <gmx-users at gromacs.org> 
Sent: Tuesday, 19 June 2012, 12:04
Subject: [gmx-users] segmentation fault-g_spatial

Dear Gromacs users. 

I have a protein in a box of water. I want to calculate the SDF of water molecules around the protein. I have used the procedure described in this page:


after two times using trjconv for putting the protein in the center of box and removing its rotation and translation, I use the g_spatial order.

g_spatial -s  ~.tpr -f   ~.xtc   (this is the output .xtc after tao times running trjcov).

I get this message:

Reading frame       7 time   14.000   There was an item outside of the allocated memory. Increase the value given with the -nab option.
Memory was allocated for [-0.374000,-0.301000,-0.217000]        to      [7.676000,7.749000,7.833000]
Memory was required for [-0.375000,6.700000,6.815001]

1) I want to know what exactly does (nab) option?

2) I have changed this -nab value from 4 to 6,8,10,.....40
but again I get something like the mentioned message or the segmentation fault.

What should I do to fix it and is it a limiting value for nab option?

3) Also please let me know, is it possible to calculate SDF of water molecules around a specific residue by creating and index group which contains that residue?


More information about the gromacs.org_gmx-users mailing list