Update
Christopher Mayne wrote: ‘I’ve since not only corrected the portion of the code that throws the error, but added some lines to automatically detect linear elements and make the necessary changes to the Gaussian input file (i.e. “A” -> “L” and removing undefined dihedrals). These fixes are in our CVS and should be included in the next alpha builds of VMD 1.9.2.’
Original Post
vmd comes with a plugin for extending force fields, ffTK. In the current version (1.9.1), there is a problem when optimizing bonded parameters on linear bonds without any lone electron pairs on the middle atom. This issue (still existing in the current alpha version 1.9.2a29) is a show-stopper for optimization, as the procedure fails completely. The error message reads
can't use empty string as operand of "-" while executing "expr { [lindex $mmEn 0] - [lindex $entry 2 2 0] }" (procedure "::ForceFieldToolKit::BondAngleOpt::optBondsAngles" line 105) invoked from within "$function $p0list" (procedure "construct_initial_simplex" line 22) invoked from within "construct_initial_simplex [lindex $args 0] $scale" (procedure "::Optimize::Opt11::handle" line 91) invoked from within "$opt initsimplex $baInitial $scale" (procedure "::ForceFieldToolKit::BondAngleOpt::optimize" line 320) invoked from within "::ForceFieldToolKit::BondAngleOpt::optimize" (procedure "::ForceFieldToolKit::gui::baoptRunOpt" line 40) invoked from within "::ForceFieldToolKit::gui::baoptRunOpt " invoked from within ".fftk_gui.hlf.nb.bondangleopt.runOpt invoke " invoked from within ".fftk_gui.hlf.nb.bondangleopt.runOpt instate {pressed !disabled} { .fftk_gui.hlf.nb.bondangleopt.runOpt state !pressed; .fftk_gui.hlf.nb.bondangleopt...." (command bound to event)can't use empty string as operand of "-" while executing "expr { [lindex $mmEn 0] - [lindex $entry 2 2 0] }" (procedure "::ForceFieldToolKit::BondAngleOpt::optBondsAngles" line 105) invoked from within "$function $p0list" (procedure "construct_initial_simplex" line 22) invoked from within "construct_initial_simplex [lindex $args 0] $scale" (procedure "::Optimize::Opt11::handle" line 91) invoked from within "$opt initsimplex $baInitial $scale" (procedure "::ForceFieldToolKit::BondAngleOpt::optimize" line 320) invoked from within "::ForceFieldToolKit::BondAngleOpt::optimize" (procedure "::ForceFieldToolKit::gui::baoptRunOpt" line 40) invoked from within "::ForceFieldToolKit::gui::baoptRunOpt " invoked from within ".fftk_gui.hlf.nb.bondangleopt.runOpt invoke " invoked from within ".fftk_gui.hlf.nb.bondangleopt.runOpt instate {pressed !disabled} { .fftk_gui.hlf.nb.bondangleopt.runOpt state !pressed; .fftk_gui.hlf.nb.bondangleopt...." (command bound to event)
Fix
Edit the file fftk_BondAngleOpt.tcl of your (presumably user-specific) installation of vmd. Search for the procedure ::ForceFieldToolKit::BondAngleOpt::computePESmm and add the following line before ::ForceFieldToolKit::Distortion::make
if { $type == "lbend" } { set type "angle" }
Either restart vmd or enter
source path/to/your/fftk_BondAngleOpt.tcl
in the tcl shell.
Please keep in mind that you should define an initial value close to 180 degrees for any linear bends in your parametrization procedure.
Technical details
The problem results from different lengths of $mmEnList and $baIndList. While ::ForceFieldToolKit::BondAngleOpt::computePESmm allows for both angles and linear bends in the input, ::ForceFieldToolKit::Distortion::make ignores any linear bend entries.