コード例 #1
0
ファイル: AOContraction.cpp プロジェクト: MRChemSoft/mrchem
/** Normalization goes like this (thanks Radovan)

    < AO | AO > =   1 for s, px, py, pz, dxy, dxz, dyz, fxyz
            3 for dxx, dyy, dzz, fxxy, ...
               15     fxxx, fyyy, fzzz, gxxxy, ...
              105     gxxxx, ...
              ...     ...
            9 for gxxyy, ...
              etc     ...
*/
GaussExp<3> AOContraction::getContraction(int m, const mrcpp::Coord<3> &center) const {
    assert(m >= 0 and m < this->nComp);
    GaussExp<3> ctr;
    double normFac = 1.0;
    const int *angMom = GTOS[this->L].comp[m];
    for (int i = 0; i < 3; i++) {
        switch (angMom[i]) {
            case 0:
                normFac *= 1.0;
                break;
            case 1:
                normFac *= 1.0;
                break;
            case 2:
                normFac *= 3.0;
                break;
            case 3:
                normFac *= 15.0;
                break;
            default:
                MSG_ERROR("We don't support g-functions at the moment");
        }
    }
    normFac = std::sqrt(normFac);

    std::array<int, 3> pow{angMom[0], angMom[1], angMom[2]};
    for (unsigned int i = 0; i < expo.size(); i++) {
        GaussFunc<3> gto(this->expo[i], 1.0, center, pow);
        gto.normalize();
        gto.setCoef(normFac * gto.getCoef() * this->coefs[i]);
        ctr.append(gto);
    }
    return ctr;
}
コード例 #2
0
ファイル: dump.cpp プロジェクト: poftwaresatent/estar
  void dump_upwind(const Algorithm & algo, const Grid * grid, FILE * stream)
  {
    Upwind const & upwind(algo.GetUpwind());
    shared_ptr<GridNode const> gfrom;
    shared_ptr<GridCSpace const> gcspace;
    if (grid)
      gcspace = grid->GetCSpace();
    fprintf(stream, "upwind edges (from, to):\n");
    for (vertex_read_iteration iv(algo.GetCSpace()->begin());
	iv.not_at_end(); ++iv) {
      if (gcspace)
	gfrom = gcspace->Lookup(*iv);
      Upwind::set_t const & downwind(upwind.GetDownwind(*iv));
      for(Upwind::set_t::const_iterator id(downwind.begin());
	  id != downwind.end(); ++id){
	fprintf(stream, "  (%zu, %zu)", *iv, *id);
	if (gcspace && gfrom) {
	  shared_ptr<GridNode const> gto(gcspace->Lookup(*id));
	  if (gto)
	    fprintf(stream, " [(%zu, %zu) -> (%zu, %zu)]",
		    gfrom->ix, gfrom->iy, gto->ix, gto->iy);
	}
	fprintf(stream, "\n");
      }
    }
  }