[gmx-users] Cannot combine residue position based cog selection with index output for g_select

Huang Dongxu fredhdx at gmail.com
Fri Oct 24 22:43:38 CEST 2014


I have a system consists of a box of water and a monolayer of polymer in
the center. I am trying to extract solvent molecules that have z
coordinates greater than 5 nm using g_select and output an index file.
Basically I want to separate my system into two portions: a box of waters
above the monolayer and the rest of the system containing the monolayer.
With the water only portion extracted by trajconv, I want to use genion to
replace some water molecules with salt and put this modified portion back
to my system that contains the monolayer.

Right now, I am able to use g_select -on -select "resname SOL and z>5" to
select all atoms that belong to SOL and has z > 5 nm. However, this way
does not guarantee that all the atoms selected are from SOL molecules whose
cog are above z=5 plane. And as a result, some atoms that are part of SOL
molecules below the z=5 plane are also selected and the entire selection
contains some complete water molecules and some atoms that are from below
plane water molecules (incomplete waters).

I am not sure with this kind of selection, if I extract it with trajconv,
and replace water with salt by genion, and then put it back to original
system, will I get correct alignment of those atoms from incomplete water
molecules and get the desired configuration. ( I think genion will only
replace complete residue; however, when using trajconv to generate new
coordination files, I am not sure if the system will be re-set to origin or
not. If so then the coordinates will definitely be misplaced and when I put
the modified part back there will be misalignment).

TO AVOID all that, I'd like to use "cog of SELECTION" option in the
g_select, except for 1 problems: the -on option only works with atom

So my essential question is: is there a way to use g_select with both the
-on option and cog option? Or is there another way to finish my task?

I have searched the archive and did not find something that answers my

Thank you all for helping out.


Dongxu Huang
Graduate student at Northwestern University

More information about the gromacs.org_gmx-users mailing list