Re: Atom selection in Tcl Force script with Amber partop file

From: Daniel Torrente (xlb608_at_my.utsa.edu)
Date: Fri Aug 15 2014 - 19:01:23 CDT

Oh, you are right, my bad. It should be "get serial" instead of "get index".

Thanks again

Daniel

On Fri, Aug 15, 2014 at 6:33 PM, Maxim Belkin <mbelkin_at_ks.uiuc.edu> wrote:

> No problem. One note: I think you have to use "get serial" instead of "get
> index" since NAMD's atomid = VMD's serial. You should probably check that
> first before running a simulation.
>
> Maxim
>
>
>
> On Aug 15, 2014, at 6:21 PM, Daniel Torrente <danieltorrenteq_at_gmail.com>
> wrote:
>
> Dear Maxim,
>
> Thanks for your help, it works perfectly. I will put all the steps for
> future reference (the least that I can do).
>
>
> On VMD (PDB loaded with the beta 1 and 2 atoms)
>
> set sel1 [atomselect top "beta == 1"]
> set sel2 [atomselect top "beta == 2"]
>
> #### For the beta 1 set of atoms #####
> set ch1 [open beta1.txt w]
> puts $ch1 "[$sel1 get Index]"; # single line with serial numbers (1-based
> indicies)
> close $ch1
> #################################
>
> #### For the beta 2 set of atoms #####
> set ch2 [open beta2.txt w]
> puts $ch2 "[$sel1 get Index]"; # single line with serial numbers (1-based
> indicies)
> close $ch2
> #################################
>
>
>
> Tcl force
> ###############Replace the atom selection part of the Tcl force script for
> this ########
> # Atoms selected for force application
>
> set ch1 [open beta1.txt r]
> set atomindex1 [read $ch1]
> close $ch1
>
> set ch2 [open beta2.txt r]
> set atomindex2 [read $ch2]
> close $ch2
>
>
> set a1 [addgroup $atomindex1]
> set a2 [addgroup $atomindex2]
>
> #########################
>
> Thanks again, my weekend was saved
>
> Daniel
>
>
> 2014-08-15 16:48 GMT-05:00 Maxim Belkin <mbelkin_at_ks.uiuc.edu>:
>
> Daniel,
>>
>> VMD can help. You can load your pdb file into VMD and make two selections:
>>
>> set sel1 [atomselect top "beta == 1"]
>> set sel2 [atomselect top "beta == 2"]
>>
>> then write their serial numbers into text files like that:
>>
>> set ch [open beta1.txt w]
>> puts $ch "[$sel1 get serial]"; # single line with serial numbers
>> (1-based indicies)
>> close $ch
>>
>> # and similar three lines for $sel2
>>
>> Then, in your tcl script simply read these files
>>
>> set ch [open beta1.txt r]
>> set atomindex1 [read $ch]
>> close $ch
>>
>> # and, again, similar one for beta2.txt
>>
>> At this point you have atomindex1 (and atomindex2) and can use addgroup,
>> or anything you want.
>>
>>
>>
>> Maxim
>>
>>
>> On Aug 15, 2014, at 12:25 PM, Daniel Torrente <xlb608_at_my.utsa.edu> wrote:
>>
>> Dear NAMD user,
>>
>> I am trying to calculate the PMF between two proteins by means of SMD
>> simulations using amber ff. My problem is related with the selection of the
>> pulling atoms in the Tcl script using the amber par-top file. Since the
>> amber par-top file do not has segname information is there other way to
>> define the pulled atoms in the Tcl script that is compatible with the amber
>> par-top file?
>>
>> This question was asked a long time ago but is still without an answer.
>>
>> http://www.ks.uiuc.edu/Research/namd/mailing_list/namd-l.2005-2006/0196.html
>>
>> Thanks in advance,
>>
>> Daniel
>>
>> Here is the usual way to define the pulling atoms in SMD/Tclforce.
>> ###################
>> set targets1 {}
>> set targets2 {}
>> set inStream [open ionized_SMD2.pdb r]
>> foreach line [split [read $inStream] "\n"] {
>>
>> set type [string trim [string range $line 0 5]]
>> set name [string trim [string range $line 12 15]]
>> set resid [string trim [string range $line 22 25]]
>> set beta [string trim [string range $line 60 65]]
>> set segname [string trim [string range $line 72 75]]
>>
>>
>> if { $beta == 1.00 } {
>> lappend targets1 "$segname $resid $name"
>> }
>> if { $beta == 2.00 } {
>> lappend targets2 "$segname $resid $name"
>>
>> }
>> }
>> close $inStream
>>
>> set atoms1 {}
>> foreach target1 $targets1 {
>> foreach {segname resid atom} $target1 { break
>> }
>>
>> set atomindex1 [atomid $segname $resid $atom]
>> lappend atoms1 $atomindex1
>> }
>>
>> set atoms2 {}
>> foreach target2 $targets2 {
>> foreach {segname resid atom} $target2 { break
>> }
>>
>> set atomindex2 [atomid $segname $resid
>> $atom]
>> lappend atoms2
>> $atomindex2
>>
>> }
>>
>> set a1 [addgroup $atoms1]
>> set a2 [addgroup $atoms2]
>> ########################
>>
>>
>>
>
>

This archive was generated by hypermail 2.1.6 : Wed Dec 31 2014 - 23:22:43 CST