本文整理汇总了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;
}
示例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;
}
}
}