当前位置: 首页>>代码示例>>C++>>正文


C++ Basis::getCharges方法代码示例

本文整理汇总了C++中Basis::getCharges方法的典型用法代码示例。如果您正苦于以下问题:C++ Basis::getCharges方法的具体用法?C++ Basis::getCharges怎么用?C++ Basis::getCharges使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Basis的用法示例。


在下文中一共展示了Basis::getCharges方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: print

// Print out the basis set specification in the format:
// (example is C atom in 3-21G basis set)
// BASIS: 6-31G
// Total no. of cgbfs: 9
// Total no. of primitives: 9
// ===============
//  Specification
// ===============
// Atom      Shell     #CGBFs    #Prims
// ......................................
// C         s          3         6
//           p          6         3
// (if full = true, then continue with this)
// ===============
// Basis Functions
// ===============
// Atom      Shell     BF    Coeff        Exponent
// .................................................
// C         s         1     0.0617669    172.2560
//                           0.358794     25.91090
//                           0.700713     5.533350
// etc...
void Logger::print(Basis& b, bool full) const
{
  // Collect the data needed for printing
  int nbfs = b.getNBFs(); // Store number of cgbfs and prims
  int nprims = 0;

  Vector qs = b.getCharges();
  // Sort the qs and get rid of duplicates
  qs.sort();
  Vector qtemp(qs.size());
  qtemp[0] = qs(0);
  int k = 1;
  for (int i = 1; i < qs.size(); i++){
    if (qs(i) != qtemp[k-1]){
      qtemp[k] = qs(i);
      k++;
    }
  }
  qs = qtemp;
  qs.resizeCopy(k);

  // Now sum over all basis functions to get the number of prims
  Vector c(3); c[0] = 0.0; c[1] = 0.0; c[2] = 0.0;
  BF bftemp(c, 0, 0, 0, c, c);

  for (int i = 0; i < nbfs; i++){
    bftemp = b.getBF(i);
    nprims += bftemp.getNPrims();
  }

  // Start printing
  title("Basis Set");
  outfile << "BASIS: " << b.getName() << "\n";
  outfile << "Total no. of cgbfs: " << nbfs << "\n";
  outfile << "Total no. of prims: " << nprims << "\n";
  title("Specification");
  outfile << std::setw(8) << "Atom";
  outfile << std::setw(8) << "Shell";
  outfile << std::setw(8) << "#CGBFs";
  outfile << std::setw(8) << "#Prims\n";
  outfile << std::string(35, '.') << "\n";
  
  // loop over the atom types
  outfile << std::setprecision(2);
  Vector subshells; Vector sublnums; 
  for (int i = 0; i < k; i++){
    int nc = 0; int np = 0;
    outfile << std::setw(8) << getAtomName(qs(i));
    subshells = b.getShells(qs[i]);

    sublnums = b.getLnums(qs[i]);
    outfile << std::setw(8) << getShellName(sublnums[0]);
    outfile << std::setw(8) << subshells[0];

    for (int j = 0; j < subshells[0]; j++){
      np += b.getBF(qs[i], j).getNPrims();
    }

    nc += subshells[0];
    outfile << std::setw(8) << np << "\n";
    for (int j = 1; j < subshells.size(); j++){
      outfile << std::setw(8) << "";
      outfile << std::setw(8) << getShellName(sublnums[j]);
      outfile << std::setw(8) << subshells[j];
      np = 0;
      for (int l = 0; l < subshells[j]; l++){
	np += b.getBF(qs[i], nc + l).getNPrims();	
      }
      nc += subshells[j];
      outfile << std::setw(8) << np << "\n";
    }

  }
  outfile << std::setprecision(8);
  // Now print out basis functions if required
  if (full) {
    title("Basis Functions");
    outfile << std::setw(8) << "Atom";
//.........这里部分代码省略.........
开发者ID:rashaw1,项目名称:molecular,代码行数:101,代码来源:logger.cpp


注:本文中的Basis::getCharges方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。