⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gaussbas.cc

📁 大型并行量子化学软件;支持密度泛函(DFT)。可以进行各种量子化学计算。支持CHARMM并行计算。非常具有应用价值。
💻 CC
📖 第 1 页 / 共 2 页
字号:
}voidGaussianBasisSet::init2(int skip_ghosts){  // center_to_shell_ and shell_to_center_  shell_to_center_.resize(nshell_);  center_to_shell_.resize(ncenter_);  center_to_nbasis_.resize(ncenter_);  int ishell = 0;  for (int icenter=0; icenter<ncenter_; icenter++) {      if (skip_ghosts && molecule()->charge(icenter) == 0.0) {          center_to_shell_[icenter] = -1;          center_to_nbasis_[icenter] = 0;          continue;        }      int j;      center_to_shell_[icenter] = ishell;      center_to_nbasis_[icenter] = 0;      for (j = 0; j<center_to_nshell_[icenter]; j++) {          center_to_nbasis_[icenter] += shell_[ishell+j]->nfunction();        }      ishell += center_to_nshell_[icenter];      for (j = center_to_shell_[icenter]; j<ishell; j++) {	  shell_to_center_[j] = icenter;	}     }  // compute nbasis_ and shell_to_function_[]  shell_to_function_.resize(nshell_);  shell_to_primitive_.resize(nshell_);  nbasis_ = 0;  nprim_ = 0;  for (ishell=0; ishell<nshell_; ishell++) {      shell_to_function_[ishell] = nbasis_;      shell_to_primitive_[ishell] = nprim_;      nbasis_ += shell_[ishell]->nfunction();      nprim_ += shell_[ishell]->nprimitive();    }  // would like to do this in function_to_shell(), but it is const  int n = nbasis();  int nsh = nshell();  function_to_shell_.resize(n);  int ifunc = 0;  for (int i=0; i<nsh; i++) {      int nfun = operator()(i).nfunction();      for (int j=0; j<nfun; j++) {          function_to_shell_[ifunc] = i;          ifunc++;        }    }  if (matrixkit_.null())    matrixkit_ = SCMatrixKit::default_matrixkit();  so_matrixkit_ = new BlockedSCMatrixKit(matrixkit_);    if (basisdim_.null()) {    int nb = nshell();    int *bs = new int[nb];    for (int s=0; s < nb; s++)      bs[s] = shell(s).nfunction();    basisdim_ = new SCDimension(nbasis(), nb, bs, "basis set dimension");    delete[] bs;  }}voidGaussianBasisSet::set_matrixkit(const Ref<SCMatrixKit>& mk){  matrixkit_ = mk;  so_matrixkit_ = new BlockedSCMatrixKit(matrixkit_);}voidGaussianBasisSet::  recursively_get_shell(int&ishell,Ref<KeyVal>&keyval,			const char*element,			const char*basisname,                        BasisFileSet &bases,			int havepure,int pure,			int get){  char keyword[KeyVal::MaxKeywordLength],prefix[KeyVal::MaxKeywordLength];  sprintf(keyword,":basis:%s:%s",	  element,basisname);  int count = keyval->count(keyword);  if (keyval->error() != KeyVal::OK) {      keyval = bases.keyval(keyval, basisname);    }  count = keyval->count(keyword);  if (keyval->error() != KeyVal::OK) {      ExEnv::err0() << indent           << scprintf("GaussianBasisSet:: couldn't find \"%s\":\n", keyword);      keyval->errortrace(ExEnv::err0());      exit(1);    }  if (!count) return;  for (int j=0; j<count; j++) {      sprintf(prefix,":basis:%s:%s",	      element,basisname);      Ref<KeyVal> prefixkeyval = new PrefixKeyVal(keyval,prefix,j);      if (prefixkeyval->exists("get")) {          char* newbasis = prefixkeyval->pcharvalue("get");          if (!newbasis) {	      ExEnv::err0() << indent << "GaussianBasisSet: "                   << scprintf("error processing get for \"%s\"\n", prefix);              keyval->errortrace(ExEnv::err0());	      exit(1);	    }	  recursively_get_shell(ishell,keyval,element,newbasis,bases,                                havepure,pure,get);          delete[] newbasis;	}      else {          if (get) {	      if (havepure) shell_[ishell] = new GaussianShell(prefixkeyval,pure);	      else shell_[ishell] = new GaussianShell(prefixkeyval);	    }	  ishell++;	}    }}GaussianBasisSet::~GaussianBasisSet(){  delete[] name_;  int ii;  for (ii=0; ii<nshell_; ii++) {      delete shell_[ii];    }  delete[] shell_;}intGaussianBasisSet::max_nfunction_in_shell() const{  int i;  int max = 0;  for (i=0; i<nshell_; i++) {      if (max < shell_[i]->nfunction()) max = shell_[i]->nfunction();    }  return max;}intGaussianBasisSet::max_ncontraction() const{  int i;  int max = 0;  for (i=0; i<nshell_; i++) {      if (max < shell_[i]->ncontraction()) max = shell_[i]->ncontraction();    }  return max;}intGaussianBasisSet::max_angular_momentum() const{  int i;  int max = 0;  for (i=0; i<nshell_; i++) {      int maxshi = shell_[i]->max_angular_momentum();      if (max < maxshi) max = maxshi;    }  return max;}intGaussianBasisSet::max_cartesian() const{  int i;  int max = 0;  for (i=0; i<nshell_; i++) {      int maxshi = shell_[i]->max_cartesian();      if (max < maxshi) max = maxshi;    }  return max;}intGaussianBasisSet::max_ncartesian_in_shell(int aminc) const{  int i;  int max = 0;  for (i=0; i<nshell_; i++) {      int maxshi = shell_[i]->ncartesian_with_aminc(aminc);      if (max < maxshi) max = maxshi;    }  return max;}intGaussianBasisSet::max_nprimitive_in_shell() const{  int i;  int max = 0;  for (i=0; i<nshell_; i++) {      if (max < shell_[i]->nprimitive()) max = shell_[i]->nprimitive();    }  return max;}intGaussianBasisSet::max_am_for_contraction(int con) const{  int i;  int max = 0;  for (i=0; i<nshell_; i++) {      if (shell_[i]->ncontraction() <= con) continue;      int maxshi = shell_[i]->am(con);      if (max < maxshi) max = maxshi;    }  return max;}intGaussianBasisSet::function_to_shell(int func) const{  return function_to_shell_[func];}intGaussianBasisSet::ncenter() const{  return ncenter_;}intGaussianBasisSet::nshell_on_center(int icenter) const{  return center_to_nshell_[icenter];}intGaussianBasisSet::nbasis_on_center(int icenter) const{  return center_to_nbasis_[icenter];}intGaussianBasisSet::shell_on_center(int icenter, int ishell) const{  return center_to_shell_[icenter] + ishell;}const GaussianShell&GaussianBasisSet::operator()(int icenter,int ishell) const{  return *shell_[center_to_shell_[icenter] + ishell];}GaussianShell&GaussianBasisSet::operator()(int icenter,int ishell){  return *shell_[center_to_shell_[icenter] + ishell];}intGaussianBasisSet::equiv(const Ref<GaussianBasisSet> &b){  if (nshell() != b->nshell()) return 0;  for (int i=0; i<nshell(); i++) {      if (!shell_[i]->equiv(b->shell_[i])) return 0;    }  return 1;}voidGaussianBasisSet::print_brief(ostream& os) const{  os << indent     << "GaussianBasisSet:" << endl << incindent     << indent << "nbasis = " << nbasis_ << endl     << indent << "nshell = " << nshell_ << endl     << indent << "nprim  = " << nprim_ << endl;  if (name_) {      os << indent         << "name = \"" << name_ << "\"" << endl;    }  os << decindent;}voidGaussianBasisSet::print(ostream& os) const{  print_brief(os);  if (!SCFormIO::getverbose(os)) return;  os << incindent;  // Loop over centers  int icenter = 0;  int ioshell = 0;  for (icenter=0; icenter < ncenter_; icenter++) {      os << endl << indent         << scprintf(             "center %d: %12.8f %12.8f %12.8f, nshell = %d, shellnum = %d\n",             icenter,             r(icenter,0),             r(icenter,1),             r(icenter,2),             center_to_nshell_[icenter],             center_to_shell_[icenter]);      for (int ishell=0; ishell < center_to_nshell_[icenter]; ishell++) {	  os << indent             << scprintf("Shell %d: functionnum = %d, primnum = %d\n",                         ishell,shell_to_function_[ioshell],shell_to_primitive_[ioshell]);          os << incindent;	  operator()(icenter,ishell).print(os);          os << decindent;          ioshell++;	}    }  os << decindent;}/////////////////////////////////////////////////////////////////////////////// GaussianBasisSet::ValueDataGaussianBasisSet::ValueData::ValueData(    const Ref<GaussianBasisSet> &basis,    const Ref<Integral> &integral){  maxam_ = basis->max_angular_momentum();  civec_ = new CartesianIter *[maxam_+1];  sivec_ = new SphericalTransformIter *[maxam_+1];  for (int i=0; i<=maxam_; i++) {      civec_[i] = integral->new_cartesian_iter(i);      if (i>1) sivec_[i] = integral->new_spherical_transform_iter(i);      else sivec_[i] = 0;    }}GaussianBasisSet::ValueData::~ValueData(){  for (int i=0; i<=maxam_; i++) {      delete civec_[i];      delete sivec_[i];    }  delete[] civec_;  delete[] sivec_;}/////////////////////////////////////////////////////////////////////////////// Local Variables:// mode: c++// c-file-style: "CLJ"// End:

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -