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