本文整理汇总了C++中path::get_NumParticle方法的典型用法代码示例。如果您正苦于以下问题:C++ path::get_NumParticle方法的具体用法?C++ path::get_NumParticle怎么用?C++ path::get_NumParticle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类path
的用法示例。
在下文中一共展示了path::get_NumParticle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: rand
vector<double> pimc::pimc_run(int NumSteps, path p)
{
int NumParticle=p.get_NumParticle();
for (int steps=0; steps<NumSteps; steps++)
{
// for each particle try a center-of-mass random move
for (int i=0; i<NumParticle; i++)
{
int ptcl= (int) NumParticle*((double) rand() / (RAND_MAX)) ;
//cout<< ptcl << endl;
if( CenterOfMassMove(p,ptcl) )
cnumAccept += 1;
}
// for each particle try a staging move
/*for (int i=0; i<NumParticle; i++)
{
int ptcl= (int) NumParticle*((double) rand() / (RAND_MAX)) ;
if ( StagingMove(p,ptcl))
snumAccept += 1;
}*/
// measure the energy
if ( (steps % observableSkip == 0) && (steps > equilSkip) )
{
double E = p.Energy();
EnergyTrace.push_back(E);
}
}
cout<< "Acceptance Ratios:" <<endl;
cout<< "Total Sampling: " << NumSteps*NumParticle << endl;
cout<< "Accepted CM: " << cnumAccept <<endl;
cout<< "Accepted Stage: " << snumAccept <<endl;
cout<< "Center of Mass: " << ((1.0*cnumAccept)/(NumSteps*NumParticle)) << endl;
cout<< "Staging: " << ((1.0*snumAccept)/(NumSteps*NumParticle)) << endl;
return EnergyTrace;
}