Re: Tcl: loadtotalforces

From: Jérôme Hénin (jerome.henin_at_uhp-nancy.fr)
Date: Mon Mar 29 2004 - 07:33:29 CST

Hi,

The first time your routine is called (at first timestep), forces have not
 yet been computed, so that your forc array is not set by loadtotalforces.
 You should add a test to check that forc actually exists before using it,
 like

if { [array exists forc] } {
        do_something_with_it
}

Regards,
Jerome

Le Lundi 29 Mars 2004 13:11, g srinivasa murthy a écrit :
> hello,
>
> I want to calculate the totalforce on
> specified
> atoms. I try to use loadtotalforces ,but ended up with
> the error message.
>
> The script which I used for purpose was:
>
> set atm1 1
> set atm2 2
>
> addatom $atm1
> addatom $atm2
>
> proc calcforces {} {
>
> global atm1 atm2
>
> loadtotalforces forc
>
> set f1 $forc($atm1)
> set f1x [lindex $f1 0]
> set f1y [lindex $f1 1]
> set f1z [lindex $f1 2]
>
> puts "$f1x \t $f1y \t $f1z"
> }
>
>
> Error message was:
>
> TCL: can't read "forc(1)": no such variable
> FATAL ERROR: can't read "forc(1)": no such variable
> while executing
> "set f1 $forc($atm1)"
> (procedure "calcforces" line 20)
> invoked from within
> "calcforces"
> FATAL ERROR: can't read "forc(1)": no such variable
> while executing
> "set f1 $forc($atm1)"
> (procedure "calcforces" line 20)
> invoked from within
> "calcforces"
>
>
> regards
> srinivasa
>
>
>
>
> ________________________________________________________________________
> Yahoo! India Insurance Special: Be informed on the best policies, services,
> tools and more. Go to: http://in.insurance.yahoo.com/licspecial/index.html

--
Jérôme Hénin
Equipe Dynamique des Assemblages Membranaires
Université Henri Poincaré / CNRS    UMR 7565
B.P. 239	54506 Vandoeuvre-lès-Nancy Cedex
Tel : (33) 3 83 68 43 95	Fax : (33) 3 83 68 43 71
http://www.edam.uhp-nancy.fr/

This archive was generated by hypermail 2.1.6 : Wed Feb 29 2012 - 15:37:28 CST