The lib/replica/ directory contains Tcl scripts that implement replica exchange for NAMD, using a Tcl server and socket connections to drive a separate NAMD process for every replica used in the simulation. Replica exchanges and energies are recorded in the potenergy.dat, realtemp.dat, and targtemp.dat files written in the output directory. These can be viewed with, e.g., ``xmgrace -nxy ....potenergy.dat'' There is also a script to load the output into VMD and color each frame according to target temperature. An example simulation folds a 66-atom model of a deca-alanine helix in about 10ns.
This implementation is designed to be modified by the user to implement exchanges of parameters other than temperature or via other temperature exchange methods. The scripts should provide a good starting point for any simulation method requiring a number of loosely interacting systems.
replica_exchange.tcl is the master Tcl script for replica exchange simulations, it is run in tclsh outside of NAMD and takes a replica exchange config file as an argument:
tclsh ../replica_exchange.tcl fold_alanin.conf tclsh ../replica_exchange.tcl restart_1.confreplica_exchange.tcl uses code in namd_replica_server.tcl, a general script for driving NAMD slaves, and spawn_namd.tcl, a variety of methods for launching NAMD slaves.
show_replicas.vmd is a script for loading replicas into VMD; first source the replica exchange conf file and then this script, then repeat for each restart conf file or for example just do ``vmd -e load_all.vmd''. This script will likely destroy anything else you are doing in VMD at the time, so it is best to start with a fresh VMD. clone_reps.vmd provides the clone_reps commmand to copy graphical representation from the top molecule to all other molecules.
A replica exchange config file should define the following Tcl variables:
The lib/replica/example/ directory contains all files needed to fold a 66-atom model of a deca-alanine helix:
The fold_alanin.conf config file contains the following settings:
set num_replicas 8 set min_temp 300 set max_temp 600 set steps_per_run 1000 set num_runs 10000 set runs_per_frame 10 set frames_per_restart 10 set namd_config_file "alanin_base.namd" set output_root "output/fold_alanin" ; # directory must exist set psf_file "alanin.psf" set initial_pdb_file "unfolded.pdb" set fit_pdb_file "alanin.pdb" set namd_bin_dir /Projects/namd2/bin/current/Linux64 set server_port 3177 set spawn_namd_command \ [list spawn_namd_ssh "cd [pwd]; [file join $namd_bin_dir namd2] +netpoll" \ [list beirut belfast] ]