
Joined: Sep 2018
Posts: 17
Forum Member

OP
Forum Member
Joined: Sep 2018
Posts: 17 
I'm calculating some dot products and I was wondering how I can bypass the following error and just set the variable to zero.
Evaluating: SQRT((0.137424056*0.137424056)+(0.990263514*0.990263514)+(2.219915813E02+2.219915813E02))
***** LEVEL 0 WARNING FROM ***** ***** Error in conversion: SQRT(0.188853711674911E01 ****************************************** BOMLEV ( 0) IS REACHED  TERMINATING. WRNLEV IS 5




Joined: Sep 2003
Posts: 4,883 Likes: 12
Forum Member

Forum Member
Joined: Sep 2003
Posts: 4,883 Likes: 12 
Why can't you just set the variable to zero? Please post your input, so that we can see what you are actually trying to do. There may be limits to the length of a numerical string.
Lennart Nilsson Karolinska Institutet Stockholm, Sweden




Joined: Sep 2018
Posts: 17
Forum Member

OP
Forum Member
Joined: Sep 2018
Posts: 17 
My script is quite long  but here is the relevant part. I'm computing the distance and angle between two ring centroids. I'm looping through all the residues per frame in my trajectory  identifying the rings, if there is a ring within 5A of first ring I use coor axis to compute distance, centroid and relevant vectors in order to then calculate the dot products and magnitudes to solve for the angle.
(I already saved x1, y1, and z1 of ring1 further up in the loop)
coor axis sele ring1 end sele ring2 end set dist ?RAXI coor lsqp norm sele ring2 end set x2 ?XAXI set y2 ?YAXI set z2 ?ZAXI calc top = (@x1*@x2)+(@y1*@y2)+(@z1*@z2) calc amag = sqrt((@x1*@x1)+(@y1*@y1)+(@z1+@z1)) calc bmag = sqrt((@x2*@x2)+(@y2*@y2)+(@z2+@z2)) calc angle = acos(@top/(@amag*@bmag))*(180/(22/7))




Joined: Sep 2003
Posts: 8,658 Likes: 26
Forum Member

Forum Member
Joined: Sep 2003
Posts: 8,658 Likes: 26 
Note that the CHARMM parser is somewhat primitive, and the arguments and operations in the CALC command must be separated by a blank char.
For instance, to avoid parsing errors, the first line
calc top = (@x1*@x2)+(@y1*@y2)+(@z1*@z2)
should be changed to be
calc top = ( @x1 * @x2 ) + ( @y1 * @y2 ) + ( @z1 * @z2 )
Rick Venable computational chemist




Joined: Sep 2003
Posts: 4,883 Likes: 12
Forum Member

Forum Member
Joined: Sep 2003
Posts: 4,883 Likes: 12 
There is also a typo in the zcomponet for amag and bmag
Lennart Nilsson Karolinska Institutet Stockholm, Sweden




Joined: Sep 2018
Posts: 17
Forum Member

OP
Forum Member
Joined: Sep 2018
Posts: 17 
Thank you for the suggestion, Dr. Venable and good catch, Dr. Nilsson!
After adding the spaces and correcting my formula, the error persists.
Evaluating: (0.622173878*0.660778981)+(6.361634413E02*6.961336977E02)+(0.780290092*0.74734538)
***** LEVEL 0 WARNING FROM ***** ***** Error in conversion: (0.780290092 ****************************************** BOMLEV ( 0) IS REACHED  TERMINATING. WRNLEV IS 5
I'm wondering if there is a way to trim the number of decimal places so that they are uniform? Could that be a source of problems in the calc command?




Joined: Sep 2003
Posts: 8,658 Likes: 26
Forum Member

Forum Member
Joined: Sep 2003
Posts: 8,658 Likes: 26 
The FORMAT command (see miscom.info) can be used to manage how numbers are represented; it uses Fortran syntax. It would need to be used before the first CALC command in your series of statements.
Assignment of variables via SET does not use the FORMAT spec, but you can use CALC for variable assignment, e.g.
calc x2 = ?xaxis
The = sign is optional with CALC, but I like to use it or clarity.
I highly recommend resetting to the default format after the series of CALC commands, which is done by the FORMAT command alone with no arguments.
Rick Venable computational chemist




