1*
2* $Id$
3*
4c
5c     Defintions of /coptopt/ and /coptimize/
6c
7c     The contents of /coptopt/ are mostly read-only and are
8c     initialized by driver_initialize().  The zmatrix info must be
9c     updated if the internal coordinates regenerated
10c
11c     /coptimize/ is dynamically updated
12c
13c     These parameter definitions from geomP.fh and soon to be from
14c     a standard include file
15      integer max_cent, max_nzvar, max_izmat
16      parameter (max_cent      = nw_max_atom)
17      parameter (max_nzvar     = 3*max_cent)
18      parameter (max_izmat     = 4*max_nzvar)
19c
20      integer max_cart
21      parameter (max_cart = 3*max_cent)
22      integer max_nvar
23*     parameter (max_nvar = max(max_nzvar,max_cart))  ! max function call cannot be used in a parameter statement
24*note:  max_nvar should be .eq. max(max_nzvar,max_cart)
25      parameter (max_nvar = max_cart)
26c
27c     zmatrix info will only be set if zcoord is true
28c
29c     nvar is the no. of variables in the optimization which
30c     is performed in one of
31c     .   cartesians
32c     .   redundant internals
33c     .   non-redundant user-specified internals
34c
35      double precision
36     $     eprec,               ! [user|auto] precision in the energy
37     $     trust,               ! [user] trust radius for spectral step
38     $     gmax_tol,            ! [user] tolerance for max internal gradient
39     $     grms_tol,            ! [user] tolerance for rms internal gradient
40     $     xrms_tol,            ! [user] tolerance for rms cartesian step
41     $     xmax_tol,            ! [user] tolerance for max cartesian step
42     $     sadstp,              ! [user] step in search for saddle point
43     $     zvarsign(max_nzvar)  ! sign of zmatrix variables
44      integer
45     $     nptopt,              ! [user] max no. of steps
46     $     inhess,              ! [user] guess hessian option
47     $     linopt,              ! [user] max. no. of steps for line search
48     $     modupd,              ! [user] update mode for hessian
49     $     moddir,              ! [user] +/- mode for initial saddle step
50     $     vardir,              ! [user] +/- var  for initial saddle step
51     $     modsad,              ! [user] 0=minim, 1=saddle
52     $     nat,                 ! no. of atoms (+ 3 pretend if ostress, or + 2 pretend if ostress2)
53     $     nat_real,            ! no. of real atoms (i.e., no cell param)
54     $     ncart,               ! no. of cartesians = 3*nat
55     $     nzmat,               ! no. of zmatrix integers
56     $     nzvar,               ! no. of zmatrix variables
57     $     nvar,                ! no. of redundant or cartesian variables
58     $     nzfrz,               ! no. of frozen zmatrix variables
59     $     isystype,            ! system type (mol, poly, slab, crys)
60     $     nactive,             ! no. of active atoms (cartesian constraints)
61     $     izmat(max_izmat),    ! zmatrix integers
62     $     izfrz(max_nzvar)     ! list of frozen variables
63c
64      logical
65     $     ofirstneg,           ! [user] take the first negative mode
66     $     opcg,                ! [user] use conjugacy
67     $     oqstep,              ! [user/auto] step in internal coords
68     $     zcoord,              ! autoz/zmatrix being used
69     $     zmatrix,             ! user specified zmatrix being used
70     $     oprint,              ! print information
71     $     odebug,              ! print debug data
72     $     ostress,             ! include stress
73     $     ostress2,            ! include lattice gradients
74     $     ocheckgrad,          ! verify the gradient
75     $     diagonal_hessian,    ! tells the code to use a diagonal hessian
76     $     ofast_diag      ,    ! use dsyev instead of jacobi eigensolver
77     $     oactive(max_cent)    ! active atom flags
78c
79      character*8
80     $     zvarname(max_nzvar) ! name of user specified zmatrix variables
81      character*255
82     $     xyz                  ! [user] prefix for xyz files or blank
83c
84      common/cdrv_optopt/
85c     doubles
86     $     eprec, trust, gmax_tol, grms_tol, xrms_tol, xmax_tol,
87     $     sadstp, zvarsign,
88c     integers
89     $     nptopt, inhess, linopt, modupd, moddir, vardir, modsad,
90     $     nat, nat_real, ncart, nzmat, nzvar, nvar, izmat, nzfrz,
91     $     izfrz, isystype, nactive,
92c     logicals
93     $     ofirstneg, opcg, oqstep, zcoord, zmatrix, oprint, odebug,
94     $     ostress, ostress2, ocheckgrad, diagonal_hessian,ofast_diag,
95     $     oactive
96c     characters
97      common/ccdrv_optopt/
98     $     zvarname, xyz
99c
100c     Contents of /coptimize/
101c
102      double precision
103     $     gmax,                ! maxmimum gradient element in opt. var.
104     $     grms,                ! rms gradient element in opt. var.
105     $     smax,                ! maximum step in opt. var.
106     $     srms,                ! rms step element in opt. var.
107     $     xmax,                ! maxmimum first-order cartesian step
108     $     xrms,                ! rms element in first-order cart. step
109     $     energy,              ! Current energy
110     $     alpha,               ! Current step in current search direction
111     $     gx(max_nvar),        ! Current cartesian gradient
112     $     gq(max_nvar),        ! Current internal coord gradient
113     $     g(max_nvar),         ! Current gradient in optimization variables
114     $     ds(max_nzvar),       ! Current search direction in opt. var.
115     $     energyp,             ! Previous energy
116     $     energyp2,            ! Previous previous energy
117     $     energyp3,            ! Previous previous previous energy
118     $     alphap,              ! Previous alpha
119     $     sp(max_nvar),        ! Previous values of optimization variables
120     $     dsp(max_nvar),       ! Previous search direction
121     $     gp(max_nvar)         ! Previous gradient in optimization variables
122c
123      character*8 lsmode        ! Action taken by previous line search
124c
125      common /coptimize/ gmax, grms, smax, srms, xmax, xrms,
126     $     energy, energyp, alpha, alphap, gx, gq, g, gp, ds, dsp, sp,
127     $     energyp2, energyp3
128c
129      common /ccoptimize/ lsmode
130