00001 #ifndef GSTRING_H
00002 #define GSTRING_H
00003
00004
00005 #include <iostream>
00006 #include <iomanip>
00007 #include <fstream>
00008 #include <stdio.h>
00009 #include <vector>
00010 #include <unistd.h>
00011 #include <string>
00012 #include <cctype>
00013 #include <ctime>
00014 #include <sys/stat.h>
00015
00016 #include "grad.h"
00017 #include "icoord.h"
00018 #include "utils.h"
00019 #include "stringtools.h"
00020 #include "pTable.h"
00021 #include "eckart.h"
00022
00023 void print_xyz_gen(int natoms, string* anames, double* coords);
00024
00025 class GString {
00026 private:
00027
00028 int isRestart;
00029 int killcounter;
00030 int ngrowth;
00031 int growing;
00032 int oi;
00033 int endearly;
00034 int bondfrags;
00035
00036 int isSSM;
00037 int hessSSM;
00038 int isFSM;
00039 int use_exact_climb;
00040 void set_fsm_active(int nnR, int nnP);
00041
00042 int ptsn;
00043 double newclimbscale;
00044
00045 void growth_iters(int max_iter, double& totalgrad, double& gradrms, double endenergy, string strfileg, int& tscontinue, double gaddmax, int osteps, int oesteps, double** dqa, double* dqmaga, double** ictan);
00046 void opt_iters(int max_iter, double& totalgrad, double& gradrms, double endenergy, string strfileg, int& tscontinue, double gaddmax, int osteps, int oesteps, double** dqa, double* dqmaga, double** ictan, int finder, int climber, int do_tp, int& tp);
00047
00048 int nfound;
00049 int nbond;
00050 int nadd;
00051 int nbrk;
00052 int nangle;
00053 int ntors;
00054 int* bond;
00055 int* add;
00056 int* brk;
00057 int* angles;
00058 double* anglet;
00059 int* tors;
00060 double* tort;
00061 int isomer_init(string isofilename);
00062 void set_ssm_bonds(ICoord &ic1);
00063 double get_ssm_dqmag(double bdist);
00064 int past_ts();
00065 int n0;
00066 int find_peaks(int type);
00067 int find_uphill(double cutoff);
00068 void trim_string();
00069 void trim_string(int nextmin);
00070 int add_linear();
00071 int using_break_planes;
00072 int break_planes_ssm(ICoord ic1);
00073
00074
00075
00076
00077 int natoms;
00078
00079 int ncpu;
00080 int runNum;
00081 int runend;
00082 string runends;
00083 string infile0;
00084
00085 double** coords;
00086 ICoord* icoords;
00087 double** tangents;
00088 double** grads;
00089 double** perp_grads;
00090
00091 int climb;
00092 int find;
00093 int TSnode0;
00094 int cTSnode;
00095 double lastdispr;
00096
00097 double xdist;
00098
00099 int nnew_bond;
00100 int* new_bond;
00101 ICoord bondsic;
00102 ICoord newic;
00103 ICoord intic;
00104 ICoord int2ic;
00105 ICoord newic_dm;
00106 ICoord intic_dm;
00107 ICoord int2ic_dm;
00108 int ic_reparam_steps;
00109 void get_eigenv_bofill();
00110 void get_eigenv_finite(int enode);
00111 void get_eigenv_finite(int enode, double** ictan);
00112 void starting_string(double* dq, int nnodes);
00113 void starting_string_dm(double* dq);
00114 int addNode(int n1, int n2, int n3);
00115 int addCNode(int n1);
00116 void add_last_node(int type);
00117 void com_rotate_move(int iR, int iP, int iN, double ff);
00118 void scan_r(int eigen);
00119 void opt_tr();
00120 void opt_r();
00121 void opt_steps(double** dqa, double** ictan, int osteps, int oesteps);
00122 int knnr_vs_opt(int n);
00123 void ic_reparam_g(double** dqa, double* dqmaga);
00124 void ic_reparam(double** dqa, double* dqmaga, int type);
00125 void ic_reparam_h(double** dqa, double* dqmaga, int type);
00126 void ic_reparam_dm(double** dqa, double* dqmaga, int type);
00127 void ic_reparam_new(double** dqa, double* dqmaga, int type);
00128 void tangent_1(double* ictan);
00129 double tangent_1b(double* ictan);
00130 void get_tangents_1(double** dqa, double* dqmaga, double** ictan);
00131 void get_tangents_1e(double** dqa, double* dqmaga, double** ictan);
00132 void get_tangents_1g(double** dqa, double* dqmaga, double** ictan);
00133 void get_tangents(double** dqa, double* dqmaga, double** ictan);
00134 void get_tangents_dm(double** dqa, double* dqmaga, double** ictan);
00135 void get_distances(double* dqmaga, double** ictan);
00136 void get_distances_dm(double* dqmaga, double** ictan);
00137
00138 int close_dist_fix(int type);
00139 int check_close_dist(int n, double* dist, int* newbonds);
00140 void add_bonds(int nadd, int* newbonds);
00141 void add_angles(int nadd, int* newangles);
00142 void align_rxn();
00143
00144 void align_string(ICoord ic1, ICoord ic2);
00145 void rotate_structure(double* xyz0, int* a);
00146
00147 void print_em(int nmaxp);
00148
00149
00150 void set_prima(string pstring);
00151 int read_string(string stringfile, double** coordsn, double* energies);
00152 int pTSnode;
00153 double* pTSnodecoords;
00154 void print_string_clump_p(int STEPS, double grad, double** allcoords, string xyzstring);
00155
00156 int twin_peaks();
00157 int nsplit;
00158 int find_ints();
00159 void ic_reparam_cut(int min, double** dqa, double* dqmaga, int type);
00160 int check_for_reaction_g(int type);
00161 int check_for_reaction(int& wts, int& wint);
00162
00163 double* V_profile;
00164 double V0;
00165
00166 int* active;
00167
00168 int nn;
00169 int nnR;
00170 int nnP;
00171 int nnmax;
00172 int nnmax0;
00173
00174 double SCALING;
00175 int INTERP_MODE;
00176 int GROWD;
00177
00178 string* anames;
00179 int* anumbers;
00180 double* amasses;
00181
00182 string stringfilename;
00183
00184 int STEP_OPT_ITERS;
00185 int MAX_OPT_ITERS;
00186 double CONV_TOL;
00187 double ADD_NODE_TOL;
00188 double HESS_INIT;
00189 int CHARGE;
00190 int SPIN;
00191 double NODE_SPACING;
00192 int NUM_INTERP;
00193 int NUM_STEPS;
00194 double DQMAG_SSM_MAX;
00195 double DQMAG_SSM_MIN;
00196 double QDISTMAX;
00197 double PEAK4_EDIFF;
00198 int tstype;
00199 double prodelim;
00200 int lastOpt;
00201 int initialOpt;
00202
00203
00204 int gradJobCount;
00205 int gradFailCount;
00206
00207
00208
00209 Gradient grad1;
00210
00211
00212 void general_init(string infilename);
00213 void parameter_init(string infilename);
00214 void structure_init(string xyzfile);
00215 void allelse_init();
00216 void restart_string(string pstring);
00217
00218 public:
00219
00220 double** allcoords;
00221
00222 void String_Method_Optimization();
00223 void reparam_and_getTangents_with_LST(double** fstring);
00224
00225 void init(string infilename, string xyzfile);
00226 void init(string infilename, int runNum, int nprocs);
00227
00228 double min_rms_structure_distance(double* struct1, double* struct2, int natoms);
00229
00230 void print_string(int STEPS, double** allcoords, string xyzstring);
00231 void print_string_clump(int STEPS, double grad, double** allcoords, string xyzstring);
00232 void write_string_file(int iter);
00233 void write_SVfile(int iter);
00234 void write_geom_file(int iter);
00235
00236
00237 void shift_node(int nnOld, int nnNew);
00238
00239 void build_fstring(double** fstring);
00240 };
00241
00242 #endif
00243
00244
00245
00246