Re: simulated annealing script

From: Jim Phillips (jim_at_ks.uiuc.edu)
Date: Thu Sep 25 2003 - 18:47:22 CDT

Hi,

You can only change reassignTemp during the simulation, not reassignFreq,
reassignIncr, or reassignHold. Also, the ramping feature won't do quite
what you're expecting if firsttimestep != 0 when you start dynamics. See
the actual code below if you're curious, but the main point is that this
was designed before Tcl scripting was incorporated in NAMD.

Not that you've got scripting, you can do something like this:

reassignFreq 500
reassignTemp 250
minimize 2000
for { set TEMP 250 } { $TEMP < 600 } { incr TEMP 50 } {
  run 500
  reassignTemp $TEMP
}
run 2500
for { set TEMP 550 } { $TEMP >= 0 } { incr TEMP -50 } {
  reassignTemp $TEMP
  run 1000
}

You could also alternate between "reinitvels $TEMP" and "run <steps>" to
implement whatever annealing protocol and reassignment frequency you want.

Here's the actual code from Controller.C:

void Controller::reassignVelocities(int step)
{
  const int reassignFreq = simParams->reassignFreq;
  if ( ( reassignFreq > 0 ) && ! ( step % reassignFreq ) ) {
    BigReal newTemp = simParams->reassignTemp;
    newTemp += ( step / reassignFreq ) * simParams->reassignIncr;
    if ( simParams->reassignIncr > 0.0 ) {
      if ( newTemp > simParams->reassignHold && simParams->reassignHold > 0.0 )
        newTemp = simParams->reassignHold;
    } else {
      if ( newTemp < simParams->reassignHold )
        newTemp = simParams->reassignHold;
    }
    iout << "REASSIGNING VELOCITIES AT STEP " << step
         << " TO " << newTemp << " KELVIN.\n" << endi;
  }
}

-Jim

On Thu, 25 Sep 2003, Cheri M Turman wrote:

> Hi all,
> I am having trouble with a simulated annealing protocol. I would like
> to heat my system from 300K to 600K in 2ps, hold at 600K for 10ps, and
> cool from 600K to 0K in 20ps. The reassigment part of my NAMD script is
> as follows:
>
> timestep 2
> # protocol
> reassignFreq 167
> reassignTemp 250
> reassignIncr 50
> reassignHold 600
> minimize 20000
> run 6000
>
> reassignFreq 833
> reassignTemp 550
> reassignIncr -50
> reassignHold 0
> run 10000
>
> The heating and holding at 600K works but it does not heat gradually
> over 2ps, rather it heats to 600K almost immediately (ie 40 steps). The
> cooling part does not run at all. The program aborts giving:
> FATAL ERROR: Setting parameter reassignFreq from script failed! I may
> not be really understanding the parameters reassignFreq, reassingTemp,
> etc. I have spent a great deal of time trying to figure these out. Can
> anyone give me a pointer?
>
> Cheers,
> Cheri
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> Cheri M. Turman
> Graduate Student
> University of Texas-Houston Medical School
> 6431 Fannin
> Houston, TX 77030
>
> e-mail: cheri.m.turman_at_uth.tmc.edu
> Ph.: 713-500-6126
> Fax: 713-500-0652
>

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