From: Tristan Croll (
Date: Fri Oct 10 2014 - 00:38:50 CDT

I suspect your problem is that veclength only ever gives you a positive answer.

Tristan Croll
Faculty of Health
School of Biomedical Sciences
Institute of Health and Biomedical Engineering
Queensland University of Technology
60 Musk Ave
Kelvin Grove QLD 4059 Australia
+61 7 3138 6443

This email and its attachments (if any) contain confidential information intended for use by the addressee and may be privileged. We do not waive any confidentiality, privilege or copyright associated with the email or the attachments. If you are not the intended addressee, you must not use, transmit, disclose or copy the email or any attachments. If you receive this email by mistake, please notify the sender immediately and delete the original email.

On 10 Oct 2014, at 2:47 pm, "Aiswarya Pawar" <<>> wrote:

Brian and Josh, Thank you so much for reply.

Why am doing this instead of dihedral command is because i wanted to check individual values for cos and sin. So is there anyway i could rectify the signs it giving?

Thank you,

On Fri, Oct 10, 2014 at 12:02 AM, Aiswarya <<>> wrote:
Dear Users,
Am trying to calculate rotational angle for a given 4 atoms, am getting the value of angle correct but its not differentiating between +ve and -ve. Ie if the angle between 4 atoms is -177 degrees am getting 177 degree, and there is no -ve sign to it. Below is the script i have used.

> # Computes the dihedral angle of a bond
> set coord1 [lindex [[atomselect top "index 86" ] get {x y z}] 0]
> set coord2 [lindex [[atomselect top "index 89" ] get {x y z}] 0]
> set coord3 [lindex [[atomselect top "index 75" ] get {x y z}] 0]
> set coord4 [lindex [[atomselect top "index 23"] get {x y z}] 0]
> set v1 [vecsub $coord1 $coord2]
> set v2 [vecsub $coord3 $coord2]
> set v3 [vecsub $coord4 $coord3]
> set cross1 [vecnorm [veccross $v2 $v1]]
> set cross2 [vecnorm [veccross $v2 $v3]]
> set cos [vecdot $cross1 $cross2]
> set rotvec [veccross $cross1 $cross2]
> set sin [veclength $rotvec]
> set angle [expr atan2($sin,$cos)*(180.0/3.14)]
> return $angle

Please someone tell me were am going wrong.

Thank you so much,