| [0b990d] | 1 | //
 | 
|---|
 | 2 | // coor.h
 | 
|---|
 | 3 | //
 | 
|---|
 | 4 | // Copyright (C) 1996 Limit Point Systems, Inc.
 | 
|---|
 | 5 | //
 | 
|---|
 | 6 | // Author: Curtis Janssen <cljanss@limitpt.com>
 | 
|---|
 | 7 | // Maintainer: LPS
 | 
|---|
 | 8 | //
 | 
|---|
 | 9 | // This file is part of the SC Toolkit.
 | 
|---|
 | 10 | //
 | 
|---|
 | 11 | // The SC Toolkit is free software; you can redistribute it and/or modify
 | 
|---|
 | 12 | // it under the terms of the GNU Library General Public License as published by
 | 
|---|
 | 13 | // the Free Software Foundation; either version 2, or (at your option)
 | 
|---|
 | 14 | // any later version.
 | 
|---|
 | 15 | //
 | 
|---|
 | 16 | // The SC Toolkit is distributed in the hope that it will be useful,
 | 
|---|
 | 17 | // but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
 | 18 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
|---|
 | 19 | // GNU Library General Public License for more details.
 | 
|---|
 | 20 | //
 | 
|---|
 | 21 | // You should have received a copy of the GNU Library General Public License
 | 
|---|
 | 22 | // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
 | 
|---|
 | 23 | // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 | 
|---|
 | 24 | //
 | 
|---|
 | 25 | // The U.S. Government is granted a limited license as per AL 91-7.
 | 
|---|
 | 26 | //
 | 
|---|
 | 27 | 
 | 
|---|
 | 28 | #ifndef _chemistry_molecule_coor_h
 | 
|---|
 | 29 | #define _chemistry_molecule_coor_h
 | 
|---|
 | 30 | 
 | 
|---|
 | 31 | #ifdef __GNUC__
 | 
|---|
 | 32 | #pragma interface
 | 
|---|
 | 33 | #endif
 | 
|---|
 | 34 | 
 | 
|---|
 | 35 | #include <iostream>
 | 
|---|
 | 36 | #include <vector>
 | 
|---|
 | 37 | 
 | 
|---|
 | 38 | #include <math/scmat/matrix.h>
 | 
|---|
 | 39 | #include <math/optimize/transform.h>
 | 
|---|
 | 40 | #include <chemistry/molecule/molecule.h>
 | 
|---|
 | 41 | 
 | 
|---|
 | 42 | namespace sc {
 | 
|---|
 | 43 | 
 | 
|---|
 | 44 | /** The IntCoor abstract class describes an internal coordinate of a
 | 
|---|
 | 45 | molecule. */
 | 
|---|
 | 46 | class IntCoor: public SavableState {
 | 
|---|
 | 47 |   protected:
 | 
|---|
 | 48 |     // conversion factors from radians, bohr to the preferred units
 | 
|---|
 | 49 |     static double bohr_conv;
 | 
|---|
 | 50 |     static double radian_conv;
 | 
|---|
 | 51 |     char *label_;
 | 
|---|
 | 52 |     double value_;
 | 
|---|
 | 53 |   public:
 | 
|---|
 | 54 |     IntCoor(StateIn&);
 | 
|---|
 | 55 |     IntCoor(const IntCoor&);
 | 
|---|
 | 56 |     /** This constructor takes a string containing a label for the
 | 
|---|
 | 57 |         internal coordinate.  The string is copied. */
 | 
|---|
 | 58 |     IntCoor(const char* label = 0);
 | 
|---|
 | 59 |     /** The KeyVal constructor.
 | 
|---|
 | 60 |         <dl>
 | 
|---|
 | 61 | 
 | 
|---|
 | 62 |         <dt><tt>label</tt><dd> A label for the coordinate using only to
 | 
|---|
 | 63 |         identify the coordinate to the user in printouts.  The default is
 | 
|---|
 | 64 |         no label.
 | 
|---|
 | 65 | 
 | 
|---|
 | 66 |         <dt><tt>value</tt><dd> A value for the coordinate.  In the way that
 | 
|---|
 | 67 |         coordinates are usually used, the default is to compute a value
 | 
|---|
 | 68 |         from the cartesian coordinates in a Molecule object.
 | 
|---|
 | 69 | 
 | 
|---|
 | 70 |         <dt><tt>unit</tt><dd> The unit in which the value is given.  This
 | 
|---|
 | 71 |         can be bohr, anstrom, radian, and degree.  The default is bohr for
 | 
|---|
 | 72 |         lengths and radian for angles.
 | 
|---|
 | 73 | 
 | 
|---|
 | 74 |         </dl> */
 | 
|---|
 | 75 |     IntCoor(const Ref<KeyVal>&);
 | 
|---|
 | 76 |     
 | 
|---|
 | 77 |     virtual ~IntCoor();
 | 
|---|
 | 78 |     void save_data_state(StateOut&);
 | 
|---|
 | 79 | 
 | 
|---|
 | 80 |     /// Returns the string containing the label for the internal coordinate.
 | 
|---|
 | 81 |     virtual const char* label() const;
 | 
|---|
 | 82 |     /// Returns the value of the coordinate in atomic units or radians.
 | 
|---|
 | 83 |     virtual double value() const;
 | 
|---|
 | 84 |     /// Sets the value of the coordinate in atomic units or radians.
 | 
|---|
 | 85 |     virtual void set_value(double);
 | 
|---|
 | 86 |     /// Returns the value of the coordinate in more familiar units.
 | 
|---|
 | 87 |     virtual double preferred_value() const;
 | 
|---|
 | 88 |     /// Returns a string representation of the type of coordinate this is.
 | 
|---|
 | 89 |     virtual const char* ctype() const = 0;
 | 
|---|
 | 90 |     /// Print information about the coordinate.
 | 
|---|
 | 91 |     virtual void print(std::ostream & o=ExEnv::out0()) const;
 | 
|---|
 | 92 |     virtual void print_details(const Ref<Molecule> &, std::ostream& =ExEnv::out0()) const;
 | 
|---|
 | 93 |     /** Returns the value of the force constant associated with this
 | 
|---|
 | 94 |         coordinate. */
 | 
|---|
 | 95 |     virtual double force_constant(Ref<Molecule>&) = 0;
 | 
|---|
 | 96 |     /// Recalculate the value of the coordinate.
 | 
|---|
 | 97 |     virtual void update_value(const Ref<Molecule>&) = 0;
 | 
|---|
 | 98 |     /// Fill in a row the the B matrix.
 | 
|---|
 | 99 |     virtual void bmat(const Ref<Molecule>&,RefSCVector&bmat,double coef=1.0) = 0;
 | 
|---|
 | 100 |     /** Test to see if this internal coordinate is equivalent to that one.
 | 
|---|
 | 101 |         The definition of equivalence is left up to the individual
 | 
|---|
 | 102 |         coordinates. */
 | 
|---|
 | 103 |     virtual int equivalent(Ref<IntCoor>&) = 0;
 | 
|---|
 | 104 | };
 | 
|---|
 | 105 | 
 | 
|---|
 | 106 | /** SumIntCoor is used to construct linear combinations of internal
 | 
|---|
 | 107 | coordinates.
 | 
|---|
 | 108 | 
 | 
|---|
 | 109 | The following is a sample ParsedKeyVal input for a SumIntCoor object:
 | 
|---|
 | 110 | <pre>
 | 
|---|
 | 111 |   sumintcoor\<SumIntCoor>: (
 | 
|---|
 | 112 |     coor: [
 | 
|---|
 | 113 |       \<StreSimpleCo>:( atoms = [ 1 2 ] )
 | 
|---|
 | 114 |       \<StreSimpleCo>:( atoms = [ 2 3 ] )
 | 
|---|
 | 115 |       ]
 | 
|---|
 | 116 |     coef = [ 1.0 1.0 ]
 | 
|---|
 | 117 |     )
 | 
|---|
 | 118 | </pre>
 | 
|---|
 | 119 | */
 | 
|---|
 | 120 | class SumIntCoor: public IntCoor {
 | 
|---|
 | 121 |   private:
 | 
|---|
 | 122 |     std::vector<double> coef_;
 | 
|---|
 | 123 |     std::vector<Ref<IntCoor> > coor_;
 | 
|---|
 | 124 |   public:
 | 
|---|
 | 125 |     SumIntCoor(StateIn&);
 | 
|---|
 | 126 |     /** This constructor takes a string containing a label for this
 | 
|---|
 | 127 |         coordinate. */
 | 
|---|
 | 128 |     SumIntCoor(const char *);
 | 
|---|
 | 129 |     /** The KeyVal constructor.
 | 
|---|
 | 130 |         <dl>
 | 
|---|
 | 131 | 
 | 
|---|
 | 132 |         <dt><tt>coor</tt><dd> A vector of IntCoor objects that define the
 | 
|---|
 | 133 |         summed coordinates.
 | 
|---|
 | 134 | 
 | 
|---|
 | 135 |         <dt><tt>coef</tt><dd> A vector of floating point numbers that gives
 | 
|---|
 | 136 |         the coefficients of the summed coordinates.
 | 
|---|
 | 137 | 
 | 
|---|
 | 138 |         </dl> */
 | 
|---|
 | 139 |     SumIntCoor(const Ref<KeyVal>&);
 | 
|---|
 | 140 | 
 | 
|---|
 | 141 |     ~SumIntCoor();
 | 
|---|
 | 142 |     void save_data_state(StateOut&);
 | 
|---|
 | 143 | 
 | 
|---|
 | 144 |     /// Returns the number of coordinates in this linear combination.
 | 
|---|
 | 145 |     int n();
 | 
|---|
 | 146 |     /** Add a coordinate to the linear combination.  coef is the
 | 
|---|
 | 147 |         coefficient for the added coordinate. */
 | 
|---|
 | 148 |     void add(Ref<IntCoor>&,double coef);
 | 
|---|
 | 149 |     /// This function normalizes all the coefficients.
 | 
|---|
 | 150 |     void normalize();
 | 
|---|
 | 151 | 
 | 
|---|
 | 152 |     // IntCoor overrides
 | 
|---|
 | 153 |     /// Returns the value of the coordinate in a.u. and radians.
 | 
|---|
 | 154 |     double preferred_value() const;
 | 
|---|
 | 155 |     /// Always returns ``SUM''.
 | 
|---|
 | 156 |     const char* ctype() const;
 | 
|---|
 | 157 |     /// Print the individual coordinates in the sum with their coefficients.
 | 
|---|
 | 158 |     void print_details(const Ref<Molecule> &, std::ostream& =ExEnv::out0()) const;
 | 
|---|
 | 159 |     /// Returns the weighted sum of the individual force constants.
 | 
|---|
 | 160 |     double force_constant(Ref<Molecule>&);
 | 
|---|
 | 161 |     /// Recalculate the value of the coordinate.
 | 
|---|
 | 162 |     void update_value(const Ref<Molecule>&);
 | 
|---|
 | 163 |     /// Fill in a row the the B matrix.
 | 
|---|
 | 164 |     void bmat(const Ref<Molecule>&,RefSCVector&bmat,double coef = 1.0);
 | 
|---|
 | 165 |     /// Always returns 0.
 | 
|---|
 | 166 |     int equivalent(Ref<IntCoor>&);
 | 
|---|
 | 167 | };
 | 
|---|
 | 168 | 
 | 
|---|
 | 169 | /** The SetIntCoor class describes a set of internal coordinates.
 | 
|---|
 | 170 | It can automatically generate these coordinates using a integral coordinate
 | 
|---|
 | 171 | generator object (see the IntCoorGen class) or the internal
 | 
|---|
 | 172 | coordinates can be explicity given.
 | 
|---|
 | 173 | 
 | 
|---|
 | 174 | The following is a sample ParsedKeyVal input for
 | 
|---|
 | 175 | a SetIntCoor object.
 | 
|---|
 | 176 | <pre>
 | 
|---|
 | 177 |   setintcoor<SetIntCoor>: [
 | 
|---|
 | 178 |     \<SumIntCoor>: (
 | 
|---|
 | 179 |       coor: [
 | 
|---|
 | 180 |         \<StreSimpleCo>:( atoms = [ 1 2 ] )
 | 
|---|
 | 181 |         \<StreSimpleCo>:( atoms = [ 2 3 ] )
 | 
|---|
 | 182 |         ]
 | 
|---|
 | 183 |       coef = [ 1.0 1.0 ]
 | 
|---|
 | 184 |       )
 | 
|---|
 | 185 |     \<BendSimpleCo>:( atoms = [ 1 2 3 ] )
 | 
|---|
 | 186 |   ]
 | 
|---|
 | 187 | </pre>
 | 
|---|
 | 188 | */
 | 
|---|
 | 189 | class SetIntCoor: public SavableState {
 | 
|---|
 | 190 |   private:
 | 
|---|
 | 191 |     std::vector<Ref<IntCoor> > coor_;
 | 
|---|
 | 192 |   public:
 | 
|---|
 | 193 |     SetIntCoor();
 | 
|---|
 | 194 |     SetIntCoor(StateIn&);
 | 
|---|
 | 195 |     /** The KeyVal constructor.
 | 
|---|
 | 196 |         <dl>
 | 
|---|
 | 197 | 
 | 
|---|
 | 198 |         <dt><tt>generator</tt><dd> A IntCoorGen object that will be used to
 | 
|---|
 | 199 |         generate the internal coordinates.
 | 
|---|
 | 200 | 
 | 
|---|
 | 201 |         <dt><tt>i</tt><dd> A sequence of integer keywords, all \f$i\f$ for
 | 
|---|
 | 202 |         \f$0 \leq i < n\f$, can be assigned to IntCoor objects.
 | 
|---|
 | 203 | 
 | 
|---|
 | 204 |         </dl> */
 | 
|---|
 | 205 |     SetIntCoor(const Ref<KeyVal>&);
 | 
|---|
 | 206 | 
 | 
|---|
 | 207 |     virtual ~SetIntCoor();
 | 
|---|
 | 208 |     void save_data_state(StateOut&);
 | 
|---|
 | 209 | 
 | 
|---|
 | 210 |     /// Adds an internal coordinate to the set.
 | 
|---|
 | 211 |     void add(const Ref<IntCoor>&);
 | 
|---|
 | 212 |     /// Adds all the elements of another set to this one.
 | 
|---|
 | 213 |     void add(const Ref<SetIntCoor>&);
 | 
|---|
 | 214 |     /// Removes the last coordinate from this set.
 | 
|---|
 | 215 |     void pop();
 | 
|---|
 | 216 |     /// Removes all coordinates from the set.
 | 
|---|
 | 217 |     void clear();
 | 
|---|
 | 218 |     /// Returns the number of coordinates in the set.
 | 
|---|
 | 219 |     int n() const;
 | 
|---|
 | 220 |     /// Returns a reference to the i'th coordinate in the set.
 | 
|---|
 | 221 |     Ref<IntCoor> coor(int i) const;
 | 
|---|
 | 222 |     /// Compute the B matrix by finite displacements.
 | 
|---|
 | 223 |     virtual void fd_bmat(const Ref<Molecule>&,RefSCMatrix&);
 | 
|---|
 | 224 |     /// Compute the B matrix the old-fashioned way.
 | 
|---|
 | 225 |     virtual void bmat(const Ref<Molecule>&, RefSCMatrix&);
 | 
|---|
 | 226 |     /** Create an approximate Hessian for this set of coordinates.  This
 | 
|---|
 | 227 |         Hessian is a symmetric matrix whose i'th diagonal is the force
 | 
|---|
 | 228 |         constant for the i'th coordinate in the set. */
 | 
|---|
 | 229 |     virtual void guess_hessian(Ref<Molecule>&,RefSymmSCMatrix&);
 | 
|---|
 | 230 |     /// Print the coordinates in the set.
 | 
|---|
 | 231 |     virtual void print_details(const Ref<Molecule> &,std::ostream& =ExEnv::out0()) const;
 | 
|---|
 | 232 |     /// Recalculate the values of the internal coordinates in the set.
 | 
|---|
 | 233 |     virtual void update_values(const Ref<Molecule>&);
 | 
|---|
 | 234 |     /// Copy the values of the internal coordinates to a vector.
 | 
|---|
 | 235 |     virtual void values_to_vector(const RefSCVector&);
 | 
|---|
 | 236 | };
 | 
|---|
 | 237 | 
 | 
|---|
 | 238 | 
 | 
|---|
 | 239 | // ////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 240 | 
 | 
|---|
 | 241 | class BitArrayLTri;
 | 
|---|
 | 242 | 
 | 
|---|
 | 243 | /** IntCoorGen generates a set of simple internal coordinates
 | 
|---|
 | 244 |     for a molecule. */
 | 
|---|
 | 245 | class IntCoorGen: public SavableState
 | 
|---|
 | 246 | {
 | 
|---|
 | 247 |   protected:
 | 
|---|
 | 248 |     Ref<Molecule> molecule_;
 | 
|---|
 | 249 |     
 | 
|---|
 | 250 |     int linear_bends_;
 | 
|---|
 | 251 |     int linear_lbends_;
 | 
|---|
 | 252 |     int linear_tors_;
 | 
|---|
 | 253 |     int linear_stors_;
 | 
|---|
 | 254 |     int nextra_bonds_;
 | 
|---|
 | 255 |     int *extra_bonds_;
 | 
|---|
 | 256 |     double linear_bend_thres_;
 | 
|---|
 | 257 |     double linear_tors_thres_;
 | 
|---|
 | 258 |     double radius_scale_factor_;
 | 
|---|
 | 259 | 
 | 
|---|
 | 260 |     void init_constants();
 | 
|---|
 | 261 | 
 | 
|---|
 | 262 |     double cos_ijk(Molecule& m, int i, int j, int k);
 | 
|---|
 | 263 |     int hterminal(Molecule& m, BitArrayLTri& bonds, int i);
 | 
|---|
 | 264 |     int nearest_contact(int i, Molecule& m);
 | 
|---|
 | 265 | 
 | 
|---|
 | 266 |     void add_bonds(const Ref<SetIntCoor>& list, BitArrayLTri& bonds, Molecule& m);
 | 
|---|
 | 267 |     void add_bends(const Ref<SetIntCoor>& list, BitArrayLTri& bonds, Molecule& m);
 | 
|---|
 | 268 |     void add_tors(const Ref<SetIntCoor>& list, BitArrayLTri& bonds, Molecule& m);
 | 
|---|
 | 269 |     void add_out(const Ref<SetIntCoor>& list, BitArrayLTri& bonds, Molecule& m);
 | 
|---|
 | 270 |   public:
 | 
|---|
 | 271 |     /** Create an IntCoorGen given a Molecule and, optionally, extra bonds.
 | 
|---|
 | 272 |         IntCoorGen keeps a reference to extra and deletes it when the
 | 
|---|
 | 273 |         destructor is called. */
 | 
|---|
 | 274 |     IntCoorGen(const Ref<Molecule>&, int nextra=0, int *extra=0);
 | 
|---|
 | 275 |     /** The KeyVal constructor.
 | 
|---|
 | 276 |         <dl>
 | 
|---|
 | 277 | 
 | 
|---|
 | 278 |         <dt><tt>molecule</tt><dd> A Molecule object.  There is no default.
 | 
|---|
 | 279 | 
 | 
|---|
 | 280 |         <dt><tt>radius_scale_factor</tt><dd> If the distance between two
 | 
|---|
 | 281 |         atoms is less than the radius scale factor times the sum of the
 | 
|---|
 | 282 |         atoms' atomic radii, then a bond is placed between the two atoms
 | 
|---|
 | 283 |         for the purpose of finding internal coordinates.  The default is
 | 
|---|
 | 284 |         1.1.
 | 
|---|
 | 285 | 
 | 
|---|
 | 286 |         <dt><tt>linear_bend_threshold</tt><dd> A bend angle in degress
 | 
|---|
 | 287 |         greater than 180 minus this keyword's floating point value is
 | 
|---|
 | 288 |         considered a linear bend. The default is 1.0.
 | 
|---|
 | 289 | 
 | 
|---|
 | 290 |         <dt><tt>linear_tors_threshold</tt><dd> The angles formed by atoms
 | 
|---|
 | 291 |         a-b-c and b-c-d are checked for near linearity.  If an angle in
 | 
|---|
 | 292 |         degrees is greater than 180 minus this keyword's floating point
 | 
|---|
 | 293 |         value, then the torsion is classified as a linear torsion. The
 | 
|---|
 | 294 |         default is 1.0.
 | 
|---|
 | 295 | 
 | 
|---|
 | 296 |         <dt><tt>linear_bend</tt><dd> Generate BendSimpleCo objects to
 | 
|---|
 | 297 |         describe linear bends.  The default is false.
 | 
|---|
 | 298 | 
 | 
|---|
 | 299 |         <dt><tt>linear_lbend</tt><dd> Generate pairs of LinIPSimpleCo and
 | 
|---|
 | 300 |         LinIPSimpleCo objects to describe linear bends.  The default is
 | 
|---|
 | 301 |         true.
 | 
|---|
 | 302 | 
 | 
|---|
 | 303 |         <dt><tt>linear_tors</tt><dd> Generate TorsSimpleCo objects to
 | 
|---|
 | 304 |         described linear torsions.  The default is false.
 | 
|---|
 | 305 | 
 | 
|---|
 | 306 |         <dt><tt>linear_stors</tt><dd> Generate ScaledTorsSimpleCo objects
 | 
|---|
 | 307 |         to described linear torsions.  The default is true.
 | 
|---|
 | 308 | 
 | 
|---|
 | 309 |         <dt><tt>extra_bonds</tt><dd> This is a vector of atom numbers,
 | 
|---|
 | 310 |         where elements \f$2 (i-1) + 1\f$ and \f$2 i\f$ specify the atoms
 | 
|---|
 | 311 |         which are bound in extra bond \f$i\f$.  The extra_bonds keyword
 | 
|---|
 | 312 |         should only be needed for weakly interacting fragments, otherwise
 | 
|---|
 | 313 |         all the needed bonds will be found.
 | 
|---|
 | 314 | 
 | 
|---|
 | 315 |         </dl> */
 | 
|---|
 | 316 |     IntCoorGen(const Ref<KeyVal>&);
 | 
|---|
 | 317 |     IntCoorGen(StateIn&);
 | 
|---|
 | 318 | 
 | 
|---|
 | 319 |     ~IntCoorGen();
 | 
|---|
 | 320 | 
 | 
|---|
 | 321 |     /// Standard member.
 | 
|---|
 | 322 |     void save_data_state(StateOut&);
 | 
|---|
 | 323 | 
 | 
|---|
 | 324 |     /// This generates a set of internal coordinates.
 | 
|---|
 | 325 |     virtual void generate(const Ref<SetIntCoor>&);
 | 
|---|
 | 326 | 
 | 
|---|
 | 327 |     /// Print out information about this.
 | 
|---|
 | 328 |     virtual void print(std::ostream& out=ExEnv::out0()) const;
 | 
|---|
 | 329 | };
 | 
|---|
 | 330 | 
 | 
|---|
 | 331 | 
 | 
|---|
 | 332 | // ////////////////////////////////////////////////////////////////////////
 | 
|---|
 | 333 | 
 | 
|---|
 | 334 | 
 | 
|---|
 | 335 | /** The MolecularCoor abstract class describes the coordinate system used
 | 
|---|
 | 336 | to describe a molecule.  It is used to convert a molecule's cartesian
 | 
|---|
 | 337 | coordinates to and from this coordinate system. */
 | 
|---|
 | 338 | class MolecularCoor: public SavableState
 | 
|---|
 | 339 | {
 | 
|---|
 | 340 |   protected:
 | 
|---|
 | 341 |     Ref<Molecule> molecule_;
 | 
|---|
 | 342 |     RefSCDimension dnatom3_; // the number of atoms x 3
 | 
|---|
 | 343 |     Ref<SCMatrixKit> matrixkit_; // used to construct matrices
 | 
|---|
 | 344 | 
 | 
|---|
 | 345 |     int debug_;
 | 
|---|
 | 346 |   public:
 | 
|---|
 | 347 |     MolecularCoor(Ref<Molecule>&);
 | 
|---|
 | 348 |     MolecularCoor(StateIn&);
 | 
|---|
 | 349 |     /** The KeyVal constructor.
 | 
|---|
 | 350 |         <dl>
 | 
|---|
 | 351 | 
 | 
|---|
 | 352 |         <dt><tt>molecule</tt><dd> A Molecule object.  There is no default.
 | 
|---|
 | 353 | 
 | 
|---|
 | 354 |         <dt><tt>debug</tt><dd> An integer which, if nonzero, will cause
 | 
|---|
 | 355 |         extra output.
 | 
|---|
 | 356 | 
 | 
|---|
 | 357 |         <dt><tt>matrixkit</tt><dd> A SCMatrixKit object.  It is usually
 | 
|---|
 | 358 |         unnecessary to give this keyword.
 | 
|---|
 | 359 | 
 | 
|---|
 | 360 |         <dt><tt>natom3</tt><dd> An SCDimension object for the dimension of
 | 
|---|
 | 361 |         the vector of cartesian coordinates.  It is usually unnecessary to
 | 
|---|
 | 362 |         give this keyword.
 | 
|---|
 | 363 | 
 | 
|---|
 | 364 |         </dl> */
 | 
|---|
 | 365 |     MolecularCoor(const Ref<KeyVal>&);
 | 
|---|
 | 366 | 
 | 
|---|
 | 367 |     virtual ~MolecularCoor();
 | 
|---|
 | 368 | 
 | 
|---|
 | 369 |     void save_data_state(StateOut&);
 | 
|---|
 | 370 | 
 | 
|---|
 | 371 |     /** Returns a smart reference to an SCDimension equal to the
 | 
|---|
 | 372 |         number of atoms in the molecule times 3. */
 | 
|---|
 | 373 |     RefSCDimension dim_natom3() { return dnatom3_; }
 | 
|---|
 | 374 | 
 | 
|---|
 | 375 |     /// Returns the molecule.
 | 
|---|
 | 376 |     Ref<Molecule> molecule() const { return molecule_; }
 | 
|---|
 | 377 | 
 | 
|---|
 | 378 |     /// Print the coordinate.
 | 
|---|
 | 379 |     virtual void print(std::ostream& =ExEnv::out0()) const = 0;
 | 
|---|
 | 380 |     virtual void print_simples(std::ostream& =ExEnv::out0()) const = 0;
 | 
|---|
 | 381 | 
 | 
|---|
 | 382 |     /** Returns a smart reference to an SCDimension equal to the number of
 | 
|---|
 | 383 |         coordinates (be they Cartesian, internal, or whatever) that are
 | 
|---|
 | 384 |         being optimized. */
 | 
|---|
 | 385 |     virtual RefSCDimension dim() = 0;
 | 
|---|
 | 386 |     
 | 
|---|
 | 387 |     /** Given a set of displaced internal coordinates, update the cartesian
 | 
|---|
 | 388 |         coordinates of the Molecule contained herein.  This function does
 | 
|---|
 | 389 |         not change the vector ``internal''. */
 | 
|---|
 | 390 |     int to_cartesian(const RefSCVector&internal);
 | 
|---|
 | 391 |     virtual int to_cartesian(const Ref<Molecule>&mol,
 | 
|---|
 | 392 |                              const RefSCVector&internal) = 0;
 | 
|---|
 | 393 | 
 | 
|---|
 | 394 |     /** Fill in the vector ``internal'' with the current internal
 | 
|---|
 | 395 |         coordinates.  Note that this member will update the values of the
 | 
|---|
 | 396 |         variable internal coordinates. */
 | 
|---|
 | 397 |     virtual int to_internal(RefSCVector&internal) = 0;
 | 
|---|
 | 398 | 
 | 
|---|
 | 399 |     /** Convert the internal coordinate gradients in ``internal'' to
 | 
|---|
 | 400 |         Cartesian coordinates and copy these Cartesian coordinate gradients
 | 
|---|
 | 401 |         to ``cartesian''. Only the variable internal coordinate gradients
 | 
|---|
 | 402 |         are transformed. */
 | 
|---|
 | 403 |     virtual int to_cartesian(RefSCVector&cartesian,RefSCVector&internal) = 0;
 | 
|---|
 | 404 | 
 | 
|---|
 | 405 |     /** Convert the Cartesian coordinate gradients in ``cartesian'' to
 | 
|---|
 | 406 |         internal coordinates and copy these internal coordinate gradients
 | 
|---|
 | 407 |         to ``internal''.  Only the variable internal coordinate gradients
 | 
|---|
 | 408 |         are calculated. */
 | 
|---|
 | 409 |     virtual int to_internal(RefSCVector&internal,RefSCVector&cartesian) = 0;
 | 
|---|
 | 410 | 
 | 
|---|
 | 411 |     /** Convert the internal coordinate Hessian ``internal'' to Cartesian
 | 
|---|
 | 412 |         coordinates and copy the result to ``cartesian''.  Only the variable
 | 
|---|
 | 413 |         internal coordinate force constants are transformed. */
 | 
|---|
 | 414 |     virtual int to_cartesian(RefSymmSCMatrix&cartesian,
 | 
|---|
 | 415 |                               RefSymmSCMatrix&internal) =0;
 | 
|---|
 | 416 | 
 | 
|---|
 | 417 |     /** Convert the Cartesian coordinate Hessian ``cartesian'' to internal
 | 
|---|
 | 418 |         coordinates and copy the result to ``internal''.  Only the variable
 | 
|---|
 | 419 |         internal coordinate force constants are calculated. */
 | 
|---|
 | 420 |     virtual int to_internal(RefSymmSCMatrix&internal,
 | 
|---|
 | 421 |                              RefSymmSCMatrix&cartesian) = 0;
 | 
|---|
 | 422 | 
 | 
|---|
 | 423 |     /** Calculate an approximate hessian and place the result in
 | 
|---|
 | 424 |         ``hessian''. */
 | 
|---|
 | 425 |     virtual void guess_hessian(RefSymmSCMatrix&hessian) = 0;
 | 
|---|
 | 426 | 
 | 
|---|
 | 427 |     /** Given an Hessian, return the inverse of that hessian.  For singular
 | 
|---|
 | 428 |         matrices this should return the generalized inverse. */
 | 
|---|
 | 429 |     virtual RefSymmSCMatrix inverse_hessian(RefSymmSCMatrix&) = 0;
 | 
|---|
 | 430 | 
 | 
|---|
 | 431 |     /// Returns the number of constrained coordinates.
 | 
|---|
 | 432 |     virtual int nconstrained();
 | 
|---|
 | 433 | 
 | 
|---|
 | 434 |     /** When this is called, MoleculeCoor may select a new internal
 | 
|---|
 | 435 |         coordinate system and return a transform to it.  The default action
 | 
|---|
 | 436 |         is to not change anything and return an IdentityTransform. */
 | 
|---|
 | 437 |     virtual Ref<NonlinearTransform> change_coordinates();
 | 
|---|
 | 438 | 
 | 
|---|
 | 439 |     Ref<SCMatrixKit> matrixkit() const { return matrixkit_; }
 | 
|---|
 | 440 | };
 | 
|---|
 | 441 | 
 | 
|---|
 | 442 | 
 | 
|---|
 | 443 | /** The IntMolecularCoor abstract class describes a molecule's coordinates
 | 
|---|
 | 444 | in terms of internal coordinates. */
 | 
|---|
 | 445 | class IntMolecularCoor: public MolecularCoor
 | 
|---|
 | 446 | {
 | 
|---|
 | 447 |   protected:
 | 
|---|
 | 448 |     Ref<IntCoorGen> generator_;
 | 
|---|
 | 449 | 
 | 
|---|
 | 450 |     void form_K_matrix(RefSCDimension& dredundant,
 | 
|---|
 | 451 |                        RefSCDimension& dfixed,
 | 
|---|
 | 452 |                        RefSCMatrix& K,
 | 
|---|
 | 453 |                        int*& is_totally_symmetric);
 | 
|---|
 | 454 | 
 | 
|---|
 | 455 |     RefSCDimension dim_; // corresponds to the number of variable coordinates
 | 
|---|
 | 456 |     RefSCDimension dvc_; // the number of variable + constant coordinates
 | 
|---|
 | 457 | 
 | 
|---|
 | 458 |     Ref<SetIntCoor> variable_; // the variable internal coordinates
 | 
|---|
 | 459 |     Ref<SetIntCoor> constant_; // the constant internal coordinates
 | 
|---|
 | 460 |     
 | 
|---|
 | 461 |     Ref<SetIntCoor> fixed_;
 | 
|---|
 | 462 |     Ref<SetIntCoor> watched_;
 | 
|---|
 | 463 |     Ref<IntCoor> followed_;
 | 
|---|
 | 464 | 
 | 
|---|
 | 465 |     // these are all of the basic coordinates
 | 
|---|
 | 466 |     Ref<SetIntCoor> bonds_;
 | 
|---|
 | 467 |     Ref<SetIntCoor> bends_;
 | 
|---|
 | 468 |     Ref<SetIntCoor> tors_;
 | 
|---|
 | 469 |     Ref<SetIntCoor> outs_;
 | 
|---|
 | 470 |     // these are provided by the user or generated coordinates that
 | 
|---|
 | 471 |     // could not be assigned to any of the above catagories
 | 
|---|
 | 472 |     Ref<SetIntCoor> extras_;
 | 
|---|
 | 473 | 
 | 
|---|
 | 474 |     Ref<SetIntCoor> all_;
 | 
|---|
 | 475 | 
 | 
|---|
 | 476 |     // Useful relationships
 | 
|---|
 | 477 |     // variable_->n() + constant_->n() = 3N-6(5)
 | 
|---|
 | 478 |     // symm_->n() + asymm_->n() = 3N-6(5)
 | 
|---|
 | 479 | 
 | 
|---|
 | 480 |     int update_bmat_;  // if 1 recompute the b matrix during to_cartesian
 | 
|---|
 | 481 |     int only_totally_symmetric_; // only coors with tot. symm comp. are varied
 | 
|---|
 | 482 |     double symmetry_tolerance_; // tol used to find coors with tot. sym. comp.
 | 
|---|
 | 483 |     double simple_tolerance_; // tol used to see if a simple is included
 | 
|---|
 | 484 |     double coordinate_tolerance_; // tol used to see if a coor is included
 | 
|---|
 | 485 |     double cartesian_tolerance_;  // tol used in intco->cart transformation
 | 
|---|
 | 486 |     double scale_bonds_; // scale factor for bonds
 | 
|---|
 | 487 |     double scale_bends_; // scale factor for bends
 | 
|---|
 | 488 |     double scale_tors_;  // scale factor for tors
 | 
|---|
 | 489 |     double scale_outs_;  // scale factor for outs
 | 
|---|
 | 490 | 
 | 
|---|
 | 491 |     int nextra_bonds_;
 | 
|---|
 | 492 |     int* extra_bonds_;
 | 
|---|
 | 493 | 
 | 
|---|
 | 494 |     int given_fixed_values_; // if true make molecule have given fixed values
 | 
|---|
 | 495 | 
 | 
|---|
 | 496 |     int decouple_bonds_;
 | 
|---|
 | 497 |     int decouple_bends_;
 | 
|---|
 | 498 | 
 | 
|---|
 | 499 |     int max_update_steps_;
 | 
|---|
 | 500 |     double max_update_disp_;
 | 
|---|
 | 501 | 
 | 
|---|
 | 502 |     /** This is called by the constructors of classes derived from
 | 
|---|
 | 503 |         IntMolecularCoor.  It initialized the lists of simple internal
 | 
|---|
 | 504 |         coordinates, and then calls the form_coordinates() member. */
 | 
|---|
 | 505 |     virtual void init();
 | 
|---|
 | 506 |     /** Allocates memory for the SetIntCoor's used to store the
 | 
|---|
 | 507 |         simple and internal coordinates. */
 | 
|---|
 | 508 |     virtual void new_coords();
 | 
|---|
 | 509 |     /// Reads the KeyVal input.
 | 
|---|
 | 510 |     virtual void read_keyval(const Ref<KeyVal>&);
 | 
|---|
 | 511 | 
 | 
|---|
 | 512 |     // control whether or not to print coordinates when they are formed
 | 
|---|
 | 513 |     int form_print_simples_;
 | 
|---|
 | 514 |     int form_print_variable_;
 | 
|---|
 | 515 |     int form_print_constant_;
 | 
|---|
 | 516 |     int form_print_molecule_;
 | 
|---|
 | 517 |   public:
 | 
|---|
 | 518 |     IntMolecularCoor(StateIn&);
 | 
|---|
 | 519 |     IntMolecularCoor(Ref<Molecule>&mol);
 | 
|---|
 | 520 |     /** The KeyVal constructor.
 | 
|---|
 | 521 |         <dl>
 | 
|---|
 | 522 | 
 | 
|---|
 | 523 |         <dt><tt>variable</tt><dd> Gives a SetIntCoor object that specifies
 | 
|---|
 | 524 |         the internal coordinates that can be varied. If this is not given,
 | 
|---|
 | 525 |         the variable coordinates will be generated.
 | 
|---|
 | 526 | 
 | 
|---|
 | 527 |         <dt><tt>followed</tt><dd> Gives a IntCoor object that specifies a
 | 
|---|
 | 528 |         coordinate to used as the first coordinate in the variable
 | 
|---|
 | 529 |         coordinate list.  The remaining coordinates will be automatically
 | 
|---|
 | 530 |         generated.  The default is no followed coordinate.  This option is
 | 
|---|
 | 531 |         usually used to set the initial search direction for a transition
 | 
|---|
 | 532 |         state optimization, where it is used in conjunction with the
 | 
|---|
 | 533 |         mode_following keyword read by the EFCOpt class.
 | 
|---|
 | 534 | 
 | 
|---|
 | 535 |         <dt><tt>fixed</tt><dd> Gives a SetIntCoor object that specifies the
 | 
|---|
 | 536 |         internal coordinates that will be fixed.  The default is no fixed
 | 
|---|
 | 537 |         coordinates.
 | 
|---|
 | 538 | 
 | 
|---|
 | 539 |         <dt><tt>watched</tt><dd> Gives a SetIntCoor object that specifies
 | 
|---|
 | 540 |         internal coordinates that will be printed out whenever the
 | 
|---|
 | 541 |         coordinates are changed.  The default is none.
 | 
|---|
 | 542 | 
 | 
|---|
 | 543 |         <dt><tt>have_fixed_values</tt><dd> If true, then values for the
 | 
|---|
 | 544 |         fixed coordinates must be given in fixed and an attempt will be
 | 
|---|
 | 545 |         made to displace the initial geometry to the given fixed
 | 
|---|
 | 546 |         values. The default is false.
 | 
|---|
 | 547 | 
 | 
|---|
 | 548 |         <dt><tt>extra_bonds</tt><dd> This is only read if the generator
 | 
|---|
 | 549 |         keyword is not given.  It is a vector of atom numbers, where
 | 
|---|
 | 550 |         elements \f$(i-1)\times 2 + 1\f$ and \f$i\times 2\f$ specify the
 | 
|---|
 | 551 |         atoms which are bound in extra bond \f$i\f$.  The extra_bonds
 | 
|---|
 | 552 |         keyword should only be needed for weakly interacting fragments,
 | 
|---|
 | 553 |         otherwise all the needed bonds will be found.
 | 
|---|
 | 554 | 
 | 
|---|
 | 555 |         <dt><tt>generator</tt><dd> Specifies an IntCoorGen object that
 | 
|---|
 | 556 |         creates simple, redundant internal coordinates. If this keyword is
 | 
|---|
 | 557 |         not given, then a vector giving extra bonds to be added is read
 | 
|---|
 | 558 |         from extra_bonds and this is used to create an IntCoorGen object.
 | 
|---|
 | 559 | 
 | 
|---|
 | 560 |         <dt><tt>decouple_bonds</tt><dd> Automatically generated internal
 | 
|---|
 | 561 |         coordinates are linear combinations of possibly any mix of simple
 | 
|---|
 | 562 |         internal coordinates.  If decouple_bonds is true, an attempt will
 | 
|---|
 | 563 |         be made to form some of the internal coordinates from just stretch
 | 
|---|
 | 564 |         simple coordinates.  The default is false.
 | 
|---|
 | 565 | 
 | 
|---|
 | 566 |         <dt><tt>decouple_bends</tt><dd> This is like decouple_bonds except
 | 
|---|
 | 567 |         it applies to the bend-like coordinates.  The default is false.
 | 
|---|
 | 568 | 
 | 
|---|
 | 569 |         <dt><tt>max_update_disp</tt><dd> The maximum displacement to be
 | 
|---|
 | 570 |         used in the displacement to fixed internal coordinates values.
 | 
|---|
 | 571 |         Larger displacements will be broken into several smaller
 | 
|---|
 | 572 |         displacements and new coordinates will be formed for each of these
 | 
|---|
 | 573 |         displacments. This is only used when fixed and have_fixed_values
 | 
|---|
 | 574 |         are given.  The default is 0.5.
 | 
|---|
 | 575 | 
 | 
|---|
 | 576 |         <dt><tt>max_update_steps</tt><dd> The maximum number of steps
 | 
|---|
 | 577 |         permitted to convert internal coordinate displacements to cartesian
 | 
|---|
 | 578 |         coordinate displacements.  The default is 100.
 | 
|---|
 | 579 |                
 | 
|---|
 | 580 |         <dt><tt>update_bmat</tt><dd> Displacements in internal coordinates
 | 
|---|
 | 581 |         are converted to a cartesian displacements iteratively.  If there
 | 
|---|
 | 582 |         are large changes in the cartesian coordinates during conversion,
 | 
|---|
 | 583 |         then recompute the \f$B\f$ matrix, which is using to do the
 | 
|---|
 | 584 |         conversion.  The default is false.
 | 
|---|
 | 585 | 
 | 
|---|
 | 586 |         <dt><tt>only_totally_symmetric</tt><dd> If a simple test reveals
 | 
|---|
 | 587 |         that an internal coordinate is not totally symmetric, then it will
 | 
|---|
 | 588 |         not be added to the internal coordinate list.  The default is true.
 | 
|---|
 | 589 |                
 | 
|---|
 | 590 |         <dt><tt>simple_tolerance</tt><dd> The internal coordinates are
 | 
|---|
 | 591 |         formed as linear combinations of simple, redundant internal
 | 
|---|
 | 592 |         coordinates.  Coordinates with coefficients smaller then
 | 
|---|
 | 593 |         simple_tolerance will be omitted. The default is 1.0e-3.
 | 
|---|
 | 594 | 
 | 
|---|
 | 595 |         <dt><tt>cartesian_tolerance</tt><dd> The tolerance for conversion
 | 
|---|
 | 596 |         of internal coordinate displacements to cartesian displacements.
 | 
|---|
 | 597 |         The default is 1.0e-12.
 | 
|---|
 | 598 |                
 | 
|---|
 | 599 |         <dt><tt>form:print_simple</tt><dd> Print the simple internal
 | 
|---|
 | 600 |         coordinates.  The default is false.
 | 
|---|
 | 601 |                
 | 
|---|
 | 602 |         <dt><tt>form:print_variable</tt><dd> Print the variable internal
 | 
|---|
 | 603 |         coordinates.  The default is false.
 | 
|---|
 | 604 |                
 | 
|---|
 | 605 |         <dt><tt>form:print_constant</tt><dd> Print the constant internal
 | 
|---|
 | 606 |         coordinates.  The default is false.
 | 
|---|
 | 607 |                
 | 
|---|
 | 608 |         <dt><tt>form:print_molecule</tt><dd> Print the molecule when
 | 
|---|
 | 609 |         forming coordinates.  The default is false.
 | 
|---|
 | 610 |                
 | 
|---|
 | 611 |         <dt><tt>scale_bonds</tt><dd> Obsolete.  The default value is 1.0.
 | 
|---|
 | 612 | 
 | 
|---|
 | 613 |         <dt><tt>scale_bends</tt><dd> Obsolete.  The default value is 1.0.
 | 
|---|
 | 614 |                
 | 
|---|
 | 615 |         <dt><tt>scale_tors</tt><dd> Obsolete.  The default value is 1.0.
 | 
|---|
 | 616 | 
 | 
|---|
 | 617 |         <dt><tt>scale_outs</tt><dd> Obsolete.  The default value is 1.0.
 | 
|---|
 | 618 | 
 | 
|---|
 | 619 |         <dt><tt>symmetry_tolerance</tt><dd> Obsolete.  The default is 1.0e-5.
 | 
|---|
 | 620 | 
 | 
|---|
 | 621 |         <dt><tt>coordinate_tolerance</tt><dd> Obsolete.  The default is 1.0e-7.
 | 
|---|
 | 622 | 
 | 
|---|
 | 623 |         </dl> */
 | 
|---|
 | 624 |     IntMolecularCoor(const Ref<KeyVal>&);
 | 
|---|
 | 625 | 
 | 
|---|
 | 626 |     virtual ~IntMolecularCoor();
 | 
|---|
 | 627 |     void save_data_state(StateOut&);
 | 
|---|
 | 628 |   
 | 
|---|
 | 629 |     /** Actually form the variable and constant internal coordinates from
 | 
|---|
 | 630 |         the simple internal coordinates. */
 | 
|---|
 | 631 |     virtual void form_coordinates(int keep_variable=0) =0;
 | 
|---|
 | 632 |     
 | 
|---|
 | 633 |     /** Like to_cartesians(), except all internal coordinates are
 | 
|---|
 | 634 |         considered, not just the variable ones. */
 | 
|---|
 | 635 |     virtual int all_to_cartesian(const Ref<Molecule> &,RefSCVector&internal);
 | 
|---|
 | 636 |     /** Like to_internal(), except all internal coordinates are
 | 
|---|
 | 637 |         considered, not just the variable ones. */
 | 
|---|
 | 638 |     virtual int all_to_internal(const Ref<Molecule> &,RefSCVector&internal);
 | 
|---|
 | 639 | 
 | 
|---|
 | 640 |     /** These implement the virtual functions inherited from
 | 
|---|
 | 641 |         MolecularCoor. */
 | 
|---|
 | 642 |     virtual RefSCDimension dim();
 | 
|---|
 | 643 |     virtual int to_cartesian(const Ref<Molecule> &,const RefSCVector&internal);
 | 
|---|
 | 644 |     virtual int to_internal(RefSCVector&internal);
 | 
|---|
 | 645 |     virtual int to_cartesian(RefSCVector&cartesian,RefSCVector&internal);
 | 
|---|
 | 646 |     virtual int to_internal(RefSCVector&internal,RefSCVector&cartesian);
 | 
|---|
 | 647 |     virtual int to_cartesian(RefSymmSCMatrix&cart,RefSymmSCMatrix&internal);
 | 
|---|
 | 648 |     virtual int to_internal(RefSymmSCMatrix&internal,RefSymmSCMatrix&cart);
 | 
|---|
 | 649 |     virtual void print(std::ostream& =ExEnv::out0()) const;
 | 
|---|
 | 650 |     virtual void print_simples(std::ostream& =ExEnv::out0()) const;
 | 
|---|
 | 651 |     virtual void print_variable(std::ostream& =ExEnv::out0()) const;
 | 
|---|
 | 652 |     virtual void print_constant(std::ostream& =ExEnv::out0()) const;
 | 
|---|
 | 653 |     int nconstrained();
 | 
|---|
 | 654 | };
 | 
|---|
 | 655 | 
 | 
|---|
 | 656 | // ///////////////////////////////////////////////////////////////////////
 | 
|---|
 | 657 | 
 | 
|---|
 | 658 | /** The SymmMolecularCoor class derives from IntMolecularCoor.  It provides
 | 
|---|
 | 659 | a unique set of totally symmetric internal coordinates.  Giving an
 | 
|---|
 | 660 | MolecularEnergy object a coor is usually the best way to optimize a
 | 
|---|
 | 661 | molecular structure.  However, for some classes of molecules
 | 
|---|
 | 662 | SymmMolecularCoor doesn't work very well.  For example, enediyne can cause
 | 
|---|
 | 663 | problems.  In these cases, cartesian coordinates (obtained by not giving
 | 
|---|
 | 664 | the MolecularEnergy object the coor keyword) might be better or you can
 | 
|---|
 | 665 | manually specify the coordinates that the SymmMolecularCoor object uses
 | 
|---|
 | 666 | with the variable keyword (see the IntMolecularCoor class description).  */
 | 
|---|
 | 667 | class SymmMolecularCoor: public IntMolecularCoor
 | 
|---|
 | 668 | {
 | 
|---|
 | 669 |   protected:
 | 
|---|
 | 670 |     // true if coordinates should be changed during optimization
 | 
|---|
 | 671 |     int change_coordinates_;
 | 
|---|
 | 672 |     // true if hessian should be transformed too (should always be true)
 | 
|---|
 | 673 |     int transform_hessian_;
 | 
|---|
 | 674 |     // max value for the condition number if coordinates can be changed
 | 
|---|
 | 675 |     double max_kappa2_;
 | 
|---|
 | 676 | 
 | 
|---|
 | 677 |     void init();
 | 
|---|
 | 678 |   public:
 | 
|---|
 | 679 |     SymmMolecularCoor(Ref<Molecule>&mol);
 | 
|---|
 | 680 |     SymmMolecularCoor(StateIn&);
 | 
|---|
 | 681 |     /** The KeyVal constructor.
 | 
|---|
 | 682 |         <dl>
 | 
|---|
 | 683 | 
 | 
|---|
 | 684 |         <dt><tt>change_coordinates</tt><dd> If true, the quality of the
 | 
|---|
 | 685 |         internal coordinates will be checked periodically and if they are
 | 
|---|
 | 686 |         beginning to become linearly dependent a new set of internal
 | 
|---|
 | 687 |         coordinates will be computed.  The default is false.
 | 
|---|
 | 688 | 
 | 
|---|
 | 689 |         <dt><tt>max_kappa2</tt><dd> A measure of the quality of the
 | 
|---|
 | 690 |         internal coordinates.  Values of the 2-norm condition,
 | 
|---|
 | 691 |         \f$\kappa_2\f$, larger than max_kappa2 are considered linearly
 | 
|---|
 | 692 |         dependent.  The default is 10.0.
 | 
|---|
 | 693 | 
 | 
|---|
 | 694 |         <dt><tt>transform_hessian</tt><dd> If true, the hessian will be
 | 
|---|
 | 695 |         transformed every time the internal coordinates are formed.  The
 | 
|---|
 | 696 |         default is true.
 | 
|---|
 | 697 | 
 | 
|---|
 | 698 |         </dl> */
 | 
|---|
 | 699 |     SymmMolecularCoor(const Ref<KeyVal>&);
 | 
|---|
 | 700 | 
 | 
|---|
 | 701 |     virtual ~SymmMolecularCoor();
 | 
|---|
 | 702 |     void save_data_state(StateOut&);
 | 
|---|
 | 703 | 
 | 
|---|
 | 704 |     /** Actually form the variable and constant internal coordinates from
 | 
|---|
 | 705 |         simple internal coordinates. */
 | 
|---|
 | 706 |     void form_coordinates(int keep_variable=0);
 | 
|---|
 | 707 | 
 | 
|---|
 | 708 |     /// Form the approximate hessian.
 | 
|---|
 | 709 |     void guess_hessian(RefSymmSCMatrix&hessian);
 | 
|---|
 | 710 |     /// Invert the hessian.
 | 
|---|
 | 711 |     RefSymmSCMatrix inverse_hessian(RefSymmSCMatrix&);
 | 
|---|
 | 712 | 
 | 
|---|
 | 713 |     /** This overrides MoleculeCoor's change_coordinates
 | 
|---|
 | 714 |         and might transform to a new set of coordinates. */
 | 
|---|
 | 715 |     Ref<NonlinearTransform> change_coordinates();
 | 
|---|
 | 716 | 
 | 
|---|
 | 717 |     void print(std::ostream& =ExEnv::out0()) const;
 | 
|---|
 | 718 | };
 | 
|---|
 | 719 | 
 | 
|---|
 | 720 | // ///////////////////////////////////////////////////////////////////////
 | 
|---|
 | 721 | 
 | 
|---|
 | 722 | /** The RedundMolecularCoor class provides a redundant set of simple
 | 
|---|
 | 723 | internal coordinates. */
 | 
|---|
 | 724 | class RedundMolecularCoor: public IntMolecularCoor
 | 
|---|
 | 725 | {
 | 
|---|
 | 726 | 
 | 
|---|
 | 727 |   public:
 | 
|---|
 | 728 |     RedundMolecularCoor(Ref<Molecule>&mol);
 | 
|---|
 | 729 |     RedundMolecularCoor(StateIn&);
 | 
|---|
 | 730 |     /// The KeyVal constructor.
 | 
|---|
 | 731 |     RedundMolecularCoor(const Ref<KeyVal>&);
 | 
|---|
 | 732 | 
 | 
|---|
 | 733 |     virtual ~RedundMolecularCoor();
 | 
|---|
 | 734 |     void save_data_state(StateOut&);
 | 
|---|
 | 735 | 
 | 
|---|
 | 736 |     /** Actually form the variable and constant internal coordinates from
 | 
|---|
 | 737 |         the simple internal coordinates. */
 | 
|---|
 | 738 |     void form_coordinates(int keep_variable=0);
 | 
|---|
 | 739 |     /// Form the approximate hessian.
 | 
|---|
 | 740 |     void guess_hessian(RefSymmSCMatrix&hessian);
 | 
|---|
 | 741 |     /// Invert the hessian.
 | 
|---|
 | 742 |     RefSymmSCMatrix inverse_hessian(RefSymmSCMatrix&);
 | 
|---|
 | 743 | };
 | 
|---|
 | 744 | 
 | 
|---|
 | 745 | // ///////////////////////////////////////////////////////////////////////
 | 
|---|
 | 746 | 
 | 
|---|
 | 747 | /** The CartMolecularCoor class implements Cartesian coordinates in a way
 | 
|---|
 | 748 |     suitable for use in geometry optimizations. CartMolecularCoor is a
 | 
|---|
 | 749 |     SavableState has StateIn and KeyVal constructors. CartMolecularCoor is
 | 
|---|
 | 750 |     derived from MolecularCoor. */
 | 
|---|
 | 751 | class CartMolecularCoor: public MolecularCoor
 | 
|---|
 | 752 | {
 | 
|---|
 | 753 |   private:
 | 
|---|
 | 754 |   protected:
 | 
|---|
 | 755 |     RefSCDimension dim_; // the number of atoms x 3
 | 
|---|
 | 756 | 
 | 
|---|
 | 757 |     /// Initializes the dimensions.
 | 
|---|
 | 758 |     virtual void init();
 | 
|---|
 | 759 |   public:
 | 
|---|
 | 760 |     CartMolecularCoor(Ref<Molecule>&mol);
 | 
|---|
 | 761 |     CartMolecularCoor(StateIn&);
 | 
|---|
 | 762 |     /// The KeyVal constructor.
 | 
|---|
 | 763 |     CartMolecularCoor(const Ref<KeyVal>&);
 | 
|---|
 | 764 | 
 | 
|---|
 | 765 |     virtual ~CartMolecularCoor();
 | 
|---|
 | 766 |   
 | 
|---|
 | 767 |     void save_data_state(StateOut&);
 | 
|---|
 | 768 | 
 | 
|---|
 | 769 |     /// These implement the virtual functions inherited from MolecularCoor.
 | 
|---|
 | 770 |     virtual RefSCDimension dim();
 | 
|---|
 | 771 |     virtual int to_cartesian(const Ref<Molecule>&,const RefSCVector&internal);
 | 
|---|
 | 772 |     virtual int to_internal(RefSCVector&internal);
 | 
|---|
 | 773 |     virtual int to_cartesian(RefSCVector&cartesian,RefSCVector&internal);
 | 
|---|
 | 774 |     virtual int to_internal(RefSCVector&internal,RefSCVector&cartesian);
 | 
|---|
 | 775 |     virtual int to_cartesian(RefSymmSCMatrix&cart,RefSymmSCMatrix&internal);
 | 
|---|
 | 776 |     virtual int to_internal(RefSymmSCMatrix&internal,RefSymmSCMatrix&cart);
 | 
|---|
 | 777 |     virtual void print(std::ostream& =ExEnv::out0()) const;
 | 
|---|
 | 778 |     virtual void print_simples(std::ostream& =ExEnv::out0()) const;
 | 
|---|
 | 779 |     void guess_hessian(RefSymmSCMatrix&hessian);
 | 
|---|
 | 780 |     RefSymmSCMatrix inverse_hessian(RefSymmSCMatrix&);
 | 
|---|
 | 781 | };
 | 
|---|
 | 782 | 
 | 
|---|
 | 783 | }
 | 
|---|
 | 784 | 
 | 
|---|
 | 785 | #endif
 | 
|---|
 | 786 | 
 | 
|---|
 | 787 | // Local Variables:
 | 
|---|
 | 788 | // mode: c++
 | 
|---|
 | 789 | // c-file-style: "CLJ"
 | 
|---|
 | 790 | // End:
 | 
|---|