Re: help whit distance restraint

From: Axel Kohlmeyer (akohlmey_at_gmail.com)
Date: Wed Jun 02 2010 - 18:11:00 CDT

On Wed, Jun 2, 2010 at 6:37 PM, Leonardo Herrera <ldhz04_at_yahoo.com.mx> wrote:
> Hi somebody
> Can anybody help me?
> I added a harminic restraint on two atoms three times in one tclforcesscript  in my protein during simulation. But I have an error when I am running my simulation. the error is:
>
>
>
> ------------- Processor 0 Exiting: Called CmiAbort ------------
> Reason: FATAL ERROR: wrong # args
>     while executing
> "et retval {}"

this looks like a typo. probably you want to do "set retval {}"

>     (procedure "vecnorm" line 7)
>     invoked from within
> "vecnorm $r12"
>     (procedure "calcforces" line 13)
>     invoked from within
> "calcforces"
>
> Charm++ fatal error:
> FATAL ERROR: wrong # args
>     while executing
> "et retval {}"
>     (procedure "vecnorm" line 7)
>     invoked from within
> "vecnorm $r12"
>     (procedure "calcforces" line 13)
>     invoked from within
> "calcforces"
>
> and my tclscript is
>
> set k 100.00
> set r0 2.15
>
> set count 0
>
> set atoms1($count) 983
> set atoms2($count) 9232
>
> incr count
>
> set atoms1($count) 1626
> set atoms2($count) 9232
>
> incr count
>
> set atoms1($count) 6794
> set atoms2($count) 9232
>
> incr count
>
> for {set i 0} {$i < $count} {incr i} {
>
>         addatom $atoms1($i)
>         addatom $atoms2($i)
> }
>
> print "tclfprces action"
>
> proc calcforces {} {
>
>         global k r0 atoms1 atoms2 count
>
>         loadcoords p
>
>         for {set j 0} {$j < $count} {incr j} {
>
>                 set r12 [vecsub $p($atoms1($j)) $p($atoms2($j))]
>
>                 set r [veclength $r12]
>
>                 set n0 [vecnorm $r12]
>
>                 set force [expr $k*($r-$r0)]
>
>                 set f1 [vecscale $force $n0]
>
>                 set f2 [vecscale -$force $n0]
>
>                 addforce $atoms1($j) $f1
>                 addforce $atoms2($j) $f2
>         }
> }
>
>
> # Ther is a definition of subroutine veclenght and vecnorm
> # Returns: the vector length
>
> proc veclength {v} {
>  set retval 0
>  foreach term $v {
>          set retval [expr $retval + $term * $term ]
>                  }
>  return [expr sqrt($retval)]
> }
>
> # Returns: the normal vector
> proc vecnorm {v} {
>  set sum 0
>  foreach term $v {
>          set sum [expr $sum + $term*$term]
>                  }
>  set sum [expr sqrt($sum)]
> et retval {}

^^^^^^^^^^^^^^^^^^^
and here it is.

cheers,
   axel.

>  foreach term $v {
>          lappend retval [expr $term / $sum]
>                  }
>  return $retval
> }
>
> thanks in advance
>
> MenB Leonardo David Herrera Zúñiga     POSGRADO EN QUÍMICA  UAMI Biofisicoquímica  Universidad Autonoma Metropolitana IztapalapaTel. +52 (55) 5804 4674    ldhz04_at_yahoo.com.mx

-- 
Dr. Axel Kohlmeyer    akohlmey_at_gmail.com
http://sites.google.com/site/akohlmey/
Institute for Computational Molecular Science
Temple University, Philadelphia PA, USA.

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:54:11 CST