[gmx-users] Usage of g_spatial

Christopher Neale chris.neale at mail.utoronto.ca
Tue May 14 22:26:55 CEST 2013

Sounds like a trjconv problem, not a g_spatial problem to me. You should center only the group that 
makes sense for your SDF -- you probably want to pick a single cation for this (then, separately, do another
run selecting a single anion; each will be used to generate a separate SDF). Then output the whole system.
This should work. If not, then I suggest that you start a new post with a relevant title and figure out what you
are doing wrong with trjconv ... you'll need to post actual commands there with associated error messages.

If you want to output only a portion of the system in your step 1, then you need to provide a -s input with the same 
number of atoms in step 2. Nevertheless, just use the whole system for trjconv for now since it should work.

Regarding your "seeing the whole distribution" for ANI from g_spatial output in VMD, I don't understand what you
see and what you expect/want to see. Try posting a figure somewhere online and post with its location and
a description of what you want to obtain.

If you want the distribution of all C cations around the average of all A anions, then you need to create a trajectory
that is A times as long as your real trajectory and reorder the coordinates so that each anion has a turn
being residue number N. Then center your whole trajectory about residue N. This is a hack, but it works for me
and I think is what you want. Also, the tool g_sdf does this on its own so you might look online for an older
version of it. I found it less useful than g_spatial for my purposes, but some users have found it to be the perfect 


-- original message --

Yes, trjconv works without tpr. Thanks for that.

I want to see the distribution of anion around cation. Is it not possible
to see an averaged spatial distribution of all anions around all cations?
Do I need to make a selection of a single cation molecule?

I did the selection of a single cation molecule which is approximately at
the center of the box and did the following

step 1: trjconv -s 1md.pdb -f 11md_gro.pdb -o 11md_gro_mod.pdb -center -ur
compact -pbc none
when it asked for group for centering and output, I selected the whole
system for both.

step 2: trjconv -s 1md.pdb -f 11md_gro_mod.pdb -o 11md_gro_mod1.pdb -fit
when it asked for group for least square once again I selected the whole

I selected the whole system as a previous discussion

suggested the same because of an error that was happening in step 2.

*Fatal error: Index[2385] 2410 is larger than the number of atoms in**
the trajectory file (2409).
Since I was getting the same error if I made any form of selections in
the first two steps, I output the whole system.

step 3: g_spatial. and used ANI as group to generate SDF and a single
cation residue as the group to output coords

        When I loaded the resultant cube in vmd I could see the whole

Where am I going wrong?

More information about the gromacs.org_gmx-users mailing list