Difficulties with using the "rescalevels" command every MD timestep

From: Spencer, Jacob (jacob.spencer.12_at_ucl.ac.uk)
Date: Thu Jan 09 2014 - 09:48:37 CST

Hello,

I am attempting to combine the TclForces functionality with the "rescalevels" command to conserve the total energy of my system. I am implementing a version of the Tully surface hopping routine, where my system is in one of many possible states and has a certain probability to hop to another state.

When this hop occurs (as determined by an external program, called from within my TclForces script) the potential energy of the system changes, and the TclForces script calculates this difference and uses the "addenergy" command to add it to the energy output. In order to conserve total energy of the system, I then wish to use the "rescalevels" command to rescale all velocities, thus changing the kinetic energy. (This is a somewhat crude method but we are only using it as a first approximation.)

My issue is that it seems impossible to get the Tcl script and the "rescalevels" command to act at the right time. If I call "rescalevels" in my NAMD input file then it always happens one timestep after I calculate the surface hop and add the energy from my Tcl script. Here is an example of standard output with comments added by me in brackets:

ENERGY: 18 2969.3589 2738.5251 0.0000 0.0000 0.0000 -2850.1807 0.0000 0.0462 5886.0536 8743.8031 304.7792 2857.7495 8786.7254 304.7792 -14686.5688 -14686.5688 76403.1408 -14686.5688 -14686.5688

WRITING EXTENDED SYSTEM TO RESTART FILE AT STEP 18
WRITING COORDINATES TO RESTART FILE AT STEP 18
FINISHED WRITING RESTART COORDINATES
WRITING VELOCITIES TO RESTART FILE AT STEP 18
FINISHED WRITING RESTART VELOCITIES
TCL: Running for 1 steps
TCL: Surface hop has happened: state #32 to state #19

(I want the velocities to be rescaled here, before the system is propagated to timestep 19)
ENERGY: 18 2969.3589 2738.5251 0.0000 0.0000 0.0000 -2850.1807 0.0000 -6.5875 5886.0536 8737.1695 304.7792 2851.1158 8780.0945 304.7792 -14639.7823 -14639.7823 76403.1408 -14639.7823 -14639.7823

TCL: 19
ENERGY: 19 2966.0892 2727.7462 0.0000 0.0000 0.0000 -2866.2276 0.0000 -6.5875 5914.7365 8735.7568 306.2644 2821.0203 8779.9563 306.2644 -16782.6938 -16782.6938 76403.1408 -16782.6938 -16782.6938

WRITING EXTENDED SYSTEM TO RESTART FILE AT STEP 19
WRITING COORDINATES TO RESTART FILE AT STEP 19
FINISHED WRITING RESTART COORDINATES
WRITING VELOCITIES TO RESTART FILE AT STEP 19
FINISHED WRITING RESTART VELOCITIES
RESCALING VELOCITIES AT STEP 19 BY 1.00056

TCL: Running for 1 steps
ENERGY: 19 2966.0892 2727.7462 0.0000 0.0000 0.0000 -2866.2276 0.0000 6.3041 5921.3561 8755.2679 306.6072 2833.9118 8799.4729 306.6072 -16731.8723 -16731.8723 76403.1408 -16731.8723 -16731.8723

(But instead the rescaling, which was calculated at the end of step 18, does not happen until the end of step 19)

I have also tried to call the "rescalevels" command from the TclForces script itself: this makes the entire program hang. I have searched but have been unable to find documentation on the "rescalevels" command and so do not know if there is a way to alter this behaviour. It seems to me that the obvious solution would be to call "rescalevels" in the TclForces script but this might be impossible.

Is there, then, a way to make "rescalevels" and TclForces "addenergy" apply to the same timestep before the next timestep occurs?

Thank you in advance for your help: sorry if this seems a little disjointed, I am happy to provide further clarification on anything.

Regards,

Jacob

This archive was generated by hypermail 2.1.6 : Wed Dec 31 2014 - 23:22:02 CST