From: Axel Kohlmeyer (
Date: Thu Apr 02 2015 - 07:43:14 CDT

On Thu, Apr 2, 2015 at 8:08 AM, Stefan Doerr <> wrote:
> Right, but I don't think this covers my problem. If you look at the water
> box atoms in the PDB
> (which is by the way the exact water box VMD uses for solvating) a unique
> resid is correctly assigned to the 3 atoms of each
> water molecule. The segid is also correctly assigned to only the water box.
> Hence the segid and resid combination in the selection is unique.
> In that case using "segid WT5 and same residue" should be equivalent to
> "segid WT5 and same resid".
> We are not talking about the absolute values of resid or residue but about
> the "same" resid or residue inside a segment.

ok. my answer was not correct. but also your analysis is not correct.
what you and i have overlooked is that the "same" qualifier applies to
(within 2.4 of not segid WT5) part. so you first select all particles
that are within 2.4 angstrom of the atoms in all segments but WT5,
then you expand this to all atoms in all segments that have the same
residue/resid and *then* you reduce it to all of those in segment WT5.
so using resid should pick more atoms.
to make this work as you expect, you have to move the "same
resid/residue as" to the very left of your selection.

as always, computers stick to the rules and don't use common sense. ;-)

> On Thu, Apr 2, 2015 at 1:54 PM, Axel Kohlmeyer <> wrote:
>> On Thu, Apr 2, 2015 at 4:41 AM, Stefan Doerr <> wrote:
>> > Hello,
>> > I wanted to point out what looks like an atomselect bug to me.
>> >
>> > I have a lipid membrane system with a protein and I added a water box on
>> > it
>> > which clashes with the membrane and protein.
>> >
>> > I am trying to select all water atoms that clash with non-water atoms to
>> > remove them.
>> > Given the following two selections I would expect identical results (as
>> > long
>> > as the water molecules have correct resid's in the PDB which they indeed
>> > have):
>> >
>> > segid WT5 and same residue as (within 2.4 of not segid WT5)
>> > segid WT5 and same resid as (within 2.4 of not segid WT5)
>> >
>> > I made a imgur album with some explanatory pictures
>> >
>> >
>> > The first selection seems to works fine (see album: red balls). If you
>> > change residue to resid it wrongly finds many more water molecules
>> > (yellow
>> > balls). Although I actually have the impression that the first selection
>> > is
>> > not totally correct either. I have seen it remove only pieces of a water
>> > molecule and not all of it.
>> >
>> > I don't see a reason why resid should not work in this selection exactly
>> > like residue.
>> residue is a number designated by VMD and guaranteed to be unique,
>> resid is just a label imported from the PDB file and can repeat. as
>> far as i remember, the PDB standard only requires it to be unique
>> within a segment.
>> however, since residue is still dependent on a correct assignment of
>> residue labels, i.e. resids to molecules, the safest way to select
>> whole molecules is to use "same fragment as". fragment is also a
>> property computed by VMD and assigns a unique id to each
>> group/fragment of connected atoms, which coincides with molecules in
>> classical force fields (that is assuming that you have correct bond
>> information imported from a .psf file or similar).
>> axel.
>> >
>> > Here is the PDB file if you want to test it. I tested it with 1.9.1 and
>> > 1.9.2 VMD:
>> >
>> --
>> Dr. Axel Kohlmeyer
>> College of Science & Technology, Temple University, Philadelphia PA, USA
>> International Centre for Theoretical Physics, Trieste. Italy.

Dr. Axel Kohlmeyer
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.