27 cFile = (
char **)calloc(argc,4);
28 if(cFile == NULL){printf(
"cFile not allocated\n");
return;}
29 for(
int f=0;f<argc;f++){
30 cFile[f] = (
char *)calloc(STRSIZE,
sizeof(*cFile));
31 if(cFile[f] == NULL){printf(
"cFile not allocated\n");
return;}
32 cFile[f] = argv[FilePos[f]];
55 for(
int d=0;d<3;d++)
ShiftPos[d] = 0.;
56 for(
int d=0;d<3;d++)
ScaleF[d] = 1.;
58 MPI_Init(&argc,&argv);
60 MPI_Comm_rank(MPI_COMM_WORLD, &Rank);
61 MPI_Comm_size(MPI_COMM_WORLD, &Size);
62 int Partition = (int)(
NFileTot/(
double)Size);
63 NFile[0] = Partition*Rank;
64 NFile[1] = Partition*(Rank+1);
82 Radici = (
double *)malloc(NRadici*
sizeof(
double));
84 Average = (
double *)malloc(NRadici*
sizeof(
double));
85 for(
int i=0;i<NRadici;i++){
91 if(
OpenRisk(cFile[f],BF_PART)==0)
return 1;
95 printf(
"Volume %lf Cm %lf # to Invert %lf\n",(
double)
pNPart()/10.,
pCm(2),pow(DUE_PI/(2.*
pNPart()/10.),.25));
96 NZeri =
Mat->
Zeri(0.,DUE_PI/2.,Radici,NRadici);
97 for(
int i=0;i<NZeri;i++){
98 Radici[i] *= 360./DUE_PI;
99 Average[i] += Radici[i];
102 printf(
"The function has no real roots\n");
105 for(
int i=0;i<NZeri;i++){
106 Average[i] /= NFile[1]-NFile[0];
107 printf(
"Angle %lf\n",Average[i]);
113 FILE *FileToWrite = NULL;
114 FileToWrite = fopen(
"CenterOfMass.dat",
"w");
117 if(
OpenRisk(cFile[f],1)==0)
return 1;
120 for(
int p=0;p<
pNPart();p++){
125 for(
int p=0;p<
pNPart();p++){
126 SysCm +=
pPos(p,Coord);
129 fprintf(FileToWrite,
"%lf \n",SysCm/
pNPart());
136 printf(
"Introduce the first of %d file from the list: ",
NFileTot);
137 scanf(
"%d",&
NFile[0]);
141 printf(
"Introduce the second of %d file from the list: ",
NFileTot);
142 scanf(
"%d",&
NFile[1]);
161 Ris = QUAD( 2*x - QUAD(sin(2*x)) ) / (4./3. * CUB(sin(x))-2.*x*cos(x)+cos(x)*sin(2*x) ) - 5.;
169 if(
OpenRisk(cFile[f],BF_PART))
return 0;
172 Pr = Pr * (1./(NFile[1] - NFile[0]));
174 char *NomeFile = (
char *) malloc(60*
sizeof(
char));
175 sprintf(NomeFile,
"PropertiesChi%.0fRho%.0fKappa%.0f.txt",
pchiN(),
prho(),
pkappaN());
176 FILE *FileToWrite = NULL;
177 FileToWrite = fopen(NomeFile,
"w");
178 fprintf(FileToWrite,
"RePhob %lf RePhil %lf\n",Pr.
RePhob,Pr.RePhil);
179 fprintf(FileToWrite,
"RadGyrPhob %lf RadGyrPhil %lf\n",Pr.GyrPhob,Pr.GyrPhil);
180 fprintf(FileToWrite,
"StructFactPhob %lf StructFactPhil %lf\n",Pr.FactPhob,Pr.FactPhil);
181 fprintf(FileToWrite,
"VolPhob %lf VolPhil %lf\n",Pr.VolPhob,Pr.VolPhil);
182 fprintf(FileToWrite,
"ChainDiff %lf\n",Pr.ChDiff);
189 if(How == VAR_OPPOSED) NLayer = 4;
190 int *NChStep = (
int *)calloc(NLayer,
sizeof(
int));
191 int *ChainLevel = (
int *)calloc(
pNChain(),
sizeof(int));
192 if(How == VAR_OPPOSED){
193 for(
int c=0,b=0;c<
pNChain();c++){
196 if(CHAIN_IF_TYPE(
Ch[c].Type,CHAIN_UP))
198 if(!strcmp(
Block[b].Name,
"LIPID1")) Level += 2;
200 ChainLevel[c] = Level;
203 else if(How == VAR_TUBE || How == VAR_VESICLE){
204 for(
int c=0,b=0;c<
pNChain();c++){
207 if(CHAIN_IF_TYPE(
Ch[c].Type,CHAIN_OUTER))
210 ChainLevel[c] = Level;
216 if(
OpenRisk(cFile[f],BF_NO))return ;
219 for(
int p=0;p<
pNPart();p++){
220 for(
int d=0;d<3;d++){
226 for(
int l=0;l<NLayer;l++){
227 for(
int p=0;p<
pNPart();p++){
228 if(ChainLevel[
pChain(p)] == l){
229 for(
int d=0;d<3;d++){
280 char *String = (
char *)calloc(16,
sizeof(
char));
281 if(ExtWhat2Draw == EL_PART)
282 sprintf(String,
"part");
283 else if(ExtWhat2Draw == EL_PART)
284 sprintf(String,
"part");
285 else if(ExtWhat2Draw == EL_CHAIN)
286 sprintf(String,
"chain");
287 else if(ExtWhat2Draw == EL_DENS)
288 sprintf(String,
"dens");
289 else if(ExtWhat2Draw == EL_QUAD)
290 sprintf(String,
"quad");
291 else if(ExtWhat2Draw == EL_QUAD1)
292 sprintf(String,
"quad1");
293 else if(ExtWhat2Draw == EL_POTENTIAL)
294 sprintf(String,
"pot");
295 else if(ExtWhat2Draw == EL_SURF)
296 sprintf(String,
"surf");
297 else if(ExtWhat2Draw == EL_CROSS)
298 sprintf(String,
"cross");
299 else if(ExtWhat2Draw == EL_ISOIPSE)
300 sprintf(String,
"isoipse");
301 else if(ExtWhat2Draw == EL_SAMPLE)
302 sprintf(String,
"sample");
303 else if(ExtWhat2Draw == EL_COLOR)
304 sprintf(String,
"color");
305 else if(ExtWhat2Draw == EL_SKIN)
306 sprintf(String,
"skin");
307 else if(ExtWhat2Draw == EL_POLYGON)
308 sprintf(String,
"polygon");
309 else if(ExtWhat2Draw == EL_ISOLEVEL)
310 sprintf(String,
"isolevel");
311 else if(ExtWhat2Draw == EL_SQUAREMESH)
312 sprintf(String,
"squaremesh");
316 if(!strcmp(String,
"part"))
318 else if(!strcmp(String,
"quad"))
320 else if(!strcmp(String,
"chain"))
322 else if(!strcmp(String,
"dens"))
324 else if(!strcmp(String,
"quad1"))
326 else if(!strcmp(String,
"pot"))
328 else if(!strcmp(String,
"surf"))
330 else if(!strcmp(String,
"cross"))
332 else if(!strcmp(String,
"isoipse"))
334 else if(!strcmp(String,
"sample"))
336 else if(!strcmp(String,
"color"))
338 else if(!strcmp(String,
"stalk"))
340 else if(!strcmp(String,
"skin"))
342 else if(!strcmp(String,
"polygon"))
344 else if(!strcmp(String,
"isolevel"))
346 else if(!strcmp(String,
"squaremesh"))
354 else if(InitFile < EndFile){
359 printf(
"Wrong init file %d !< %d\n",InitFile,EndFile);
363 else if(EndFile > InitFile)
366 printf(
"Wrong end file %d !< %d\n",InitFile,EndFile);
370 fprintf(stderr,
"Processing: %s %d/%d %.1f %%\r",cFile[f],f,(
NFile[1]-
NFile[0]),(f-
NFile[0])/(
double)(
NFile[1]-
NFile[0])*100.);
377 Open(cFile[f],BF_NO);
408 for(
int p=0;p<
pNPart();p++){
CHAIN * Ch
Information on all chains.
int pNLink()
Maximum number of bonds.
void SetBoundFile(int InitFile, int EndFile)
Set the initial and final number of files.
double Ypsilon
External parameter to calculate the contact angle.
double InvScaleUn
Define the shrink factor between the box edges.
int LineSize
Line size of the gl.
bool OpenRisk(char *InFile, int BF)
Opens a file without reallocationg.
double prho()
Density coexistence.
double pVel(int p, int d)
Return the velocity.
BLOCK * Block
Information for every block.
int NFileTot
Total number of file.
double Vel[4]
xyzr Velocity of the particle
double ShiftPos[3]
Reference position.
int SetNChain(int NewNCh)
Set and reallocate the number of chains.
int OpenFile(int f)
Opens the f file of the list open.
int pChain(int p)
Return the chain.
bool Write(char *OutFile)
Writes a "system-file" or a "x y z" file".
int CenterOfMass(int Coord)
Averaged center of mass Boh.
int Zeri(double a, double b, double *Radici, int NRadici)
Find the.
void RemoveChains()
Remove chains satisfying a condition.
void SetPos(int p, double *Pos)
Set the particle position.
int quando
Current number of the file list.
Properties SysProperties()
Calculate some basis properties.
int NChType
Type of chain selected.
int pType(int p)
Return the type.
double pCm(int d)
Center of mass of the system.
int CLat2
lateral coordinate
double Pos[3]
xyz Position of the particle
Some calculated properties of the system.
double ScaleFact
Normal scaling factor (z zooming)
void DivideLayers(int How)
Reorder the LIPID block in four different layers.
bool Open(char *InFile, int BF)
Open the.
FUNC Func
Pointer to a function.
int InitIdx
Initial particle position.
int Angle(int NBin)
Calculation of the contact angle angle Boh?
int SetNPart(int NewNPart)
Set and reallocate the number of particles.
double pEdge(int d)
xyzr edges of the simulation box
int pNPCh()
Number of particle per chain.
int pNBlock()
Number of blocks.
double pchiN()
Incompatibility.
int ChangeFile()
Defines the first and the last file to be elaborated file.
double ContactAngle(double x)
Definition of the contact angle.
int PropertiesF()
Calculates some properties of the system prop.
void SetType(int p, int t)
Set the particle type.
Basics class to start a MPI grid.
double PreFact
External parameter in the definition of the contact angle.
int NBackFold
Type of backfold.
void SwapChain(int c1, int c2, int b)
Swap two chains.
int NVisSkip
How many lipids are skipped in the visualization.
double Pos[4]
xyzr Postion of the chain
int NPCh
particles per chain
void DefBlock(int *NChStep, int How)
Define four different blocks.
double ScaleF[3]
Scale factor.
ElPoly(int argc, char **argv, int *FilePos)
Constructor.
char * ChooseDraw(int ExtWhat2Draw)
Convert the internal definition for the menu of ElPoly in string.
double pReOverCutOff()
Re/CutOff.
Matematica * Mat
Implementation of all usefull algorythms.
int What2Draw
Draw the content in the appropriate visulization.
int EndIdx
End particle position.
double pPos(int p, int d)
Return back folded position.
double RePhob
End2End distance of the.
int pNChain()
Number of chain.
int NFile[2]
First and last file of the list.
int CLat1
lateral coordinate
Information of every particle.
void Print()
Print the current values.
void SetVel(int p, double *Vel)
Set the particle velocity.
void Processing(int f)
Information on the current file elaborated.
void SetEdge(double Val, int d)
Set Edge.
double ContactAngle(double x)
Definition of the contact angle function Boh.
double pkappaN()
Incompressibility.
int CNorm
Normal coordinate.
int pNPart()
Number of particle.
void Shift2Center()
Shift the system to the center.