From: Olya Kravchenko (ovkrav_at_gmail.com)
Date: Mon Mar 07 2016 - 23:02:34 CST
Hi all,
I have another question about applying constant forces. My system is a
box of argon atoms, I would like to apply constant force in Z
direction to atoms that pass through XY slab of certain thickness
located at the center. Here is my script (this is to be called in
.conf file):
set sel [atomselect top all]
set ailist [$sel get index]
foreach i $ailist { addatom $i }
set linaccel_namd [vecscale [expr 1.0/418.68] $linaccel]
print "linear acceleration imparted: ($linaccel) Ang*ps^-2"
proc calcforces { } {
global ailist linaccel_namd
loadcoords coords
loadmasses masses
foreach i $ailist {
foreach {x y z} $coords($i) {;}
if { $z > 27.5 and $z < 37.5} {
set force [vecscale $masses($i) $linaccel_namd]
addforce $atom $force
}
}
}
When I submit the job I am getting the following error:
Reason: FATAL ERROR: wrong # args
while executing "atomselect top all"
invoked from within "set sel [atomselect top all]"
(file "my_force1.tcl" line 1)
Charm++ fatal error:
FATAL ERROR: wrong # args
while executing "atomselect top all" invoked from within
"set sel [atomselect top all]"
(file "my_force1.tcl" line 1)
Why is it complaining about [atomselect top all]? I tried various ways
to set this selection and when I make it an array (which I know makes
no sense but I just wanted to proceed further and see if it complains
about the next line) I see the same error message about second line
(set ailist [$sel get index]). Can't figure out what is wrong with the
syntax here. Help, please?
This archive was generated by hypermail 2.1.6 : Tue Dec 27 2016 - 23:21:50 CST