From 35ed853f62e9c878c17c7900a3c43a5c21ef1b3c Mon Sep 17 00:00:00 2001 From: jormacara Date: Wed, 15 Apr 2009 22:06:05 +0000 Subject: [PATCH] Trust region based optimization --- doc/user/main.tex | 6 + doc/user/mepgs.tex | 161 ++++++++++++++++++++++++ doc/user/tropt.tex | 304 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 471 insertions(+) create mode 100644 doc/user/mepgs.tex create mode 100644 doc/user/tropt.tex diff --git a/doc/user/main.tex b/doc/user/main.tex index c2e7467cd4..7c77a7157d 100644 --- a/doc/user/main.tex +++ b/doc/user/main.tex @@ -93,6 +93,12 @@ \chapter{Geometry Optimization with STEPPER} \input{stepper} +\chapter{Geometry Optimization with TROPT} +\input{tropt} + +\chapter{Minimum Energy Path with MEPGS} +\input{mepgs} + \chapter{Constraints for Geometry Optimization} \input{constraints} diff --git a/doc/user/mepgs.tex b/doc/user/mepgs.tex new file mode 100644 index 0000000000..b1594896f5 --- /dev/null +++ b/doc/user/mepgs.tex @@ -0,0 +1,161 @@ +% +% $Id: driver.tex,v 1.15 2004-05-20 01:21:27 edo Exp $ +% +\label{sec:mepgs} + + +The MEPGS module performs a search for the two critical points on the +potential energy surface conected to a saddle point of the molecule +defined by input using the \verb+GEOMETRY+ directive (see Section \ref{sec:geom}). +The algorithm programmed in MEPGS is a {\bf constrained} trust region quasi-newton optimization and approximate energy Hessian updates. + + +Optional input for this module is specified within the compound +directive, +\begin{verbatim} + MEPGS + + OPTTOL + + EPREC + + STRIDE + + EVIB + + MAXMEP + + MAXITER + + INHESS + + (BACKWARD || FORWARD) + + (MSWG || NOMSWG) + + (XYZ || NOXYZ) + + END +\end{verbatim} + +\sloppy + +\section{Convergence criteria} + +The user may request a specific value for the tolerance with the keyword \verb+OPTTOL+ which will couple all the convergence criteria in the following way: + +\begin{verbatim} + GRMS 1.0*OPTTOL + GMAX 1.5*OPTTOL + XRMS 4.0*OPTTOL + XMAX 6.0*OPTTOL +\end{verbatim} + +\section{Available precision} + +\begin{verbatim} + EPREC +\end{verbatim} + +In performing a constrained trust region optimization the precision of the energy is coupled to the convergence criteria (see Section \ref{sec:tropt:eprec}). +Note that the default EPREC for DFT calculations is 5e-6 instead of 1e-7. + +\section{Controlling the step length} + +\begin{verbatim} + STRIDE +\end{verbatim} + +A dynamic stride (\verb+stride+) is used to control the step length during +the minimum energy path walking when taking the Euler step as starting point. + +\section{Moving away from the saddle point} + +\begin{verbatim} + EVIB +\end{verbatim} + +The expected decrease in energy (\verb+evib+) assuming a quadratic approximation around the saddle structure to be obtained. + +\section{Maximum number of MEPGS steps} + +\begin{verbatim} + MAXMEP +\end{verbatim} + +By default at most 250 minimum energy path steps will be taken, +but this may be modified with this directive. + +\section{Maximum number of steps} + +\begin{verbatim} + MAXITER +\end{verbatim} + +By default at most 20 {\bf constrained} geometry optimization steps will be taken, +but this may be modified with this directive. + +\section{Initial Hessian} +\begin{verbatim} + INHESS +\end{verbatim} + +With this option the MEPGS module will be able to transform +Cartesian Hessian from previous frequency calculation. + +\section{Selecting the side to traverse} +\begin{verbatim} + (BACKWARD || FORWARD) +\end{verbatim} + +With this option the MEPGS module will select which side of the +minimum energy path to explore. By default both sides are explored +for a MEPGS run. + +\section{Using mass} +\begin{verbatim} + (MSWG || NOMSWG) +\end{verbatim} + +With this option the MEPGS will trigger the use of mass when following the +minimum energy path. Mass is not used as default, if mass is used then +this formally becomes an intrinsic reaction coordinate. + +\section{Minimum energy path saved XYZ file} + +\begin{verbatim} + XYZ [] + NOXYZ +\end{verbatim} + +The \verb+XYZ+ directive causes the geometry at each calculated +structure on the minimum energy path to be output into file in the +permanent directory in XYZ format. +The optional string will +prefix the filename. The \verb+NOXYZ+ directive turns this off. + +For example, the input +\begin{verbatim} + mepgs; xyz ; end +\end{verbatim} +will cause a trajectory file filename.xyz to be created +in the permanent directory. + +\section{MEPGS usage} + +\begin{verbatim} + start somename + geometry; ; end + task theory freq + freq; reuse somename.hess ; end + mepgs; ; end + task theory mepgs +\end{verbatim} + +In the above example, after performing a frequency analysis for the saddle +point, the information of the force constant matrix is reused (freq directive) +in order to be able to follow the transition state mode. + +\fussy + + diff --git a/doc/user/tropt.tex b/doc/user/tropt.tex new file mode 100644 index 0000000000..dd595371cb --- /dev/null +++ b/doc/user/tropt.tex @@ -0,0 +1,304 @@ +% +% $Id: driver.tex,v 1.15 2004-05-20 01:21:27 edo Exp $ +% +\label{sec:tropt} + +The TROPT module is one of three drivers (see Section \ref{sec:stepper} +for documentation on STEPPER and Section \ref{sec:driver} for documentation on DRIVER) +to perform a geometry optimization +function on the molecule defined by input using the \verb+GEOMETRY+ +directive (see Section \ref{sec:geom}). Geometry optimization is +either an energy minimization or a transition state optimization. +The algorithm programmed in TROPT is a trust region quasi-newton optimization +and approximate energy Hessian updates. + +TROPT is {\bf not} selected by default out of the two available modules to +perform geometry optimization. In order to force use of TROPT (e.g., +because a previous optimization used STEPPER or DRIVER) provide a TROPT input +block (below) --- even an empty block will force use of TROPT. + +Optional input for this module is specified within the compound +directive, +\begin{verbatim} + TROPT + (LOOSE || DEFAULT || TIGHT) + GMAX + GRMS + XMAX + XRMS + + OPTTOL + + EPREC + + TRUST + + CLEAR + REDOAUTOZ + + INHESS + + (MODDIR || VARDIR) + (FIRSTNEG || NOFIRSTNEG) + + MAXITER + + BSCALE + ASCALE + TSCALE + HSCALE + + PRINT ... + + XYZ [] + NOXYZ + + END +\end{verbatim} + +\sloppy + +\section{Convergence criteria} + +\begin{verbatim} + (LOOSE || DEFAULT || TIGHT) + GMAX + GRMS + XMAX + XRMS + + OPTTOL + +\end{verbatim} + +The defaults may be used, or the directives \verb+LOOSE+, +\verb+DEFAULT+, or \verb+TIGHT+ specified to use standard sets of +values, or the individual criteria adjusted. All criteria are in +atomic units. +\verb+GMAX+ and \verb+GRMS+ control the maximum and root mean square +gradient in the coordinates being used (Z-matrix, redundant internals, +or Cartesian). \verb+XMAX+ and \verb+XRMS+ control the maximum and +root mean square of the Cartesian step. + +\begin{verbatim} + LOOSE DEFAULT TIGHT + GMAX 0.0045d0 0.00045 0.000015 + GRMS 0.0030d0 0.00030 0.00001 + XMAX 0.0054d0 0.00180 0.00006 + XRMS 0.0036d0 0.00120 0.00004 +\end{verbatim} + +Additionally the user may request a specific value for the tolerance with the keyword \verb+OPTTOL+ which will couple all the convergence criteria in the following way: + +\begin{verbatim} + GRMS 1.0*OPTTOL + GMAX 1.5*OPTTOL + XRMS 4.0*OPTTOL + XMAX 6.0*OPTTOL +\end{verbatim} + +Note that GMAX and GRMS used for convergence of geometry may significantly vary in +different coordinate systems such as Z-matrix, redundant internals, or Cartesian. +The coordinate system is defined in the input file (default is Z-matrix). +Therefore the choice of coordinate system may slightly affect converged energy. +Although in most cases XMAX and XRMS are last to converge which are always done +in Cartesian coordinates, which insures convergence to the same geometry in +different coordinate systems. + + +The old criterion may be recovered with the input +\begin{verbatim} + gmax 0.0008; grms 1; xrms 1; xmax 1 +\end{verbatim} + +\section{Available precision} +\label{sec:tropt:eprec} + +\begin{verbatim} + EPREC +\end{verbatim} + +In performing a trust region optimization the precision of the energy is coupled to the convergence criteria. +As mentioned above in most cases XMAX and XRMS are last to converge, thus, +an accelerated converge is triggered in TROPT when GMAX and GRMS are already converged and the corresponding energy change with respect to the previous point is below the EPREC threshold, then, the structure is treated as optimized. This is used as an accelerated convergence criteria to avoid long tail in the optimization process. +This will increase the speed of an optimization in most of the cases but it will +be somehow cumbersome when dealing with flat energy surfaces, in this case a more tight EPREC value is recommended. +Note that the default EPREC for DFT calculations is 5e-6 instead of 1e-7. + +\section{Controlling the step length} + +\begin{verbatim} + TRUST +\end{verbatim} + +A dynamic trust radius (\verb+trust+) is used to control the step during +optimization processes both minimization and saddle-point searches. +It defaults to 0.3 for minimizations and 0.1 +for saddle-point searches. + +\section{Backstepping in TROPT} +If a step taken during the optimization is too large or in the wrong direction (e.g., the step causes the energy to go up for a minimization), the TROPT optimizer will automatically ``backstep'' and reduce the current value of the trust radius in order to avoid a permanent ``backsteping''. + +\section{Maximum number of steps} + +\begin{verbatim} + MAXITER +\end{verbatim} + +By default at most 20 geometry optimization steps will be taken, +but this may be modified with this directive. + +\section{Discard restart information} +\begin{verbatim} + CLEAR +\end{verbatim} + +By default TROPT reuses Hessian information from a previous +optimization, and, to facilitate a restart also stores which mode is +being followed for a saddle-point search. This option deletes all +restart data. + +\section{Regenerate internal coordinates} + +\begin{verbatim} + REDOAUTOZ +\end{verbatim} + +Deletes Hessian data and regenerates internal coordinates at the +current geometry. Useful if there has been a large change in the +geometry that has rendered the current set of coordinates invalid or +non-optimal. + +\section{Initial Hessian} +\begin{verbatim} + INHESS +\end{verbatim} + +\begin{itemize} +\item 0 = Default ... use restart data if available, otherwise use diagonal guess. +\item 1 = Use diagonal initial guess. +\item 2 = Use restart data if available, otherwise transform +Cartesian Hessian from previous frequency calculation. +\end{itemize} + + +In addition, the diagonal elements of the initial Hessian for +internal coordinates may be scaled using separate factors for +bonds, angles and torsions with the following +\begin{verbatim} + BSCALE + ASCALE + TSCALE +\end{verbatim} +These values typically give a two-fold speedup over unit values, based +on about 100 test cases up to 15 atoms using 3-21g and 6-31g* SCF. +However, if doing many optimizations on physically similar systems it +may be worth fine tuning these parameters. + +Finally, the entire Hessian from any source may be scaled +by a factor using the directive +\begin{verbatim} + HSCALE +\end{verbatim} +It might be of utility, for instance, when computing an initial +Hessian using SCF to start a large MP2 optimization. The SCF +vibrational modes are expected to be stiffer than the MP2, so scaling +the initial Hessian by a number less than one might be beneficial. + + +\section{Mode or variable to follow to saddle point} + +\begin{verbatim} + (MODDIR || VARDIR) + (FIRSTNEG || NOFIRSTNEG) +\end{verbatim} + +When searching for a transition state the program, by default, +will take an initial step uphill and then do mode following +using a fuzzy maximum overlap (the lowest eigen-mode with an +overlap with the previous search direction of 0.7 times the +maximum overlap is selected). Once a negative eigen-value +is found, that mode is followed regardless of overlap. + +The initial uphill step is appropriate if the gradient points roughly +in the direction of the saddle point, such as might be the case if a +constrained optimization was performed at the starting geometry. +Alternatively, the initial search direction may be chosen to be along +a specific internal variable (using the directive +\verb+VARDIR+) or along a specific eigen-mode (using \verb+MODDIR+). +Following a variable might be valuable if the initial gradient is +either very small or very large. Note that the eigen-modes in the +optimizer have next-to-nothing to do with the output from a frequency +calculation. You can examine the eigen-modes used by the optimizer +with + +\begin{verbatim} + tropt; print hvecs; end +\end{verbatim} + +The selection of the first negative mode is usually a good choice if +the search is started in the vicinity of the transition state and the +initial search direction is satisfactory. However, sometimes the +first negative mode might not be the one of interest (e.g., transverse +to the reaction direction). If \verb+NOFIRSTNEG+ is specified, the +code will not take the first negative direction and will continue doing +mode-following until that mode goes negative. + +\section{Optimization history as XYZ file} + +\begin{verbatim} + XYZ [] + NOXYZ +\end{verbatim} + +The \verb+XYZ+ directive causes the geometry at each step +to be output into file in the permanent directory in XYZ format. + The optional string will +prefix the filename. The \verb+NOXYZ+ directive turns this off. + +For example, the input +\begin{verbatim} + tropt; xyz ; end +\end{verbatim} +will cause a trajectory file filename.xyz to be created +in the permanent directory. + +\section{Print options} + +The UNIX command \verb+"egrep '^@' < output"+ will extract a pretty +table summarizing the optimization. + +If you specify the NWChem input +\begin{verbatim} + scf; print none; end + tropt; print low; end + task scf optimize +\end{verbatim} +you'll obtain a pleasantly terse output. + +For more control, these options for the standard print directive are +recognized +\begin{itemize} +\item \verb+debug+ - prints a large amount of data. Don't use in parallel. +\item \verb+high+ - print the search direction in internals +\item \verb+default+ - prints geometry for each major step (not during + the line search), gradient in internals (before + and after application of constraints) +\item \verb+low+ - prints convergence and energy information. At + convergence prints final geometry, change in internals + from initial geometry +\end{itemize} +and these specific print options +\begin{itemize} +\item {\tt finish} (low) - print geometry data at end of calculation +\item {\tt bonds} (default) - print bonds at end of calculation +\item {\tt angles} (default) - print angles at end of calculation +\item {\tt hvecs} (never) - print eigen-values/vectors of the Hessian +\item {\tt searchdir} (high) - print the search direction in internals +\item `{\tt internal gradient}' (default) - print the gradient in internals +\item {\tt sadmode} (default) - print the mode being followed to the saddle point +\end{itemize} + +\fussy + +