本文整理汇总了C++中vector3::print方法的典型用法代码示例。如果您正苦于以下问题:C++ vector3::print方法的具体用法?C++ vector3::print怎么用?C++ vector3::print使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vector3
的用法示例。
在下文中一共展示了vector3::print方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: R
EwaldPeriodic(const matrix3<>& R, int nAtoms)
: R(R), G((2*M_PI)*inv(R)), RTR((~R)*R), GGT(G*(~G))
{ logPrintf("\n---------- Setting up ewald sum ----------\n");
//Determine optimum gaussian width for Ewald sums:
// From below, the number of reciprocal cells ~ Prod_k |R.column[k]|
// and number of real space cells ~ Prod_k |G.row[k]|
// including the fact that the real space cost ~ Natoms^2/cell
// and the reciprocal space cost ~ Natoms/cell
sigma = 1.;
for(int k=0; k<3; k++)
sigma *= R.column(k).length() / G.row(k).length();
sigma = pow(sigma/std::max(1,nAtoms), 1./6);
logPrintf("Optimum gaussian width for ewald sums = %lf bohr.\n", sigma);
//Carry real space sums to Rmax = 10 sigma and Gmax = 10/sigma
//This leads to relative errors ~ 1e-22 in both sums, well within double precision limits
for(int k=0; k<3; k++)
{ Nreal[k] = 1+ceil(CoulombKernel::nSigmasPerWidth * G.row(k).length() * sigma / (2*M_PI));
Nrecip[k] = 1+ceil(CoulombKernel::nSigmasPerWidth * R.column(k).length() / (2*M_PI*sigma));
}
logPrintf("Real space sum over %d unit cells with max indices ", (2*Nreal[0]+1)*(2*Nreal[1]+1)*(2*Nreal[2]+1));
Nreal.print(globalLog, " %d ");
logPrintf("Reciprocal space sum over %d terms with max indices ", (2*Nrecip[0]+1)*(2*Nrecip[1]+1)*(2*Nrecip[2]+1));
Nrecip.print(globalLog, " %d ");
}
示例2: setup
void Basis::setup(const GridInfo& gInfo, const IonInfo& iInfo, double Ecut, const vector3<> k)
{ //Find the indices within Ecut:
vector3<int> iGbox; for(int i=0; i<3; i++) iGbox[i] = 1 + int(sqrt(2*Ecut) * gInfo.R.column(i).length() / (2*M_PI));
std::vector< vector3<int> > iGvec;
std::vector<int> indexVec;
vector3<int> iG;
for(iG[0]=-iGbox[0]; iG[0]<=iGbox[0]; iG[0]++)
for(iG[1]=-iGbox[1]; iG[1]<=iGbox[1]; iG[1]++)
for(iG[2]=-iGbox[2]; iG[2]<=iGbox[2]; iG[2]++)
if(0.5*dot(iG+k, gInfo.GGT*(iG+k)) <= Ecut)
{ iGvec.push_back(iG);
indexVec.push_back(gInfo.fullGindex(iG));
}
setup(gInfo, iInfo, indexVec, iGvec);
logPrintf("nbasis = %lu for k = ", nbasis); k.print(globalLog, " %6.3f ");
}