NAMD does not exit simulation on satisfying condition in the tclforces script

From: Mithun Biswas (mithun_at_theochem.uni-frankfurt.de)
Date: Thu Jul 19 2012 - 10:26:01 CDT

Hi,

I want to write a tcl script which checks a certain dihedral angle and
when the dihedral angle is more than some value, say 20 deg, stops the
simulation. Then I restart the simulation with a different parameter
set. To do this I have to mention in the script that on fulfilling the
angle criteria NAMD should save the current coordinate, velocity etc.
and stop. So, I added a few lines to my usual namd conf file :

  tclForcesScript {

set aid1 907
set aid2 908
set aid3 911
set aid4 914

addatom $aid1
addatom $aid2
addatom $aid3
addatom $aid4

proc calcforces {} {

global aid1 aid2 aid3 aid4 phi

loadcoords p
print $aid1
set phi [getdihedral $p($aid1) $p($aid2) $p($aid3) $p($aid4)]
print "phi=$phi"
if {$phi > 20} {
set t [getstep] ; #t is in 2fs steps
print "The current time is $t"
output "lastframe_azodna14"
exit
}
}
}

On running the script, NAMD does not save the output files and exit but
seems to be stuck. So, I get the following :

**************************
TCL: 907
TCL: phi=-179.990377212
ENERGY: 8 2775.9529 1775.0256 670.5433
0.0000 -3419.6739 .....

MINIMIZER STARTING CONJUGATE GRADIENT ALGORITHM
LINE MINIMIZER REDUCING GRADIENT FROM 7.47036e+07 TO 74703.6
TCL: 907
TCL: phi=179.950813637
TCL: The current time is 9
TCL: Writing to files with basename lastframe_azodna14.
***************************

Any help is appreciated.

Regards,

Mithun

-- 
Dr. Mithun Biswas
Institut für Physikalische u. Theoretische Chemie
Goethe-Universität
Max-von-Laue-Str. 7
60438 Frankfurt am Main
Phone: +49 69 798 29030

This archive was generated by hypermail 2.1.6 : Mon Dec 31 2012 - 23:21:49 CST