31 void reshape(
int w,
int h){
37 void MouseMove(
int x,
int y){
40 void special(
int k,
int x,
int y){
46 for(
int d=0;d<3;d++) Dr->
Edge[d] =
pEdge(d);
48 Dr->
xi = -.4;Dr->yi = -.4;Dr->zi = .0;
49 Dr->
xp = 0.;Dr->yp = 0.;Dr->zp = 0.;
50 Dr->
xa = 0.;Dr->ya = 0.;Dr->za = 0.;
62 Cylinder = (GLuint *)calloc(
pNNano(),
sizeof(GLuint));
69 for(
int n=0;n<
pNNano();n++){
97 glVertex3d(Pos1[0],Pos1[1],Pos1[2]);
98 glVertex3d(Pos2[0],Pos2[1],Pos2[2]);
106 for(
int l=0;l<
Ln[p].
NLink;l++){
108 for(
int d=0;d<3;d++){
112 for(
int d=0;d<3;d++){
116 else if(Pos1[d] - Pos2[d] < -.5*
pEdge(d)*InvScaleUn){
126 glDisable(GL_LIGHTING);
132 for(
int n=0;n<
pNNano();n++){
133 glDeleteLists(Cylinder[n],1);
135 if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_WALL)){
136 glDeleteLists(GlWall,1);
141 glDisable(GL_LIGHTING);
153 SigErr(
DrawOutFile != NULL,
"DrawOutFile already allocated, can't use the file");
155 sprintf(FName,
"PovSnap%05d.pov",
pStep());
157 int ImSize[2] = {1000,1000};
158 fprintf(
DrawOutFile,
"// POV 3.x input script : plot.pov\n// command: povray +W%d +H%d -I%s -O%s.tga +P +X +A +FT +C\n",ImSize[0],ImSize[1],FName,FName);
159 fprintf(
DrawOutFile,
"#if (version < 3.5)\n#error \"POV3DisplayDevice has been compiled for POV-Ray 3.5 or above.\\nPlease upgrade POV-Ray.\"\n#end\n");
160 fprintf(
DrawOutFile,
"#include \"PovHeader.inc\"\n");
173 fprintf(
DrawOutFile,
"// End of POV-Ray 3.x generation\n");
182 glColor4fv(ColorType[Typ]);
190 FILE *FRead = fopen(FileName,
"r");
191 if(FRead == NULL)
return;
195 glDisable(GL_LIGHTING);
196 glColor4f(.5,0.0,.4,1.0);
197 for(
int k=0;!(fgets(cLine,STRSIZE,FRead)==NULL);k++){
198 fscanf(FRead,
"%d %d\n",&c1,&c2);
205 for(
int d=0;d<3;d++){
208 else if(
pPos(c1,d) - Pos[d] < -.5*
pEdge(d))
212 ((Pos[1])*InvScaleUn),
213 ((Pos[2])*InvScaleUn*ScaleFact));
223 glDisable(GL_LIGHTING);
232 if(!strncmp(
Block[b].Name,
"PEP",3)){
239 if(!CHAIN_IF_TYPE(Chc,
NChType))
continue;
259 glEnable(GL_LIGHTING);
260 glEnable( GL_LIGHT0 );
263 glDisable(GL_LIGHTING);
265 double Red = fabs(
Nano[n].Hamaker)/3.;
267 GLfloat Color[4] = {Red,.1,.1,Alpha};
268 glMaterialfv(GL_FRONT_AND_BACK,GL_AMBIENT,Color);
269 glMaterialfv(GL_FRONT_AND_BACK,GL_DIFFUSE,Color);
271 if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_NONE))
return;
272 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_CLUSTER)){
277 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_JANUS)){
282 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_PORE)){
285 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_CYL)){
290 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_TIP)){
294 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_BOUND)){
298 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_TORUS)){
304 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_STALK)){
308 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_HARM)){
312 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_WALL)){
316 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_UMBR)){
319 glNormal3f(0.,0.,-1.);
343 glMultMatrixd(M.
data);
346 if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_SPH)){
349 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_EXT)){
350 glColor4f(Red,.1,.1,.5);
351 glCallList(Cylinder[n]);
353 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_PORE)){
354 glColor4f(Red,.1,.1,.5);
355 glCallList(Cylinder[n]);
357 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_JANUS)){
358 glCallList(Cylinder[n]);
360 else if(VAR_IF_TYPE(
Nano[n].Shape,SHAPE_CYL)){
361 glCallList(Cylinder[n]);
364 glCallList(Cylinder[n]);
368 Red = fabs(
Nano[n].Hamaker)/3.;
369 if(!VAR_IF_TYPE(
Nano[n].Shape,SHAPE_WALL))
return;
370 glDisable(GL_LIGHTING);
383 glMultMatrixd(M.
data);
392 glDisable(GL_LIGHTING);
393 FILE *Arch = fopen(ArchFile,
"r");
394 if(Arch == NULL) {printf(
"File %s not present \n",ArchFile);
return;}
403 for(
int p=
Block[b].InitIdx;fgets(cLine,STRSIZE,Arch);p++){
405 sscanf(cLine,
"%d %d %lf %lf\n",&l1,&l2,&Elong,&Alpha);
408 if(l1 == l2)
continue;
409 for(
int d=0;d<3;d++){
413 Mid[d] = .5*(Pos1[d]+Pos2[d]);
421 glDisable(GL_LIGHTING);
430 (RefPos[1]*InvScaleUn),
432 glColor4f( .7,.1,.1,1.);
433 glutSolidSphere(0.1,20,20);
437 for(
int p=0,link=0;p<
pNPart();p++){
439 if(Red < 0.) Red = -Red;
444 double Add = 1./(double)
NEdge/3.;
447 glColor4f(0.,Green,0.,Alpha);
454 glColor4f(0.,0.,Blue,Alpha);
461 glColor4f(Red,0.,0.,Alpha);
469 if(Green + Blue + Red> .01)
471 glColor4f(Red,Green,Blue,Alpha);
482 glDisable(GL_LIGHTING);
498 if(!strncmp(
Block[b].Name,
"PEP",3)){
503 for(
int c=c1;c<c1+
pNChain(b);c++){
504 if(!CHAIN_IF_TYPE(c,
NChType))
continue;
505 for(
int d=0;d<3;d++){
507 ChPos.
Set((
Ch[c].Pos[d]-
Ch[c].Dir[d]*.5)*InvScaleUn,d);
509 double Red =
Ch[c].Angle/M_PI;
510 double Green = 1.-Red;
513 if(Red > 0.35 && Red < .65);
516 glColor4f(Red,Green,Blue,Alpha);
518 double Length1 = ChDir.
Norm();
519 double Length2 = Freccia.
Norm();
520 for(
int d=0;d<3;d++){
521 Axis.
Set(.5*(ChDir.
Val(d)/Length1+Freccia.
Val(d)/Length2),d);
523 glTranslated(ChPos.
Val(0),ChPos.
Val(1),ChPos.
Val(2));
524 glRotatef(180.,Axis.
Val(0),Axis.
Val(1),Axis.
Val(2));
525 glScaled(Length1/Length2,1.0,1.0);
526 glNormal3f(ChDir.
Val(0),ChDir.
Val(1),ChDir.
Val(2));
530 for(
int ppc=0;ppc<
pNPCh();ppc++){
540 glDisable(GL_LIGHTING);
544 double Length1 = v.
Norm();
545 double Length2 = Freccia.
Norm();
546 for(
int d=0;d<3;d++){
547 Axis.
Set(d,.5*(v[d]/Length1 + Freccia[d]/Length2));
549 glTranslated(Origin[0],Origin[1],Origin[2]);
550 glRotatef(180.,Axis[0],Axis[1],Axis[2]);
551 glScaled(Length1/Length2,1.0,1.0);
552 glNormal3f(v[0],v[1],v[2]);
557 glDisable(GL_LIGHTING);
566 if(!CHAIN_IF_TYPE(Chc,
NChType))
continue;
568 if(CHAIN_IF_TYPE(Chc,CHAIN_UP))
571 if(CHAIN_IF_TYPE(Chc,CHAIN_FLABBY))
574 if(CHAIN_IF_TYPE(Chc,CHAIN_TILTED))
578 (GLfloat)(
Ch[c].Pos[1]*InvScaleUn),
580 glColor4f(Red,Green,Blue,1.);
588 dDensity = (
double *)calloc(Values,
sizeof(
double));
591 for(
int v=0;v<Values;v++){
592 if(Max < dDensity[v]){
596 for(
int v=0;v<Values;v++){
599 for(
int v=0;v<Values-1;v++){
602 glColor4f(1.,0.,1.,1.);
613 glDisable(GL_LIGHTING);
619 for(
int p=0,link=0;p<
pNPart();p++){
626 glColor4f( 1.,.1,.1,1.);
628 glCallList(Cylinder[0]);
643 glDisable(GL_LIGHTING);
649 for(
int p=0,link=0;p<
pNPart();p++){
651 if(!CHAIN_IF_TYPE(Chc,
NChType) &&
pType(p)!=2)
continue;
653 glColor4fv(ColorType[Typ]);
655 glColor4f(0.0,1.0,0.,1.0);
656 for(
int l=0;l<
Ln[p].
NLink;l++){
658 double Shift[3] = {0.,0.,0.};
660 glColor4f(1.0,.0,0.,1.0);
671 ((
pPos(link,1)-Shift[1])*InvScaleUn),
672 ((
pPos(link,2)-Shift[2])*InvScaleUn*ScaleFact));
GLfloat xp
Translation, wheel.
double InvScaleUn
Rescale the three orthogonal directions.
CHAIN * Ch
Information on all chains.
int pNLink()
Maximum number of bonds.
void RenderPart(void)
Choose the visualisation (obsolete)
void DMouseMove(int x, int y)
How the scene rotate (Camera view should be implemented)
int IfInfo
Removes the info line.
double InvScaleUn
Define the shrink factor between the box edges.
void Menu()
Creates the menu.
int NLink
How many links per particle.
void DrRunTime()
Draws in run time (expensive)
void Dreshape(int w, int h)
Principal reshape function.
int Type
Type of the chain (see list CHAIN_)
double pVel(int p, int d)
Return the velocity.
void DrBondNo(double *Pos1, double *Pos2, float *Color)
Null function.
BLOCK * Block
Information for every block.
void DrNanoOpenGl(int n)
OpenGl draw function.
int NFileTot
Total number of file.
int Graphics(int argc, char **argv)
Boh.
LINKS * Ln
Array of linking between the particles.
Draw provides the basic configuration of the openGL libraries used in every derived program...
double Norm()
Return the norm of a Vettore.
double ShiftPos[3]
Reference position.
NANO * Nano
Extra particle.
double Normalize()
Normlizes a Vettore.
int OpenFile(int f)
Opens the f file of the list open.
int pChain(int p)
Return the chain.
Geometrical operations on vectors.
void DFigure(void)
Definition of the scene on which the objects will be drawn.
char cWhat2Draw[STRSIZE]
What to draw.
void ElMenuVisual(int option)
Choose what to visualize.
DRAW_PART Draw_Nano
Pointer to a distance.
int quando
Current number of the file list.
double pInvEdge(int d)
Inverted xyzr edges of the simulation box.
int DefCube(int NSquare)
Cube.
double Height
Height of the cylinder.
int NChType
Type of chain selected.
void ESlide1()
Sequence of pictures.
int pType(int p)
Return the type.
void DrProtein(const char *FileName, int nBlock)
Load and draw the linking of a protein.
void Dspecial(int k, int x, int y)
Boh.
void CreateMenu()
Creates the menu.
double Val(int N)
Value of the N column.
int Picture()
Write a tiff file of the data in pixel.
double * x
Where the data are stored.
double ScaleFact
Normal scaling factor (z zooming)
void DrPartPovRay(int p)
PovRay draw function.
int InitIdx
Initial particle position.
int Angle(int NBin)
Calculation of the contact angle angle Boh?
void DTimer(int v)
Not working.
void DrBondPovRay(double *Pos1, double *Pos2, float *Color)
Draw the bonds.
int Shape
0 none, 1 spherical, 2 cylindrical 3 wall
double pNanoPos(int n, int d)
Return back folded nano position.
double pEdge(int d)
xyzr edges of the simulation box
void HeaderPovRay()
Print the header for povray.
int pNPCh()
Number of particle per chain.
double Saturation
Saturation of the color (increase intensity)
double PorePos()
Find the position of the pore.
int NPType
Type of particle selected.
int DefCylinder(double Rad, double Height)
Cylinder.
int pNBlock()
Number of blocks.
void DrPartList()
Create a list of all the particles.
int * Link
with whom is bonded
int NEdge
Number of particles per edge.
void DrawNano(int n)
Pointer to a generic function.
int IfMaterial
Activate the illumination for a specific material.
void DrBond(int p)
Finde the neighbour of the particle p and draw the bond.
void Point2Shape(int iShape)
Point to the shape function.
FILE * DrawOutFile
Output file for drawing.
void DrawFuncFooter()
Dnd the visualization.
void ShiftRef(int BackFold)
Backfold the system wrt the reference position.
int pNNano()
Number of nanoparticles.
void DrVector(Vettore v, Vettore Origin)
Draw a vector.
double VetV(const Vettore *u, const Vettore *v)
Vectorial product between two Vettore returns the area.
GLuint Particles
Refers to the list of the total position of the particles which will be generated in another program...
void DrawFuncHeader()
Assign the pointer to the corrispondent draw function, intilize the visualization.
int NVisSkip
How many lipids are skipped in the visualization.
double Pos[4]
xyzr Postion of the chain
int PairCorrelation(double *Point, int NSample, int How, int Type)
1-d pair correlation
Matrice computes the algebric operations on matrices.
void DrNanoPovRay(int n)
PovRay draw function.
void ESlide()
Sequence of pictures.
char * ChooseDraw(int ExtWhat2Draw)
Convert the internal definition for the menu of ElPoly in string.
void DrCrossLinks()
Visualize the cross links.
int Step
Current step for the picture's name.
void DrawPart(int p)
Pointer to a generic function.
int What2Draw
Draw the content in the appropriate visulization.
double pVelMax(int d)
Maximum velocity.
char Block2Draw[20]
Name of the block to draw.
int EndIdx
End particle position.
void DrChains()
Position of every chain in hexagons.
double pPos(int p, int d)
Return back folded position.
void ElMenuChoise(int option)
Choose what to visualize.
void DrBondOpenGl(double *Pos1, double *Pos2, float *Color)
Draw the bonds.
int pNChain()
Number of chain.
double Angle(Vettore *u, Vettore *v)
Computes the angle between two Vetttore.
GLfloat xi
Position of the info string.
void DrVectors()
Draw the chains as vectors.
DRAW_PART Draw_Part
Pointer to a distance/field function.
int DrIntorno(int p, double Blue)
Visualize only particles within a certain distance.
DRAW_BOND Draw_Bond
Pointer to a distance/field function.
void DrawBond(double *Pos1, double *Pos2, float *Color)
Pointer to a generic function.
void Window(int argc, char **argv)
Initial definition of the window.
void DrPartOpenGl(int p)
OpenGl draw function.
void DrColor()
Visualisation of the particle system with velocity color scheme.
int IfIntorno
If it visualizes only the particles/chains within a certain distance.
void Set(double Val, int Col)
Set the N column.
double * data
Stored entries.
void DrField(int NGrid, double IsoLevel, int nNano, FILE *FWrite)
Draw a scalar field.
int CNorm
Normal coordinate.
int pStep()
Number of steps.
int pNPart()
Number of particle.