1*
2* $Id$
3*
4c
5c     Defintions of /ctropt/ and /ctropt/
6c
7c     The contents of /ctropt/ 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     /ctropt/ 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     $     maxdr,
45     $     opt_tol,
46     $     slength
47      integer
48     $     nptopt,              ! [user] max no. of steps
49     $     inhess,              ! [user] guess hessian option
50     $     linopt,              ! [user] max. no. of steps for line search
51     $     modupd,              ! [user] update mode for hessian
52     $     moddir,              ! [user] +/- mode for initial saddle step
53     $     vardir,              ! [user] +/- var  for initial saddle step
54     $     modsad,              ! [user] 0=minim, 1=saddle
55     $     nat,                 ! no. of atoms (+ 3 pretend if ostress, or + 2 pretend if ostress2)
56     $     nat_real,            ! no. of real atoms (i.e., no cell param)
57     $     ncart,               ! no. of cartesians = 3*nat
58     $     nzmat,               ! no. of zmatrix integers
59     $     nzvar,               ! no. of zmatrix variables
60     $     nvar,                ! no. of redundant or cartesian variables
61     $     nzfrz,               ! no. of frozen zmatrix variables
62     $     isystype,            ! system type (mol, poly, slab, crys)
63     $     nactive,             ! no. of active atoms (cartesian constraints)
64     $     izmat(max_izmat),    ! zmatrix integers
65     $     izfrz(max_nzvar)     ! list of frozen variables
66cjmc
67     $     ,hfollow
68cjmc
69c
70      logical
71     $     ofirstneg,           ! [user] take the first negative mode
72     $     opcg,                ! [user] use conjugacy
73     $     oqstep,              ! [user/auto] step in internal coords
74     $     zcoord,              ! autoz/zmatrix being used
75     $     zmatrix,             ! user specified zmatrix being used
76     $     oprint,              ! print information
77     $     odebug,              ! print debug data
78     $     ostress,             ! include stress
79     $     ostress2,            ! include lattice gradients
80     $     ocheckgrad,          ! verify the gradient
81     $     oactive(max_cent)    ! active atom flags
82     $     ,redostep
83c
84      character*8
85     $     zvarname(max_nzvar) ! name of user specified zmatrix variables
86      character*60
87     $     xyz                  ! [user] prefix for xyz files or blank
88c
89      common/cdrv_tropt/
90c     doubles
91     $     eprec, trust, gmax_tol, grms_tol, xrms_tol, xmax_tol,
92     $     sadstp, zvarsign, maxdr, opt_tol, slength,
93c     integers
94     $     nptopt, inhess, linopt, modupd, moddir, vardir, modsad,
95     $     nat, nat_real, ncart, nzmat, nzvar, nvar, izmat, nzfrz,
96     $     izfrz, isystype, nactive , hfollow,
97c     logicals
98     $     ofirstneg, opcg, oqstep, zcoord, zmatrix, oprint, odebug,
99     $     ostress, ostress2, ocheckgrad, oactive, redostep
100c     characters
101      common/ccdrv_tropt/
102     $     zvarname, xyz
103c
104c     Contents of /ctropt/
105c
106      double precision
107     $     gmax,                ! maxmimum gradient element in opt. var.
108     $     grms,                ! rms gradient element in opt. var.
109     $     smax,                ! maximum step in opt. var.
110     $     srms,                ! rms step element in opt. var.
111     $     xmax,                ! maxmimum first-order cartesian step
112     $     xrms,                ! rms element in first-order cart. step
113     $     energy,              ! Current energy
114     $     alpha,               ! Current step in current search direction
115     $     gx(max_nvar),        ! Current cartesian gradient
116     $     gq(max_nvar),        ! Current internal coord gradient
117     $     g(max_nvar),         ! Current gradient in optimization variables
118     $     ds(max_nzvar),       ! Current search direction in opt. var.
119     $     energyp,             ! Previous energy
120     $     alphap,              ! Previous alpha
121     $     sp(max_nvar),        ! Previous values of optimization variables
122     $     dsp(max_nvar),       ! Previous search direction
123     $     gp(max_nvar)         ! Previous gradient in optimization variables
124cjmc
125     $     ,saddir(max_nvar)
126cjmc
127c
128      character*8 lsmode        ! Action taken by previous line search
129c
130      common /ctropt/ gmax, grms, smax, srms, xmax, xrms,
131     $     energy, energyp, alpha, alphap, gx, gq, g, gp, ds, dsp, sp,
132cjmc
133     $     saddir
134cjmc
135c
136      common /cctropt/ lsmode
137