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


C++ Domain::WalkOnSphere方法代码示例

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


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

示例1: while

WOSPotential::ValueType
WOSPotential::method4(ParticleSet& P)
{
  double V0 = 0.0;
  WP->setP(P);
  Domain domain;
  double pe = 0.0;
  double dpe = 0.0;
  int hfruns = m_runs/2;
  for(int irun = 0; irun < hfruns; irun++)
  {
    domain.runner = WP->R0;                /// initialise runner
    domain.in_device = true;               /// runner is inside device
    device->MaximumSphere(domain);         /// calc d_{0}
    domain.WalkOnSphere();
    posvec_t r1(-domain.runner[0],-domain.runner[1],-domain.runner[2]);
    double vD0 = device->OC_contrib0(domain.radius,domain.runner,WP);
    double vbare = device->OC_passage(V0,domain,WP);
    WP->calcwt();
    double vol = 0.0;
    while(domain.in_device)
    {
      device->MaximumSphere(domain);
      vol += device->contribk(domain,WP);
      domain.WalkOnSphere();
      vbare += device->OC_passage(V0,domain,WP);
    }
    vol *= WP->qwt;   /// the half has been included
    double vrun = vol + vbare + vD0;
    pe += vrun;
    dpe += vrun * vrun;
    domain.runner = WP->R0;                /// initialise runner
    domain.in_device = true;               /// runner is inside device
    device->MaximumSphere(domain);         /// calc d_{0}
    domain.runner = r1;
    //domain.WalkOnSphere();
    vD0 = device->OC_contrib0(domain.radius,domain.runner,WP);
    vbare = device->OC_passage(V0,domain,WP);
    WP->calcwt();
    vol = 0.0;
    while(domain.in_device)
    {
      device->MaximumSphere(domain);
      vol += device->contribk(domain,WP);
      domain.WalkOnSphere();
      vbare += device->OC_passage(V0,domain,WP);
    }
    vol *= WP->qwt;   /// the half has been included
    vrun = vol + vbare + vD0;
    pe += vrun;
    dpe += vrun * vrun;
  }
  pe *= m_norm;
  dpe *= m_norm;
  dpe = sqrt(m_norm * fabs ( dpe - pe * pe ));
  cout << pe << '\t' << dpe << endl;
  exit(-1);
  return pe;
}
开发者ID:digideskio,项目名称:qmcpack,代码行数:59,代码来源:WOSPotential.cpp

示例2: sample_point

void HeteroStructure::sample_point(Domain& domain){

  calc_dfrac(domain);
  sample_prob(domain);

  int nlayers = layers.size();

  double phi = 2.0 * M_PI * Random();
  double rnd = Random();
  double hop = Random();

  for( int ilayer = 0; ilayer < nlayers; ilayer++){
    if ( hop <= layers[ilayer]->prob_d){
      double theta = acos( ( 1.0 - rnd ) * interfaces[ ilayer + 1 ]->d_frac
			   + rnd * interfaces[ ilayer ]->d_frac );
      domain.WalkOnSphere( theta, phi );
      return;
    }
  }
  for(int ilayer = 0; ilayer < nlayers; ilayer++){
    if(hop <= interfaces[ilayer]->prob_d){
      double d = fabs( interfaces[ilayer]->d_frac );
      double denom = 1.0 - ( 1.0 - d ) * rnd; denom = denom * denom;
      double rho = domain.radius * d * sqrt( 1.0 / denom - 1.0 );
      weight_bc *= interfaces[ ilayer ]->xsign;
      domain.WalkOnDisk( rho, phi, interfaces[ ilayer ]->z_val );
      return;
    }
  }  

}
开发者ID:digideskio,项目名称:qmcpack,代码行数:31,代码来源:HeteroStructure.cpp


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