本文整理汇总了C++中ParticleSet::applyMinimumImage方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleSet::applyMinimumImage方法的具体用法?C++ ParticleSet::applyMinimumImage怎么用?C++ ParticleSet::applyMinimumImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ParticleSet
的用法示例。
在下文中一共展示了ParticleSet::applyMinimumImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: evaluate
EnergyDensityEstimator::Return_t EnergyDensityEstimator::evaluate(ParticleSet& P)
{
if(have_required_traces)
{
Pdynamic = &P;
//Collect positions from ParticleSets
int p=0;
{
const ParticlePos_t& Rs = Pdynamic->R;
for(int i=0; i<Rs.size(); i++)
{
R[p] = Rs[i];
p++;
}
}
if(Pstatic)
{
const ParticlePos_t& Rs = Pstatic->R;
for(int i=0; i<Rs.size(); i++)
{
R[p] = Rs[i];
p++;
}
}
if(P.Lattice.SuperCellEnum != SUPERCELL_OPEN)
P.applyMinimumImage(R);
//Convert information accumulated in ParticleSets into EnergyDensity quantities
RealType w=w_trace->sample[0];
p=0;
{
Vd_trace->combine();
const ParticleSet& Ps = *Pdynamic;
const vector<TraceReal>& Ts = Td_trace->sample;
const vector<TraceReal>& Vs = Vd_trace->sample;
for(int i=0; i<Ps.getTotalNum(); i++)
{
EDValues(p,W) = w;
EDValues(p,T) = w*Ts[i];
EDValues(p,V) = w*Vs[i];
p++;
}
}
if(Pstatic)
{
Vs_trace->combine();
const ParticleSet& Ps = *Pstatic;
const vector<TraceReal>& Vs = Vs_trace->sample;
for(int i=0; i<Ps.getTotalNum(); i++)
{
EDValues(p,W) = w;
EDValues(p,T) = 0.0;
EDValues(p,V) = w*Vs[i];
p++;
}
}
//Accumulate energy density in spacegrids
const DistanceTableData &dtab(*P.DistTables[dtable_index]);
fill(particles_outside.begin(),particles_outside.end(),true);
for(int i=0; i<spacegrids.size(); i++)
{
SpaceGrid& sg = *spacegrids[i];
sg.evaluate(R,EDValues,P.Collectables,particles_outside,dtab);
}
//Accumulate energy density of particles outside any spacegrid
int bi,v;
const int bimax = outside_buffer_offset + (int)nEDValues;
for(int p=0; p<particles_outside.size(); p++)
{
if(particles_outside[p])
{
for(bi=outside_buffer_offset,v=0; bi<bimax; bi++,v++)
{
P.Collectables[bi] += EDValues(p,v);
}
}
}
nsamples++;
#if defined(ENERGYDENSITY_CHECK)
int thread = omp_get_thread_num();
#pragma omp critical (edcheck)
{
RealType Dsum = 0.0;
RealType Tsum = 0.0;
RealType Vsum = 0.0;
RealType Esum = 0.0;
for(int p=0; p<nparticles; p++)
{
Dsum+=EDValues(p,W);
Tsum+=EDValues(p,T);
Vsum+=EDValues(p,V);
}
Esum=Tsum+Vsum;
static int cnt=0;
//app_log()<<"eval ED Dsum"<<cnt<<" "<<Dsum<<endl;
app_log()<<thread<<" eval ED "<<cnt<<" "<<Tsum<<" "<<Vsum<<" "<<Esum<<endl;
int nvals=(int)nEDValues;
RealType edvals[nvals];
RealType edtmp [nvals];
for(int v=0; v<nvals; v++)
edvals[v]=0.0;
//.........这里部分代码省略.........