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_BIGBUFSIZ 8192
00133
00134
00135 class Orbital;
00136 class QMTimestep;
00137 class Timestep;
00138 class Molecule;
00139
00141 enum {
00142 QMSTATUS_UNKNOWN = -1,
00143 QMSTATUS_OPT_CONV = 0,
00144 QMSTATUS_SCF_NOT_CONV = 1,
00145 QMSTATUS_OPT_NOT_CONV = 2,
00146 QMSTATUS_FILE_TRUNCATED = 3
00147 };
00148
00150 enum {
00151 SCFTYPE_UNKNOWN = -1,
00152 SCFTYPE_NONE = 0,
00153 SCFTYPE_RHF = 1,
00154 SCFTYPE_UHF = 2,
00155 SCFTYPE_ROHF = 3,
00156 SCFTYPE_GVB = 4,
00157 SCFTYPE_MCSCF = 5,
00158 SCFTYPE_FF = 6
00159 };
00160
00162 enum {
00163 RUNTYPE_UNKNOWN = 0,
00164 RUNTYPE_ENERGY = 1,
00165 RUNTYPE_OPTIMIZE = 2,
00166 RUNTYPE_SADPOINT = 3,
00167 RUNTYPE_HESSIAN = 4,
00168 RUNTYPE_SURFACE = 5,
00169 RUNTYPE_GRADIENT = 6,
00170 RUNTYPE_MEX = 7,
00171 RUNTYPE_DYNAMICS = 8,
00172
00173
00174 RUNTYPE_PROPERTIES = 9
00175
00176 };
00177
00179 enum {
00180 QMCHARGE_UNKNOWN = 0,
00181 QMCHARGE_MULLIKEN = 1,
00182 QMCHARGE_LOWDIN = 2,
00183 QMCHARGE_ESP = 3,
00184 QMCHARGE_NPA = 4
00185 };
00186
00187
00215 enum {
00216 WAVE_CANON, WAVE_GEMINAL, WAVE_MCSCFNAT,
00217 WAVE_MCSCFOPT, WAVE_CINATUR,
00218 WAVE_PIPEK, WAVE_BOYS, WAVE_RUEDEN,
00219 WAVE_NAO, WAVE_PNAO, WAVE_NHO,
00220 WAVE_PNHO, WAVE_NBO, WAVE_PNBO,
00221 WAVE_PNLMO, WAVE_NLMO, WAVE_MOAO,
00222 WAVE_NATO, WAVE_UNKNOWN
00223 };
00224
00225
00226
00227
00228
00229
00230
00231
00232 typedef struct {
00233 int type;
00234 int spin;
00235 int exci;
00236 char info[QMDATA_BUFSIZ];
00237
00238 int max_avail_orbs;
00239
00240 int *orbids;
00241 float *orbocc;
00242 } wavef_signa_t;
00243
00244
00245
00246
00247
00249 typedef struct {
00250 float expon;
00251 float coeff;
00252 } prim_t;
00253
00255 typedef struct {
00256 int numprims;
00257 int type;
00258 int combo;
00259
00260
00261 int num_cart_func;
00262
00263
00264
00265 float *norm_fac;
00266 float *basis;
00267 prim_t *prim;
00268 } shell_t;
00269
00271 typedef struct {
00272 int atomicnum;
00273 int numshells;
00274 shell_t *shell;
00275 } basis_atom_t;
00276
00279 class QMData {
00280 public:
00281
00282 int num_wave_f;
00283
00284
00285
00286
00287
00288
00289
00290 int num_basis;
00291
00292
00293
00294 int num_wavef_signa;
00295
00296
00297 private:
00298 int num_types;
00299 int num_atoms;
00300
00301 int *atom_types;
00302 int *atom_sort;
00303 int *num_shells_per_atom;
00304
00305 int *wave_offset;
00306
00307
00308
00309
00310
00311 int num_shells;
00312 int *num_prim_per_shell;
00313
00314 int *angular_momentum;
00315
00316
00317
00318
00319 int highest_shell;
00320
00321
00322 float **norm_factors;
00323
00324
00325
00326
00327
00328
00329 float *basis_array;
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341 int *atom_basis;
00342
00343 int *shell_types;
00344
00345
00346
00347
00348
00349
00350 basis_atom_t *basis_set;
00351
00352
00353
00354
00355
00356
00357
00358
00359 wavef_signa_t *wavef_signa;
00360
00361
00362
00363
00364
00365
00366
00367 int nimag;
00368 int nintcoords;
00369
00370 double *carthessian;
00371
00372
00373 double *inthessian;
00374
00375
00376 float *wavenumbers;
00377 float *intensities;
00378 float *normalmodes;
00379 int *imagmodes;
00380
00381
00382 public:
00383
00384 int runtype;
00385 int scftype;
00386 int status;
00387 int nproc;
00388 int memory;
00389 int num_electrons;
00390 int totalcharge;
00391
00392
00393
00394 char *basis_string;
00395 char runtitle[QMDATA_BIGBUFSIZ];
00396 char geometry[QMDATA_BUFSIZ];
00397
00398 char version_string[QMDATA_BUFSIZ];
00399
00400
00401 QMData(int natoms, int nbasis, int shells, int nwave);
00402 ~QMData(void);
00403
00404
00407 void init_electrons(Molecule *mol, int totcharge);
00408
00409
00410
00411
00412
00413
00415 void delete_basis_set();
00416
00419 int init_basis(Molecule *mol, int num_basis_atoms, const char *string,
00420 const float *basis, const int *atomic_numbers,
00421 const int *nshells, const int *nprim,
00422 const int *shelltypes);
00423
00426 int create_unique_basis(Molecule *mol, int num_basis_atoms);
00427
00430 void normalize_basis();
00431
00432 #if 0 // XXX: unused
00433
00434 void sort_atoms_by_type();
00435 #endif
00436
00439 void init_angular_norm_factors();
00440
00441
00442
00443
00444
00445
00447 const basis_atom_t* get_basis(int atom=0) const;
00448
00450 const shell_t* get_basis(int atom, int shell) const;
00451
00452 const int* get_atom_types() const { return atom_types; }
00453 const int* get_num_shells_per_atom() const { return num_shells_per_atom; }
00454 const int* get_num_prim_per_shell() const { return num_prim_per_shell; }
00455
00456 int get_num_atoms() { return num_atoms; }
00457 int get_num_types() { return num_types; }
00458 int get_num_shells() { return num_shells; }
00459 int get_num_wavecoeff_per_atom(int atom) const;
00460
00462 int get_wave_offset(int atom, int shell=0) const;
00463
00465 const char* get_shell_type_str(const shell_t *shell);
00466
00467 char* get_angular_momentum_str(int atom, int shell, int mom) const;
00468 void set_angular_momentum_str(int atom, int shell, int mom,
00469 const char *tag);
00470 void set_angular_momentum(int atom, int shell, int mom,
00471 int *pow);
00472 int get_angular_momentum(int atom, int shell, int mom, int comp);
00473 int set_angular_momenta(const int *angmom);
00474
00475
00476
00477
00478
00479
00480 int get_num_imag() { return nimag; }
00481 int get_num_intcoords() { return nintcoords; }
00482 void set_carthessian(int numcartcoords, double *array);
00483 void set_inthessian(int numintcoords, double *array);
00484 void set_normalmodes(int numcart, float *array);
00485 void set_wavenumbers(int numcart, float *array);
00486 void set_intensities(int numcart, float *array);
00487 void set_imagmodes(int numimag, int *array);
00488 const double* get_carthessian() const { return carthessian; }
00489 const double* get_inthessian() const { return inthessian; }
00490 const float* get_normalmodes() const { return normalmodes; }
00491 const float* get_wavenumbers() const { return wavenumbers; }
00492 const float* get_intensities() const { return intensities; }
00493 const int* get_imagmodes() const { return imagmodes; }
00494
00495
00496
00497
00498
00499
00501 const char *get_scftype_string(void) const;
00502
00504 const char *get_runtype_string(void) const;
00505
00507 const char* get_status_string();
00508
00509
00510
00511
00512
00513
00516 int assign_wavef_id(int type, int spin, int excit, char *info,
00517 wavef_signa_t *(&signa_ts), int &numsig);
00518
00522 int find_wavef_id_from_gui_specs(int type, int spin, int exci);
00523
00525 int compare_wavef_guitype_to_type(int guitype, int type);
00526
00528 int has_wavef_guitype(int guitype);
00529
00531 int has_wavef_spin(int spin);
00532
00534 int has_wavef_exci(int exci);
00535
00538 int has_wavef_signa(int type, int spin, int exci);
00539
00542 int get_highest_excitation(int guitype);
00543
00544
00545
00546
00547
00548
00549
00551 void update_avail_orbs(int iwavesig, int norbitals,
00552 const int *orbids, const float *orbocc);
00553
00559 int get_max_avail_orbitals(int iwavesig);
00560
00564 int get_avail_orbitals(int iwavesig, int *(&orbids));
00565
00568 int get_avail_occupancies(int iwavesig, float *(&orbocc));
00569
00573 int get_orbital_label_from_gui_index(int iwavesig, int iorb);
00574
00577 int has_orbital(int iwavesig, int orbid);
00578
00579 #define ANGS_TO_BOHR 1.88972612478289694072f
00580
00581 int expand_atompos(const float *atompos,
00582 float *(&expandedpos));
00583 int expand_basis_array(float *(&expandedbasis), int *(&numprims));
00584
00585 void compute_overlap_integrals(Timestep *ts,
00586 const float *expandedbasis,
00587 const int *numprims, float *(&overlap_matrix));
00588
00589 int mullikenpop(Timestep *ts, int iwavesig,
00590 const float *expandedbasis,
00591 const int *numprims);
00592
00593
00594 double localization_orbital_change(int orbid1, int orbid2,
00595 const float *C,
00596 const float *S);
00597
00598 float pair_localization_measure(int num_orbitals,
00599 int orbid1, int orbid2,
00600 const float *C, const float *S);
00601
00602 double mean_localization_measure(int num_orbitals, const float *C,
00603 const float *S);
00604
00607 void rotate_2x2_orbitals(float *C, int orbid1, int orbid2,
00608 double gamma);
00609
00612 double localization_rotation_angle(const float *C, const float *S,
00613 int orbid1, int orbid2);
00614
00615
00616 double gross_atom_mulliken_pop(const float *C, const float *S,
00617 int atom, int orbid) const;
00618
00619 double orb_pair_gross_atom_mulliken_pop(const float *C, const float *S,
00620 int atom, int orbid1, int orbid2);
00621
00624 int orblocalize(Timestep *ts, int waveid, const float *expandedbasis,
00625 const int *numprims);
00626
00629 Orbital* create_orbital(int iwave, int orbid, float *pos,
00630 QMTimestep *qmts);
00631
00632 };
00633
00634
00635
00636 #endif
00637