Allink  v0.1
VarDataRead.cpp
1 /***********************************************************************
2 VarData: This Program reads and writes a specific file format
3 storing all the information relative to a set of equal structure
4 polymers to the CHAIN, PART and GENERAL structures. It provides
5 two different ways to backfold the coordinates, a fanction that
6 creates an initial system with different option and some function
7 for the data analisys. The first calculate the distribution of the
8 monomer in the box, the second the distribution of the bonds.
9 Copyright (C) 2008 by Giovanni Marelli <sabeiro@virgilio.it>
10 
11 
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16 
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21 
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 ***********************************************************************/
26 #include "../include/VarData.h"
27 ;
28 bool VarData::ReadConf(char *InFile){
29  FILE *FileToRead;
30  VarMessage("ReadConf");
31  if((FileToRead = fopen(InFile,"r"))==0){
32  printf("The file %s is missing\n",InFile);
33  return 1;
34  }
35  //double *buff = (double *)malloc(sizeof(double));
36  double buff[1];
37  char cLine[STRSIZE];
38  char Topology[20];
39  int NCircle = 0;
40  int NHeight = 0;
41  int DiblockLim = 0;
42  SysFormat = 0;
43  // fgets(cLine,256,FileToRead);
44  for(int k=0;!(fgets(cLine,STRSIZE,FileToRead)==NULL);k++){
45  if(cLine[0] == '#') continue;
46  if(ReadString("NSoft",cLine,buff)==1){
47  NSoft = (int)*buff;
48  if(NSoft != 0)
49  Soft = (SOFT *)realloc(Soft,NSoft*sizeof(SOFT));
50  }
51  //sytem type
52  if(ReadString("IfSystem",cLine,buff)==1){
53  if( (int)*buff == 1 ){
54  SysFormat = VAR_SYS_TXVL;
55  }
56  else{
57  SysFormat = VAR_SYS_XVT;
58  }
59  }
60  //
61  if(ReadString("CNorm",cLine,buff)==1){
62  CNorm = (int)*buff;
63  CLat1 = (CNorm+1)%3;
64  CLat2 = (CNorm+2)%3;
65  }
66  if(ReadString("NAddChain",cLine,buff)==1)
67  NAddChain = (int)*buff;
68  if(ReadString("NAddChol",cLine,buff)==1)
69  NAddChol = (int)*buff;
70  if(ReadString("NSolvent",cLine,buff)==1)
71  NSolvent = (int)*buff;
72  if(ReadString("NStuffing",cLine,buff)==1)
73  NStuffing = (int)*buff;
74  if(ReadString("DiblockLim",cLine,buff)==1)
75  DiblockLim = (int)*buff;
76  if(ReadString("IfTwoTails",cLine,buff)==1)
77  if( (int)*buff == 1 ){
78  VAR_ADD_TYPE(SysType,VAR_TWOTAILS);
79  }
80  if(ReadString("NPartPChain",cLine,buff)==1)
81  SetNPCh((int)*buff);
82  if(ReadString("NNano",cLine,buff)==1){
83  Gen->NNano = (int)*buff;
84  if(Gen->NNano != 0)
85  Nano = (NANO *)realloc(Nano,Gen->NNano*sizeof(NANO));
86  }
87  if(ReadString("NCircle",cLine,buff)==1){
88  NCircle = (int)*buff;
89  }
90  if(ReadString("NHeight",cLine,buff)==1){
91  NHeight = (int)*buff;
92  }
93  if(ReadString("rho",cLine,buff)==1)
94  Gen->rho = *buff;
95  if(ReadString("chiN",cLine,buff)==1)
96  Gen->chiN = *buff;
97  if(ReadString("kappaN",cLine,buff)==1)
98  Gen->kappaN = *buff;
99  if(ReadString("kappaBend",cLine,buff)==1)
100  Gen->kappaBend = *buff;
101  if(ReadString("kappaSpring",cLine,buff)==1)
102  Gen->kappaSpring = *buff;
103  if(ReadString("ReOverCutOff",cLine,buff)==1)
104  Gen->ReOverCutOff = *buff;
105  if(ReadString("WFuncStraight2",cLine,buff)==1)
106  Gen->WFuncStraight2 = *buff;
107  if(ReadString("WFuncStraight3",cLine,buff)==1)
108  Gen->WFuncStraight3 = *buff;
109  if(ReadString("vBB",cLine,buff)==1)
110  Gen->vBB = *buff;
111  if(ReadString("Lx",cLine,buff)==1)
112  Gen->Edge[0] = *buff;
113  if(ReadString("Ly",cLine,buff)==1)
114  Gen->Edge[1] = *buff;
115  if(ReadString("Lz",cLine,buff)==1)
116  Gen->Edge[2] = *buff;
117  }
118  ReadSoft(FileToRead);
119  ReadNano(FileToRead,NCircle,NHeight);
120  SetNBlock(1);
121  Block[0].Asym = DiblockLim;
122  fclose(FileToRead);
123  // char cSystem[512];
124  // SysDef(cSystem);
125  // printf("%s\n",cSystem);
126  // HeaderNano(cSystem);
127  // printf("%s",cSystem);
128  // HeaderSoft(cSystem);
129  // printf("%s",cSystem);
130  return 0;
131 }
132 int VarData::NanoString(char *cLine,int n){
133  double Pos[3];
134  double Vel[3];
135  double Axis[3];
136  double Char[5];
137  char Shape[20];
138  char Name[20];
139  if( !Fetch(cLine,"x","%lf %lf %lf",Pos,Pos+1,Pos+2)){
140  for(int d=0;d<3;d++)
141  Nano[n].Pos[d] = pEdge(d)*.5;
142  }
143  else{
144  for(int d=0;d<3;d++){
145  if(isnan(Pos[d])) Pos[d] = .5*pEdge(d);
146  Nano[n].Pos[d] = Pos[d]*ScaleF[d];
147  Nano[n].Bkf[d] = - floor(Nano[n].Pos[d]/pEdge(d))*pEdge(d);
148  }
149  }
150  if( !Fetch(cLine,"a","%lf %lf %lf",Axis,Axis+1,Axis+2)){
151  Nano[n].Axis[CLat1] = 0.;
152  Nano[n].Axis[CLat2] = 0.;
153  Nano[n].Axis[CNorm] = 1.;
154  }
155  else{
156  if(isnan(Axis[0])) Axis[0] = 0.;
157  if(isnan(Axis[1])) Axis[1] = 0.;
158  if(isnan(Axis[2])) Axis[2] = 1.;
159  Nano[n].Axis[0] = Axis[0];
160  Nano[n].Axis[1] = Axis[1];
161  Nano[n].Axis[2] = Axis[2];
162  }
163  if( Fetch(cLine,"c","%lf %lf %lf %lf",Char,Char+1,Char+2,Char+3)){
164  double r = sqrt(.5*SQR(ScaleF[0])+.5*SQR(ScaleF[1]));
165  Nano[n].Rad = Char[0]*r;
166  Nano[n].Viscosity = 0.1;
167  Nano[n].Hamaker = Char[1];
168  Nano[n].Height = Char[2]*ScaleF[2];
169  Nano[n].OffSet = Char[3];
170  Nano[n].Coating = Char[3];
171  Nano[n].Gamma = 3.*3.14*Nano[n].Rad*Nano[n].Viscosity;
172  //Nano[n].Zeta = sqrt(12. * 2. * 1. * Nano[n].Gamma/Nano[n].Mass/dt);
173  }
174  // if( ret == 8){
175  if( Fetch(cLine,"s","%s",Shape)){
176  Nano[n].Shape = ShapeId(Shape);
177  }
178  Nano[n].Mass = 100.;
179  return 0;
180 }
181 int VarData::ShapeId(char *Shape){
182  int iShape=0;
183  if(!strcmp(Shape,"no"))
184  VAR_ADD_TYPE(iShape,SHAPE_NONE);
185  else if(!strcmp(Shape,"sph"))
186  VAR_ADD_TYPE(iShape,SHAPE_SPH);
187  else if(!strcmp(Shape,"tip"))
188  VAR_ADD_TYPE(iShape,SHAPE_TIP);
189  else if(!strcmp(Shape,"dip"))
190  VAR_ADD_TYPE(iShape,SHAPE_SPH);
191  else if(!strcmp(Shape,"cyl")){
192  VAR_ADD_TYPE(iShape,SHAPE_CYL);
193  VAR_ADD_TYPE(iShape,SHAPE_HEI);
194  }
195  else if(!strcmp(Shape,"tilt")){
196  VAR_ADD_TYPE(iShape,SHAPE_TILT);
197  VAR_ADD_TYPE(iShape,SHAPE_HEI);
198  }
199  else if(!strcmp(Shape,"pill")){
200  VAR_ADD_TYPE(iShape,SHAPE_PILL);
201  VAR_ADD_TYPE(iShape,SHAPE_HEI);
202  }
203  else if(!strcmp(Shape,"wall"))
204  VAR_ADD_TYPE(iShape,SHAPE_WALL);
205  else if(!strcmp(Shape,"cluster"))
206  VAR_ADD_TYPE(iShape,SHAPE_CLUSTER);
207  else if(!strcmp(Shape,"harm"))
208  VAR_ADD_TYPE(iShape,SHAPE_HARM);
209  else if(!strcmp(Shape,"clinks"))
210  VAR_ADD_TYPE(iShape,SHAPE_CLINKS);
211  else if(!strcmp(Shape,"pore"))
212  VAR_ADD_TYPE(iShape,SHAPE_PORE);
213  else if(!strcmp(Shape,"ext"))
214  VAR_ADD_TYPE(iShape,SHAPE_EXT);
215  else if(!strcmp(Shape,"janus"))
216  VAR_ADD_TYPE(iShape,SHAPE_JANUS);
217  else if(!strcmp(Shape,"stalk"))
218  VAR_ADD_TYPE(iShape,SHAPE_STALK);
219  else if(!strcmp(Shape,"torus"))
220  VAR_ADD_TYPE(iShape,SHAPE_TORUS);
221  else if(!strcmp(Shape,"umbr"))
222  VAR_ADD_TYPE(iShape,SHAPE_UMBR);
223  else if(!strcmp(Shape,"bound"))
224  VAR_ADD_TYPE(iShape,SHAPE_BOUND);
225  else
226  printf("Nano type %s not recognized\n",Shape);
227  return iShape;
228 }
229 void VarData::ReadNano(FILE *ConfFile,int NCircle,int NHeight){
230  char cLine[STRSIZE];
231  rewind(ConfFile);
232  for(int k=0,n=0;!(fgets(cLine,STRSIZE,ConfFile)==NULL);k++){
233  if(n == Gen->NNano) break;
234  if(cLine[0] == '#') continue;
235  if(strstr(cLine, "Rigid") == cLine) {
236  NanoString(cLine,n);
237  for(int d=0;d<3;d++){
238  Nano[n].Pos[d] *= pEdge(d);
239  Nano[n].Vel[d] = 0.;
240  Nano[n].AVel[d] = 0.;
241  }
242  Nano[n].NCircle = (int)(NCircle*Nano[n].Rad);
243  if( (Nano[n].NCircle%2) != 0)
244  Nano[n].NCircle++;
245  Nano[n].NHeight = (int)(NHeight*Nano[n].Height);
246  if( (Nano->NHeight%2) != 0)
247  Nano->NHeight++;
248  n++;
249  }
250  }
251 }
252 void VarData::SubNanoHeader(char *cFile){
253  FILE *FRead = fopen(cFile,"r+");
254  char cLine[STRSIZE];
255  fpos_t fPosNano;
256  do {
257  fgetpos(FRead,&fPosNano);
258  fgets(cLine, sizeof(cLine),FRead);
259  if(strstr(cLine, "# Rigid") == cLine){
260  break;
261  }
262  else if(strstr(cLine, "#") != cLine){
263  printf("No # Rigid present!\n");
264  break;
265  }
266  } while (1==1);
267  fgets(cLine, sizeof(cLine),FRead);
268  fsetpos(FRead,&fPosNano);
269  HeaderNano(FRead);
270  fprintf(FRead,"%s",cLine);
271  fclose(FRead);
272 }
273 int VarData::ReadSoft(FILE *ConfFile){
274  double Pos[3];
275  double Vel[3];
276  double Char[5];
277  int iShape=0;
278  char Shape[20];
279  char Name[20];
280  char cLine[STRSIZE];
281  rewind(ConfFile);
282  for(int k=0,n=0;!(fgets(cLine,STRSIZE,ConfFile)==NULL);k++){
283  if(cLine[0] == '#') continue;
284  if(n == NSoft) break;
285  if (strstr(cLine, "Soft") == cLine) {
286  if( !Fetch(cLine,"x","%lf %lf %lf",Pos,Pos+1,Pos+2)){
287  Soft[n].Pos[0] = 0.;
288  Soft[n].Pos[1] = 0.;
289  Soft[n].Pos[2] = 0.;
290  }
291  else{
292  Soft[n].Pos[0] = Pos[0]*pEdge(0);
293  Soft[n].Pos[1] = Pos[1]*pEdge(1);
294  Soft[n].Pos[2] = Pos[2]*pEdge(2);
295  }
296  if( !Fetch(cLine,"v","%lf %lf %lf",Vel,Vel+1,Vel+2)){
297  Soft[n].Vel[0] = 0.;
298  Soft[n].Vel[1] = 0.;
299  Soft[n].Vel[2] = 0.;
300  }
301  else{
302  Soft[n].Vel[0] = Vel[0];
303  Soft[n].Vel[1] = Vel[1];
304  Soft[n].Vel[2] = Vel[2];
305  }
306  if( !Fetch(cLine,"c","%lf %lf %lf",Char,Char+1,Char+2)){
307  printf("Rigid characteristic are not specified\n");
308  return 1;
309  }
310  Soft[n].Size[0] = Char[0];
311  Soft[n].Size[1] = Char[1];
312  Soft[n].Size[2] = Char[2];
313  if( !Fetch(cLine,"s","%s",Shape)){
314  printf("Soft shape is not specified\n");
315  return 1;
316  }
317  if(!strcmp(Shape,"planar")){
318  VAR_ADD_TYPE(Soft[n].Topology,VAR_PLANAR);
319  }
320  else if(!strcmp(Shape,"planarPE")){
321  VAR_ADD_TYPE(Soft[n].Topology,VAR_PLANAR_PE);
322  }
323  else if(!strcmp(Shape,"tube"))
324  VAR_ADD_TYPE(Soft[n].Topology,VAR_TUBE);
325  else if(!strcmp(Shape,"obstacle"))
326  VAR_ADD_TYPE(Soft[n].Topology,VAR_OBSTACLE);
327  else if(!strcmp(Shape,"coating"))
328  VAR_ADD_TYPE(Soft[n].Topology,VAR_COATING);
329  else if(!strcmp(Shape,"distributed"))
330  VAR_ADD_TYPE(Soft[n].Topology,VAR_DISTRIBUTED);
331  else if(!strcmp(Shape,"vesicle"))
332  VAR_ADD_TYPE(Soft[n].Topology,VAR_VESICLE);
333  else{
334  printf("Soft type not recognized %s\n",Shape);
335  return 1;
336  }
337  sprintf(Soft[n].Name,"LIPID");
338  // if( !Fetch(cLine,"n","%s",Name)){
339  // printf("Soft name not specified\n");
340  // return 1;
341  // }
342  // sprintf(Soft[n].Name,"%s",Name);
343  n++;
344  }
345  }
346  return 0;
347 }
348 //#################SYS#INFO##################################
349 void VarData::ReadHeader(FILE *FileToRead){
350  VarMessage("ReadSysInfo");
351  SysFormat = 0;
352  VAR_REM_TYPE(SysType,VAR_CHAIN_DEF);
353  char cLine[STRSIZE];
354  double Val[6];
355  for(int d=0;d<3;d++){
356  Gen->Cm[d] = 0.;
357  }
358  fgets(cLine,STRSIZE,FileToRead);
359  if(Fetch(cLine,"l",3,Val)){
360  SysFormat = VAR_SYS_TXVL;
361  VAR_ADD_TYPE(SysType,VAR_EDGE);
362  SetEdge(Val[0]*ScaleF[0],0);
363  SetEdge(Val[1]*ScaleF[1],1);
364  SetEdge(Val[2]*ScaleF[2],2);
365  }
366  //else if(!strcspn(cLine,"# L=\n")){
367  else if(!strncmp(cLine,"# L=",4)){
368  SysFormat = VAR_SYS_XVT;
369  }
370  else{
371  do{
372  fgets(cLine,STRSIZE,FileToRead);
373  char *pLine = strchr(cLine,'#');
374  if(pLine == NULL){
375  int NPar = sscanf(cLine,"%lf %lf %lf %lf\n",Val,Val+1,Val+2,Val+3);
376  if(NPar == 3){
377  SysFormat = VAR_SYS_XYZ;
378  SetNChain(1);
379  SetNBlock(1);
380  }
381  else if(NPar == 4){
382  SysFormat = VAR_SYS_XYZT;
383  SetNChain(1);
384  SetNBlock(1);
385  }
386  break;
387  }
388  } while(1==1);
389  }
390  rewind(FileToRead);
391  if( SysFormat == VAR_SYS_TXVL ){
392  ReadHeaderTxvl(FileToRead);
393  }
394  else if ( SysFormat == VAR_SYS_XVT ){
395  ReadHeaderXvt(FileToRead);
396  }
397  rewind(FileToRead);
398 }
399 void VarData::ReadHeaderTxvl(FILE *FileToRead){
400  double Val[6];
401  char cLine[STRSIZE];
402  fgets(cLine,STRSIZE,FileToRead);
403  Gen->Time += 1.;
404  Gen->NNano = 0;
405  //Energy
406  //#Chain
407  if(Fetch(cLine,"c",1,Val)){
408  SetNChain((int)Val[0]);
409  }
410  //What to draw
411  if(Fetch(cLine,"d","%s",cWhat2Draw));
412  //Delta t
413  if(Fetch(cLine,"D",1,Val)) SetDeltat(Val[0]);
414  if(Fetch(cLine,"e",3,Val)){
415  Gen->Energy[0] = Val[0];
416  Gen->Energy[1] = Val[1];
417  Gen->Energy[2] = Val[2];
418  }
419  //inputs
420  if(Fetch(cLine,"i",3,Val)){
421  Gen->rho = Val[0];
422  Gen->chiN = Val[1];
423  Gen->kappaN = Val[2];
424  }
425  //#link
426  if(Fetch(cLine,"L",1,Val)){
427  SetNLink((int)Val[0]);
428  }
429  //#Part
430  if(Fetch(cLine,"n",1,Val)){
431  //SetNLink(2);
432  SetNPart((int)Val[0]);
433  VAR_ADD_TYPE(SysType,VAR_OPEN_TRUST);
434  }
435  //Nano
436  if(Fetch(cLine,"N",4,Val)){
437  Gen->NNano = 1;
438  // Nano = (NANO *) realloc(Nano,Gen->NNano*sizeof(NANO));
439  Nano->Rad = Val[0];
440  Nano->Hamaker = Val[1];
441  Nano->Viscosity = Val[2];
442  Nano->Height = Val[3];
443  if(Nano->Hamaker > 0.1){
444  Nano->Shape = SHAPE_SPH;
445  if(Nano->Height > 0.1){
446  Nano->Shape = SHAPE_CYL;
447  }
448  }
449  }
450  if(Fetch(cLine,"P",1,Val)){
451  if( *Val < 0. || *Val > 3.);
452  else{
453  CNorm = (int)*Val;
454  CLat1 = (CNorm+1)%3;
455  CLat2 = (CNorm+2)%3;
456  }
457  }
458  if(Fetch(cLine,"r",4,Val)){
459  Gen->NNano = 1;
460  // Nano = (NANO *) realloc(Nano,Gen->NNano*sizeof(NANO));
461  Nano->Pos[0] = Val[0];
462  Nano->Pos[1] = Val[1];
463  Nano->Pos[2] = Val[2];
464  Nano->Axis[0] = 0.;
465  Nano->Axis[1] = 0.;
466  Nano->Axis[2] = 1.;
467  Nano->Shape = SHAPE_NONE;
468  }
469  //step
470  if(Fetch(cLine,"s",1,Val)) SetStep((int) Val[0]);
471  //Temperature
472  if(Fetch(cLine,"T",1,Val)) SetTemp(Val[0]);
473  //# Values
474  if(Fetch(cLine,"v",1,Val)){
475  NEdge = (int)Val[0];
476  if(!strcmp(cWhat2Draw,"color")){
477  SetNLink(0);
479  SetNChain(1);
480  SetNPCh(pNPart());
481  VAR_ADD_TYPE(SysType,VAR_OPEN_TRUST);
482  }
483  }
484  SetNBlock(1);
485  //----------inclusion------------------------
486  // how many Nano
487  //Gen->NNano = 0;
488  fpos_t PosTemp;
489  fgetpos(FileToRead,&PosTemp);
490  do {
491  fgets(cLine, sizeof(cLine),FileToRead);
492  if(strstr(cLine, "# Rigid") == cLine)
493  Gen->NNano++;
494  else if(strstr(cLine, "# Pep") == cLine)
495  Gen->NNano++;
496  else
497  break;
498  } while (1==1);
499  fsetpos(FileToRead,&PosTemp);
500  if(Gen->NNano != 0)
501  Nano = (NANO *) realloc(Nano,Gen->NNano*sizeof(NANO));
502  for(int n=0;n<Gen->NNano;n++){
503  fgetpos(FileToRead,&PosTemp);
504  fgets(cLine,STRSIZE,FileToRead);
505  if( strncmp(cLine,"# Rigid",7)){// + strncmp(cLine,"# Pep",5)){
506  fsetpos(FileToRead,&PosTemp);
507  break;
508  }
509  NanoString(cLine,n);
510  }
511 }
512 void VarData::ReadHeaderXvt(FILE *FileToRead){
513  double Val[6];
514  char cLine[STRSIZE];
515  fgets(cLine,STRSIZE,FileToRead);
516  fpos_t PosTemp;
517  //-----------edge-nblock------------
518  fgetpos(FileToRead,&PosTemp);
519  double Time = 0.;
520  int NBlock = 0;
521  if( sscanf(cLine,"# L=%lf %lf %lf t=%lf blocks=%d",&Val[0],&Val[1],&Val[2],&Time,&NBlock) == 5 ){
522  for(int d=0;d<3;d++) SetEdge(Val[d]*ScaleF[d],d);
523  SetTime(Time);
524  SetStep((int)(Time/0.05));
525  SetNBlock(NBlock);
526  VAR_ADD_TYPE(SysType,VAR_EDGE);
527  for(int d=0;d<3;d++)
528  Nano->Pos[d] = (.5 - ShiftPos[d])*pEdge(d);
529  SetNanoBkf(0);
530  Nano->Axis[0] = 0.;Nano->Axis[1] = 0.;Nano->Axis[2] = 1.;
531  }
532  //---------------virial-coefficients---------------
533  //fgets(cLine,STRSIZE,FileToRead);
534  double v[6];
535  double w[10];
536  int IfTwoType = 1;
537  int IfThreeType = 1;
538  fscanf(FileToRead,"# v=");
539  for(int i=0;i<6;i++){
540  if(fscanf(FileToRead,"%lf ",v+i) != 1){
541  //fsetpos(FileToRead,&PosTemp);
542  if(i == 2) IfThreeType = 0;
543  break;
544  }
545  if(i > 2) IfTwoType = 0;
546  }
547  int NThird = 10;
548  Gen->vBB = v[3];
549  if(IfTwoType) NThird = 4;
550  fscanf(FileToRead,"w=");
551  for(int i=0;i<NThird;i++){
552  if(fscanf(FileToRead,"%lf ",w+i) != 1){
553  break;
554  }
555  }
556  Gen->rho = 3.*(- .5*v[0] + sqrt(QUAD(v[0])*.25-8.*w[0]/3.))/(4.*w[0]);
557  Gen->kappaN = - v[0] * Gen->rho*.5-3.;
558  if(IfTwoType)
559  Gen->chiN = (v[1] - .5*(v[0]+v[2]))*Gen->rho;
560  else if(IfThreeType)
561  Gen->chiN = (v[1] - .5*(v[0]+v[3]))*Gen->rho;
562  //---------------intra-forces-------------------
563  fgets(cLine,STRSIZE,FileToRead);
564  double Nigot1,Nigot2,Nigot3;
565  fgetpos(FileToRead,&PosTemp);
566  int ret = sscanf(cLine,"# a2=%lf a3=%lf Re=%lf N=%lf ks=%lf kb=%lf l0=%lf",&Gen->WFuncStraight2,&Gen->WFuncStraight3,&Gen->ReOverCutOff,&Nigot3,&Gen->kappaSpring,&Gen->kappaBend,&Gen->SpringRest);
567  if(ret == 7);
568  else fsetpos(FileToRead,&PosTemp);
569  SetCoeff(v,w);
570  //----------inclusion------------------------
571  double Pos[3];
572  double Char[5];
573  int NSide[2];
574  double Axis[3];
575  char Shape[10];
576  char FileName[60];
577  int NNanoTemp = 0;
578  // how many Nano
579  fgetpos(FileToRead,&PosTemp);
580  Gen->NNano = 0;
581  for(int t=0;t<50;t++){
582  if(NULL == fgets(cLine,sizeof(cLine),FileToRead)) break;
583  if(strstr(cLine, "# Rigid") == cLine)
584  Gen->NNano++;
585  else if(strstr(cLine, "# Pep") == cLine)
586  Gen->NNano++;
587  else
588  break;
589  }
590  fsetpos(FileToRead,&PosTemp);
591  if(Gen->NNano != 0)
592  Nano = (NANO *) realloc(Nano,Gen->NNano*sizeof(NANO));
593  for(int n=0;n<Gen->NNano;n++){
594  fgetpos(FileToRead,&PosTemp);
595  fgets(cLine,STRSIZE,FileToRead);
596  if( strncmp(cLine,"# Rigid",7)){
597  fsetpos(FileToRead,&PosTemp);
598  continue;
599  }
600  NanoString(cLine,n);
601  NNanoTemp++;
602  }
603  //printf("%lf %lf %lf %s\n",Pos[0],Axis[0],Char[0],Shape);
604  // Soft
605  for(int n=NNanoTemp;n<Gen->NNano;n++){
606  fgetpos(FileToRead,&PosTemp);
607  fgets(cLine,STRSIZE,FileToRead);
608  if( strncmp(cLine,"# Pep",4) ){
609  fsetpos(FileToRead,&PosTemp);
610  break;
611  }
612  if( Fetch(cLine,"g","%lf %lf %lf",Char,Char+1,Char+2)){
613  Nano[n].Rad = Char[0];
614  Nano[n].Height = Char[1];
615  Nano[n].Hamaker = Char[2];
616  }
617  if( Fetch(cLine,"d","%d %d",NSide,NSide+1)){
618  Nano[n].NCircle = NSide[0];
619  Nano[n].NHeight = NSide[1];
620  }
621  if( Fetch(cLine,"fn","%s",FileName)){
622  sprintf(Nano[n].ArchFile,"%s",FileName);
623  }
624  Nano[n].Shape = SHAPE_CLUSTER;
625  }
626 }
627 //###############################PASS#THRU########################
628 //If the information for the allocation are missing
629 int VarData::ReadPassThru(FILE *FileToRead){
630  VarMessage("PassThru");
631  int Val[3];
632  char cLine[STRSIZE];
633  char cVar[STRSIZE];
634  char cVal[STRSIZE];
635  int Paren[2];
636  int NChain = 0;
637  int NPart = 0;
638  int NPCh = 0;
639  int NType = 0;
640  int NLink = 0;
641  if( SysFormat == VAR_SYS_TXVL ){
642  for(int k=0;!(fgets(cLine,STRSIZE,FileToRead)==NULL);k++){
643  if(cLine[0] == '#') continue;
644  int iLen = (int) (strlen(cLine));
645  if( Fetch(cLine,"t","%d %d %d",Val,Val+1,Val+2)){
646  int p = Val[0];
647  int c = Val[1];
648  int t = Val[2];
649  if(c >= NChain) NChain++;
650  if(t >= NType) NType++;
651  }
652  if(cLine[0] == '{') NPart++;
653  if(NChain==0) NPCh++;
654  for(int i=0,link=0,part=0;i<iLen;i++){
655  if(cLine[i] == 'l' && cLine[i+1] == '['){
656  link++;
657  if(link >= NLink) NLink++;
658  }
659  }
660  }
661  if(NChain==0) NChain = 1;
662  Block[0].InitIdx = 0;
663  Block[0].NChain = NChain;
664  Block[0].NPCh = NPCh;
665  Block[0].NPart = NPart;
666  Block[0].EndIdx = NPart;
667  }
668  else if ( SysFormat == VAR_SYS_XVT ){
669  for(int k=0,b=0;!(fgets(cLine,STRSIZE,FileToRead)==NULL);k++){
670  if(3 == sscanf(cLine,"# n=%d N=%d name=%s",&Val[0],&Val[1],&Block[b].Name)){
671  Block[b].InitIdx = NPart;
672  Block[b].NChain = Val[0];
673  Block[b].NPCh = Val[1];
674  Block[b].NPart = Block[b].NChain*Block[b].NPCh;
675  NChain += Block[b].NChain;
676  NPart += Block[b].NPart;
677  Block[b].EndIdx = NPart;
678  Block[b].Arch = ARCH_LINES;
679  NLink = 1;
680  if(strcasestr(Block[b].Name, "TT") == Block[b].Name){
681  Block[b].Arch = ARCH_TWOTAILS;
682  NLink = 2;
683  }
684  if(strcasestr(Block[b].Name, "PEP") == Block[b].Name){
685  Block[b].Arch = ARCH_CLUSTER;
686  }
687  //printf("Found block # %d name %s #chain %d #part %d #partPchain%d from %d to %d\n",b,Block[b].NChain,Block[b].Name,Block[b].NPart,Block[b].NPCh,Block[b].InitIdx,Block[b].EndIdx);
688  b++;
689  if(Gen->NBlock == b) break;
690  }
691  }
692  for(int b=0,nNano=0;b<pNBlock();b++){
693  if(VAR_IF_TYPE(Block[b].Arch,ARCH_CLUSTER)){
694  for(int n=0;n<pNNano();n++,nNano=n){
695  if(VAR_IF_TYPE(Nano[n].Shape,SHAPE_CLUSTER)){
696  Nano[n].nBlock = b;
697  }
698  }
699  }
700  }
701  NPCh = Block[0].NPCh;
702  }
703  else{
704  for(int k=0,b=0;!(fgets(cLine,STRSIZE,FileToRead)==NULL);k++){
705  if(cLine[0] == '#' || cLine[0] == '$'){continue;}
706  NPart++;
707  }
708  if(SysFormat == VAR_SYS_XYZ) NPCh = NPart;
709  }
710  SetNLink(NLink);
711  SetNPart(NPart);
712  SetNChain(NChain);
713  SetNPCh(NPCh);
714  SetNType(NType);
715  rewind(FileToRead);
716  return 0;
717 }
718 //####################READ#PART#################################3
719 int VarData::ReadPart(FILE *FileToRead){
720  for(int d=0;d<3;d++) Gen->Cm[d] = 0.;
721  if( SysFormat == VAR_SYS_TXVL ){
722  if(ReadPartTxvl(FileToRead)) return 1;
723  Block[0].NPart = Gen->NPart;
724  Block[0].NChain = Gen->NChain;
725  Block[0].NPCh = Gen->NPCh;
726  Block[0].InitIdx = 0;
727  Block[0].EndIdx = Gen->NPart;
728  }
729  else if( SysFormat == VAR_SYS_XVT ){
730  if(ReadPartXvt(FileToRead)) return 1;
731  }
732  else if( SysFormat == VAR_SYS_XYZT ){
733  if(ReadPartXyzt(FileToRead)) return 1;
734  }
735  else {
736  if(ReadPartXyz(FileToRead)) return 1;
737  }
738  for(int d=0;d<3;d++) Gen->Cm[d] /= (double)pNPart();
739  if(pNNano() == 0){
740  for(int d=0;d<3;d++){
741  Nano->Pos[d] = .5*pEdge(d);
742  }
743  SetNanoBkf(0);
744  Nano->Axis[0] = 0.;Nano->Axis[1] = 0.;Nano->Axis[2] = 1.;
745  }
746  return 0;
747 }
748 int VarData::ReadPartTxvl(FILE *FileToRead){
749  VarMessage("ReadPartSys");
750  int NChain = 0;
751  int NPart = 0;
752  Gen->NPCh = 0;
753  int NType = 0;
754  int NLink = 0;
755  double Val[6];
756  int Char[6];
757  char cLine[STRSIZE];
758  for(int d=0;d<4;d++) Gen->Vel[d] = 0.000001;
759  for(int c=0;c<Gen->NChain;c++){
760  for(int d=0;d<3;d++)
761  Ch[c].Pos[d] = 0.;
762  }
763  Block[0].InitIdx = 0;
764  Block[0].EndIdx = Gen->NPart;
765  int NPCh = 0;
766  for(int p=0,c=0;!(fgets(cLine,STRSIZE,FileToRead)==NULL);p++){
767  //if(p >= Gen->NPart) break;
768  int IfContinue = 1;
769  int iLen = strlen(cLine);
770  for(int k=0;k<iLen;k++){
771  if(cLine[k] == '#'){
772  p--;
773  IfContinue = 0;
774  break;
775  }
776  }
777  if(!IfContinue) continue;
778  if(p >= Gen->NPart){
779  //printf("More particles than expected %d > %d\n",p,Gen->NPart);
780  //return 1;
781  }
782  Pm[p].Idx=p;Pm[p].Typ=0;Pm[p].CId=0;
783  int sPos = Fetch(cLine,"t","%d %d %d",Char,Char+1,Char+2);
784  if(sPos){
785  Pm[p].Idx = Char[0];
786  Pm[p].CId = Char[1];
787  Pm[p].Typ = Char[2];
788  }
789  if(p>0 && Pm[p].CId != Pm[p-1].CId){
790  Ch[c].NPCh = NPCh;
791  Ch[c].InitBead = p-NPCh;
792  Ch[c].EndBead = p;
793  NPCh = 0;
794  }
795  sPos += Fetch(cLine+sPos,"x","%lf %lf %lf",Pm[p].Pos,Pm[p].Pos+1,Pm[p].Pos+2);
796  sPos += Fetch(cLine+sPos,"v","%lf %lf %lf",Pm[p].Vel,Pm[p].Vel+1,Pm[p].Vel+2);
797  for(int d=0;d<3;d++){
798  Pm[p].Pos[d] *= ScaleF[d];
799  Ch[c].Pos[d] += Pm[p].Pos[d];
800  Gen->Cm[d] += Pm[p].Pos[d];
801  //Ch[c].Vel[d] += Pm[p].Vel[d];
802  if(Gen->Vel[d] < Pm[p].Vel[d])
803  Gen->Vel[d] = Pm[p].Vel[d];
804  }
805  if(Pm[p].CId > c){
806  c++;
807  if(c >= Gen->NChain){
808  printf("More chains than expected %d > %d\n",c,Gen->NChain);
809  }
810  }
811  if(Pm[p].CId == 0){Gen->NPCh++;}
812  if(Gen->NType < Pm[p].Typ ){
813  NType++;
814  if(Pm[p].CId == 0)
815  Block[0].Asym = p;
816  }
817  //Ch[c].NPart++;
818  Pm[p].Vel[3] = sqrt( QUAD((Pm[p].Vel[0])) + QUAD((Pm[p].Vel[1])) + QUAD((Pm[p].Vel[2])) );
819  Gen->Vel[3] += sqrt( QUAD((Pm[p].Vel[0])) + QUAD((Pm[p].Vel[1])) + QUAD((Pm[p].Vel[2])) );
820  for(int l=0;l<Gen->NLink;l++){
821  Ln[p].Link[l] = 0;
822  int sPosOld = Fetch(cLine+sPos,"l",1,Val);
823  //int sPosOld = Fetch(cLine+sPos,"l","%d",Val);
824  if(sPosOld){
825  Ln[p].Link[l] = (int)Val[0];
826  Ln[p].NLink = l+1;
827  sPos += sPosOld;
828  }
829  }
830  //printf("%s{t[%d %d %d] x(%lf %lf %lf) v(%lf %lf %lf) l[%d] l[%d]}\n\n",p,cLine,Pm[p].Idx,Pm[p].CId,Pm[p].Typ,Pm[p].Pos[0],Pm[p].Pos[1],Pm[p].Pos[2],Pm[p].Vel[0],Pm[p].Vel[1],Pm[p].Vel[2],Pm[p].Link[0],Pm[p].Link[1]);
831  }
832  for(int c=0;c<Gen->NChain;c++)
833  for(int d=0;d<3;d++)
834  Ch[c].Pos[d] /= Gen->NPCh;
835  Gen->Vel[3] /= (double)NPart;
836  NType++;
837  // Gen->NChain++;
838  if(Gen->NPCh == 0) Gen->NPCh = Gen->NPart;
839  return 0;
840 }
841 int VarData::ReadPartXvt(FILE *FileToRead){
842  VarMessage("ReadPartNoSys");
843  double *buff = (double *) malloc(sizeof(double));
844  char cLine[STRSIZE];
845  sprintf(cLine," ");
846  int NChain = 0;
847  int NPart = 0;
848  int NPCh = 0;
849  int NType = 0;
850  int Asym = 0;
851  int Val[3];
852  int NLink=0;
853  fpos_t PosTemp;
854  for(int b=0,NCh=0;b<pNBlock();NCh+=Block[b++].NChain){
855  for(int t=0;t<50;t++){
856  fgets(cLine,STRSIZE,FileToRead);
857  if(3 == sscanf(cLine,"# n=%d N=%d name=%s",&Val[0],&Val[1],&Block[b].Name)){
858  Block[b].InitIdx = NPart;
859  Block[b].NChain = Val[0];
860  Block[b].NPCh = Val[1];
861  Block[b].NPart = Block[b].NChain*Block[b].NPCh;
862  NChain += Block[b].NChain;
863  NPart += Block[b].NPart;
864  Block[b].EndIdx = NPart;
865  Block[b].Arch = ARCH_LINES;
866  NLink = 1;
867  if(strcasestr(Block[b].Name, "TT") == Block[b].Name){
868  Block[b].Arch = ARCH_TWOTAILS;
869  NLink = 2;
870  }
871  if(strcasestr(Block[b].Name, "PEP") == Block[b].Name){
872  Block[b].Arch = ARCH_CLUSTER;
873  }
874  break;
875  }
876  }
877  // // while(strncmp(cLine,"# n=",3)){fgets(cLine,STRSIZE,FileToRead);printf("%s\n",cLine);}
878  // printf("%s\n",cLine);
879  for(int c=NCh;c<NCh+Block[b].NChain;c++){
880  int pCurr = Block[b].InitIdx + (c-NCh)*Block[b].NPCh;
881  Ch[c].NPCh = Block[b].NPCh;
882  Ch[c].InitBead = pCurr;
883  Ch[c].EndBead = pCurr + Block[b].NPCh;
884  for(int ppc=0;ppc<Block[b].NPCh;ppc++){
885  if(NULL == fgets(cLine,STRSIZE,FileToRead)) break;
886  if(cLine[0] == '#'){ppc--;continue;}
887  int p = pCurr + ppc;
888  if(p >= pNPart()){
889  printf("Reading more particles than the ones allocated\n");
890  exit(1);
891  }
892  Pm[p].Idx = p;
893  Pm[p].CId = c;
894  //sscanf(cLine,"%lf %lf %lf %lf %lf %lf %d",&Pm[p].Pos[0],&Pm[p].Pos[1],&Pm[p].Pos[2],&Pm[p].Vel[0],&Pm[p].Vel[1],&Pm[p].Vel[2],&Pm[p].Typ);
895  int Incr = ReadVal(cLine ,buff);Pm[p].Pos[0] = *buff*ScaleF[0];
896  Incr += ReadVal(cLine+Incr,buff);Pm[p].Pos[1] = *buff*ScaleF[1];
897  Incr += ReadVal(cLine+Incr,buff);Pm[p].Pos[2] = *buff*ScaleF[2];
898  Incr += ReadVal(cLine+Incr,buff);Pm[p].Vel[0] = *buff;
899  Incr += ReadVal(cLine+Incr,buff);Pm[p].Vel[1] = *buff;
900  Incr += ReadVal(cLine+Incr,buff);Pm[p].Vel[2] = *buff;
901  Incr += ReadVal(cLine+Incr,buff);Pm[p].Typ = (int)*buff;
902  for(int d=0;d<3;d++) Gen->Cm[d] += Pm[p].Pos[d];
903  if(NType < Pm[p].Typ ) NType++;
904  }
905  }
906  }
907  for(int b=0;b<pNBlock();b++){
908  int p1 = Block[b].InitIdx;
909  for(int ppc=1;ppc<Block[b].NPCh;ppc++){
910  //if(Pm[p1+ppc].Typ == 1 && Pm[p1+ppc-1].Typ == 0)
911  if(Pm[p1+ppc].Typ != Pm[p1+ppc-1].Typ)
912  Block[b].Asym = ppc;
913  }
914  if(Block[b].Asym == 0) Block[b].Asym = pNPCh();
915  }
916  // links
917  if(pNLink() > 0){
918  for(int b=0;b<pNBlock();b++){
919  int NLink = 1;
920  if(Block[b].Arch == ARCH_CLUSTER) NLink = 0;
921  for(int c=0;c<Block[b].NChain;c++){
922  int pCurr = Block[b].InitIdx + c*Block[b].NPCh;
923  for(int ppc = 0;ppc<Block[b].NPCh-1;ppc++){
924  Ln[pCurr+ppc].NLink = NLink;
925  Ln[pCurr+ppc].Link[0] = pCurr+ppc+1;
926  if(Block[b].Arch == ARCH_TWOTAILS){
927  if(ppc == Block[b].Asym/2 - 1){
928  Ln[pCurr+ppc].NLink = 1;
929  Ln[pCurr+ppc].Link[0] = pCurr + Block[b].Asym - 1;
930  }
931  // if(ppc == Block[b].Asym){
932  // Ln[pCurr+ppc].NLink = 1;
933  // Ln[pCurr+ppc].Link[1] = pCurr + Block[b].Asym + 2;
934  // }
935  }
936  }
937  }
938  }
939  }
940  // for(int c=0;c<Gen->NChain;c++)printf("%d %d\n",c,Ch[c].NPart);
941  double Norm2 = CUBE(pReOverCutOff()) / SQR(pNPCh());
942  double Norm3 = CUBE(SQR(pReOverCutOff()) / pNPCh());
943  MInt->Rescale(Norm2,2);
944  MInt->Rescale(Norm3,3);
945  free(buff);
946  NType++;
947  if(NPCh == 0) NPCh = Gen->NPart;
948  SetNType(NType);
949  if(0 == pNPart()){
950  Block[0].InitIdx = 0;
951  Block[0].NChain = 0;
952  Block[0].NPCh = 0;
953  Block[0].NPart = 0;
954  Block[0].EndIdx = 0;
955  }
956  return 0;
957 }
958 int VarData::ReadLineXvt(char *cLine,double *Pos,int *Type){
959  double Temp = 0.;
960  int Incr = ReadVal(cLine ,&Temp);Pos[0] = Temp*ScaleF[0];
961  Incr += ReadVal(cLine+Incr,&Temp);Pos[1] = Temp*ScaleF[1];
962  Incr += ReadVal(cLine+Incr,&Temp);Pos[2] = Temp*ScaleF[2];
963  Incr += ReadVal(cLine+Incr,&Temp);
964  Incr += ReadVal(cLine+Incr,&Temp);
965  Incr += ReadVal(cLine+Incr,&Temp);
966  Incr += ReadVal(cLine+Incr,&Temp);*Type = (int)Temp;
967  return 0;
968 }
969 int VarData::ReadPartXyz(FILE *FileToRead){
970  double *buff = (double *) malloc(sizeof(double));
971  char cLine[STRSIZE];
972  double Pos[3];
973  for(int p=0,c=-1;!(fgets(cLine,STRSIZE,FileToRead)==NULL);p++){
974  if(p >= pNPart()-1) continue;
975  Pm[p].Idx=p;Pm[p].Typ=0;Pm[p].CId=0;
976  if(cLine[0] == '#' || cLine[0] == '$'){p--;continue;}
977  sscanf(cLine,"%lf %lf %lf",Pos,Pos+1,Pos+2);
978  for(int d=0;d<3;d++)
979  Pm[p].Pos[d] = Pos[d];
980  // int Incr = ReadVal(cLine,buff) ;Pm[p].Pos[0] = *buff;
981  // Incr += ReadVal(cLine+Incr,buff);Pm[p].Pos[1] = *buff;
982  // Incr += ReadVal(cLine+Incr,buff);Pm[p].Pos[2] = *buff;
983  }
984  BfEdge();
985  if(IfNormalize){
986  for(int d=0;d<3;d++){
987  ScaleF[d] = pInvEdge(d);
988  SetEdge(1.,d);
989  }
990  }
991  for(int p=0;p<pNPart();p++){
992  for(int d=0;d<3;d++){
993  Pm[p].Pos[d] *= ScaleF[d];
994  }
995  }
996  SetNNano(0);
997  Block[0].InitIdx = 0;
998  Block[0].EndIdx = pNPart();
999  Block[0].NChain = 1;
1000  Block[0].NPCh = pNPart();
1001  free(buff);
1002  return 0;
1003 }
1004 int VarData::ReadPartXyzt(FILE *FileToRead){
1005  double *buff = (double *) malloc(sizeof(double));
1006  char cLine[STRSIZE];
1007  double Pos[4];
1008  int NChain = 0;
1009  int NPCh = 0;
1010  int OldTyp = 0;
1011  for(int p=0,c=-1;!(fgets(cLine,STRSIZE,FileToRead)==NULL);p++){
1012  if(p >= pNPart()-1) continue;
1013  Pm[p].Idx=p;Pm[p].Typ=0;Pm[p].CId=0;
1014  if(cLine[0] == '#' || cLine[0] == '$'){p--;continue;}
1015  sscanf(cLine,"%lf %lf %lf %lf",Pos,Pos+1,Pos+2,Pos+3);
1016  for(int d=0;d<3;d++)
1017  Pm[p].Pos[d] = Pos[d];
1018  Pm[p].Typ = (int)Pos[3];
1019  if(OldTyp > Pm[p].Typ){
1020  NChain++;
1021  }
1022  Pm[p].CId = NChain;
1023  if(NChain == 0) NPCh++;
1024  OldTyp = Pm[p].Typ;
1025  }
1026  BfEdge();
1027  if(IfNormalize){
1028  for(int d=0;d<3;d++){
1029  ScaleF[d] = pInvEdge(d);
1030  SetEdge(1.,d);
1031  }
1032  }
1033  for(int p=0;p<pNPart();p++){
1034  for(int d=0;d<3;d++){
1035  Pm[p].Pos[d] *= ScaleF[d];
1036  }
1037  }
1038  if(NChain == 0) NChain = 1;
1039  SetNChain(NChain);
1040  SetNPCh(NPCh);
1041  Block[0].InitIdx= 0;
1042  Block[0].EndIdx = pNPart();
1043  Block[0].NChain = pNChain();
1044  Block[0].NPCh = pNPCh();
1045  free(buff);
1046  return 0;
1047 }
int ReadPart(FILE *FileToRead)
Reads particle type and position.
int SetNLink(int NewNCh)
Set and reallocate the number of links.
Definition: VarDataComm.cpp:41
void SetNPCh(int NewNCh)
Set and reallocate the number of particles per chains.
CHAIN * Ch
Information on all chains.
Definition: VarData.h:1050
int CId
Chain Identifier.
Definition: VarData.h:224
int pNLink()
Maximum number of bonds.
Information about the nanoparticle.
Definition: VarData.h:423
int ReadPartXvt(FILE *FileToRead)
Reads a position-velocity-type file.
double kappaN
Incompressibility.
Definition: VarData.h:325
BLOCK * Block
Information for every block.
Definition: VarData.h:1054
int NAddChol
Additional cholesterol chains into the membrane.
Definition: VarData.h:1068
double Vel[4]
xyzr Velocity of the particle
Definition: VarData.h:220
LINKS * Ln
Array of linking between the particles.
Definition: VarData.h:1048
double Viscosity
Viscosity.
Definition: VarData.h:455
void ShapeId(int iShape, char *Shape)
Identifier of the shape.
double ShiftPos[3]
Reference position.
Definition: VarData.h:1058
NANO * Nano
Extra particle.
Definition: VarData.h:1044
double chiN
Incompatibility.
Definition: VarData.h:323
int SetNChain(int NewNCh)
Set and reallocate the number of chains.
Definition: VarDataComm.cpp:78
double Gamma
Friction term.
Definition: VarData.h:451
double Hamaker
Strength of the interaction.
Definition: VarData.h:447
int ReadPartXyzt(FILE *FileToRead)
Reads a x y z t file.
double Edge[4]
xyzr edges of the simulation box
Definition: VarData.h:309
char cWhat2Draw[STRSIZE]
What to draw.
Definition: VarData.h:1042
double WFuncStraight2
Weighting function straight length.
Definition: VarData.h:339
int Asym
Diblock limit of the chain.
Definition: VarData.h:273
double Time
Total time.
Definition: VarData.h:301
double Mass
Mass.
Definition: VarData.h:443
void SetTime(double Val)
Set Time.
Definition: VarData.h:1006
char Name[60]
BLock name.
Definition: VarData.h:257
int SetNBlock(int Val)
Set NBlock.
double Rad
Size.
Definition: VarData.h:445
void SetNanoBkf(int n)
Set the back folded array for the nano n.
double pInvEdge(int d)
Inverted xyzr edges of the simulation box.
Definition: VarData.h:920
int Fetch(char *str, char *mask, char *fmt,...)
Retrive from a string the information concerning the mask.
int Arch
Architecture type.
Definition: VarData.h:269
double Height
Height of the cylinder.
Definition: VarData.h:449
Information for every soft object.
Definition: VarData.h:276
double Vel[3]
Velocity.
Definition: VarData.h:431
void SubNanoHeader(char *cFile)
Substitue the nano header.
int CLat2
lateral coordinate
Definition: VarData.h:1078
double Pos[3]
xyz Position of the particle
Definition: VarData.h:216
int NLink
Maximum number of bonds.
Definition: VarData.h:357
int InitBead
Initial bead.
Definition: VarData.h:250
int NAddChain
Additional homopolymer chains into the membrane.
Definition: VarData.h:1066
int InitIdx
Initial particle position.
Definition: VarData.h:265
double Vel[4]
Velocity of the system.
Definition: VarData.h:315
double Pos[3]
Position.
Definition: VarData.h:427
int Shape
0 none, 1 spherical, 2 cylindrical 3 wall
Definition: VarData.h:473
void ReadHeader(FILE *FileToRead)
Reads a header.
bool ReadString(const char *String, char *cLine, double *Value)
Copy the value in the.
double SpringRest
Rest length of the harmonic potential.
Definition: VarData.h:333
void SetDeltat(double Val)
Set DeltaT.
Definition: VarData.h:1000
int nBlock
In which block is the peptide written.
Definition: VarData.h:481
int SetNPart(int NewNPart)
Set and reallocate the number of particles.
Definition: VarDataComm.cpp:2
int NStuffing
Stuffing for the cylinder.
Definition: VarData.h:1072
double pEdge(int d)
xyzr edges of the simulation box
Definition: VarData.h:918
int pNPCh()
Number of particle per chain.
int Idx
Particle identifier.
Definition: VarData.h:222
double vBB
Chemical potential of the water.
Definition: VarData.h:319
int ReadPartTxvl(FILE *FileToRead)
Reads a type-position-velocity-link file.
int pNBlock()
Number of blocks.
MatInt * MInt
Matrix of the prefactor of the interactions.
Definition: VarData.h:529
int NChain
Number of chain.
Definition: VarData.h:347
int NEdge
Number of particles per edge.
Definition: VarData.h:1084
double Vel[3]
bias velocity
Definition: VarData.h:282
double kappaSpring
Prefactor of the bond spring.
Definition: VarData.h:331
int NPart
particles
Definition: VarData.h:261
int NCircle
Number of monomers per circle.
Definition: VarData.h:479
int HeaderNano(FILE *FileToWrite)
Write the nano section of the header to the file.
void SetTemp(double Val)
Set Temperature.
Definition: VarData.h:1004
int ReadSoft(FILE *ConfFile)
Reads the specifications about the nano.
int ReadPartXyz(FILE *FileToRead)
Reads a x y z file.
int NPCh
Number of particle per chain.
Definition: VarData.h:349
double Bkf[3]
Backfolded position.
Definition: VarData.h:429
int SysType
Contains the definition of the system.
Definition: VarData.h:1086
double Pos[3]
initial position
Definition: VarData.h:280
int pNNano()
Number of nanoparticles.
double Coating
Thickness of the LJ well.
Definition: VarData.h:461
double Cm[3]
Center of mass of the system.
Definition: VarData.h:313
double Energy[3]
Pot, kinetik, free.
Definition: VarData.h:307
double Pos[4]
xyzr Postion of the chain
Definition: VarData.h:238
int NPCh
particles per chain
Definition: VarData.h:259
double ScaleF[3]
Scale factor.
Definition: VarData.h:1060
void SetStep(int Val)
Set Step.
Definition: VarData.h:1002
int ReadLineXvt(char *cLine, double *Pos, int *Type)
Read a single line in format Xvt.
int SysFormat
Contains the definition of the file format.
Definition: VarData.h:1088
int NanoString(char *cLine, int n)
Reads and set the specifics of the nano.
int NSolvent
Solvent molecules.
Definition: VarData.h:1070
double OffSet
Reference potential.
Definition: VarData.h:457
int EndBead
End bead.
Definition: VarData.h:252
double pReOverCutOff()
Re/CutOff.
Definition: VarData.h:946
SOFT * Soft
Soft bodies.
Definition: VarData.h:1052
void SetNType(int NewNType)
Set the number of species.
int NChain
chains
Definition: VarData.h:263
double WFuncStraight3
Weighting function straight length.
Definition: VarData.h:341
int EndIdx
End particle position.
Definition: VarData.h:267
int NType
of types of the particle
Definition: VarData.h:355
int pNChain()
Number of chain.
int IfNormalize
If normalize the lateral dimensions to one.
Definition: VarData.h:1092
int BfEdge()
Find the box size if missing.
int CLat1
lateral coordinate
Definition: VarData.h:1076
void ReadHeaderTxvl(FILE *FileToRead)
Reads a header for a txvl file format.
void ReadHeaderXvt(FILE *FileToRead)
Reads a header of xvl file format.
int ReadPassThru(FILE *FileToRead)
Reads the information to alloc the structure.
bool ReadConf(char *InFile)
Reads a "configuration file".
Definition: VarDataRead.cpp:28
double AVel[3]
Angular velocity.
Definition: VarData.h:441
double Axis[3]
Rotation axis.
Definition: VarData.h:435
int NSoft
Number of soft bodies.
Definition: VarData.h:1062
void Rescale(double SFactor, int Order)
Rescale entries.
Definition: VarData.cpp:312
int SetNNano(int Val)
Set NNano.
int NPart
Number of particle.
Definition: VarData.h:345
PART * Pm
Particle information of all particle.
Definition: VarData.h:1046
int Typ
Type.
Definition: VarData.h:226
double ReOverCutOff
Convertion unit R_e over CutOff.
Definition: VarData.h:335
int NPCh
Number of particles per chain.
Definition: VarData.h:248
int NBlock
Number of blocks.
Definition: VarData.h:359
void VarMessage(const char *s,...)
If enabled call the function position.
Definition: VarData.cpp:29
double Size[3]
dimension xyz/rad height
Definition: VarData.h:284
void ReadNano(FILE *ConfFile, int NCircle, int NHeight)
Reads the specifications about the hard object.
void SetCoeff()
Set the virial coefficients from the known values of density coex...
Definition: VarData.cpp:171
double rho
Density coexistence.
Definition: VarData.h:327
void SetEdge(double Val, int d)
Set Edge.
Definition: VarData.h:976
int ReadVal(char *pLine, double *Value)
Copy the value in the String to the Value referring to the position of pLine.
int CNorm
Normal coordinate.
Definition: VarData.h:1074
int pNPart()
Number of particle.
int NHeight
Number of monomers per side.
Definition: VarData.h:477
double kappaBend
Prefactor of the bending potential.
Definition: VarData.h:329