From: Shashidhar Rao (shashidharr_at_gmail.com)
Date: Mon Feb 01 2016 - 14:25:15 CST

Thank you very much, Ashar.

Before venturing on modifying the script to adjust the "atomselect" command
in the first of the script, I tried to make that command work on the vmd
command line by typing:

atomselect 1 LEU74.CA [I am hoping to select the CA atom in Leu74 of
molecule ID 1]

I obtained the following error message:

ERROR) Bad character:46:.
ERROR) syntax error
atomselect: can not parse selection text: LEU74.CA

Not sure what is going wrong. Any guidance will be very much appreciated.

Thanks,
Shashi Rao

On Mon, Feb 1, 2016 at 12:52 PM, Ashar Malik <asharjm_at_gmail.com> wrote:

> You will save this in a text parsable file maybe one exclusively end in
> .tcl and run it using the TKconsole included in VMD. Alternatively from the
> command line using
>
> vmd -dispdev text -eofexit < script.tcl
>
> Cant read the script but i think i programmed $id to hold the molecule ID.
> To change selection of atom selected in the reference molecule you need to
> adjust the atomselect command in the first part of the script.
> On Feb 2, 2016 5:57 AM, "Shashidhar Rao" <shashidharr_at_gmail.com> wrote:
>
>> Hello Ashar,
>>
>> Many thanks for sending the script. However, I am not entirely clear on
>> how I will use this script (which I assume will be executed from the VMD
>> command line). Will I replace the $id by the atom number or is there a way
>> of denoting it as for example the C-alpha atom of residue 74 (resid 74 and
>> atom ca)?
>>
>> Thank you again for your efforts in putting together the script.
>>
>> Shashi Rao
>>
>> On Sun, Jan 31, 2016 at 12:26 AM, Ashar Malik <asharjm_at_gmail.com> wrote:
>>
>>> I am not sure if there exists a direct selection command to go across
>>> molecules. It may exist so it maybe helpful to wait, however I have put
>>> together a small script which should pretty much do what you asked.
>>>
>>> Assuming you have two molecules loaded into VMD with ID 0 and 1.
>>> Use the following code.
>>>
>>> set id_ 0 ;#select reference molecules ID
>>> set s0 [atomselect $id_ "index 1" ] ;#select 1 atom from this molecule
>>> which is your reference
>>> set ref_ [lindex [$s0 get {x y z}] 0] ;#grab the x,y and z coordinates
>>>
>>> #the additional lindex command in the last line is a sanity check to
>>> ensure 1 atom is selected.
>>>
>>> set id_ 1 ;#select next molecules ID
>>> set s1 [atomselect $id_ all] ;#select everything in this new molecule
>>> set tar_ [$s1 get {x y z}] ;#get atom coordinates of everything in as
>>> list
>>>
>>> set n_o_A [llength $tar_] ;#get number of atoms for the for loop
>>>
>>> for {set i 0} {$i < $n_o_A} {incr i} { ;# loop over all atoms in
>>> selection to compare with reference
>>> set temp [lindex $tar_ $i] ;# store current atom in a temp variable
>>> set dist_ [vecdist $ref_ $temp] ;# get distance between current
>>> atom and reference
>>> if {$dist_ < 5} {
>>> lappend tar_atoms [expr $i+1] ;# if distance below cut off save index
>>> of atom from current molecule.
>>> # note that in the previous line $i is the index of the atom in the list
>>> which is probably off by 1 -- i just added 1 to it to fix this
>>> # and haven't tested it. Be careful when using it.
>>> }
>>> }
>>>
>>> When you run this code -- a list of index of atoms in molecule id 1 will
>>> be generated which are within a cutoff (5A) of the reference atom in
>>> molecule id 0. This is basically a template. You could have the lower part
>>> of this in a for loop and run the same changing the "id_" variable in each
>>> iteration for the total number of molecules you have. For that you may also
>>> have to log the molecule id along with target atoms or you might loose the
>>> distinction in the target atoms identified as to which molecule do they
>>> originate from.
>>>
>>> If you are unable to log the molID along with the target atoms
>>> identified, post again and you will get a reply.
>>>
>>> This code is not optimized - meaning thre might (probably does) exist a
>>> better way of accomplishing this.
>>>
>>> Good luck and hope this helps.
>>>
>>> Best,
>>> /A
>>>
>>> On Sat, Jan 30, 2016 at 5:45 AM, Shashidhar Rao <shashidharr_at_gmail.com>
>>> wrote:
>>>
>>>> Hello VMD Gurus,
>>>>
>>>> I am trying to find a way by which I can select residues/atoms within
>>>> molecule ID 1 which are within 5 angstroms of a given residue in molecule
>>>> ID 2. Thus, my selection is across multiple molecules. as an extension, I
>>>> may have 10 molecule IDs and I would like to select all the residues within
>>>> 5 angstroms of a given residue in molecule ID 2 in all the remaining
>>>> molecule IDs.
>>>>
>>>> I need this recipe to identify a set of water molecules simulated
>>>> separately in a PDB file using the PDB structure of a solute molecule which
>>>> is placed in the context of the water molecules.
>>>>
>>>> thanks for your help
>>>>
>>>> --
>>>> Shashidhar N. Rao
>>>> 3 SERINA DRIVE
>>>> PLAINSBORO
>>>> NEW JERSEY 08536 USA
>>>>
>>>> shashidharr_at_gmail.com
>>>>
>>>
>>>
>>>
>>> --
>>> Best,
>>> /A
>>>
>>
>>
>>
>> --
>> Shashidhar N. Rao
>> 3 SERINA DRIVE
>> PLAINSBORO
>> NEW JERSEY 08536 USA
>>
>> shashidharr_at_gmail.com
>>
>

-- 
Shashidhar N. Rao
3 SERINA DRIVE
PLAINSBORO
NEW JERSEY 08536 USA
shashidharr_at_gmail.com