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


C++ ParticleList::getNext方法代码示例

本文整理汇总了C++中ParticleList::getNext方法的典型用法代码示例。如果您正苦于以下问题:C++ ParticleList::getNext方法的具体用法?C++ ParticleList::getNext怎么用?C++ ParticleList::getNext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ParticleList的用法示例。


在下文中一共展示了ParticleList::getNext方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: calculateForces

void MDcalculation::calculateForces(bool monitoring){
	V = 0;
	ParticleList* list;
	//Calculating weights, finding 2BF and 3BF particle lists
	findNeighbours();
	// return;
	//Calculating 2BF and 3BF
	for(int i = 0; i < Nx + 2; i++){
	for(int j = 0; j < Ny + 2; j++){
	for(int k = 0; k < Nz + 2; k++){
		list = cells[i][j][k];
		if(i != 0 && i != Nx + 1 && j != 0 && j != Ny + 1 && k != 0 && k != Nz + 1){
			//Internal 3BF calculation
			for(Particle* p = list->getFirst(); list->hasNext(); p = list->getNext()){
				V += potential->force2(p);
				V += potential->force3(p);
			}
		}else{
			//3BF for boundary with internal
			for(Particle* p = list->getFirst(); list->hasNext(); p = list->getNext()){
				V += potential->boundaryForce3(p);
			}
		}
	}
	}
	}
}
开发者ID:AndreDouzette,项目名称:MolecularDynamics,代码行数:27,代码来源:MDcalculation.cpp

示例2: calculateMeanDisplacement

void MDcalculation::calculateMeanDisplacement(){
	//Resetting
	for(int t = 0; t < 3; t++){
		rMeanSquared[t] = 0;
	}
	ParticleList* list;
	for(int i = 1; i < Nx + 1; i++){
	for(int j = 1; j < Ny + 1; j++){
	for(int k = 1; k < Nz + 1; k++){
		list = cells[i][j][k];
		for(Particle* p = list->getFirst(); list->hasNext(); p = list->getNext()){
			for(int d = 0; d < 3; d++){
				rMeanSquared[p->type] += p->rReal[d]*p->rReal[d];
			}
		}
	}
	}
	}
	MPI_Reduce(rMeanSquared, rMeanSquaredSum, 3, MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
	if(rank == 0){
		for(int t = 0; t < 3; t++){
			if(NparticlesType[t] == 0){
				rMeanSquaredSum[t] = 0;
			}else{
				rMeanSquaredSum[t] = rMeanSquaredSum[t]/NparticlesType[t];
			}
		}
	}
}
开发者ID:AndreDouzette,项目名称:MolecularDynamics,代码行数:29,代码来源:MDcalculation.cpp

示例3: thermostat

void MDcalculation::thermostat(double dt, double T0, double tau, double T){
	double gamma = sqrt(1 + dt/tau*(T0/T - 1));
	//Scaling velocities
	ParticleList* list;
	for(int i = 1; i <= Nx; i++){
	for(int j = 1; j <= Ny; j++){
	for(int k = 1; k <= Nz; k++){
		list = cells[i][j][k];
		for(Particle* p = list->getFirst(); list->hasNext(); p = list->getNext()){
			for(int d = 0; d < 3; d++){
				p->v[d] = p->v[d]*gamma;
			}
		}
	}
	}
	}
} 
开发者ID:AndreDouzette,项目名称:MolecularDynamics,代码行数:17,代码来源:MDcalculation.cpp

示例4: calculateKineticEnergy

void MDcalculation::calculateKineticEnergy(){
	K = 0;
	double Ksum;
	double v2;
	ParticleList* list;
	for(int i = 1; i < Nx + 1; i++){
	for(int j = 1; j < Ny + 1; j++){
	for(int k = 1; k < Nz + 1; k++){
		list = cells[i][j][k];
		for(Particle* p = list->getFirst(); list->hasNext(); p = list->getNext()){
			if(container->mark[p->id]){
				continue;
			}
			v2 = p->v[0]*p->v[0] + p->v[1]*p->v[1] + p->v[2]*p->v[2];
			K += potential->m[p->type]*v2;
		}
	}
	}
	}
	K = 0.5*K;
	MPI_Allreduce(&K, &Ksum, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD);
	K = Ksum;
}
开发者ID:AndreDouzette,项目名称:MolecularDynamics,代码行数:23,代码来源:MDcalculation.cpp


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