From: Josh Vermaas (vermaas2_at_illinois.edu)
Date: Thu Apr 16 2015 - 13:05:25 CDT

Another issue you may want to deal with is the fact that TCL needs to be
coerced into doing math.

set sasa {([measure sasa 1.8 $A -samples $s] + [measure sasa 1.8 $B
-samples $s] - [measure sasa 1.8 $sel -samples $s]) * 0.5}

Should become:

set sasa [expr {([measure sasa 1.8 $A -samples $s] + [measure sasa 1.8
$B -samples $s] - [measure sasa 1.8 $sel -samples $s]) * 0.5}]

Without the expr, TCL will refuse to do addition and subtraction like
you want.

-Josh Vermaas

On 04/16/2015 12:23 PM, Joaquim Rui de Castro Rodrigues wrote:
> Hi,
>
> Your atomselections are wrong: "protein and resname CNT" should return you a selection with zero atoms, and not the complex. Mind that the "and" in the selection text is a logical AND. What you want is "protein or resname CNT".
>
> Cheers,
> Rui Rodrigues
>
>
> ________________________________________
> De: owner-vmd-l_at_ks.uiuc.edu [owner-vmd-l_at_ks.uiuc.edu] Em Nome De Aryan Vahedi [arvah1_at_morgan.edu]
> Enviado: quinta-feira, 16 de Abril de 2015 16:58
> Para: vmd-l_at_ks.uiuc.edu
> Assunto: vmd-l: measure sasa of a complex (CNT and protein)
>
> Hi,
>
> I have been continuing an analysis of a trajectory modeling the interaction of a protein and a CNT. In numerous publications, contact area is determined using the following equation:
>
> contact area = [(sasa of protein + sasa of CNT) - sasa of complex] * 0.5 <------ sourced from paper DOI: 10.1038/srep09297
>
> Having looked over entries in vmd-l and other reliable sources on the internet I still have not been able to produce a a working script. Below is what I have come up with (thank in part to posts by Josh Vermaas and Ramin
> Ekhteiari):
>
>> #sasa_complex
>> puts -nonewline "\n \t \t Selection: "
>> # selection
>> set sel [atomselect top "protein and resname CNT"]
>> set A [atomselect top "protein"]
>> set B [atomselect top "resname CNT"]
>> set n [molinfo top get numframes]
>> set s 500
>> set output [open "sasa_complex.dat" w]
>> # sasa calculation loop
>> for {set i 0} {$i < $n} {incr i} {
>> molinfo top set frame $i
>> set sasa {([measure sasa 1.8 $A -samples $s] + [measure sasa 1.8 $B -samples $s] - [measure sasa 1.8 $sel -samples $s]) * 0.5}
>> puts "\t \t progress: $i/$n"
>> puts $output "$sasa"
>> }
>> puts "\t \t progress: $n/$n"
>> puts "Done."
>> puts "output file: sasa_complex.dat"
>> close $output
> This script results in the whole expression simply being printing down each frame in the resulting dat file. In other words, it is not calculating the expression. This of course suggests that the expression is written incorrectly but I just can’t seem to identify how so. Furthermore, I am able to get the script to work if I try measuring sasa for one variable (works for protein and CNT selections independently but not together) at a time i.e. the following:
>
>> #sasa_protein
>> puts -nonewline "\n \t \t Selection: "
>> # selection
>> set sel [atomselect top "protein"]
>> set n [molinfo top get numframes]
>> set output [open "sasa_proteinCNT.dat" w]
>> # sasa calculation loop
>> for {set i 0} {$i < $n} {incr i} {
>> molinfo top set frame $i
>> set sasa [measure sasa 1.8 $sel]
>> puts "\t \t progress: $i/$n"
>> puts $output "$sasa"
>> }
>> puts "\t \t progress: $n/$n"
>> puts "Done."
>> puts "output file: sasa_proteinCNTdat"
>> close $output
> In this case, if I try replacing the selection above with “protein and resname CNT” so that I can determine sasa of the complex I get only zeros down the trajectory file (I presume for some fundamental reason in the way the measure sasa command works). It seems to me, that I now need to understand how one comes to the calculation of sasa of a complex.
>
> As always, your help is greatly appreciated.
>
> Best,
> Aryan Vahedi
> Morgan State University
> Biology MS
>