Re: Dihedral colvar

Date: Fri Sep 08 2017 - 13:55:01 CDT

Dear Jerome,

Thank you again for giving such information. Now I have used the "tcl" in
NAMD input file for colvar and create such type of colvar string as you
told previously. But still this is not working. Can you please check the
script which I copied in below where I might did some mistake.

####NAMD input file
structure ../../c_ion.psf
coordinates ../../c_ion.pdb
outputname min01 #writes final .vel and .coor

paraTypeCharmm on #parameter file is charmm type
parameters /home/nsengupta/priti/restrain/par_all22_prot.prm

exclude scaled1-4 #which pair is excluded from non-bonded
1-4scaling 1.0
cutoff 12.5 #coulomb and vdW in Angs
switching on #smoothing function for coulomb and vdW
switchdist 10.5 #distance at which smooth starts (in Angs)
pairlistdist 13.5 #goes with cutoff

timestep 2.0 #timesteps are in femtoseconds
rigidBonds all ;# needed for 2fs steps
nonbondedFreq 1 #time steps between non-bonded evaluation
restartfreq 1 #at this frequency
dcdfile min01.dcd #writes .dcd file
dcdfreq 500 #at this frequency
outputEnergies 500 #writes energy at this frequency
fullElectFrequency 2 #time steps between Coulomb evaluation
stepspercycle 20 #atoms are reassigned every cycle

PME on #use particle mesh Ewald for Coulomb
PMEGridSpacing 1.0

cellBasisVector1 118.0 0.0 0.0 #periodic boundary
cellBasisVector2 0.0 76.0 0.0 #conditions
cellBasisVector3 0.0 0.0 89.0
cellOrigin 232.49 80.76 7.22

minimization on
numsteps 20000

colvars on

###file opening containg atom index and phi/psi value
set f1 [open "c_A.dat" r] #atom C index
set ff1 [read $f1]
set f2 [open "n_A.dat" r] #atom N index
set ff2 [read $f2]
set f3 [open "ca_A.dat" r] #atom CA index
set ff3 [read $f3]
set f4 [open "phi1_a.dat" r] #phi value
set ff4 [read $f4]

for {set n 0} {$n <= 54} {incr n} {
        set nxt [expr ($n + 1)]

        set c1_p [lindex $ff1 $n]
        set n_p [lindex $ff2 $n]
        set ca_p [lindex $ff3 $n]
        set c2_p [lindex $ff1 $nxt]
        set p [lindex $ff4 $n]

        cv config "colvar {
            name phi
            dihedral {
                group1 {
                    atomNumbers $c1_p
                group2 {
                    atomNumbers $n_p
                group3 {
                    atomNumbers $ca_p
                group4 {
                    atomNumbers $c2_p

        harmonic {
            name phi
            colvars dihedral
            centers $p
            forceConstant 5.0


On Fri, Sep 8, 2017 at 7:23 PM, Jérôme Hénin <> wrote:

> The cv command is available both in NAMD and VMD, once you've enabled the
> colvars module.
> You cannot use Tcl scripting within a colvars configuration file - you can
> use it in the NAMD config file to generate colvars configuration strings as
> in the example I gave above.
> Jerome
> On 8 September 2017 at 15:44, PRITI ROY <> wrote:
>> Dear Jerome,
>> Thank you for your fast reply. According to your script the "cv" command
>> is accesible in vmd as per I know or I might be completely not understand
>> well. If possible give some insights.
>> I have written one tcl colvar configuration file using four types atom
>> index which were saved in ".dat" file and run in loop. But when I run this,
>> error shoing that "keyword "set" is not supported". Does "tcl" not
>> accessible to colvar?
>> Kindly enlighten this matter.
>> Best,
>> Priti
>> On Mon, Sep 4, 2017 at 6:10 PM, Jérôme Hénin <>
>> wrote:
>>> Hi Priti,
>>> If I understand you correctly, you want to define a series of 50
>>> dihedral restraints. You will need to define one separate colvar for each
>>> angle, but you don't have to write them separately. That can be scripted
>>> using a Tcl loop:
>>> for {set i 0} { $i < 50 } {incr i} {
>>> cv config "colvar { dihedral ... }"
>>> }
>>> Where the colvar block contains the details of the dihedral angle. You
>>> can use variable $i inside the block to define the specifics of each angle.
>>> Best,
>>> Jerome
>>> On 4 September 2017 at 13:08, PRITI ROY <> wrote:
>>>> Dear all,
>>>> I would like to do dihedral restrain using the colvar module of nearly
>>>> 50 residues. I have gone through the colvar module. In dihedral colvar,
>>>> there are four group selection which are for atoms and depending on 1st
>>>> group it denote the particular dihedral angel. Basically this module
>>>> describe in light of atoms.
>>>> How could I define this dihedral colvar for residues?
>>>> Please give some idea to resolve my problem.
>>>> Thanks,
>>>> Priti

This archive was generated by hypermail 2.1.6 : Sun Dec 31 2017 - 23:21:39 CST