The truth is rarely pure and never simple

namd2 and tclBCScript

When using the tclBCScript interface of namd for imposing additional forces on a classical molecular dynamics simulation, you may get the (undocumented) error message

------------- Processor 0 Exiting: Called CmiAbort ------------
Reason: FATAL ERROR: tclBCScript failed to call nextatom until failure

Charm++ fatal error:
FATAL ERROR: tclBCScript failed to call nextatom until failure

If you look at the corresponding source, you can see that you have to call the TCL routine nextatom until it returns -2 at all cost. And even if you don’t do anything in this particular step. This information is hidden in the manual behind the sentence “This (nextatom) should be called as the condition of a while loop, i.e., while {[nextatom]} { … } to iterate over all atoms.”
According to the source, the internal counter (which happens to be inaccessible for you by means of TCL and an unpatched namd installation) starts with the value -1 and is set to -2 when all atoms have been iterated over. If the calcforces method finishes without the internal counter being -2, namd assumes that your script is buggy and throws the error in question. Caveat: If you do not call nextatom at least once, the internal counter will not be set to -2, even if you have excluded all atoms via dropatom.

Leave a comment

Your email address will not be published.