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


C++ vector3::print方法代码示例

本文整理汇总了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 ");
	}
开发者ID:yalcinozhabes,项目名称:pythonJDFTx,代码行数:25,代码来源:CoulombPeriodic.cpp

示例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 ");
}
开发者ID:yalcinozhabes,项目名称:pythonJDFTx,代码行数:16,代码来源:Basis.cpp


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