In case you want to perform a relaxed scan of the potential energy surface for a given dihedral, you have to perform constrained (or at least restrained) optimizations. The namd way to do so is to define a collective variable (colvar in namd terminology) and then impose a harmonic potential on this collective variable. Please note that namd only supports restraints but no constraints during energy minimization.
namd requires only little input: first of all, colvar calculation has to be enabled by adding two lines to your job configuration file.
colvars on colvarsConfig colvars.conf
The second line introduces a separate configuration file with a different syntax. For a dihedral of the atoms 12, 3, 4, 15 it should look similar to:
colvar { name dih # user defined name that appears in the optional output and is necessary for references outputValue on # writes a trajectory of the colvar to the logfile. dihedral { group1 { atomNumbers 12 } group2 { atomNumbers 3 } group3 { atomNumbers 4 } group4 { atomNumbers 15 } } } harmonic { name dih_pot # arbitrary colvars dih # unique reference centers -50 # desired value forceConstant 5.0 # well, ... }
Please note that the atom numbers are counted from one.