本文整理汇总了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);
}
}
}
}
}
}
示例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];
}
}
}
}
示例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;
}
}
}
}
}
}
示例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;
}