Allink  v0.1
ElPoly.cpp
1 /***********************************************************************
2 ElPoly:This progam provide a graphical visualisation of the data
3 opend by VarData using openGL glut. The most important option are
4 the possibility of changing the backfold of the polymers with 'c',
5 see the subsequent file in the list with '>', see the bond with 'b'.
6 Copyright (C) 2008 by Giovanni Marelli <sabeiro@virgilio.it>
7 
8 
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13 
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18 
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 ***********************************************************************/
23 #include "ElPoly.h"
24 //#include "../include/Draw.h"
25 
26 ElPoly *Pol;
27 void Legenda();
28 
29 #ifdef __glut_h__
30 void MenuChoise(int option){
31  //Pol->What2Draw = option;
32  Pol->ElMenuChoise(option);
33 }
34 void MenuVisual(int option){
35  //Pol->What2Draw = option;
36  Pol->ElMenuVisual(option);
37 }
38 #endif
39 int main(int argc,char **argv){
40  if(argc<2){
41  printf("Mi serve come argomento un file!\n");
42  return 0;
43  }
44  int *FilePos = (int *)calloc(argc,sizeof(int));
45  char Comando[60];
46  char ConfF[256];
47  char cWhat2Draw[12];
48  sprintf(cWhat2Draw,"part");
49  sprintf(ConfF,"Polymers.conf");
50  sprintf(Comando,"ciccia");
51  int NBin = 100;
52  int NSample = 32;
53  int NFile = 0;
54  int IfUser = 1;
55  int IfCreate = 0;
56  int nBlock = 0;
57  int quando = 0;
58  int Coord = 2;
59  int CoordProfile = 0;
60  int nNano = 0;
61  int BackFold = BF_PART;
62  int NParam = 0;
63  double Param[10];
64  //Number = (char *)malloc(100*sizeof(char));
65  // frame = (char *)malloc(100*sizeof(char));
66  //SpecFuntore <Matematica> SpecMat(&Mat,Matematica::Eval);
67  //SpecFuntore <ElPoly> SpecPol(&Pol,ElPoly::ContactAngle);
68  for(int i=1;i<argc;i++){
69  if(argv[i][0] != '-'){
70  FilePos[NFile] = i;
71  NFile++;
72  }
73  if(!strcmp(*(argv+i),"--help")){
74  Legenda();
75  return 0;
76  }
77  if(!strcmp(*(argv+i),"-b")){
78  char sBf[12];
79  if(argc < i){printf("Which backfold?\n");return 1;}
80  i += 1;
81  }
82  else if(!strcmp(*(argv+i),"-bl")){
83  if(argc < i){printf("Which block?\n");return 1;}
84  sscanf(argv[i+1],"%d",&nBlock);
85  i+=1;
86  }
87  else if(!strcmp(*(argv+i),"-c")){
88  if(argc < i){printf("Which normal coordinate?\n");return 1;}
89  i+=1;
90  }
91  else if(!strcmp(*(argv+i),"-cc")){
92  if(argc < i){printf("Which coordinate for the profile?\n");return 1;}
93  sscanf(argv[i+1],"%d",&CoordProfile);
94  i+=1;
95  }
96  else if(!strcmp(*(argv+i),"-d")){
97  sprintf(Comando,"d");
98  if(argc < i){printf("What to visualize?\n");return 1;}
99  sscanf(argv[i+1],"%s",&cWhat2Draw);
100  i+=1;
101  IfUser = 0;
102  }
103  else if(!strcmp(*(argv+i),"-f")){
104  if(argc < i+1){printf("Which files?\n");return 1;}
105  i+=2;
106  }
107  else if(!strcmp(*(argv+i),"-n")){
108  if(argc < i){printf("Which nanoparticle?\n");return 1;}
109  sscanf(argv[i+1],"%d",&nNano);
110  i+=1;
111  }
112  else if(!strcmp(*(argv+i),"--normalize")){
113  }
114  else if(!strcmp(*(argv+i),"-p")){
115  if(argc < i){printf("Which value for the paramter?\n");return 1;}
116  i+=1;
117  }
118  else if(!strcmp(*(argv+i),"-s")){
119  if(argc < i){printf("How many samples?\n");return 1;}
120  sscanf(argv[i+1],"%d",&NSample);
121  i+=1;
122  }
123  else if(!strcmp(*(argv+i),"--scale")){
124  if(argc < i){printf("What scale?\n");return 1;}
125  i+=3;
126  }
127  else if(!strcmp(*(argv+i),"--scalez")){
128  if(argc < i){printf("What scale?\n");return 1;}
129  i+=1;
130  }
131  else if(!strcmp(*(argv+i),"--skip")){
132  if(argc < i){printf("How many chains to skip?\n");return 1;}
133  i+=1;
134  }
135  else if(!strcmp(*(argv+i),"--Shift")){
136  i+=3;
137  }
138  else if(!strcmp(*(argv+i),"-v")){
139  if(argc < i){printf("How many values?\n");return 1;}
140  sscanf(argv[i+1],"%d",&NBin);
141  i+=1;
142  }
143  else if(!strcmp(*(argv+i),"-x")){
144  IfCreate = 1;
145  }
146  else if(!strncmp(*(argv+i),"--",2)){
147  sprintf(Comando,"%s",argv[i]+2);
148  IfUser = 0;
149  }
150  }
151  if(IfCreate){
152  VarData *Dat = new VarData;
153  Dat->DefSoft(argv[FilePos[0]],ConfF);
154  return 0;
155  }
156  Pol = new ElPoly(NFile,argv,FilePos);
157  for(int i=1;i<argc;i++){
158  if(!strcmp(*(argv+i),"-b")){
159  char sBf[12];
160  if(argc < i){printf("Which backfold?\n");return 1;}
161  sscanf(argv[i+1],"%s",sBf);
162  if(!strcmp(sBf,"part"))
163  BackFold = BF_PART;
164  else if(!strcmp(sBf,"no"))
165  BackFold = BF_NO;
166  else if(!strcmp(sBf,"chain"))
167  BackFold = BF_CHAIN;
168  else if(!strcmp(sBf,"skip"))
169  BackFold = BF_SKIP;
170  else if(!strcmp(sBf,"nano"))
171  BackFold = BF_NANO;
172  else if(!strcmp(sBf,"tilt"))
173  BackFold = BF_TILT;
174  else{
175  printf("Backfold not recognized set to chain\n");
176  BackFold = BF_CHAIN;
177  }
178  Pol->SetBackFold(BackFold);
179  i+=1;
180  }
181  else if(!strcmp(*(argv+i),"-c")){
182  if(argc < i){printf("Which normal coordinate?\n");return 1;}
183  sscanf(argv[i+1],"%d",&Coord);
184  Pol->SetCNorm(Coord);
185  i+=1;
186  }
187  else if(!strcmp(*(argv+i),"--normalize")){
188  Pol->SetIfNormalize(1);
189  }
190  else if(!strcmp(*(argv+i),"-f")){
191  int InitFile = 0;
192  int EndFile = 0;
193  if(argc < i+1){printf("Which files?\n");return 1;}
194  sscanf(argv[i+1],"%d",&InitFile);
195  sscanf(argv[i+2],"%d",&EndFile);
196  Pol->SetBoundFile(InitFile,EndFile);
197  i+=2;
198  }
199  else if(!strcmp(*(argv+i),"-p")){
200  if(argc < i){printf("Which value for the paramter?\n");return 1;}
201  sscanf(argv[i+1],"%lf",Param);
202  Pol->ExtParam = Param[0];
203  NParam = 1;
204  i+=1;
205  }
206  else if(!strcmp(*(argv+i),"--Ref")){
207  double RefPos[3] = {.0,.0,.0};
208  double ShiftPos[3] = {.0,.0,.0};
209  if(i<argc-2){
210  for(int d=0;d<3;d++){
211  sscanf(*(argv+d+i+1),"%lf",RefPos+d);
212  ShiftPos[d] = RefPos[d] - .5;
213  }
214  i+=3;
215  }
216  Pol->SetShiftPos(ShiftPos);
217  }
218  else if(!strcmp(*(argv+i),"-s")){
219  Pol->NEdge = NSample;
220  i+=1;
221  }
222  else if(!strcmp(*(argv+i),"--scale")){
223  double Scale[3];
224  if(argc < i){printf("What scale?\n");return 1;}
225  for(int d=0;d<3;d++){
226  sscanf(*(argv+d+i+1),"%lf",Scale+d);
227  }
228  Pol->SetScaleF(Scale);
229  i+=3;
230  }
231  else if(!strcmp(*(argv+i),"--scalez")){
232  double Scale;
233  if(argc < i){printf("What scale?\n");return 1;}
234  sscanf(argv[i+1],"%lf",&Scale);
235  Pol->ScaleFact = Scale;
236  i+=1;
237  }
238  else if(!strcmp(*(argv+i),"--skip")){
239  if(argc < i){printf("How many lipid to skip in the visualisation?\n");return 1;}
240  int NSkip = 0;
241  sscanf(argv[i+1],"%d",&NSkip);
242  Pol->SetNVisSkip(NSkip);
243  i+=1;
244  }
245  else if(!strcmp(*(argv+i),"--Shift")){
246  double ShiftPos[3] = {.0,.0,.0};
247  if(i<argc-2){
248  for(int d=0;d<3;d++){
249  sscanf(*(argv+d+i+1),"%lf",ShiftPos+d);
250  }
251  i+=3;
252  }
253  Pol->SetShiftPos(ShiftPos);
254  }
255  else if(!strcmp(*(argv+i),"-S")){
256  int Shift = SHIFT_NO;
257  char sBf[12];
258  if(argc < i){printf("Which shift?\n");return 1;}
259  sscanf(argv[i+1],"%s",sBf);
260  if(!strcmp(sBf,"cm"))
261  Shift = BF_PART;
262  else if(!strcmp(sBf,"nano"))
263  Shift = BF_NO;
264  else if(!strcmp(sBf,"cm_nano"))
265  Shift = BF_CHAIN;
266  else{
267  printf("shift not recognized set to no\n");
268  Shift = SHIFT_NO;
269  }
270  Pol->ShiftSys(Shift);
271  i+=1;
272  }
273  }
274  Pol->Open(argv[FilePos[0]],BackFold);
275  if(!IfUser)sprintf(Pol->cWhat2Draw,"%s",cWhat2Draw);
276  char cSystem1[STRSIZE];
277  char cSystem2[STRSIZE];
278  Pol->SysInfo(cSystem1);
279  Pol->SysDef(cSystem2);
280  printf("------------------------------------------------------\n");
281  printf("%s NFile %d\n%s\n",cSystem1,NFile,cSystem2);
282  printf("------------------------------------------------------\n");
283  while(strcmp(Comando,"q")){
284  if(IfUser){
285  printf("ElPoly> ");
286  scanf("%s",Comando);
287  }
288  if(!strcmp(Comando,"d")){
289 #ifdef __glut_h__
290  Pol->Graphics(argc,argv);
291 #else
292  printf("Graphics libraries (GL/glut.h) not supplied\n");
293 #endif //__glut_h__
294  }
295  else if(!strcmp(Comando,"?") ){
296  Legenda();
297  }
298  else if(!strcmp(Comando,"!") ){
299  printf("Insert a shell command: ");
300  scanf("%s",Comando);
301  system(Comando);
302  }//--------------------Dens-Func----------------------
303  else if(!strcmp(Comando,"dens")){
304  Pol->DensProf(NBin,NSample,Coord);
305  if(!IfUser) return 0;
306  }//--------------------3To2-------------------------
307  else if(!strcmp(Comando,"3to2")){
308  Pol->From3To2d(NSample,Param[0]);
309  if(!IfUser) return 0;
310  }//--------------------3To1-------------------------
311  else if(!strcmp(Comando,"3to1")){
312  Pol->From3To1d(Coord);
313  if(!IfUser) return 0;
314  }//--------------------2To1-------------------------
315  else if(!strcmp(Comando,"2to1")){
316  Pol->From2To1d(Coord);
317  if(!IfUser) return 0;
318  }//--------------------Projection----------------------
319  else if(!strcmp(Comando,"pro")){
320  Pol->ProjectionF(NBin,Coord);
321  if(!IfUser) return 0;
322  }//--------------------Core-Part----------------------
323  else if(!strcmp(Comando,"core")){
324  Pol->CoreF(NSample,0);
325  if(!IfUser) return 0;
326  }//--------------------Core-Nano----------------------
327  else if(!strcmp(Comando,"coreNano")){
328  Pol->CoreF(NSample,1);
329  if(!IfUser) return 0;
330  }//--------------------Radial-Shell--------------------
331  else if(!strcmp(Comando,"RadShell")){
332  Pol->RadialShell(NBin);
333  if(!IfUser) return 0;
334  }//--------------------Contact-Angle-------------------
335  else if(!strcmp(Comando,"angle")){
336  Pol->Angle(NBin);
337  if(!IfUser) return 0;
338  }//--------------------Slab-Prof-----------------------
339  else if(!strcmp(Comando,"SlabProf")){
340  Pol->SlabProf(NBin,nNano,CoordProfile);
341  if(!IfUser) return 0;
342  }//--------------------Slab-Prof-----------------------
343  else if(!strcmp(Comando,"SlabAngleProfs")){
344  Pol->SlabAngleProfs(NBin,10,CoordProfile);
345  if(!IfUser) return 0;
346  }//--------------------Cart-Dens-----------------------
347  else if(!strcmp(Comando,"CartDens")){
348  Pol->CartDens(NBin,nNano);
349  if(!IfUser) return 0;
350  }//--------------------Rad-Nano-----------------------
351  else if(!strcmp(Comando,"radNano")){
352  Pol->RadDistrF(NBin,1,nNano);
353  if(!IfUser) return 0;
354  }//--------------------Rad-Cm----------------------------
355  else if(!strcmp(Comando,"radCm")){
356  Pol->RadDistrF(NBin,0,nNano);
357  if(!IfUser) return 0;
358  }//--------------------Rad-CmN----------------------------
359  else if(!strcmp(Comando,"radCmN")){
360  Pol->RadDistrF(NBin,2,nNano);
361  if(!IfUser) return 0;
362  }//--------------------Rad-CmN----------------------------
363  else if(!strcmp(Comando,"radStalk")){
364  Pol->RadDistrF(NBin,4,nNano);
365  if(!IfUser) return 0;
366  }//--------------------Rad-CmN----------------------------
367  else if(!strcmp(Comando,"radPore")){
368  Pol->RadDistrF(NBin,5,nNano);
369  if(!IfUser) return 0;
370  }//----------Cartesian-around-the-pep---------------------
371  else if(!strcmp(Comando,"cartNano")){
372  Pol->RadDistrF(NBin,6,nNano);
373  if(!IfUser) return 0;
374  }//----------Distribution-of-the-bond-length-----------------
375  else if(!strcmp(Comando,"BondDistr")){
376  Pol->BondDistr(NSample);
377  if(!IfUser) return 0;
378  }//----------Distribution-of-the-splay-angle-----------------
379  else if(!strcmp(Comando,"SplayDistr")){
380  Pol->SplayDistr(NSample);
381  if(!IfUser) return 0;
382  }//--------------------Center-Of-Mass------------------
383  else if(!strcmp(Comando,"cm")){
384  Pol->CenterOfMass(Coord);
385  if(!IfUser) return 0;
386  }//-------------------Thick-prof----------------------
387  else if(!strcmp(Comando,"Dens2Thick")){
388  Pol->RadDens2Thick(NBin);
389  if(!IfUser) return 0;
390  }//-------------------Thick-prof----------------------
391  else if(!strcmp(Comando,"Dens2Thick2d")){
392  Pol->RadDens2Thick2d(NBin);
393  if(!IfUser) return 0;
394  }//-------------------Thick-prof----------------------
395  else if(!strcmp(Comando,"ThickFromDens")){
396  Pol->ThickFromDens(NBin);
397  if(!IfUser) return 0;
398  }//--------------------Temperature----------------------
399  else if(!strcmp(Comando,"temp")){
400  Pol->Temperature(NBin,Coord);
401  if(!IfUser) return 0;
402  }//--------------------Nano-Particle---------------------
403  else if(!strcmp(Comando,"nano")){
404  Pol->NanoParticle(NBin);
405  if(!IfUser) return 0;
406  }//--------------------Surface------------------------
407  else if(!strcmp(Comando,"surf")){
408  Pol->Surface(NBin,1);
409  if(!IfUser) return 0;
410  }//--------------------Diffusivity------------------------
411  else if(!strcmp(Comando,"diff")){
412  Pol->Diffusivity();
413  if(!IfUser) return 0;
414  }//--------------------DiffusivitySlab------------------------
415  else if(!strcmp(Comando,"DiffSlab")){
416  Pol->DiffSlab(NSample);
417  if(!IfUser) return 0;
418  }//--------------------Pair-Corr--------------------
419  else if(!strcmp(Comando,"PairCorr")){
420  Pol->PairCorr(NBin,1);
421  if(!IfUser) return 0;
422  }//--------------------Pair-Correlation--------------------
423  else if(!strcmp(Comando,"pairMon")){
424  Pol->PairCorrelationF(NBin,0);
425  if(!IfUser) return 0;
426  }//--------------------Pair-Correlation--------------------
427  else if(!strcmp(Comando,"pairChain")){
428  Pol->PairCorrelationF(NBin,1);
429  if(!IfUser) return 0;
430  }//--------------------Pair-Correlation-----------------
431  else if(!strcmp(Comando,"pairRound")){
432  Pol->PairCorrelationF(NBin,2);
433  if(!IfUser) return 0;
434  }//--------------------Pair-Correlation------------------
435  else if(!strcmp(Comando,"pairSquare")){
436  Pol->PairCorrelationF(NBin,3);
437  if(!IfUser) return 0;
438  }//--------------------Pair-Correlation---------------
439  else if(!strcmp(Comando,"pairPep")){
440  Pol->PairCorrelationF(NBin,4);
441  if(!IfUser) return 0;
442  }//--------------------Average-snapshots---------------
443  else if(!strcmp(Comando,"AvSnap")){
444  Pol->AvSnap();
445  if(!IfUser) return 0;
446  }//--------------------Scattering--------------------
447  else if(!strcmp(Comando,"scatt")){
448  Pol->ScatteringF(NBin,0);
449  if(!IfUser) return 0;
450  }//--------------------Scattering--------------------
451  else if(!strcmp(Comando,"scatt2")){
452  Pol->ScatteringF(NBin,1);
453  if(!IfUser) return 0;
454  }//--------------------Worm--------------------
455  else if(!strcmp(Comando,"worm")){
456  Pol->WormF(20,NBin);
457  if(!IfUser) return 0;
458  }//--------------------Header--------------------
459  else if(!strcmp(Comando,"header")){
460  Pol->HeaderAverage(nNano);
461  if(!IfUser) return 0;
462  }//--------------------Spectrum--------------------
463  else if(!strcmp(Comando,"spe")){
464  Pol->SpectrumF(NSample);
465  return 0;
466  if(!IfUser) return 0;
467  }//--------------------RadNormPos--------------------
468  else if(!strcmp(Comando,"RadNormPos")){
469  Pol->RadNormPos(NBin,NSample);
470  if(!IfUser) return 0;
471  }//--------------------PoreDistr--------------------
472  else if(!strcmp(Comando,"AreaDistr")){
473  Pol->AreaDistrF(NBin);
474  if(!IfUser) return 0;
475  }//--------------------Midplane----------------
476  else if(!strcmp(Comando,"mid")){
477  Pol->Midplane(NSample);
478  if(!IfUser) return 0;
479  }//--------------------Midplane----------------
480  else if(!strcmp(Comando,"midSpe")){
481  Pol->SpectrumMidplane(NSample);
482  if(!IfUser) return 0;
483  }//-------------------chain-properties--------------------
484  else if(!strcmp(Comando,"prop")){
485  Pol->PropertiesF();
486  if(!IfUser) return 0;
487  }//-------------------Divide-Layers--------------------
488  else if(!strcmp(Comando,"divOpp")){
489  Pol->DivideLayers(VAR_OPPOSED);
490  if(!IfUser) return 0;
491  }//-------------------Divide-Layers--------------------
492  else if(!strcmp(Comando,"divTube")){
493  Pol->DivideLayers(VAR_TUBE);
494  if(!IfUser) return 0;
495  }//-------------------Divide-Layers--------------------
496  else if(!strcmp(Comando,"divVes")){
497  Pol->DivideLayers(VAR_VESICLE);
498  if(!IfUser) return 0;
499  }//-------------------ChainPArea--------------------
500  else if(!strcmp(Comando,"AreaCompr")){
501  Pol->AreaCompr(NSample);
502  if(!IfUser) return 0;
503  }//-------------------Pre-Trace--------------------
504  else if(!strcmp(Comando,"PTrace")){
505  Pol->PressTrace();
506  if(!IfUser) return 0;
507  }//-------------------Press-Trace--------------------
508  else if(!strcmp(Comando,"PRadial")){
509  Pol->PressRadial();
510  if(!IfUser) return 0;
511  }//-------------------TensProf--------------------
512  else if(!strcmp(Comando,"Tens")){
513  Pol->SurfTens(NBin);
514  if(!IfUser) return 0;
515  }//-------------------TensProf--------------------
516  else if(!strcmp(Comando,"TensCartRad")){
517  Pol->Tens2dCartRad();
518  if(!IfUser) return 0;
519  }//-------------------TensSum--------------------
520  else if(!strcmp(Comando,"SumTens")){
521  Pol->SumTens();
522  //Pol->Prova();
523  if(!IfUser) return 0;
524  }//-------------------Prova--------------------
525  else if(!strcmp(Comando,"Prova")){
526  Pol->Prova();
527  if(!IfUser) return 0;
528  }//-------------------Stalk--------------------
529  else if(!strcmp(Comando,"stalk")){
530  Pol->StalkF(32);
531  if(!IfUser) return 0;
532  }//-------------------Stalk--------------------
533  else if(!strcmp(Comando,"StalkLine")){
534  Pol->StalkLineProfF(NBin);
535  if(!IfUser) return 0;
536  }//-------------------BackBone--------------------
537  else if(!strcmp(Comando,"BackBone")){
538  double *Line = new double[NBin];
539  Pol->BackBone(Line,NBin);
540  if(!IfUser) return 0;
541  }//-------------------Remove--------------------
542  else if(!strcmp(Comando,"rem")){
543  Pol->RemoveChains();
544  if(!IfUser) return 0;
545  }//-----------------Chain-position--------------------
546  else if(!strcmp(Comando,"ChPos")){
547  FILE *FWrite = fopen("ChainPos.dat","w");
548  for(int c=0;c<Pol->pNChain();c++){
549  fprintf(FWrite,"%lf %lf %lf\n",Pol->Ch[c].Pos[0],Pol->Ch[c].Pos[1],Pol->Ch[c].Pos[2]);
550  }
551  fclose(FWrite);
552  if(!IfUser) return 0;
553  }//-------------------Transform--------------------
554  else if(!strcmp(Comando,"tra")){
555  Pol->Transform(nBlock);
556  Pol->Write("transformed.dat");
557  if(!IfUser) return 0;
558  }//-------------------WriteXyz--------------------
559  else if(!strcmp(Comando,"xyz")){
560  Pol->WriteXyz("resume.dat");
561  if(!IfUser) return 0;
562  }//-------------------WriteXyz--------------------
563  else if(!strcmp(Comando,"ConvLattice")){
564  Pol->ConvLattice(NSample,"LatticePoints.dat");
565  if(!IfUser) return 0;
566  }//-------------------Write--------------------
567  else if(!strcmp(Comando,"write")){
568  Pol->Write("resume.dat");
569  if(!IfUser) return 0;
570  }//-------------------WidomOut--------------------
571  else if(!strcmp(Comando,"WidomOut")){
572  //Pol->WidomOut("NrgLipid.dat",NBin);
573  Pol->WidomOut();
574  if(!IfUser) return 0;
575  }//-------------------WidomIn--------------------
576  else if(!strcmp(Comando,"WidomIn")){
577  //Pol->WidomIn("NrgLipid.dat",NBin);
578  Pol->WidomIn();
579  if(!IfUser) return 0;
580  }//-------------------End2EndDistr--------------------
581  else if(!strcmp(Comando,"End2End")){
582  Pol->End2EndDistr("End2EndDistr");
583  if(!IfUser) return 0;
584  }//-----------------ElasticCoupling--------------------
585  else if(!strcmp(Comando,"ElCoup")){
586  Pol->ElasticCoupling(NSample);
587  if(!IfUser) return 0;
588  }//-----------------ElasticCoupling--------------------
589  else if(!strcmp(Comando,"ElCoupNVT")){
590  Pol->ElasticCouplingNVT();
591  if(!IfUser) return 0;
592  }//-----------------E2EDecoupling--------------------
593  else if(!strcmp(Comando,"E2EDec")){
594  Pol->Decoupling(1);
595  if(!IfUser) return 0;
596  }//-----------------SmoothGrid------------------------
597  else if(!strcmp(Comando,"SmoothGrid")){
598  Pol->SmoothGrid(NBin,"GridSmoothed.dat");
599  if(!IfUser) return 0;
600  }//-----------------IsoSurface------------------------
601  else if(!strcmp(Comando,"IsoSurf")){
602  Pol->IsoSurf(NSample,Param,NParam);
603  if(!IfUser) return 0;
604  }//-----------------IsoLine------------------------
605  else if(!strcmp(Comando,"IsoLine")){
606  NParam = 10;
607  double OldParam = Param[0];
608  for(int p=0;p<NParam;p++){
609  Param[p] = OldParam*p/(double)(NParam);
610  }
611  Pol->IsoLine(NSample,Param,NParam,0);
612  if(!IfUser) return 0;
613  }//-----------------IsoLineDens------------------------
614  else if(!strcmp(Comando,"IsoLineDens")){
615  Pol->IsoLine(NSample,Param,NParam,1);
616  if(!IfUser) return 0;
617  }//-----------------Follow-Pore------------------------
618  else if(!strcmp(Comando,"FPore")){
619  Pol->FetchPore();
620  if(!IfUser) return 0;
621  }//-----------------Follow-Stalk------------------------
622  else if(!strcmp(Comando,"FStalk")){
623  Pol->FetchStalk();
624  if(!IfUser) return 0;
625  }//-----------------Area-Stalk------------------------
626  else if(!strcmp(Comando,"AStalk")){
627  Pol->StalkArea();
628  if(!IfUser) return 0;
629  }//-----------------Shift-to-center------------------------
630  else if(!strcmp(Comando,"Shift2Center")){
631  Pol->Shift2Center();
632  if(!IfUser) return 0;
633  }//-----------------AvSnap------------------------
634  else if(!strcmp(Comando,"AvSnap")){
635  Pol->AvSnap();
636  if(!IfUser) return 0;
637  }//-----------------DirDecoupling--------------------
638  else if(!strcmp(Comando,"DirDec")){
639  Pol->Decoupling(0);
640  if(!IfUser) return 0;
641  }//-----------------ElasticCoupling--------------------
642  else if(!strcmp(Comando,"BilDist")){
643  Pol->BilayerDistance("BilayerDistance.dat",NSample);
644  if(!IfUser) return 0;
645  }//-------------------BondDistr--------------------
646  else if(!strcmp(Comando,"Bond")){
647  Pol->BondDistr("BondDistr.dat",NBin);
648  if(!IfUser) return 0;
649  }//-------------------Difference,-two-files---------------
650  else if(!strcmp(Comando,"Diff2Dens")){
651  Pol->Diff2Files(NSample,1);
652  if(!IfUser) return 0;
653  }//-------------------Difference,-two-files---------------
654  else if(!strcmp(Comando,"Diff2Pre")){
655  Pol->Diff2Files(NSample,0);
656  if(!IfUser) return 0;
657  }//-------------------Difference,-two-files---------------
658  else if(!strcmp(Comando,"RestPre")){
659  Pol->RestPress(NBin);
660  if(!IfUser) return 0;
661  }//-------------------Conv-to-tecplot-----------------
662  else if(!strcmp(Comando,"tecplotDens")){
663  Pol->Conv2Tecplot(NBin,0);
664  if(!IfUser) return 0;
665  }//-------------------Conv-to-tecplot-----------------
666  else if(!strcmp(Comando,"tecplotPre")){
667  Pol->Conv2Tecplot(NBin,1);
668  if(!IfUser) return 0;
669  }//-------------------Conv-to-tecplot-----------------
670  else if(!strcmp(Comando,"tecplotHei")){
671  Pol->Conv2Tecplot(NBin,2);
672  if(!IfUser) return 0;
673  }//-------------------Conv-to-rzd-----------------
674  else if(!strcmp(Comando,"rzd")){
675  Pol->Conv2rzd(NBin);
676  if(!IfUser) return 0;
677  }//-------------------Conv-to-rzd-----------------
678  else if(!strcmp(Comando,"xyzd")){
679  Pol->Conv2xyzd(NBin);
680  if(!IfUser) return 0;
681  }//-------------------Conv-to-vmd--------------
682  else if(!strcmp(Comando,"vmd")){
683  Pol->Conv2Vmd();
684  if(!IfUser) return 0;
685  }//-------------------povray--------------
686  else if(!strcmp(Comando,"povray")){
687  Pol->Conv2Povray();
688  if(!IfUser) return 0;
689  }//-----------------------Coord------------------
690  else if(!strcmp(Comando,"coord")){
691  printf("Enter coordinate number [0 2] or radius [3]: ");
692  scanf("%d",&Coord);
693  if(Coord < 0 || Coord > 3){
694  printf("Value not valid, coord set to 0\n");
695  Coord = 0;
696  }
697  if(!IfUser) return 0;
698  }//-----------------------Normal------------------
699  else if(!strcmp(Comando,"norm")){
700  printf("Enter the direction of the normal: ");
701  int Temp = 0;
702  scanf("%d",&Temp);
703  if(Temp >= 0 && Temp < 3){
704  Pol->CNorm = Temp;
705  Pol->CLat1 = (Pol->CNorm+1)%3;
706  Pol->CLat2 = (Pol->CNorm+2)%3;
707  printf("n %d c1 %d c2 %d\n",Pol->CNorm,Pol->CLat1,Pol->CLat2);
708  }
709  if(!IfUser) return 0;
710  }//--------------------Chain-Type------------------
711  else if(!strcmp(Comando,"type")){
712  int NChType = CHAIN_EVERY;
713  printf("up %d down %d flabby %d stretch %d added %d every %d: ",CHAIN_UP,CHAIN_DOWN,CHAIN_FLABBY,CHAIN_STRETCH,CHAIN_ADDED,CHAIN_EVERY);
714  scanf("%d",&NChType);
715  if(NChType != CHAIN_UP && NChType != CHAIN_DOWN && NChType != CHAIN_FLABBY && NChType != CHAIN_STRETCH && NChType != CHAIN_ADDED && NChType != CHAIN_EVERY){
716  printf("Value not valid, type set to %d\n",CHAIN_EVERY);
717  NChType = CHAIN_EVERY;
718  }
719  Pol->NChType = NChType;
720  if(!IfUser) return 0;
721  }//------------------Change-Files------------------------
722  else if(!strcmp(Comando,"file")){
723  Pol->ChangeFile();
724  if(!IfUser) return 0;
725  }//------------------Change-NBin---------------------
726  else if(!strcmp(Comando,"val")){
727  printf("Number bins (NBin) :");
728  scanf("%d",&NBin);
729  if(!IfUser) return 0;
730  }//------------------Find-neighbours---------------------
731  else if(!strcmp(Comando,"Nei")){
732  Pol->FindNeighbours("CrossLinks.dat");
733  if(!IfUser) return 0;
734  }//------------------Change-NSample---------------------
735  else if(!strcmp(Comando,"sample")){
736  Pol->Sample(NSample);
737  if(!IfUser) return 0;
738  }//-------------------Open-Another-File-----------------------------
739  else if(!strcmp(Comando,"open")){
740  char InFile[256];
741  printf("New file name: ");
742  scanf("%s",Comando);
743  sprintf(InFile,Comando);
744  Pol->OpenFile(InFile);
745  if(!IfUser) return 0;
746  }//---------------Next-File-in-the-List----------------------
747  else if(!strcmp(Comando,">")){
748  quando++;
749  if(quando >= NFile){
750  quando = 0;
751  }
752  if(quando >=0 && quando < NFile){
753  Pol->OpenFile(quando);
754  printf("Opening: %s\n",argv[FilePos[quando]]);
755  }
756  if(!IfUser) return 0;
757  }//---------------Previous--------------------------
758  else if(!strcmp(Comando,"<")){
759  quando--;
760  if(quando < 0){
761  quando = NFile-1;
762  }
763  if(quando >=0 && quando < NFile){
764  Pol->OpenFile(quando);
765  printf("Opening: %s\n",argv[FilePos[quando]]);
766  }
767  if(!IfUser) return 0;
768  }//----------------Open-f-File-----------------
769  else if(!strcmp(Comando,"f")){
770  printf("Open file num 0-%d: ",NFile);
771  scanf("%d",&quando);
772  if( quando >= 0 && quando < NFile){
773  Pol->OpenFile(quando);
774  }
775  if(!IfUser) return 0;
776  }//-----------------System-Info---------------------------
777  else if(!strcmp(Comando,"info")){
778  printf("------------------------------------------------------\n");
779  char cSystem[STRSIZE];
780  Pol->SysInfo(cSystem);
781  printf("%s\n",cSystem);
782  Pol->SysDef(cSystem);
783  printf("%s\n",cSystem);
784  }
785  else if(!strcmp(Comando,"q") ){
786  if(!IfUser) return 0;
787  }
788  else {
789  printf("Comando non valido, scrivere ?\
790  per la lista dei comandi\n");
791  IfUser = 1;
792  }
793  }
794  printf("Te se qe te ve be te ne?\n");
795  if(Pol) delete Pol;
796  return 0;
797 }
798 #ifdef __glut_h__
799 void Slide(){
800  Pol->ESlide();
801 }
802 void ParticleList(){
803  Pol->RenderPart();
804 }
805 void ParticleRealTime(){
806  return;
807  Pol->DrRunTime();
808 }
809 void keyboard(unsigned char key,int x, int y){
810  Pol->keyboard(key,x,y);
811 }
812 void mouse(int button, int state,int x,int y){
813  Pol->ElDrawMouse(button,state,x,y);
814 }
815 void Menu(){
816  Pol->Menu();
817 }
818 #endif // __glut_h__
819 void Legenda(){
820  printf("\n\
821 *****************************************************************\n\
822 ( )\n\
823 ) Program that reads and elaborate a spefic file format (\n\
824 ( the option are the following, Needs a input file )\n\
825 ) (\n\
826 (-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-)\n\
827 ( d draw the 3D position of the particle )\n\
828 ( ! execute a shell command )\n\
829 ( q quit )\n\
830 ( dens density of the [coord] coordinate for the [file] )\n\
831 ( pro calculate the projection long [coord] )\n\
832 ( core spatial average sample on NBin bin )\n\
833 ( surf ratio between the actual surcafe and the circular )\n\
834 ( core three dimentional sampled average of the system )\n\
835 ( diff diffusivity of the extra particle )\n\
836 ( > < open the file form the list position )\n\
837 ( cm movement of the center of mass of the system )\n\
838 ( file number of file to use from the list )\n\
839 ( info ... )\n\
840 ( val number of values for the density profile )\n\
841 ( radShell average the outer shell of a drop )\n\
842 ( radCm normal and radial density wrt the center of mass )\n\
843 ( radCmN normal wrt to the center of mass, radial to the nano )\n\
844 ( radNano normal and radial density wrt the Nano )\n\
845 ( temp Temperature profile along a direction )\n\
846 ( nano density and diffisivity of the nano in the membrane )\n\
847 ( surf sampling and averaging a surface )\n\
848 ( pairMon pair correlation function of the monomers )\n\
849 ( pairChain pair correlation function of the chains )\n\
850 ( pairRound radial pair correlation function )\n\
851 ( scatt scattering og the membrane )\n\
852 ( scatt2 alternative formulation )\n\
853 ( worm projecting the density of the system on the local norma)\n\
854 ( header averaging the values written on the header )\n\
855 ( spe calculating the spectrum )\n\
856 ( mid sampling the membrane in midplanes )\n\
857 ( prop calculating some characteristic properties of the chain)\n\
858 ( Area calculating the area compressibility )\n\
859 ( )\n\
860 ( )\n\
861 ( )\n\
862 *****************************************************************\n");
863 }
864 // else if(!strcmp(Comando,"coreNano")){
865 // else if(!strcmp(Comando,"radShell")){
866 // else if(!strcmp(Comando,"angle")){
867 // else if(!strcmp(Comando,"radNano")){
868 // else if(!strcmp(Comando,"radCm")){
869 // else if(!strcmp(Comando,"radCmN")){
870 // else if(!strcmp(Comando,"cm")){
871 // else if(!strcmp(Comando,"temp")){
872 // else if(!strcmp(Comando,"nano")){
873 // else if(!strcmp(Comando,"surf")){
874 // else if(!strcmp(Comando,"diff")){
875 // else if(!strcmp(Comando,"pairMon")){
876 // else if(!strcmp(Comando,"pairChain")){
877 // else if(!strcmp(Comando,"pairRound")){
878 // else if(!strcmp(Comando,"pairSquare")){
879 // else if(!strcmp(Comando,"scatt")){
880 // else if(!strcmp(Comando,"scatt2")){
881 // else if(!strcmp(Comando,"worm")){
882 // else if(!strcmp(Comando,"header")){
883 // else if(!strcmp(Comando,"spe")){
884 // else if(!strcmp(Comando,"mid")){
885 // else if(!strcmp(Comando,"prop")){
886 // else if(!strcmp(Comando,"Area")){
887 // else if(!strcmp(Comando,"coord")){
888 // else if(!strcmp(Comando,"norm")){
889 // else if(!strcmp(Comando,"type")){
890 // else if(!strcmp(Comando,"file")){
891 // else if(!strcmp(Comando,"val")){
892 // else if(!strcmp(Comando,"sample")){
893 // else if(!strcmp(Comando,"open")){
894 // else if(!strcmp(Comando,">")){
895 // else if(!strcmp(Comando,"<")){
896 // else if(!strcmp(Comando,"f")){
void RadDens2Thick2d(int NBin)
Calculate the thickness from the radial density profile.
CHAIN * Ch
Information on all chains.
Definition: VarData.h:1050
void SetScaleF(double *Scale)
Set scale factor.
Definition: VarData.h:985
void SpectrumMidplane(int NBin)
Calculates the 1d, 2d spectrum spe.
void RenderPart(void)
Choose the visualisation (obsolete)
void Conv2Povray()
esport the data in pov file format for rendering
void SetBoundFile(int InitFile, int EndFile)
Set the initial and final number of files.
Definition: ElPolyEl.cpp:351
void Conv2xyzd(int NSample)
esport the data in radius depth density file format
int Diffusivity()
Diffusivity coefficient of the chains diff.
void Menu()
Creates the menu.
Definition: ElPolyDraw.cpp:685
int PressTrace()
Trace of the pressure profile.
void DrRunTime()
Draws in run time (expensive)
Definition: ElPolyDraw.cpp:76
void SysDef(char *cSystem)
Print a string with the system definitions.
Definition: VarData.cpp:167
void IsoLine(int NSample, double *IsoValue, int NIso, int How)
Calculate the discrete density of the system and the correspondent isolines.
Definition: ElPolyRepr.cpp:430
void ThickFromDens(int NBin)
Calculate the thickness profile from the density plot.
void Midplane(int NBin)
Midplanes for a sequence of snapshots.
void SysInfo(char *cSystem)
Print a string with the system information.
Definition: VarData.cpp:164
int Graphics(int argc, char **argv)
Boh.
Definition: ElPolyDraw.cpp:43
int Tens2dCartRad()
Change the pressure profile from cartesian to radial.
void keyboard(unsigned char key, int x, int y)
Draws all the particles and bonds.
void BilayerDistance(char *OutFile, int NBin)
Measure the elastic coupling between the two sheets.
int OpenFile(int f)
Opens the f file of the list open.
Definition: ElPolyEl.cpp:147
bool Write(char *OutFile)
Writes a "system-file" or a "x y z" file".
int CenterOfMass(int Coord)
Averaged center of mass Boh.
Definition: ElPolyEl.cpp:111
char cWhat2Draw[STRSIZE]
What to draw.
Definition: VarData.h:1042
void ElMenuVisual(int option)
Choose what to visualize.
void RemoveChains()
Remove chains satisfying a condition.
Definition: ElPolyEl.cpp:246
void AreaDistrF(int NBin)
Distribution of the areas around the protein.
void StalkLineProfF(int NBin)
Write the line describing a linear stalk.
int NChType
Type of chain selected.
Definition: VarData.h:1080
int PressRadial()
Contour plot around the inclusion.
int CLat2
lateral coordinate
Definition: VarData.h:1078
void Decoupling(int What)
Decoupling of the direction/end to end distance of the chains.
int ScatteringF(int NBin, int How)
2d Scattering scatt scatt2
int Diff2Files(int NBin, int How)
Density and thickness profile arond the nanoparticle.
void AreaCompr(int NSample)
Calculates the number of chain per area area.
void SumTens()
Sum more tension profile files.
double ScaleFact
Normal scaling factor (z zooming)
Definition: ElPoly.h:461
void DivideLayers(int How)
Reorder the LIPID block in four different layers.
Definition: ElPolyEl.cpp:187
void Sample(int NSample)
Sample the space in NSample lattice points.
Definition: ElPolyRepr.cpp:740
bool Open(char *InFile, int BF)
Open the.
Definition: VarData.cpp:105
void PairCorr(int NBin, int NDim)
1d pair correlation
void SetShiftPos(double *RefPos)
Set reference pos.
Definition: VarData.h:991
void FindNeighbours(char *FileName)
Find the couples of most neighbouring chains.
void HeaderAverage(int nNano)
Read the header and average the information.
int WormF(int Partition, int NBin)
Density profile of a non straight worm shape membrane worm.
void WidomOut(char *InFile, int NBin)
Create a system file with a chain less and the information about the missing chain.
void RadNormPos(int NBin, int NGrid)
Radial profile of the normal position of the particles.
void RadDistrF(int NBin, int How, int nNano)
3d (rad,norma,dens) density profile with respect to a initial position radNano radCm radCmN ...
int Angle(int NBin)
Calculation of the contact angle angle Boh?
Definition: ElPolyEl.cpp:78
int SurfTens(int NBin)
Radial summation of the 3d tension profile.
int From3To2d(int Coord, double Param)
Project the velocities of a 3d system on a 2d system wrt a coordinate.
Definition: ElPolyRepr.cpp:188
void WidomIn(char *InFile, int NBin)
Create the histogram of the energy of adding lipids.
void BondDistr(int NSample)
Distribution of the bond lengths.
void ElDrawMouse(int button, int state, int x, int y)
Scaling.
void RestPress(int NBin)
Pressure difference between the virial and the ideal gas term.
void SlabAngleProfs(int NBin, int NAngle, int Coord)
Radial profiles of the slab density between 0⁰ and 90⁰ subdivided in NAngle angles.
void AvSnap()
Average the postion of the lipids over many snapshots.
Definition: ElPolyRepr.cpp:714
void FetchPore()
Write the position of the pore for every snapshot.
Definition: ElPolyRepr.cpp:570
int CoreF(int NBin, int How)
Sampling of the three dimentional space.
void SetNVisSkip(int NSkip)
Set backfold type.
Definition: ElPoly.h:262
void BackBone(double *Line, int NBin)
Describe the backbone of a filament.
int SpectrumF(int NBin)
Calculates the 1d, 2d spectrum spe.
int NEdge
Number of particles per edge.
Definition: VarData.h:1084
int ChangeFile()
Defines the first and the last file to be elaborated file.
Definition: ElPolyEl.cpp:135
void FetchStalk()
Write the position of the stalk for every snapshot.
Definition: ElPolyRepr.cpp:596
int DensProf(int NBin, int NSample, int Coord)
Calculate the density profile dens.
int PropertiesF()
Calculates some properties of the system prop.
Definition: ElPolyEl.cpp:165
double ExtParam
External parameter (e.g. for MarchingCubes)
Definition: ElPoly.h:459
bool ShiftSys(int How)
Shift the system accordin to the SHIFT_ definitions.
void ElasticCouplingNVT()
Measure the elastic coupling between the two sheets.
void DiffSlab(int NSlab)
Diffusivity of particles starting from an initial slab.
void RadDens2Thick(int NBin)
Calculate the thickness from the radial density profile.
void CartDens(int NBin, int nNano)
3d (rad,norma,dens) density profile in cartesian coordinates
int RadialShell(int NBin)
Outer shell of a projected (rad,normal) graph.
Definition: ElPolyRepr.cpp:239
void SetBackFold(int Bf)
Set backfold type.
Definition: ElPoly.h:258
double Pos[4]
xyzr Postion of the chain
Definition: VarData.h:238
bool WriteXyz(char *OutFile)
Writes a "system-file" or a "x y z" file".
void End2EndDistr(char *OutFile)
Write the end to end distance of the chains.
int PairCorrelationF(int NBin, int How)
1d, 2d pair correlation of the chains pairRound pairSquare (obsolete)
void SetCNorm(int d)
Set Edge.
Definition: VarData.h:978
void ESlide()
Sequence of pictures.
Definition: ElPolyDraw.cpp:706
void SmoothGrid(int NSample, char *FWrite)
Smooth a grid with BSplines.
void StalkArea()
Area of hydrophobic in the torus.
Definition: ElPolyRepr.cpp:624
void ElasticCoupling(int NSample)
Measure the elastic coupling between the two sheets.
void ElMenuChoise(int option)
Choose what to visualize.
void Transform(int block)
Transform a block.
Definition: VarDataEl.cpp:475
int pNChain()
Number of chain.
int From3To1d(int Coord)
Project a 3d system on one coordinate.
Definition: ElPolyRepr.cpp:235
void Conv2rzd(int NSample)
esport the data in radius depth density file format
void IsoSurf(int NSample, double *IsoValue, int NIso)
Density plot all over different snapshots and calculation of the isolevel surface.
Definition: ElPolyRepr.cpp:313
int CLat1
lateral coordinate
Definition: VarData.h:1076
void Conv2Vmd()
esport the data in vmd file format
int DefSoft(char *nome2, char *ConfF)
Define and write the system as described in the conf file.
void Prova()
Dummy function to operate on a sequence of files.
void SplayDistr(int NSample)
Distribution of end to end distances.
int Surface(int NBin, int Coord)
Area of a surfuce projected on the coordinate Coord surf.
Definition: ElPolyRepr.cpp:111
Reads and elaborates a system of chains.
Definition: VarData.h:521
Definition: ElPoly.dox:1
int Temperature(int NBin, int Coord)
Spatial distribution of the temperature.
int ProjectionF(int NBin, int Coord)
Projection of the system against one direction pro.
Definition: ElPolyRepr.cpp:2
void SlabProf(int NBin, int nNano, int Coord1)
Thickness and density profile along Coord1.
void StalkF(int NSample)
Separate the leaflets.
int NanoParticle(int NBin)
Diffusion and density profile around the nanoparticle nano.
void Conv2Tecplot(int NBin, int How)
Prepare a countor plot for tecplot.
Definition: ElPolyOutput.cpp:3
int From2To1d(int Coord)
Projet a 2d system on one of the two coordinates.
Definition: ElPolyRepr.cpp:204
int CNorm
Normal coordinate.
Definition: VarData.h:1074
void ConvLattice(int NSample, char *FName)
Convert into a square lattice.
void Shift2Center()
Shift the system to the center.
Definition: ElPolyEl.cpp:372