From: Peter (peter.mawanga.lagos_at_gmail.com)
Date: Wed Mar 27 2024 - 16:14:08 CDT

Thanks a lot. This works for my issue.

On Wed, Mar 27, 2024 at 6:23 AM Joaquim Rui de Castro Rodrigues <
joaquim.rodrigues_at_ipleiria.pt> wrote:

> Dear Peter,
>
> Check this example:
> https://www.ks.uiuc.edu/Research/vmd/current/ug/node20.html
>
> that would translate to:
>
> set x [lindex $centerofsphere 0]
> set y [lindex $centerofsphere 1]
> set z [lindex $centerofsphere 2]
> set caatoms [atomselect top "name CA and (sqrt(sqr(x-$x) + sqr(y-$y) +
> sqr(z-$z)) < 22.0)"]
>
> Hope this helps,
> JR Rodrigues
>
>
> ------------------------------
> *De:* owner-vmd-l_at_ks.uiuc.edu <owner-vmd-l_at_ks.uiuc.edu> em nome de Peter <
> peter.mawanga.lagos_at_gmail.com>
> *Enviado:* 27 de março de 2024 06:29
> *Para:* Vmd l <vmd-l_at_ks.uiuc.edu>
> *Assunto:* Re: vmd-l: Atom selection based on center of sphere
>
> *Atenção:* Este email foi originado fora do Instituto Politécnico de
> Leiria. Por favor, não clique em links nem abra anexos, a não ser que
> reconheça o remetente e saiba que o conteúdo é seguro.
>
> I think a dummy (fictitious) atom might be a better alternative to
> "$centerofsphere," but I was not able to figure out how to transfer the XYZ
> coordinates of the geometric center to such a fictitious atom for the
> distance calculation and the desired output.
>
> Please suggest some method or alternative to proceed further. Thank you
> very much.
>
> On Tue, Mar 26, 2024 at 5:41 PM Peter <peter.mawanga.lagos_at_gmail.com>
> wrote:
>
> Hello everyone,
>
> I tried selecting CA atoms within a certain distance of the center of the
> sphere but have not been able to do so. More specifically, the "atomselect"
> command is not able to process the selection. Is there any way of resolving
> this issue?
>
> ******************************************
>
> set allatoms [atomselect top all]
>
> set centerofsphere [measure center $allatoms]
>
> set caatoms [atomselect top "name CA within 22 of $centerofsphere"]
>
> $caatoms writepdb selectedatoms.pdb
>
> ******************************************
>
>
> --
> Cheers
> Peter
>
>
>
> --
> Cheers
> Peter
>

-- 
Cheers
Peter