Allink  v0.1
ForcesTens.cpp
1 #include "Forces.h"
3  if(VAR_IF_TYPE(SysAlloc,ALL_TENS)) return;
4  for(int d=0;d<3;d++){
5  Tens.RefPos[d] = pNanoPos(0,d);//.5*pEdge(d);
6  }
7  Tens.Pre = (double **)calloc(Tens.NComp,sizeof(double));
8  Tens.Dens = (double **)calloc(2,sizeof(double));
9  // 2d
10  if(VAR_IF_TYPE(Tens.CalcMode,CALC_2d)){
12  SetEdge(.5*MIN(pEdge(CLat1),pEdge(CLat2)),3);
13  Tens.Edge[0] = pEdge(3);
14  Tens.Edge[1] = pEdge(CNorm);
15  Tens.Edge[2] = 1.;
16  Tens.Wrap[0] = 0;
17  Tens.Wrap[1] = 1;
18  for(int d=0;d<3;d++){
19  Tens.EdgeInv[d] = 1./Tens.Edge[d];
20  }
21  for(int c=0;c<Tens.NComp;c++){
22  Tens.Pre[c] = (double *)calloc(SQR(Tens.NSlab),sizeof(double));
23  }
24  for(int c=0;c<2;c++){
25  Tens.Dens[c] = (double *)calloc(SQR(Tens.NSlab),sizeof(double));
26  }
27  }
28  // 3d
29  if(VAR_IF_TYPE(Tens.CalcMode,CALC_3d)){
31  for(int d=0;d<3;d++){
32  Tens.Edge[d] = pEdge(d);
33  Tens.Wrap[d] = 1;
34  Tens.EdgeInv[d] = pInvEdge(d);
35  }
36  for(int c=0;c<Tens.NComp;c++){
37  Tens.Pre[c] = (double *)calloc(CUBE(Tens.NSlab),sizeof(double));
38  }
39  for(int c=0;c<2;c++){
40  Tens.Dens[c] = (double *)calloc(CUBE(Tens.NSlab),sizeof(double));
41  }
42  }
43  VAR_ADD_TYPE(SysAlloc,ALL_TENS);
44 }
46  // 3d
47  if(VAR_IF_TYPE(Tens.CalcMode,CALC_3d)){
48  double PosRel[3];
49  for(int p=0;p<pNPart();p++){
50  for(int d=0;d<3;d++){
51  PosRel[d] = pPos(p,d) - (pEdge(d)*.5 - Tens.RefPos[d]);
52  PosRel[d] -= floor(PosRel[d]*pInvEdge(d))*pEdge(d);
53  }
54  int sx = (int)(PosRel[0]*pInvEdge(0)*Tens.NSlab);
55  int sy = (int)(PosRel[1]*pInvEdge(1)*Tens.NSlab);
56  int sz = (int)(PosRel[2]*pInvEdge(2)*Tens.NSlab);
57  int v = (sx*Tens.NSlab+sy)*Tens.NSlab+sz;
58  int t = pType(p);
59  if(t > 1) continue;
60  Tens.Dens[t][v] += 1.;
61  }
62  }
63  // 2d
64  else if(VAR_IF_TYPE(Tens.CalcMode,CALC_2d)){
65  double PosRel[3];
66  for(int p=0;p<pNPart();p++){
67  PosRel[CLat1] = pPos(p,CLat1) - Tens.RefPos[CLat1];
68  PosRel[CLat2] = pPos(p,CLat2) - Tens.RefPos[CLat2];
69  PosRel[CNorm] = pPos(p,CNorm) + (pEdge(CNorm)*.5 - Tens.RefPos[CNorm]);
70  for(int d=0;d<3;d++){
71  PosRel[d] -= floor(PosRel[d]*pInvEdge(d))*pEdge(d);
72  }
73  int sr = (int)(hypot(PosRel[CLat1],PosRel[CLat2])*Tens.EdgeInv[0]*Tens.NSlab);
74  int sz = (int)(PosRel[CNorm]*pInvEdge(CNorm)*Tens.NSlab);
75  if(sr < 0 || sr >= Tens.NSlab) continue;
76  if(sz < 0 || sz >= Tens.NSlab) continue;
77  int v = (sr*Tens.NSlab+sz);
78  int t = pType(p);
79  if(t > 1) continue;
80  Tens.Dens[t][v] += 1.;
81  //printf("%d %d %d %lf\n",sr,sz,v,Tens.Dens[t][v]);
82  }
83  }
84 }
86  if(!VAR_IF_TYPE(SysAlloc,ALL_FORCES)){
87  printf("Forces not allocated\n");
88  return;
89  }
90  ClearDens();
91  AddDens(0,pNPart());
92  SumDens(0,pNPart());
93  double Dist = 0.;
94  double DistRelBA[4];
95  for(int p=0;p<pNPart();p++){
96  for(int d=0;d<3;d++){
97  Fm[p].Dir[d] = 0.;
98  }
99  }
100  // non bonded
101  double Pos[3];
102  for(int p1=0;p1<pNPart();p1++){
103  for(Pc->SetCurr(p1);Pc->IfCurr();Pc->NextCurr()){
104  int p2 = Pc->p2Curr;
105  if(p2 <= p1) continue;
106  Pc->Dist2Curr(DistRelBA);
107  if(DistRelBA[3] > Kf.CutOff2) continue;
108  double Dist = sqrt(DistRelBA[3]);
109  double Force = 0.;
110  for(int t=0;t<pNType();t++){
111  Force += MInt->Coeff(pType(p1),pType(p2),t)*(Dens3[p1*pNType()+t]+Dens3[p2*pNType()+t]);
112  }
113  Force *= DerWei3(Dist,pWei3Par())*2./3.;
114  Force += DerWei2(Dist,pWei2Par())*MInt->Coeff(pType(p1),pType(p2));
115  SumTens(p1,p2,Force,DistRelBA);
116  Force /= -Dist;
117  SigErr(Force > 5000.,"Forces over the limit %lf\n",Force);
118  for(int d=0;d<3;d++){
119  Fm[p1].Dir[d] += Force*DistRelBA[d];
120  Fm[p2].Dir[d] -= Force*DistRelBA[d];
121  }
122  }
123  }
124  // bonded
125  double DistRelBC[4];
126  double Pre[12];
127  for(int b=0;b<pNBlock();b++){
128  for(int c=0;c<pNChain(b);c++){
129  for(int p=c*pNPCh(b);p<(c+1)*pNPCh(b)-1;p++){
130  TwoPartDist(p+1,p,DistRelBA);
131  double ForceSp = pkSpr()*(1. - pSprRest()/DistRelBA[3]);
132  SumTens(p,p+1,ForceSp,DistRelBA);
133  for(int d=0;d<3;d++){
134  Fm[p].Dir[d] += ForceSp*DistRelBA[d];
135  Fm[p+1].Dir[d] -= ForceSp*DistRelBA[d];
136  }
137  if(p < (c+1)*pNPCh(b)-2){
138  TwoPartDist(p+2,p+1,DistRelBC);
139  double CosAngle = 0.;
140  for(int d=0;d<3;d++){
141  DistRelBA[d] /= DistRelBA[3];
142  DistRelBC[d] /= DistRelBC[3];
143  CosAngle += DistRelBA[d]*DistRelBC[d];
144  }
145  double PreFactBA = pkBen()/DistRelBA[3];
146  double PreFactBC = pkBen()/DistRelBC[3];
147  for(int d=0;d<3;d++){
148  Fm[p+0].Dir[d] += PreFactBA*(DistRelBC[d]-DistRelBA[d]*CosAngle);
149  Fm[p+1].Dir[d] -= PreFactBA*(DistRelBC[d]-DistRelBA[d]*CosAngle);
150  Fm[p+1].Dir[d] += PreFactBC*(DistRelBA[d]-DistRelBC[d]*CosAngle);
151  Fm[p+2].Dir[d] -= PreFactBC*(DistRelBA[d]-DistRelBC[d]*CosAngle);
152  Pre[d ] = DistRelBA[d]*pkBen()*(DistRelBC[d]-DistRelBA[d]*CosAngle);
153  Pre[d+6] = DistRelBC[d]*pkBen()*(DistRelBA[d]-DistRelBC[d]*CosAngle);
154  }
155  Pre[ 3] = DistRelBA[0]*pkBen()*(DistRelBC[1]-DistRelBA[1]*CosAngle);
156  Pre[ 4] = DistRelBA[0]*pkBen()*(DistRelBC[2]-DistRelBA[2]*CosAngle);
157  Pre[ 5] = DistRelBA[1]*pkBen()*(DistRelBC[2]-DistRelBA[2]*CosAngle);
158  Pre[ 9] = DistRelBC[0]*pkBen()*(DistRelBA[1]-DistRelBC[1]*CosAngle);
159  Pre[10] = DistRelBC[0]*pkBen()*(DistRelBA[2]-DistRelBC[2]*CosAngle);
160  Pre[11] = DistRelBC[1]*pkBen()*(DistRelBA[2]-DistRelBC[2]*CosAngle);
161  SumTens(p,p+1,Pre);
162  SumTens(p+1,p+2,Pre+6);
163  }
164  }
165  }
166  }
167  return;
168  //external
169  double Pot[3];
170  double PosBf[3];
171  double dr[4];
172  double NPos[3];
173  for(int n=0;n<pNNano();n++){
174  Point2Shape(Nano[n].Shape);
175  for(int p=0;p<pNPart();p++){
176  pPos(p,Pos);
177  double Dr2 = NanoDist2(Pos,n);
178  double InvDist = 1./Dr2;
179  double Cons = Potential(Dr2,0,pType(p),Pot);
180  for(int d=0;d<3;d++){
181  dr[d] = Nano[n].Pos[d] - pPos(p,d);
182  if(dr[d] > .5*pInvEdge(d)) dr[d] -= pEdge(d);
183  if(dr[d] < -.5*pInvEdge(d)) dr[d] += pEdge(d);
184  }
185  double Norm = SQR(Nano[n].Rad)/(SQR(dr[0]) + SQR(dr[1]) + SQR(dr[2]));
186  Norm = sqrt(Norm);
187  for(int d=0;d<3;d++){
188  NPos[d] = NPos[d] + dr[d]*Norm;
189  Fm[p].Dir[d] += Cons*dr[d]*InvDist;
190  Pre[d ] = Cons*dr[d]*dr[d]*InvDist;
191  }
192  Pre[3] = Cons*dr[0]*dr[1]*InvDist;
193  Pre[4] = Cons*dr[0]*dr[2]*InvDist;
194  Pre[5] = Cons*dr[1]*dr[2]*InvDist;
195  SumTens(NPos,Pos,Pre);
196  }
197  }
198 }
199 double Forces::TensRefCart(double *Pos1,double *Pos2,double *PosP1,double *PosP2){
200  for(int d=0;d<3;d++){
201  PosP1[d] = Pos1[d] - (pEdge(d)*.5 - Tens.RefPos[d]);
202  PosP2[d] = Pos2[d] - (pEdge(d)*.5 - Tens.RefPos[d]);
203  PosP1[d] -= floor(PosP1[d]*pInvEdge(d))*pEdge(d);
204  PosP2[d] -= floor(PosP2[d]*pInvEdge(d))*pEdge(d);
205  }
206 }
207 double Forces::TensRefPol(double *PosO1,double *PosO2,double *PosP1,double *PosP2){
208  double Pos1[2] = {PosO1[CLat1]-Tens.RefPos[CLat1],PosO1[CLat2]-Tens.RefPos[CLat2]};
209  double Pos2[2] = {PosO2[CLat1]-Tens.RefPos[CLat1],PosO2[CLat2]-Tens.RefPos[CLat2]};
210  for(int d=0;d<2;d++){
211  Pos1[d] -= floor(Pos1[d]*pInvEdge(d) + .5)*pEdge(d);
212  Pos2[d] -= floor(Pos2[d]*pInvEdge(d) + .5)*pEdge(d);
213  }
214  PosP1[0] = hypot(Pos1[0],Pos1[1]);
215  PosP2[0] = hypot(Pos2[0],Pos2[1]);
216  PosP1[1] = PosO1[CNorm] + (pEdge(CNorm)*.5 - Tens.RefPos[CNorm]);
217  PosP2[1] = PosO2[CNorm] + (pEdge(CNorm)*.5 - Tens.RefPos[CNorm]);
218  for(int d=1;d<2;d++){
219  PosP1[d] -= floor(PosP1[d]*Tens.EdgeInv[d])*Tens.Edge[d];
220  PosP2[d] -= floor(PosP2[d]*Tens.EdgeInv[d])*Tens.Edge[d];
221  }
222  //printf("%d %d %lf %lf %lf %lf \n",p1,p2,PosP1[0],PosP1[1],PosP2[0],PosP2[0]);
223 }
224 void Forces::SumTens(int p1,int p2,double *Pre){
225  SumTens(Pm[p1].Pos,Pm[p2].Pos,Pre);
226 }
227 void Forces::SumTens(double *Pos1,double *Pos2,double *Pre){
228  double PosP1[3];
229  double PosP2[3];
230  TensRef(Pos1,Pos2,PosP1,PosP2);
231  int NPoint = 100;
232  double PointInv = 1./(double)NPoint;
233  double Deltav[3];
234  double Pos[3];
235  int vCurr[3];
236  for(int d=0;d<Tens.NDim;d++){
237  // starts from the smallest position
238  Pos[d] = PosP1[d] < PosP2[d] ? PosP1[d] : PosP2[d];
239  Deltav[d] = fabs((PosP2[d]-PosP1[d])*PointInv);
240  // forward/backward?
241  if( fabs(PosP2[d] - PosP1[d]) > Tens.Edge[d]*.5){
242  Deltav[d] = -fabs((MAX(PosP1[d],PosP2[d])-Tens.Edge[d]-Pos[d])*PointInv);
243  }
244  }
245  //printf("%d %d) [%lf %lf] [%lf %lf] (%lf %lf) (%lf %lf)\n",p1,p2,PosP1[0],PosP1[1],PosP2[0],PosP2[1],Deltav[0],Deltav[1],Tens.Edge[0],Tens.Edge[1]);
246  for(int p=0;p<NPoint;p++){
247  for(int d=0;d<Tens.NDim;d++){
248  vCurr[d] = (int)(Pos[d]*Tens.NSlab*Tens.EdgeInv[d]);
249  //assert(vCurr[d] >= 0 && vCurr[d] < Tens.NSlab);
250  if(vCurr[d] < 0 || vCurr[d] >= Tens.NSlab) return;
251  // update the current position forward/backward
252  Pos[d] += Deltav[d];
253  // wrap the position to the other end
254  if(Pos[d] > Tens.Edge[d]){
255  if(!Tens.Wrap[d]) return;
256  Pos[d] -= floor(Pos[d]*Tens.EdgeInv[d])*Tens.Edge[d];
257  }
258  }
259  int vTot = 0;
260  for(int d=0;d<Tens.NDim;d++){
261  vTot += vCurr[d];
262  if(d < Tens.NDim-1)
263  vTot *= Tens.NSlab;
264  }
265  //printf("%d %d %d (%lf %lf) %lf\n",vCurr[0],vCurr[1],vTot,Pos[0],Pos[1],Pre[0]);
266  for(int c=0;c<Tens.NComp;c++){
267  Tens.Pre[c][vTot] += Pre[c]*PointInv;
268  }
269  }
270 }
271 void Forces::SumTens(int p1,int p2,double Force,double *DistRel){
272  if(fabs(Force) < 0.) return;
273  if(fabs(Force) > 5000.) return;
274  double Pre[6];
275  double InvDist = Force/DistRel[3];
276  Pre[0] = DistRel[0]*DistRel[0]*InvDist;
277  Pre[1] = DistRel[1]*DistRel[1]*InvDist;
278  Pre[2] = DistRel[2]*DistRel[2]*InvDist;
279  Pre[3] = DistRel[0]*DistRel[1]*InvDist;
280  Pre[4] = DistRel[0]*DistRel[2]*InvDist;
281  Pre[5] = DistRel[1]*DistRel[2]*InvDist;
282  SumTens(p1,p2,Pre);
283 }
284 void Forces::WriteTens2d(FILE *FWrite,int Comp,double InvNFile){
285  int link[4] = {0,0,0,0};
286  fprintf(FWrite,"# l(%.1f %.1f %.1f) r(%.2f %.2f %.2f) v[%d] d[color]\n",Tens.Edge[0],Tens.Edge[1],1.,Tens.RefPos[0],Tens.RefPos[1],Tens.RefPos[2],Tens.NSlab);
287  double *VolContr = (double *)calloc(Tens.NSlab,sizeof(double));
288  VolumeCircSlab(VolContr,Tens.NSlab);
289  for(int sr=1,p=0,c=0;sr<Tens.NSlab;sr++){
290  double r = sr*Tens.Edge[0]/(double)Tens.NSlab;
291  for(int sz=0;sz<Tens.NSlab;sz++){
292  double z = sz*Tens.Edge[1]/(double)Tens.NSlab;
293  int v = sr*Tens.NSlab+sz;
294  if(Tens.Dens[0][v] <= 0. && Tens.Dens[1][v] <= 0. && fabs(Tens.Pre[Comp][v]) <= 0.) continue;
295  double Press = -Tens.Pre[Comp][v]*InvNFile/VolContr[sr];
296  double Dens1 = Tens.Dens[0][v]*InvNFile/VolContr[sr];
297  double Dens2 = Tens.Dens[1][v]*InvNFile/VolContr[sr];
298  fprintf(FWrite,"{x(%.3f %.3f %.3f) v( %lf %.2f %.2f)}\n",r,z,0.,Press,Dens1,Dens2);continue;
299  link[0] = (sr+0)*Tens.NSlab+(sz+0);
300  link[1] = (sr+0)*Tens.NSlab+(sz+1);
301  link[2] = (sr+1)*Tens.NSlab+(sz+0);
302  link[3] = (sr+1)*Tens.NSlab+(sz+1);
303  for(int lx=0;lx<2;lx++){
304  for(int ly=0;ly<2;ly++){
305  int l = 2*lx+ly;
306  int l1 = p + (p+1)%4;
307  int l2 = p + (p+2)%4;
308  int l3 = p + (p+3)%4;
309  fprintf(FWrite,"{t[%d %d %d]",p,c,0);
310  fprintf(FWrite," x(%.3f %.3f %.3f)",r,z,Press);
311  fprintf(FWrite," v( %lf %.2f %.2f)",Press,Dens1,Dens2);
312  // -Tens.Pre[Comp][v]*InvNFile,
313  // Tens.Dens[0][v]*InvNFile,
314  // Tens.Dens[1][v]*InvNFile);
315  fprintf(FWrite," l[%d] l[%d] l[%d]}\n",l1,l2,l3);
316  p++;
317  }
318  }
319  c++;
320  }
321  }
322  //free(VolContr);
323 }
324 void Forces::WriteTens(char *FTens,int Comp,double InvNFile){
325  double InvValues = 1. / Tens.NSlab;
326  double InvVolume = prho()*CUBE(Tens.NSlab)/pVol();
327  if(VAR_IF_TYPE(Tens.CalcMode,CALC_2d)){
328 #ifdef OMPI_MPI_H
329  MPI_Allreduce(MPI_IN_PLACE,Tens.Pre[Comp],SQR(Tens.NSlab),MPI_DOUBLE,MPI_SUM,Proc->CommGrid);
330  for(int t=0;t<2;t++){
331  MPI_Allreduce(MPI_IN_PLACE,Tens.Dens[t],SQR(Tens.NSlab),MPI_DOUBLE,MPI_SUM,Proc->CommGrid);
332  }
333  int Rank=0;
334  MPI_Comm_rank(Proc->CommGrid, &Rank);
335  if(Rank==0){
336 #endif
337  FILE *FWrite = fopen(FTens,"w");
338  WriteTens2d(FWrite,Comp,InvNFile);
339  fclose(FWrite);
340  for(int s=0;s<SQR(Tens.NSlab);s++){
341  Tens.Pre[Comp][s] = 0.;
342  Tens.Dens[0][s] = 0.;
343  Tens.Dens[1][s] = 0.;
344  }
345  #ifdef OMPI_MPI_H
346  }
347  #endif
348  }
349  if(VAR_IF_TYPE(Tens.CalcMode,CALC_3d)){
350 #ifdef OMPI_MPI_H
351  MPI_Allreduce(MPI_IN_PLACE,Tens.Pre[Comp],CUB(Tens.NSlab),MPI_DOUBLE,MPI_SUM,Proc->CommGrid);
352  for(int t=0;t<2;t++){
353  MPI_Allreduce(MPI_IN_PLACE,Tens.Dens[t],CUB(Tens.NSlab),MPI_DOUBLE,MPI_SUM,Proc->CommGrid);
354  }
355  int Rank=0;
356  MPI_Comm_rank(Proc->CommGrid, &Rank);
357  if(Rank==0){
358 #endif
359  FILE *FWrite = fopen(FTens,"w");
360  fprintf(FWrite,"# l(%.1f %.1f %.1f) r(%.2f %.2f %.2f) v[%d] d[color]\n",pEdge(0),pEdge(1),pEdge(2),Tens.RefPos[0],Tens.RefPos[1],Tens.RefPos[2],Tens.NSlab);
361  for(int sx=0;sx<Tens.NSlab;sx++){
362  double x = sx*InvValues*pEdge(CLat1);
363  for(int sy=0;sy<Tens.NSlab;sy++){
364  double y = sy*InvValues*pEdge(CLat2);
365  for(int sz=0;sz<Tens.NSlab;sz++){
366  double z = sz*InvValues*pEdge(CNorm);
367  int v = (sx*Tens.NSlab+sy)*Tens.NSlab+sz;
368  if(Tens.Dens[0][v] <= 0 && Tens.Dens[1][v] <= 0 && ABS(Tens.Pre[Comp][v]) <= 0) continue;
369  fprintf(FWrite,"{x(%.3f %.3f %.3f)",x,y,z);
370  fprintf(FWrite," v( %lf %.2f %.2f)}\n",
371  -Tens.Pre[Comp][v]*InvNFile*InvVolume,
372  Tens.Dens[0][v]*InvNFile*InvVolume,
373  Tens.Dens[1][v]*InvNFile*InvVolume);
374  }
375  }
376  }
377  fclose(FWrite);
378  for(int s=0;s<CUB(Tens.NSlab);s++){
379  Tens.Pre[Comp][s] = 0.;
380  Tens.Dens[0][s] = 0.;
381  Tens.Dens[1][s] = 0.;
382  }
383  }
384 #ifdef OMPI_MPI_H
385  }
386 #endif
387 }
388 
void CalcTens()
Calculate the forces for the tension profile.
Definition: ForcesTens.cpp:85
TENS_REF Tens_Ref
Pointer to a coordinate distance.
Definition: Forces.h:647
double pkBen()
Bending coupling.
Definition: VarData.h:932
void WriteTens(char *TFile, int Comp, double InvNFile)
Write the pressure and density profile.
Definition: ForcesTens.cpp:324
double NanoDist2(double *Pos, int n)
Pointer to a generic function.
Definition: VarData.h:764
double prho()
Density coexistence.
Definition: VarData.h:944
double ** Pre
Pressure array.
Definition: Forces.h:199
NANO * Nano
Extra particle.
Definition: VarData.h:1044
void WriteTens2d(FILE *FWrite, int Comp, double InvNFile)
Write the 2d pressure profile.
Definition: ForcesTens.cpp:284
int NDim
of dimensions
Definition: Forces.h:193
double pInvEdge(int d)
Inverted xyzr edges of the simulation box.
Definition: VarData.h:920
int pType(int p)
Return the type.
int CLat2
lateral coordinate
Definition: VarData.h:1078
double DerWei2(const double r, const double b)
Derivative of the quadratic weighting function.
double Dir[3]
Direction.
Definition: Forces.h:178
double pkSpr()
Spring coupling.
Definition: VarData.h:934
double pSprRest()
Rest distance of the harmonic potential.
Definition: VarData.h:942
int Wrap[3]
Which coordinate to wrap.
Definition: Forces.h:209
double TensRef(double *Pos1, double *Pos2, double *PosP1, double *PosP2)
Particle positions back folded on the tension reference point.
Definition: Forces.h:649
void Dist2Curr(double *DistRel)
Retrun the squared current interparticle distance.
Definition: Cubo.cpp:502
int SysAlloc
Which arrays are allocated.
Definition: Forces.h:753
double pVol()
xyzr edges of the simulation box
Definition: VarData.h:922
double TensRefPol(double *Pos1, double *Pos2, double *PosP1, double *PosP2)
Particle positions back folded on the tension reference point (polar coordinates) ...
Definition: ForcesTens.cpp:207
double Pos[3]
Position.
Definition: VarData.h:427
double Edge[3]
Edges.
Definition: Forces.h:207
double pNanoPos(int n, int d)
Return back folded nano position.
double pEdge(int d)
xyzr edges of the simulation box
Definition: VarData.h:918
int pNPCh()
Number of particle per chain.
double RefPos[3]
Reference point.
Definition: Forces.h:205
double pWei3Par()
Parameter of the third order weighting function.
Definition: VarData.h:950
double TwoPartDist(int p1, int p2, double *RelDist)
Return the relative distance between two particles (wrapped)
Definition: VarDataEl.cpp:419
int pNBlock()
Number of blocks.
void SumTens(int p1, int p2, double Forces, double *DistRel)
Sum the forces on the line joining the points p1 and p2.
Definition: ForcesTens.cpp:271
MatInt * MInt
Matrix of the prefactor of the interactions.
Definition: VarData.h:529
KFORCES Kf
Prefactor of the forces.
Definition: Forces.h:779
void NextCurr()
Increase the iterator to the next couple.
Definition: Cubo.cpp:479
void Point2Shape(int iShape)
Point to the shape function.
Definition: VarDataEl.cpp:490
double EdgeInv[3]
Inverse of the edges.
Definition: Forces.h:211
double pWei2Par()
Parameter of the second order weighting function.
Definition: VarData.h:948
int pNNano()
Number of nanoparticles.
double Coeff(int t1, int t2)
Prefactor of the force.
Definition: VarData.cpp:246
double Potential(double Dist, int t1, int t2, double *Pot)
Pointer to a potential.
Definition: Forces.h:504
int CalcMode
Calculation mode.
Definition: Forces.h:197
double ** Dens
Density array.
Definition: Forces.h:201
void ClearDens()
Set the local densities to zero.
void AllocTens()
Alloc the pressure profile.
Definition: ForcesTens.cpp:2
int pNType()
of types of the particle
int NComp
of components
Definition: Forces.h:191
double pPos(int p, int d)
Return back folded position.
double DerWei3(const double r, const double a)
Derivative of the cubic weighting function.
int pNChain()
Number of chain.
int CLat1
lateral coordinate
Definition: VarData.h:1076
int IfCurr()
Tell when the curr loop is over.
Definition: Cubo.cpp:498
double CutOff2
CutOff of the lennard jones.
Definition: Forces.h:165
int p2Curr
Current particle.
Definition: Cubo.h:51
double SumDens(int pInit, int pEnd)
Sum the local density for the particles between pInit and pEnd and multiply the factors by the virial...
int NSlab
of slabs
Definition: Forces.h:195
void CalcDens()
Calculate the densities.
Definition: ForcesTens.cpp:45
PART * Pm
Particle information of all particle.
Definition: VarData.h:1046
int AddDens(int pInit, int pEnd)
Add the densities connected with the particles between pInit and pEnd.
void SetCurr(int p)
Gather information of the neighbouring cells.
Definition: Cubo.cpp:453
TENS Tens
Structure for the pressure calculation.
Definition: Forces.h:783
DomDec * Pc
Pair list.
Definition: Forces.h:785
void VolumeCircSlab(double *VolContr, int NSample)
Fill an array of.
double TensRefCart(double *Pos1, double *Pos2, double *PosP1, double *PosP2)
Particle positions back folded on the tension reference point (Cartesian coordinates) ...
Definition: ForcesTens.cpp:199
void SetEdge(double Val, int d)
Set Edge.
Definition: VarData.h:976
FORCES * Fm
Array containing the forces for each particle.
Definition: Forces.h:781
int CNorm
Normal coordinate.
Definition: VarData.h:1074
int pNPart()
Number of particle.