Allink
v0.1
|
00001 #include "Forces.h" 00002 void Forces::CreateInitial(){ 00003 if(VAR_IF_TYPE(SysShape,SYS_1D)){ 00004 Create1d(); 00005 } 00006 else if(VAR_IF_TYPE(SysShape,SYS_2D)){ 00007 Create2d(); 00008 } 00009 else if(VAR_IF_TYPE(SysShape,SYS_3D)){ 00010 Create3d(); 00011 } 00012 else if(VAR_IF_TYPE(SysShape,SYS_STALK)){ 00013 CreateStalk(); 00014 } 00015 else if(VAR_IF_TYPE(SysShape,SYS_LEAVES)){ 00016 CreateLeaves(); 00017 } 00018 else if(VAR_IF_TYPE(SysShape,SYS_PORE)){ 00019 CreatePore(); 00020 } 00021 else if(VAR_IF_TYPE(SysShape,SYS_ROD)){ 00022 CreateRod(); 00023 } 00024 else if(VAR_IF_TYPE(SysShape,SYS_RIGID)){ 00025 CreateRigid(); 00026 } 00027 else if(VAR_IF_TYPE(SysShape,SYS_MD)){ 00028 CreateMD(); 00029 } 00030 else if(VAR_IF_TYPE(SysShape,SYS_MC)){ 00031 CreateMC(); 00032 } 00033 else if(VAR_IF_TYPE(SysShape,SYS_ELECTRO)){ 00034 CreateElectro(); 00035 } 00036 else if(VAR_IF_TYPE(SysShape,SYS_TRIAL)){ 00037 int NSect = 3; 00038 double Pos[3]; 00039 for(int d=0;d<3;d++){ 00040 Pos[d] = .5*pEdge(d)/(double)NSect; 00041 } 00042 for(int p=0;p<pNPart();p++){ 00043 for(int d=0;d<3;d++){ 00044 Pm[p].Pos[d] = Pos[d]; 00045 } 00046 Pm[p].Typ = 0; 00047 Pos[0] += pEdge(0)/(double)NSect; 00048 if(Pos[0] > pEdge(0)){ 00049 Pos[0] = .5*pEdge(0)/(double)NSect; 00050 Pos[1] += pEdge(1)/(double)NSect; 00051 if(Pos[1] > pEdge(1)){ 00052 Pos[1] = .5*pEdge(1)/(double)NSect; 00053 Pos[2] += pEdge(2)/(double)NSect; 00054 } 00055 } 00056 } 00057 // Pm[0].Pos[0] = .1;Pm[0].Pos[1] = .5;Pm[0].Pos[2]= .5; 00058 // Pm[1].Pos[0] = .2;Pm[1].Pos[1] = .6;Pm[1].Pos[2]= .7; 00059 // Pm[2].Pos[0] = .3;Pm[2].Pos[1] = .9;Pm[2].Pos[2]= .2; 00060 // Pm[3].Pos[0] = .4;Pm[3].Pos[1] = .3;Pm[3].Pos[2]= .5; 00061 // Pm[4].Pos[0] = .5;Pm[4].Pos[1] = .4;Pm[4].Pos[2]= .6; 00062 } 00063 else{ 00064 printf("System shape not recognized %d\n",SysShape); 00065 return ; 00066 } 00067 Old2Move = Bead2Move; 00068 VAR_ADD_TYPE(SysType,VAR_SYS_TXVL); 00069 VAR_ADD_TYPE(SysType,VAR_EDGE); 00070 } 00071 void Forces::Create2d(){ 00072 double Dx = pEdge(0)/(double)(nEdge[0]); 00073 double Dy = pEdge(1)/(double)(nEdge[1]); 00074 for(int px=0;px<nEdge[0];px++){ 00075 for(int py=0;py<nEdge[1];py++){ 00076 int p = px*nEdge[1]+py; 00077 Pm[p].Idx = p; 00078 Pm[p].Pos[0] = Dx*(double)px + .5*Dx; 00079 Pm[p].Pos[1] = Dy*(double)py + .5*Dy; 00080 Pm[p].Pos[2] = 0.; 00081 Pm[p].CId = py; 00082 Pm[p].Typ = 0; 00083 if(px == 0 && BoundCond[0]){ 00084 Pm[p].Typ = 2; 00085 } 00086 if(px == nEdge[0]-1 && BoundCond[1]){ 00087 Pm[p].Typ = 2; 00088 } 00089 if(py == 0 && BoundCond[2]){ 00090 Pm[p].Typ = 2; 00091 } 00092 if(py == nEdge[1]-1 && BoundCond[3]){ 00093 Pm[p].Typ = 2; 00094 } 00095 Ln[p].NLink = 4; 00096 int pym1 = p-1; 00097 if( py-1 < 0 ) pym1 += nEdge[1]; 00098 if(pym1 >= pNPart() ) pym1 -= pNPart(); 00099 Ln[p].Link[0] = pym1; 00100 int pyp1 = p+1; 00101 if( py+1 >= nEdge[1]) pyp1 -= nEdge[1]; 00102 if(pyp1 < 0) pyp1 += pNPart(); 00103 Ln[p].Link[1] = pyp1; 00104 int pxm1 = p-nEdge[1]; 00105 if(pxm1 < 0) pxm1 += pNPart(); 00106 Ln[p].Link[2] = pxm1; 00107 int pxp1 = p+nEdge[1]; 00108 if(pxp1 > pNPart()-1) pxp1 -= pNPart(); 00109 Ln[p].Link[3] = pxp1; 00110 //printf("%d) %d %d %d %d \n",p,Ln[p].Link[0],Ln[p].Link[1],Ln[p].Link[2],Ln[p].Link[3]); 00111 } 00112 } 00113 //Ln[0].Link[0] = nEdge[0]-1; 00114 AddRigid(); 00115 } 00116 void Forces::Create3d(){ 00117 double Dx = pEdge(0)/(double)(NEdge-1); 00118 double Dy = pEdge(1)/(double)(NEdge-1); 00119 double Dz = pEdge(2)/(double)(NEdge-1); 00120 Kf.Elong[1] = Dx; 00121 Kf.Elong[2] = Dy; 00122 Kf.Elong[0] = Dz; 00123 Kf.El[0] = 11.;//Elastic coupling 00124 Kf.El[1] = 11.;//Elastic coupling 00125 Kf.El[2] = 11.;//Elastic coupling 00126 for(int px=0,ppp=0;px<NEdge;px++){ 00127 for(int py=0;py<NEdge;py++){ 00128 for(int pz=0;pz<NEdge;pz++){ 00129 Pm[ppp].Idx = ppp; 00130 Pm[ppp].Pos[0] = Dx*(double)px; 00131 Pm[ppp].Pos[1] = Dy*(double)py;//Mate->Casuale();//Dy*(double)p; 00132 Pm[ppp].Pos[2] = Dz*(double)pz;//Mate->Casuale(); 00133 // if( p == 20) 00134 // Pm[p].Pos[2] = .01; 00135 int link = 0; 00136 if(pz != NEdge-1){ 00137 Ln[ppp].Link[link] = ppp+1; 00138 link++; 00139 } 00140 if(pz != 0){ 00141 Ln[ppp].Link[link] = ppp-1; 00142 link++; 00143 } 00144 if(py != 0){ 00145 Ln[ppp].Link[link] = ppp-NEdge; 00146 link++; 00147 } 00148 if(py != NEdge-1){ 00149 Ln[ppp].Link[link] = ppp+NEdge; 00150 link++; 00151 } 00152 if(px != 0){ 00153 Ln[ppp].Link[link] = ppp-NEdge*NEdge; 00154 link++; 00155 } 00156 if(px != NEdge-1){ 00157 Ln[ppp].Link[link] = ppp+NEdge*NEdge; 00158 link++; 00159 } 00160 Ln[ppp].NLink = link; 00161 if( (px == 0 || px == NEdge -1) && 00162 (py == 0 || py == NEdge -1) && 00163 (pz == 0 || pz == NEdge -1)) 00164 Pm[ppp].Typ = 2; 00165 //for(int l=0;l<Ln[ppp].NLink;l++) 00166 //printf("%d %d %lf %lf %lf\n",ppp,Pm[ppp].Link[l],Pm[ppp].Pos[0] - Pm[Pm[ppp].Link[l]].Pos[0],Pm[ppp].Pos[1] - Pm[Pm[ppp].Link[l]].Pos[1],Pm[ppp].Pos[2] - Pm[Pm[ppp].Link[l]].Pos[2]); 00167 ppp++; 00168 } 00169 } 00170 } 00171 } 00172 void Forces::CreateLeaves(){ 00173 double Dx = pEdge(0)/(double)(NEdge-1); 00174 double Dy = pEdge(1)/(double)(NEdge-1); 00175 double Dz = pEdge(2)/(double)(NEdge-1); 00176 Bead2Move = 0; 00177 for(int p=0;p<NEdge;p++){ 00178 Kf.Elong[0] = Dx; 00179 Pm[p].Idx = p; 00180 Pm[p].Pos[0] = Dx*p; 00181 Pm[p].Pos[1] = .5*pEdge(1); 00182 Pm[p].Pos[2] = Kf.Elong[2]; 00183 Pm[p].CId = 0; 00184 Pm[p].Typ = 0; 00185 if(p == Bead2Move) Pm[p].Typ = 1; 00186 Ln[p].NLink = 2; 00187 if(p == 0){ 00188 if(BoundCond[0]) 00189 Ln[p].Link[0] = NEdge-1; 00190 else 00191 Ln[p].NLink = 1; 00192 Pm[p].Typ = 2; 00193 } 00194 else 00195 Ln[p].Link[0] = p-1; 00196 if(p == NEdge-1){ 00197 if(BoundCond[1]) 00198 Ln[p].Link[1] = 0; 00199 else 00200 Ln[p].NLink = 1; 00201 Pm[p].Typ = 2; 00202 } 00203 else 00204 Ln[p].Link[1] = p+1; 00205 } 00206 AddRigid(); 00207 } 00208 void Forces::CreateRod(){ 00209 double Dx = pEdge(0)/(double)(NEdge-1); 00210 double Dy = pEdge(1)/(double)(NEdge-1); 00211 double Dz = pEdge(2)/(double)(NEdge-1); 00212 for(int p=0;p<NEdge;p++){ 00213 Pm[p].Idx = p; 00214 Pm[p].Pos[0] = p*Dx*.5; 00215 Pm[p].Pos[1] = .5*pEdge(1); 00216 Pm[p].Pos[2] = .5*pEdge(2); 00217 Pm[p].CId = 0; 00218 Pm[p].Typ = 0; 00219 if(p < NEdge-1){ 00220 Ln[p].NLink = 1; 00221 Ln[p].Link[0] = p+1; 00222 } 00223 } 00224 for(int p=0;p<2;p++){ 00225 Pm[p].Typ = 2; 00226 } 00227 //SetkSpr(0.); 00228 SetkBen(Kf.SLap); 00229 Bead2Move = NEdge - 1; 00230 Pm[Bead2Move].Typ = 1; 00231 Pm[Bead2Move-1].Typ = 1; 00232 } 00233 void Forces::CreatePore(){ 00234 double Dx = pEdge(0)/(double)(NEdge-1); 00235 double Dy = pEdge(1)/(double)(NEdge-1); 00236 double Dz = pEdge(2)/(double)(NEdge-1); 00237 Kf.Elong[0] = Dx; 00238 Bead2Move = 0; 00239 int NSegment = (int)(NEdge/6.); 00240 double AngleS = .25*DUE_PI/(double)NSegment; 00241 for(int c=0;c<pNChain();c++){ 00242 for(int p=c*NEdge;p<NEdge*(c+1);p++){ 00243 Pm[p].Pos[0] = Dx*(double)(p-c*NEdge); 00244 Pm[p].Pos[1] = .5*pEdge(1); 00245 Pm[p].Pos[2] = Kf.Elong[2]*(c-.5)+.5*pEdge(2); 00246 if(p >= c*NEdge + 2*NSegment && p <= c*NEdge + 4*NSegment){ 00247 //double pa = (double)(p-c*NEdge + 4*NSegment); 00248 double pa = (double)(p-2*NSegment); 00249 double x = Kf.Elong[2]*.5*sin(AngleS*pa); 00250 double z = Kf.Elong[2]*.5*cos(AngleS*pa); 00251 Pm[p].Pos[0] = x + Dx*2*NSegment; 00252 Pm[p].Pos[2] = -z + Kf.Elong[2]*(c)+.5*pEdge(2); 00253 } 00254 else if(p > c*NEdge + 4*NSegment){ 00255 Pm[p].Pos[0] = Dx*(6*NSegment - p); 00256 Pm[p].Pos[2] = Kf.Elong[2]*(c+.5)+.5*pEdge(2); 00257 } 00258 Pm[p].Idx = p; 00259 Pm[p].CId = c; 00260 Pm[p].Typ = 0; 00261 if(p == Bead2Move) Pm[p].Typ = 1; 00262 Ln[p].NLink = 3; 00263 if(p == c*NEdge ){ 00264 Ln[p].Link[0] = p + 1; 00265 } 00266 else 00267 Ln[p].Link[0] = p - 1; 00268 if(p == NEdge*(c+1) - 1){ 00269 Ln[p].Link[1] = p - 1; 00270 } 00271 else 00272 Ln[p].Link[1] = p + 1; 00273 Ln[p].Link[2] = NEdge - p - 1; 00274 } 00275 } 00276 int pHalf = (int)(NEdge/2.); 00277 Ln[pHalf].NLink = 2; 00278 Pm[0].Typ = 2; 00279 Pm[1].Typ = 2; 00280 Pm[NEdge-2].Typ = 2; 00281 Pm[NEdge-1].Typ = 2; 00282 Pm[pHalf-1].Typ = 2; 00283 Pm[pHalf].Typ = 2; 00284 Pm[pHalf+1].Typ = 2; 00285 AddRigid(); 00286 // for(int p=0;p<pNPart();p++) 00287 // printf("%d) %lf %lf %lf %d) %d %d %d\n",p,Pm[p].Pos[0],Pm[p].Pos[1],Pm[p].Pos[2],Ln[p].NLink,Ln[p].Link[0],Ln[p].Link[1],Ln[p].Link[2]); 00288 } 00289 void Forces::CreateStalk(){ 00290 double Dx = pEdge(0)/(double)(NEdge-1); 00291 double Dy = pEdge(1)/(double)(NEdge-1); 00292 double Dz = pEdge(2)/(double)(NEdge-1); 00293 Bead2Move = 0; 00294 int c=0; 00295 int NSegment = (int)(NEdge/3.); 00296 double AngleS = .5*DUE_PI/(double)NSegment; 00297 for(int c=0;c<pNChain();c++){ 00298 for(int p=c*NEdge;p<NEdge*(c+1);p++){ 00299 Kf.Elong[0] = Dx; 00300 Pm[p].Idx = p; 00301 Pm[p].Pos[0] = Dx*(double)(p-c*NEdge); 00302 Pm[p].Pos[1] = .5*pEdge(1); 00303 Pm[p].Pos[2] = Kf.Elong[2]*(double)c+.5*pEdge(2)-1.5*Kf.Elong[2]; 00304 Pm[p].CId = c; 00305 Pm[p].Typ = 0; 00306 if(c==1){ 00307 if(p > c*NEdge + NSegment && p <= c*NEdge + 2*NSegment ){ 00308 double x = Kf.Elong[2]*.5*sin(AngleS*(p-c*NEdge + NSegment)); 00309 double z = Kf.Elong[2]*.5*cos(AngleS*(p-c*NEdge + NSegment)); 00310 Pm[p].Pos[0] = x + Dx*NSegment; 00311 Pm[p].Pos[2] = z + Kf.Elong[2]*(double)c+.5-1.*Kf.Elong[2];//+ Kf.Elong[2]/(double)NSegment; 00312 } 00313 else if(p > c*NEdge + 2*NSegment ){ 00314 Pm[p].Pos[0] = Dx*(NEdge*(c+1)-p); 00315 Pm[p].Pos[2] = Kf.Elong[2]*(double)(c+1)+.5-1.5*Kf.Elong[2]; 00316 } 00317 } 00318 if(c==2){ 00319 if(p < c*NEdge + NSegment ){ 00320 Pm[p].Pos[0] = 1. - Dx*(double)(p-c*NEdge); 00321 Pm[p].Pos[2] = Kf.Elong[2]*(double)(c-1)+.5-1.5*Kf.Elong[2]; 00322 } 00323 else if(p >= c*NEdge + NSegment && p < c*NEdge + 2*NSegment ){ 00324 double x = Kf.Elong[2]*.5*sin(AngleS*(p-c*NEdge + NSegment)); 00325 double z = Kf.Elong[2]*.5*cos(AngleS*(p-c*NEdge + NSegment)); 00326 Pm[p].Pos[0] = - x + 2*Dx*NSegment; 00327 Pm[p].Pos[2] = z + Kf.Elong[2]*(double)(c-1)+.5-1.*Kf.Elong[2]; } 00328 } 00329 if(p == Bead2Move) Pm[p].Typ = 1; 00330 Ln[p].NLink = 3; 00331 if(p == c*NEdge ){ 00332 Ln[p].Link[0] = p + 1; 00333 Pm[p].Typ = 2; 00334 } 00335 else 00336 Ln[p].Link[0] = p - 1; 00337 if(p == NEdge*(c+1) - 1){ 00338 Ln[p].Link[1] = p - 1; 00339 Pm[p].Typ = 2; 00340 } 00341 else 00342 Ln[p].Link[1] = p + 1; 00343 if(c == 0) 00344 Ln[p].Link[2] = p + NEdge; 00345 if(c == 1) 00346 Ln[p].Link[2] = p - NEdge; 00347 if(p == c*NEdge + 1 || p == (c+1)*NEdge - 2) 00348 Pm[p].Typ =2; 00349 // if(p == c*NEdge + 2 || p == (c+1)*NEdge - 3) 00350 //Pm[p].Typ =2; 00351 } 00352 } 00353 } 00354 void Forces::Create1d(){ 00355 double Dx = pEdge(0)/(double)(NEdge-1); 00356 double Dy = pEdge(1)/(double)(NEdge-1); 00357 double Dz = pEdge(2)/(double)(NEdge-1); 00358 Bead2Move = NEdge/2; 00359 for(int p=0;p<pNPart();p++){ 00360 Pm[p].Idx = p; 00361 Pm[p].Pos[0] = Dx*(double)p; 00362 Pm[p].Pos[1] = .5;//Mate->Casuale();//Dy*(double)p; 00363 Pm[p].Pos[2] = .45;//Mate->Casuale(); 00364 Ln[p].NLink = 2; 00365 Pm[p].Typ = 0; 00366 if(p == Bead2Move) Pm[p].Typ = 1; 00367 int link=0; 00368 if(p == 0 || p==1){ 00369 Ln[p].NLink--; 00370 Pm[p].Typ = 2; 00371 } 00372 else{ 00373 Ln[p].Link[link] = p - 1; 00374 link++; 00375 } 00376 if(p == pNPart()-1 || p == pNPart()-2){ 00377 Ln[p].NLink--; 00378 Pm[p].Typ = 2; 00379 } 00380 else{ 00381 Ln[p].Link[link] = p + 1; 00382 link++; 00383 } 00384 } 00385 } 00386 void Forces::CreateRigid(){ 00387 SetNNano(2); 00388 for(int n=0;n<pNNano();n++){ 00389 for(int d=0;d<3;d++){ 00390 Nano[n].Pos[d] = .5*pEdge(d); 00391 Nano[n].Vel[d] = .0; 00392 Nano[n].AVel[d] = 0.; 00393 Nano[n].Axis[d] = 0.; 00394 } 00395 Nano[n].Axis[0] = 1.; 00396 Nano[n].Shape = 2; 00397 Nano[n].Rad = .03; 00398 Nano[n].Height = .3; 00399 Nano[n].Mass = 1.; 00400 Nano[n].Gamma = 10.; 00401 Nano[n].Zeta = 30.; 00402 } 00403 Nano[0].Mass = 1.; 00404 Nano[1].Shape = 1; 00405 for(int d=0;d<3;d++){ 00406 Nano[1].Pos[d] = .0*pEdge(d); 00407 Nano[1].Vel[d] = .01; 00408 } 00409 } 00410 void Forces::CreateMC(){ 00411 int NSect[3] = {3,3,3}; 00412 StatFile1 = fopen("StatisticsMC1.dat","w"); 00413 StatFile2 = fopen("StatisticsMC2.dat","w"); 00414 NInsertion = 0; 00415 NRemoval = 0; 00416 DefNanoForceParam(); 00417 PrintForce(); 00418 SetNChain(NEdge); 00419 SetNPCh(1); 00420 OldNrgBead = new double[pNPart()]; 00421 OldNrgCh = new double[pNChain()]; 00422 double Edge[3] = {pEdge(0),pEdge(1),pEdge(2)}; 00423 for(int d=0;d<3;d++) NSect[d] = (int)(Edge[d]/(double)(2.*sqrt(Kf.CutOff2))); 00424 double Dens = pNPart()/pVol(); 00425 double Lambda3 = 1.;//CUBE(sqrt(DUE_PI/SQR(hPlanck))); 00426 GaussVar = sqrt(SQR(pReOverCutOff())/(double)(Block[0].NPCh-1.)/3.)/2.; 00427 for(int p=0;p<pNPart();p++){ 00428 for(int d=0;d<3;d++){ 00429 Pm[p].Pos[d] = Mat->Casuale()*pEdge(d); 00430 } 00431 } 00432 ChooseCalcMode(CalcMode); 00433 ChoosePot(CalcMode); 00434 } 00435 void Forces::CreateMD(){ 00436 int NSect[3] = {3,3,3}; 00437 double Edge[3] = {pEdge(0),pEdge(1),pEdge(2)}; 00438 double Dens = pNPart()/pVol(); 00439 double Lambda3 = 1.;//CUBE(sqrt(DUE_PI/SQR(hPlanck))); 00440 for(int d=0;d<3;d++)NSect[d] = (int)(Edge[d]/(double)(2.*sqrt(Kf.CutOff2))); 00441 GaussVar = sqrt(SQR(pReOverCutOff())/(double)(Block[0].NPCh-1.)/3.)/2.; 00442 DefNanoForceParam(); 00443 int n3 = 2; 00444 while ((n3*n3*n3)<pNPart()) n3++; 00445 int iix=0; 00446 int iiy=0; 00447 int iiz=0; 00448 for(int p=0;p<pNPart();p++){ 00449 Pm[p].Pos[0] = ((double)iix+0.5)*pEdge(0)/n3; 00450 Pm[p].Pos[1] = ((double)iiy+0.5)*pEdge(1)/n3; 00451 Pm[p].Pos[2] = ((double)iiz+0.5)*pEdge(2)/n3; 00452 iix++; 00453 if (iix==n3) { 00454 iix=0; 00455 iiy++; 00456 if (iiy==n3) { 00457 iiy=0; 00458 iiz++; 00459 } 00460 } 00461 for(int d=0;d<3;d++){ 00462 Pm[p].Vel[d] = Mat->Gaussiano(0.,1.0); 00463 } 00464 } 00465 ChooseCalcMode(CalcMode); 00466 ChoosePot(CalcMode); 00467 } 00468 void Forces::CreateElectro(){ 00469 int NSect[3] = {3,3,3}; 00470 StatFile1 = fopen("StatisticsMC1.dat","w"); 00471 StatFile2 = fopen("StatisticsMC2.dat","w"); 00472 NInsertion = 0; 00473 NRemoval = 0; 00474 DefNanoForceParam(); 00475 PrintForce(); 00476 SetNChain(NEdge); 00477 SetNPCh(1); 00478 OldNrgBead = new double[pNPart()]; 00479 OldNrgCh = new double[pNChain()]; 00480 double Edge[3] = {pEdge(0),pEdge(1),pEdge(2)}; 00481 for(int d=0;d<3;d++) NSect[d] = (int)(Edge[d]/(double)(2.*sqrt(Kf.CutOff2))); 00482 double Dens = pNPart()/pVol(); 00483 double Lambda3 = 1.;//CUBE(sqrt(DUE_PI/SQR(hPlanck))); 00484 GaussVar = sqrt(SQR(pReOverCutOff())/(double)(Block[0].NPCh-1.)/3.)/2.; 00485 int NCenter = 6; 00486 double *PCenter = (double *)calloc(NCenter*2,sizeof(double)); 00487 GaussVar = Kf.Elong[0]; 00488 for(int c=0;c<NCenter;c++){ 00489 for(int d=0;d<2;d++){ 00490 PCenter[c*2+d] = Mat->Casuale()*pEdge(d)*.7 + pEdge(d)*.2; 00491 } 00492 } 00493 for(int p=0;p<NEdge;p++){ 00494 int c = (p%NCenter); 00495 for(int d=0;d<2;d++){ 00496 Pm[p].Pos[d] = Mat->Gaussiano(PCenter[c*2+d],GaussVar); 00497 Pm[p].Pos[d] -= floor(Pm[p].Pos[d]*pInvEdge(d))*pEdge(d); 00498 // if(Pm[p].Pos[d] > pEdge(d)) Pm[p].Pos[d] += pEdge(d) - Pm[p].Pos[d]; 00499 // if(Pm[p].Pos[d] < 0) Pm[p].Pos[d] *= -1.; 00500 } 00501 Pm[p].Pos[2] = .2*pEdge(2)*sin(6*Pm[p].Pos[0]*pInvEdge(0))*sin(4*Pm[p].Pos[1]*pInvEdge(1)) + .5*pEdge(2); 00502 } 00503 GaussVar = Kf.Elong[1]; 00504 for(int p=NEdge;p<NEdge+NSpline;p++){ 00505 for(int d=0;d<2;d++){ 00506 Pm[p].Pos[d] = (p-NEdge)/(double)NSpline*pEdge(d); 00507 // double Move = Mat->Gaussiano(Pm[p-1].Pos[d],GaussVar); 00508 // if(p == NEdge){ Pm[p].Pos[d] = 0.; Move = 0.;} 00509 // if(Move > pEdge(d) ) Pm[p].Pos[d] = Move - pEdge(d); 00510 // else if(Move < 0. ) Pm[p].Pos[d] = -Move; 00511 // else Pm[p].Pos[d] = Move; 00512 // Pm[p].Pos[d] -= floor(Pm[p].Pos[d]*pInvEdge(d))*pEdge(d); 00513 } 00514 Pm[p].Pos[2] = .2*pEdge(2)*sin(6*Pm[p].Pos[0]*pInvEdge(0))*sin(4*Pm[p].Pos[1]*pInvEdge(1)) + .5*pEdge(2); 00515 } 00516 ChooseCalcMode(CalcMode); 00517 ChoosePot(CalcMode); 00518 }