00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 #ifndef QMDATA_H
00095 #define QMDATA_H
00096
00097
00098 #define GUI_WAVEF_TYPE_CANON 0
00099 #define GUI_WAVEF_TYPE_GEMINAL 1
00100 #define GUI_WAVEF_TYPE_MCSCFNAT 2
00101 #define GUI_WAVEF_TYPE_MCSCFOPT 3
00102 #define GUI_WAVEF_TYPE_CINAT 4
00103 #define GUI_WAVEF_TYPE_LOCAL 5
00104 #define GUI_WAVEF_TYPE_OTHER 6
00105
00106 #define GUI_WAVEF_SPIN_ALPHA 0
00107 #define GUI_WAVEF_SPIN_BETA 1
00108
00109 #define GUI_WAVEF_EXCI_GROUND 0
00110
00111
00112
00113
00114
00115
00116
00117
00118 #define SPD_D_SHELL -5
00119 #define SPD_P_SHELL -4
00120 #define SPD_S_SHELL -3
00121 #define SP_S_SHELL -2
00122 #define SP_P_SHELL -1
00123 #define S_SHELL 0
00124 #define P_SHELL 1
00125 #define D_SHELL 2
00126 #define F_SHELL 3
00127 #define G_SHELL 4
00128 #define H_SHELL 5
00129 #define I_SHELL 6
00130
00131 #define QMDATA_BUFSIZ 81
00132 #define QMDATA_BUFSTRFMT "%.80s"
00133 #define QMDATA_BIGBUFSIZ 8192
00134 #define QMDATA_BIGBUFSTRFMT "%.8191s"
00135
00136
00137 class Orbital;
00138 class QMTimestep;
00139 class Timestep;
00140 class Molecule;
00141
00143 enum {
00144 QMSTATUS_UNKNOWN = -1,
00145 QMSTATUS_OPT_CONV = 0,
00146 QMSTATUS_SCF_NOT_CONV = 1,
00147 QMSTATUS_OPT_NOT_CONV = 2,
00148 QMSTATUS_FILE_TRUNCATED = 3
00149 };
00150
00152 enum {
00153 SCFTYPE_UNKNOWN = -1,
00154 SCFTYPE_NONE = 0,
00155 SCFTYPE_RHF = 1,
00156 SCFTYPE_UHF = 2,
00157 SCFTYPE_ROHF = 3,
00158 SCFTYPE_GVB = 4,
00159 SCFTYPE_MCSCF = 5,
00160 SCFTYPE_FF = 6
00161 };
00162
00164 enum {
00165 RUNTYPE_UNKNOWN = 0,
00166 RUNTYPE_ENERGY = 1,
00167 RUNTYPE_OPTIMIZE = 2,
00168 RUNTYPE_SADPOINT = 3,
00169 RUNTYPE_HESSIAN = 4,
00170 RUNTYPE_SURFACE = 5,
00171 RUNTYPE_GRADIENT = 6,
00172 RUNTYPE_MEX = 7,
00173 RUNTYPE_DYNAMICS = 8,
00174
00175
00176 RUNTYPE_PROPERTIES = 9
00177
00178 };
00179
00181 enum {
00182 QMCHARGE_UNKNOWN = 0,
00183 QMCHARGE_MULLIKEN = 1,
00184 QMCHARGE_LOWDIN = 2,
00185 QMCHARGE_ESP = 3,
00186 QMCHARGE_NPA = 4
00187 };
00188
00189
00217 enum {
00218 WAVE_CANON, WAVE_GEMINAL, WAVE_MCSCFNAT,
00219 WAVE_MCSCFOPT, WAVE_CINATUR,
00220 WAVE_PIPEK, WAVE_BOYS, WAVE_RUEDEN,
00221 WAVE_NAO, WAVE_PNAO, WAVE_NHO,
00222 WAVE_PNHO, WAVE_NBO, WAVE_PNBO,
00223 WAVE_PNLMO, WAVE_NLMO, WAVE_MOAO,
00224 WAVE_NATO, WAVE_UNKNOWN
00225 };
00226
00227
00228
00229
00230
00231
00232
00233
00234 typedef struct {
00235 int type;
00236 int spin;
00237 int exci;
00238 char info[QMDATA_BUFSIZ];
00239
00240 int max_avail_orbs;
00241
00242 int *orbids;
00243 float *orbocc;
00244 } wavef_signa_t;
00245
00246
00247
00248
00249
00251 typedef struct {
00252 float expon;
00253 float coeff;
00254 } prim_t;
00255
00257 typedef struct {
00258 int numprims;
00259 int type;
00260 int combo;
00261
00262
00263 int num_cart_func;
00264
00265
00266
00267 float *norm_fac;
00268 float *basis;
00269 prim_t *prim;
00270 } shell_t;
00271
00273 typedef struct {
00274 int atomicnum;
00275 int numshells;
00276 shell_t *shell;
00277 } basis_atom_t;
00278
00281 class QMData {
00282 public:
00283
00284 int num_wave_f;
00285
00286
00287
00288
00289
00290
00291
00292 int num_basis;
00293
00294
00295
00296 int num_wavef_signa;
00297
00298
00299 private:
00300 int num_types;
00301 int num_atoms;
00302
00303 int *atom_types;
00304 int *atom_sort;
00305 int *num_shells_per_atom;
00306
00307 int *wave_offset;
00308
00309
00310
00311
00312
00313 int num_shells;
00314 int *num_prim_per_shell;
00315
00316 int *angular_momentum;
00317
00318
00319
00320
00321 int highest_shell;
00322
00323
00324 float **norm_factors;
00325
00326
00327
00328
00329
00330
00331 float *basis_array;
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343 int *atom_basis;
00344
00345 int *shell_types;
00346
00347
00348
00349
00350
00351
00352 basis_atom_t *basis_set;
00353
00354
00355
00356
00357
00358
00359
00360
00361 wavef_signa_t *wavef_signa;
00362
00363
00364
00365
00366
00367
00368 int nimag;
00369 int nintcoords;
00370
00371 double *carthessian;
00372
00373
00374 double *inthessian;
00375
00376
00377 float *wavenumbers;
00378 float *intensities;
00379 float *normalmodes;
00380 int *imagmodes;
00381
00382
00383 public:
00384
00385 int runtype;
00386 int scftype;
00387 int status;
00388 int nproc;
00389 int memory;
00390 int num_electrons;
00391 int totalcharge;
00392
00393
00394
00395 char *basis_string;
00396 char runtitle[QMDATA_BIGBUFSIZ];
00397 char geometry[QMDATA_BUFSIZ];
00398
00399 char version_string[QMDATA_BUFSIZ];
00400
00401 QMData(int natoms, int nbasis, int shells, int nwave);
00402 ~QMData(void);
00403
00406 void init_electrons(Molecule *mol, int totcharge);
00407
00408
00409
00410
00411
00413 void delete_basis_set();
00414
00417 int init_basis(Molecule *mol, int num_basis_atoms, const char *string,
00418 const float *basis, const int *atomic_numbers,
00419 const int *nshells, const int *nprim,
00420 const int *shelltypes);
00421
00423 int create_unique_basis(Molecule *mol, int num_basis_atoms);
00424
00427 void normalize_basis();
00428
00429 #if 0
00430
00432
00433 #endif
00434
00437 void init_angular_norm_factors();
00438
00439
00440
00441
00442
00443
00445 const basis_atom_t* get_basis(int atom=0) const;
00446
00448 const shell_t* get_basis(int atom, int shell) const;
00449
00450 const int* get_atom_types() const { return atom_types; }
00451 const int* get_num_shells_per_atom() const { return num_shells_per_atom; }
00452 const int* get_num_prim_per_shell() const { return num_prim_per_shell; }
00453
00454 int get_num_atoms() { return num_atoms; }
00455 int get_num_types() { return num_types; }
00456 int get_num_shells() { return num_shells; }
00457 int get_num_wavecoeff_per_atom(int atom) const;
00458
00460 int get_wave_offset(int atom, int shell=0) const;
00461
00463 const char* get_shell_type_str(const shell_t *shell);
00464
00465 char* get_angular_momentum_str(int atom, int shell, int mom) const;
00466 void set_angular_momentum_str(int atom, int shell, int mom, const char *tag);
00467 void set_angular_momentum(int atom, int shell, int mom, int *pow);
00468 int get_angular_momentum(int atom, int shell, int mom, int comp);
00469 int set_angular_momenta(const int *angmom);
00470
00471
00472
00473
00474
00475
00476 int get_num_imag() { return nimag; }
00477 int get_num_intcoords() { return nintcoords; }
00478 void set_carthessian(int numcartcoords, double *array);
00479 void set_inthessian(int numintcoords, double *array);
00480 void set_normalmodes(int numcart, float *array);
00481 void set_wavenumbers(int numcart, float *array);
00482 void set_intensities(int numcart, float *array);
00483 void set_imagmodes(int numimag, int *array);
00484 const double* get_carthessian() const { return carthessian; }
00485 const double* get_inthessian() const { return inthessian; }
00486 const float* get_normalmodes() const { return normalmodes; }
00487 const float* get_wavenumbers() const { return wavenumbers; }
00488 const float* get_intensities() const { return intensities; }
00489 const int* get_imagmodes() const { return imagmodes; }
00490
00491
00492
00493
00494
00495
00497 const char *get_scftype_string(void) const;
00498
00500 const char *get_runtype_string(void) const;
00501
00503 const char* get_status_string();
00504
00505
00506
00507
00508
00509
00512 int assign_wavef_id(int type, int spin, int excit, char *info,
00513 wavef_signa_t *(&signa_ts), int &numsig);
00514
00518 int find_wavef_id_from_gui_specs(int type, int spin, int exci);
00519
00521 int compare_wavef_guitype_to_type(int guitype, int type);
00522
00524 int has_wavef_guitype(int guitype);
00525
00527 int has_wavef_spin(int spin);
00528
00530 int has_wavef_exci(int exci);
00531
00534 int has_wavef_signa(int type, int spin, int exci);
00535
00538 int get_highest_excitation(int guitype);
00539
00540
00541
00542
00543
00544
00545
00547 void update_avail_orbs(int iwavesig, int norbitals,
00548 const int *orbids, const float *orbocc);
00549
00555 int get_max_avail_orbitals(int iwavesig);
00556
00560 int get_avail_orbitals(int iwavesig, int *(&orbids));
00561
00564 int get_avail_occupancies(int iwavesig, float *(&orbocc));
00565
00569 int get_orbital_label_from_gui_index(int iwavesig, int iorb);
00570
00573 int has_orbital(int iwavesig, int orbid);
00574
00575 #define ANGS_TO_BOHR 1.88972612478289694072f
00576
00577 int expand_atompos(const float *atompos,
00578 float *(&expandedpos));
00579 int expand_basis_array(float *(&expandedbasis), int *(&numprims));
00580
00581 void compute_overlap_integrals(Timestep *ts,
00582 const float *expandedbasis,
00583 const int *numprims, float *(&overlap_matrix));
00584
00585 int mullikenpop(Timestep *ts, int iwavesig,
00586 const float *expandedbasis,
00587 const int *numprims);
00588
00589
00590 double localization_orbital_change(int orbid1, int orbid2,
00591 const float *C,
00592 const float *S);
00593
00594 float pair_localization_measure(int num_orbitals,
00595 int orbid1, int orbid2,
00596 const float *C, const float *S);
00597
00598 double mean_localization_measure(int num_orbitals, const float *C,
00599 const float *S);
00600
00603 void rotate_2x2_orbitals(float *C, int orbid1, int orbid2,
00604 double gamma);
00605
00608 double localization_rotation_angle(const float *C, const float *S,
00609 int orbid1, int orbid2);
00610
00612 double gross_atom_mulliken_pop(const float *C, const float *S,
00613 int atom, int orbid) const;
00614
00615 double orb_pair_gross_atom_mulliken_pop(const float *C, const float *S,
00616 int atom, int orbid1, int orbid2);
00617
00620 int orblocalize(Timestep *ts, int waveid, const float *expandedbasis,
00621 const int *numprims);
00622
00625 Orbital* create_orbital(int iwave, int orbid, float *pos,
00626 QMTimestep *qmts);
00627
00628 };
00629
00630
00631
00632 #endif
00633