TlSparseSymmetricMatrix DfEriX_Parallel::makeSchwarzTable( const TlOrbitalInfoObject& orbitalInfo) { this->log_.info("make Schwartz cutoff table(parallel): start"); TlCommunicate& rComm = TlCommunicate::getInstance(); const int numOfProcs = rComm.getNumOfProcs(); const int rank = rComm.getRank(); const index_type maxShellIndex = orbitalInfo.getNumOfOrbitals(); TlSparseSymmetricMatrix schwarz(maxShellIndex); DfEriEngine engine; engine.setPrimitiveLevelThreshold(0.0); int counter = 0; for (index_type shellIndexP = 0; shellIndexP < maxShellIndex;) { const int shellTypeP = orbitalInfo.getShellType(shellIndexP); const int maxStepsP = 2 * shellTypeP + 1; for (index_type shellIndexQ = 0; shellIndexQ < maxShellIndex;) { const int shellTypeQ = orbitalInfo.getShellType(shellIndexQ); const int maxStepsQ = 2 * shellTypeQ + 1; if (counter == rank) { // const DfEriEngine::AngularMomentum2 queryPQ(0, 0, shellTypeP, // shellTypeQ); const DfEriEngine::CGTO_Pair PQ = // engine.getCGTO_pair(orbitalInfo, // shellIndexP, // shellIndexQ, // 0.0); // engine.calc(queryPQ, queryPQ, PQ, PQ); engine.calc(0, orbitalInfo, shellIndexP, 0, orbitalInfo, shellIndexQ, 0, orbitalInfo, shellIndexP, 0, orbitalInfo, shellIndexQ); double maxValue = 0.0; const int maxIndex = maxStepsP * maxStepsQ; for (int index = 0; index < maxIndex; ++index) { maxValue = std::max(maxValue, std::fabs(engine.WORK[index])); } schwarz.set(shellIndexP, shellIndexQ, std::sqrt(maxValue)); } shellIndexQ += maxStepsQ; ++counter; if (counter >= numOfProcs) { counter = 0; } } shellIndexP += maxStepsP; } this->log_.info("make schwartz table: finalize"); // rComm.gatherToMaster(schwarz); // rComm.broadcast(schwarz); rComm.allReduce_SUM(schwarz); this->log_.info("make Schwartz cutoff table(parallel): end"); return schwarz; }
void tfield(int anzy,int xmin, int xmax, int ymin, int ymax, double *t,double scale, int xofs, int yofs, int xsize, int ysize, int rough) { double si,co,l1,l2,tet,dxx,dxy,dyy,dd1,dd2,sq,*pos; int i,j,x,y,x1,y1,x2,y2,x3,y3,x4,y4,dx1,dy1,dx3,dy3,nox,noy,myxofs,myyofs; XPoint mypoint[4]; nox=(xmax-xmin)+2; /* +2 to make all blobs visible */ noy=(ymax-ymin)+2; myxofs=((xmax-xmin-1)%rough)/2; myyofs=((ymax-ymin-1)%rough)/2; if (scale>0) { for (i=0;i<(xmax-xmin-1)/rough+1;i++) for (j=0;j<(ymax-ymin-1)/rough+1;j++) { pos=&t[3*(((xmin+i)*rough+myxofs)*anzy+(ymin+j)*rough+myyofs)]; /* we do not need this address calculation!!! */ dxx=*(pos++); dxy=*(pos++); dyy=*(pos); dd1=(dxx+dyy)/2; dd2=(dxx-dyy)/2; sq=sqrt(dd2*dd2+dxy*dxy); l1=dd1+sq; l2=dd1-sq; tet=-atan2(dxy,l1-dyy); si=sin(tet); co=cos(tet); x=xofs+(i*rough+myxofs+1)*xsize/(nox-1); y=yofs+ysize-(j*rough+myyofs+1)*ysize/(noy-1); x1=-co*l1/scale*rough; y1=-si*l1/scale*rough; dx1=y1*0.2; dy1=-x1*0.2; x2=x-x1; y2=y-y1; x1+=x; y1+=y; x3=+si*l2/scale*rough; y3=-co*l2/scale*rough; dx3=y3*0.2; dy3=-x3*0.2; x4=x-x3; y4=y-y3; x3+=x; y3+=y; if (l1>0){ mypoint[0].x=x1; mypoint[0].y=y1; mypoint[1].x=x+dx1; mypoint[1].y=y+dy1; mypoint[2].x=x2; mypoint[2].y=y2; mypoint[3].x=x-dx1; mypoint[3].y=y-dy1; mypolygon(schwarz(),mypoint,4); } else{ mypoint[0].x=x1+dx1; mypoint[0].y=y1+dy1; mypoint[1].x=x2-dx1; mypoint[1].y=y2-dy1; mypoint[2].x=x2+dx1; mypoint[2].y=y2+dy1; mypoint[3].x=x1-dx1; mypoint[3].y=y1-dy1; mypolygon(rot(),mypoint,4); } if (l2>0){ mypoint[0].x=x3; mypoint[0].y=y3; mypoint[1].x=x+dx3; mypoint[1].y=y+dy3; mypoint[2].x=x4; mypoint[2].y=y4; mypoint[3].x=x-dx3; mypoint[3].y=y-dy3; mypolygon(schwarz(),mypoint,4); } else{ mypoint[0].x=x3+dx3; mypoint[0].y=y3+dy3; mypoint[1].x=x4-dx3; mypoint[1].y=y4-dy3; mypoint[2].x=x4+dx3; mypoint[2].y=y4+dy3; mypoint[3].x=x3-dx3; mypoint[3].y=y3-dy3; mypolygon(rot(),mypoint,4); } } } }