00001
00009 #ifndef HAQCHEM_H
00010 #define HAQCHEM_H
00011
00012 class HaLocOrb;
00013 class HaAtBasDB;
00014 class HaAtomOrbDB;
00015 class HaPseudoPotDB;
00016 class HaField3D;
00017
00018 class InternalBasis;
00019
00020 #include "gaufile.h"
00021 #include "haatombasis.h"
00022 #include "halocorb.h"
00023 #include "haatgroup.h"
00024 #include "command.h"
00025 #include "hacompmod.h"
00026
00027 typedef vector<HaAtomBasis> AtBasisType;
00028 typedef vector<HaLocOrb> LocOrbType;
00029
00030 enum WaveFunType{ HARTREE_FOCK, NDO, MP2, DFT_BLYP3 };
00031
00032 const int INT_ENGINE_GAUSS = 0;
00033 const int INT_ENGINE_IPACK = 1;
00034
00035 class HaQCMod: public HaCompMod
00037 {
00038 friend class HaGaussian;
00039 friend class QChemParDlg;
00040
00041 public:
00042
00043 HaQCMod(HaMolSet* new_phost_mset);
00044 ~HaQCMod();
00045
00046 void SetStdParams();
00047
00048 bool operator==(const HaQCMod& rhs) const;
00049 bool operator <(const HaQCMod& rhs) const;
00050
00051 bool Print_info(ostream &sout, const int level) const;
00052
00053
00054
00055 int GetNumCnt() const;
00056 bool GetCntCoord(HaMat_double& coord);
00057 bool GetCntCharges(HaVec_double& charges) const;
00058
00059
00060
00061 void SetCharge(int NewCharge);
00062 void SetMult(int NewMult);
00063 int GetCharge() const;
00064 int GetMult() const;
00065
00066 int GetNelectr() const;
00067 int GetNalphel() const;
00068 int GetNbetel() const;
00069
00070 inline int GetNumOccMO() const { return ( this->GetNalphel()); }
00071 inline int GetNumVacMO() const { return ( this->GetNumMO() - this->GetNalphel()); }
00072 int GetNumMO() const;
00073
00074 bool SetWaveFunType(HaString str_wf_type);
00075
00076
00077
00078 bool InitBasis(GauFile& gfile);
00079 bool InitBasis(const char* bname);
00080
00081 int FBasFunPos(const HaAtom* ref_aptr) const;
00082 const HaAtom* GetAtomOfAO(const int idx_AO) const;
00083
00084
00085 int GetNBfunc() const;
00086
00087 const char* GetBasName() const { return m_bas_name.c_str(); }
00088 bool UsePseudoPot() const;
00089
00090
00091
00092 bool InitLocOrb(const char* setid );
00093
00094 int GetNActiveOrb() const;
00095
00096 bool IsLocOrbFullBasis();
00097
00098 const HaLocOrb& GetLocOrbAO_by_idx(const int index) const;
00099 const HaLocOrb* GetLocOrbByRef(const char* ref_str_ch) const;
00100 int GetLocOrbIdx(const HaLocOrb* lorb);
00101
00102 int GetLocOrbIdxOfGrp(const HaString& gid , HaVec_int & ilgr ) const;
00103
00104 bool ExtractLocOrbSubMat(const HaString & gid1, const HaString & gid2,
00105 const HaMat_double & ActOrbMat,
00106 HaMat_double & ActOrbSubMat) const;
00107
00108 bool InsertLocOrbSubMat(const HaString & gid1, const HaString & gid2,
00109 HaMat_double & ActOrbMat,
00110 const HaMat_double & ActOrbSubMat) const;
00111
00112 const char* GetLocOrbSetID() const { return m_loc_orb_set_id.c_str(); }
00113
00114 int ProjMatToLocOrb(HaMat_double& fmat_loc, const HaMat_double& fmat_full);
00115
00116
00117
00118 bool BuildMOgrid(const HaVec_double& orb_coef, HaField3D& mo_grid);
00119 bool CreateOrbContour(const HaVec_double& orb_coef, const double mo_isolvl=0.1, const int ngrid= 11);
00120 bool CreateMOcontour (const int imo, const double mo_isolvl=0.1, const int ngrid= 11); int m_grid_size;
00121
00122
00123
00124 bool BuildFockMatFromMOs( HaMat_double& fock_matrix, double cut_ene = -100000.0);
00125
00126 static int int_engine;
00127
00128
00129
00130 bool InitBasOvlp();
00131 bool Init1eDens(GauFile& gfile);
00132 bool InitMOs(GauFile& gfile);
00133 static bool LoadGauCom_IO();
00134 bool LoadGauCom_B() const;
00135 bool LoadGauCom_B_2() const;
00136
00137 bool LoadDataFromFChk(const char* fname);
00138
00139 bool load_mo_flag;
00140
00141 int ProjMatToActBas(HaMat_double & fmat, HaMat_double & fmat_lb);
00142 int CalcEPfromMO(HaMat_double& gm,double ene);
00143
00144 HaMat_double& GetOvlpMat();
00145
00146
00147 static int max_gauss_mem;
00148 static void set_max_gauss_mem(int new_max_mem);
00149
00150 integer max_it_avg;
00151 integer max_it_noavg;
00152 int iuhf;
00153 double conv_dm;
00154 int nae_act;
00155 int nbe_act;
00156 int guess_only;
00157 int set_guess_from_mos;
00158
00159 public:
00160
00161 #ifdef USE_IPACK
00162 int TestIPack1();
00163 int TestIPack2();
00164 int TestRandomGen();
00165 #endif
00166
00167 static int InitIPack();
00168
00169 public:
00170
00171 int PrepGauss();
00172 int RunCNDO();
00173 int RunCNDO2();
00174 int RunCNDOThread();
00175
00176 int StopCalc();
00177
00178 int stop_calc_flag;
00179
00180 enum {CNDO_2=1,INDO_2,ZINDO_1,ZINDO_S,HUCKEL} ndo_method;
00181
00182 int FormDenMat(const HaMat_double& cmo, double* pa, int nel);
00183 double ZIndoGInt(double r, double k1, double k2);
00184 int NDOExp(int ia , int l, int method, int ovlp, int& n, HaVec_double& cf, HaVec_double& exp);
00185 int CNDOInteg(int iprint,int method,int iatom,int natoms,
00186 const HaVec_integer& ian, const HaMat_double& c,
00187 double* ss, double* gamma1, double* p_gamma2, double* gamma3,
00188 const HaVec_integer& ilst_bf_at, const HaVec_integer& ifst_bf_at,
00189 HaVec_double& yy, HaVec_double& zz);
00190
00191 HaMat_double ovlp_mat;
00192 HaMat_double MO_coef;
00193 HaVec_double MOene;
00194 b_type gbas;
00195
00196 WaveFunType wave_fun_type;
00197
00198 GauBasisSet AtBasis;
00199 vector<HaLocOrb> ActiveOrb;
00200
00201 protected:
00202 HaString m_bas_name;
00203 HaString m_loc_orb_set_id;
00204
00205 int charge;
00206 int mult;
00207
00208 double m_solv_chrg;
00209 int m_save_solv_chrg_flag;
00210
00211 };
00212
00213
00214 #ifdef HAQCHEM_CPP
00215
00216 bool qc_db_init_flag=false;
00217 HaPseudoPotDB pseudo_db;
00218 HaAtBasDB bas_db;
00219 HaAtomOrbDB ao_db;
00220
00221 #else
00222
00223 extern bool qc_db_init_flag;
00224 extern HaPseudoPotDB pseudo_db;
00225 extern HaAtBasDB bas_db;
00226 extern HaAtomOrbDB ao_db;
00227
00228
00229 #endif // end if HAQCHEM_CPP
00230
00231
00232 #endif // end if !defined(HAQCHEM_H)