From: Nicolas Sapay (
Date: Mon Mar 06 2006 - 09:13:38 CST

Dear Ignacio,
it should be possible to do this taking into account the PBC in your
selection command. Example: You want to select water within 5 A of a
- 1 : Make a selection using the "within" command:
set sel1 [atomselect top "water within 5 of resid 1"]
- 2 : If the residue 1 is at less than 5 A of a PBC (e.g. the PBC
related ot the x axis), translate the center of the first selection and
make a second selection:
# Measure the center of the first selection
lassign [measure center $sel1] a b c
# Translate the x coordinates taking in to account the length of your
set a [expr - (abs($a)/$a) * abs($length - $a)]
# Make a second selection considering that the cartesian equation of a
sphere is (x-a)虏 + (y-b)虏 + (z-c)虏 = r虏
set sel2 [atomselect top "water and

I'm not sure it will be easy to take into account the 3 dimensions with
this method.... However, I hope it will help you!

Enjoy :-)


>I have a simulation box where the interesting molecule (the solute) is
>near the edge. This poses no problem in the simulation, as it's done
>with periodic boundary conditions, and I can enable the periodic images
>as well in VMD. The problem is I'm only interested in the molecules
>closest to the solute, but if I select them with "within 4 of index 0"
>(for example), it only selects the molecules in the "self" cell, but
>not in the periodic images (at least, not the ones in the opposite side
>of the periodic image, which are actually close the solute).
>Graphically, If I have this system:
>* = solute
>| = cell boundary
>I want to select this:
># = selected
>But I get only this:
>Is there a way to get what I want other than preprocessing the input
>file to get it centered around the solute (which would then give the
>same problem for other different molecules)?

[ Dr Nicolas Sapay ]
Institut de Biologie et Chimie des Prot茅ines
CNRS - Claude Bernard University, IFR128 Bioscience Lyon-Gerland
Phone: +33 (0)4 72 72 26 46 - Fax: +33 (0)4 72 72 26 46
Address: 7 passage du Vercors, 69367-F Lyon cedex 07, France