Accessing Colvars Within NAMD TCL

From: David Rogers (wantye_at_gmail.com)
Date: Thu Jun 30 2011 - 10:28:33 CDT

NAMD Gurus,

  Is is possible to access the content of the variables calculated by
colvars inside namd's input file? Specifically, I'd like to do
something like the following:

------- vars.conf -------

colvarsTrajFrequency 100
colvarsTrajAppend off
analysis off

colvar {
  name BVpsi
  outputSystemForce yes
  dihedral {
    group1 { atomNameResidueRange CA 76
                pdfSegID B }
    group2 { atomNameResidueRange C 76
                pdfSegID B }
    group3 { atomNameResidueRange N 77
                pdfSegID B }
    group4 { atomNameResidueRange CA 77
                pdfSegID B }
  }
}

------- run.namd -------

..

colvars on
colvarsConfig vars.conf

run 100

if { [ expr $colvars(BVpsi) > 50.0 && $colvars(BVpsi) < 100.0 ] } {
  # set a temperature, change a parameter, etc.
  }
run 100

-------

  It would also be great to have an API for changing colvar parameters
(such as harmonic force constants, atom id-s of atoms in groups, etc.)
during run-time, but this is likely to be much harder to implement
than copying a number into a tcl variable. If the latter hasn't been
done, is there a simple solution to modify the source to create and
update a tcl variable in this way--e.g. the same way callback is
implemented:

# NAMD_2.7 callback labels (4/12/11)
#TS BOND ANGLE DIHED CROSS IMPRP ELECT VDW BOUNDARY MISC POTENTIAL
KINETIC TOTAL TEMP PRESSURE GPRESSURE VOLUME CELL_A CELL_B CELL_C
CELL_O PERIODIC
  proc save_callback {labels values} {
    global saved_labels saved_values
    set saved_labels $labels
    set saved_values $values
  }
  callback save_callback

Thanks in advance,
~ David Rogers
  Postdoc, Sandia National Labs

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