Trisurf Monte Carlo simulator
Samo Penic
2014-04-30 3de2893d882d2c407375146376fbf9bb54f33e8b
commit | author | age
5bb11d 1 #include "general.h"
SP 2 #include "sh.h"
3b3902 3 #include <stdlib.h>
5bb11d 4 #include "vesicle.h"
SP 5 #include "initial_distribution.h"
3b3902 6 #include "frame.h"
9bf6ee 7 #include <math.h>
5bb11d 8
SP 9 int main(){
8854f5 10 ts_vesicle *vesicle=initial_distribution_dipyramid(17,60,60,60,0.15);
5bb11d 11 //parsetape(vesicle,&i);
SP 12
13 //these four must come from parsetype!
14 vesicle->dmax=1.67*1.67;
15 vesicle->stepsize=0.15;
16 vesicle->clist->max_occupancy=8;
17 vesicle->bending_rigidity=25.0;
18 fprintf(stderr,"xk=%f\n",vesicle->bending_rigidity);
19
3b3902 20 centermass(vesicle);
SP 21 vesicle->sphHarmonics=sph_init(vesicle->vlist, 21);
5bb11d 22 int i,j;
8854f5 23 ts_double area;
79fc9c 24 for(i=1;i<=vesicle->sphHarmonics->l;i++){
SP 25     for(j=1;j<=2*i+1;j++){
26     fprintf(stderr,"co(%d,%d)=%e\n",i,j,vesicle->sphHarmonics->co[i][j]);
5bb11d 27     }
SP 28 }
9bf6ee 29 ts_double r0;
SP 30 vesicle_volume(vesicle);
31 fprintf(stderr,"Volume=%e\n",vesicle->volume);
32 r0=getR0(vesicle);
33 fprintf(stderr,"r0=%e\n",r0);
8854f5 34 area=0;
SP 35 for(i=0;i<vesicle->tlist->n;i++){
36     area+=vesicle->tlist->tria[i]->area;
37 }
38 fprintf(stderr,"area_dipyramid=%e\n",area);
3b3902 39 fprintf(stderr,"Centroid=(%e,%e,%e)\n", vesicle->cm[0],vesicle->cm[1],vesicle->cm[2]);
8854f5 40
9bf6ee 41 preparationSh(vesicle,r0);
SP 42 calculateYlmi(vesicle);
8e58b4 43 /*
3b3902 44 ts_coord *coord=(ts_coord *)malloc(sizeof(ts_coord));
SP 45 ts_double fi, theta;
8e58b4 46
3b3902 47   for(i=0;i<vesicle->vlist->n;i++){
SP 48
49     cart2sph(coord,vesicle->vlist->vtx[i]->x, vesicle->vlist->vtx[i]->y, vesicle->vlist->vtx[i]->z);
50         fi=coord->e2;
51         theta=coord->e3; 
52
53
54     fprintf(stderr,"VTX(x,y,z,fi,theta)=%e,%e,%e,%e,%e ---> Ylmi(2,-2,%d)=%9.7e <---- data: omega=%e, r0=%e, plgndr(2,abs(-2),cos(theta))=%e, co(2,-2)=%e cos((m-l-1)*fi)=%e\n",vesicle->vlist->vtx[i]->x, vesicle->vlist->vtx[i]->y, vesicle->vlist->vtx[i]->z,fi,theta,i+1,vesicle->sphHarmonics->Ylmi[2][0][i], vesicle->vlist->vtx[i]->solAngle, vesicle->vlist->vtx[i]->relR, plgndr(2,abs(-2),cos(theta)), vesicle->sphHarmonics->co[2][1], cos(-2*fi));
55
56     }
57
58 free(coord);
8e58b4 59 */
79048f 60 calculateUlm(vesicle);
SP 61 for(i=0;i<vesicle->sphHarmonics->l;i++){
62     for(j=0;j<2*i+1;j++){
63     fprintf(stderr,"ulm(%d,%d)=%e\n",i,j+1,vesicle->sphHarmonics->ulm[i][j]);
64     }
65 }
66
8e58b4 67 storeUlm2(vesicle);
5bb11d 68
SP 69 sph_free(vesicle->sphHarmonics);
9bf6ee 70 vesicle_free(vesicle);
5bb11d 71 return 0;
SP 72 }