From: Vermaas, Joshua (Joshua.Vermaas_at_nrel.gov)
Date: Thu Aug 08 2019 - 12:18:32 CDT

Hi Alex,

The heart of the within command is implemented in SpatialSearch.C. Basically, what "within 5 of protein" does is to select any atom whose position is within 5 Angstroms of any protein atom. The implementation does not consider radii at all, only atom centers, so literally it will select an atom if its position is within 5 Angstroms of an atom in the "of" part of the selection. The name OH2 will restrict it to water oxygens only, turning off any other atoms.

-Josh

On 2019-08-08 09:39:18-06:00 owner-vmd-l_at_ks.uiuc.edu wrote:

Hello,

I’m currently working with diffusion of water within a certain distance of a protein and I was wanting to know more in depth how the “within” command works. Specifically, if I make a selection like

set sel [atomselect top “name OH2 and (within 5 of protein)”]

does the within command determine which Oxygen atoms are within 5 Ĺ by measuring the distance from each protein atom? Or is it something more complex like measuring the shortest distance which is perpendicular to the protein surface?

If anyone knows the answer or knows where to point me to source code where I could find out myself that would be wonderful.

Thanks,
Alex