From 48bb92b75443c452e2a873d01be92bfe419e26bc Mon Sep 17 00:00:00 2001
From: mihaf <miha.fosnaric@gmail.com>
Date: Thu, 06 Feb 2014 12:04:07 +0000
Subject: [PATCH] Adding polymers MC steps (not done yet)...

---
 src/poly.c    |   13 ++++++
 src/io.c      |    6 ++
 src/tape      |    4 +
 src/energy.c  |    3 +
 aclocal.m4    |   10 ++--
 src/general.h |   17 +++++---
 src/frame.c   |   25 ++++++++----
 src/poly.h    |    2 +
 8 files changed, 58 insertions(+), 22 deletions(-)

diff --git a/aclocal.m4 b/aclocal.m4
index 3094178..da06da5 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,4 +1,4 @@
-# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.3 -*- Autoconf -*-
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
 # 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
@@ -14,8 +14,8 @@
 
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
-[m4_warning([this file was generated for autoconf 2.69.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],,
+[m4_warning([this file was generated for autoconf 2.68.
 You have another version of autoconf.  It may work, but is not guaranteed to.
 If you have problems, you may need to regenerate the build system entirely.
 To do so, use the procedure documented by the package, typically `autoreconf'.])])
@@ -38,7 +38,7 @@
 [am__api_version='1.11'
 dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
 dnl require some minimum version.  Point them to the right macro.
-m4_if([$1], [1.11.6], [],
+m4_if([$1], [1.11.3], [],
       [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
 ])
 
@@ -54,7 +54,7 @@
 # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
 # This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
 AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.6])dnl
+[AM_AUTOMAKE_VERSION([1.11.3])dnl
 m4_ifndef([AC_AUTOCONF_VERSION],
   [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
 _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
diff --git a/src/energy.c b/src/energy.c
index abbb8e7..3b1779c 100644
--- a/src/energy.c
+++ b/src/energy.c
@@ -19,6 +19,9 @@
     return TS_SUCCESS;
 }
 
+inline ts_bool energy_poly_vertex(ts_vertex *vtx,ts_poly *poly){
+	
+}
 
 inline ts_bool energy_vertex(ts_vertex *vtx){
 //    ts_vertex *vtx=&vlist->vertex[n]-1; // Caution! 0 Indexed value!
diff --git a/src/frame.c b/src/frame.c
index 5cfede9..1ee270b 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -31,11 +31,11 @@
 }
 
 ts_bool cell_occupation(ts_vesicle *vesicle){
-    ts_uint i,cellidx, n=vesicle->vlist->n;
-    ts_double shift;
-    ts_double dcell;
-    shift=(ts_double) vesicle->clist->ncmax[0]/2;
-    dcell=1.0/(1.0 + vesicle->stepsize);
+    ts_uint i,j,cellidx, n=vesicle->vlist->n;
+    //ts_double shift;
+    //ts_double dcell;
+    //shift=(ts_double) vesicle->clist->ncmax[0]/2;
+    //dcell=1.0/(1.0 + vesicle->stepsize);
     //`fprintf(stderr, "Bil sem tu\n"); 
 
     cell_list_cell_occupation_clear(vesicle->clist);
@@ -45,10 +45,19 @@
 //    vesicle->vlist->vtx[i]->cell=vesicle->clist->cell[cellidx];
 
     cell_add_vertex(vesicle->clist->cell[cellidx],vesicle->vlist->vtx[i]);
-
     }
+
+    for(i=0;i<vesicle->poly_list->n;i++){
+	for(j=0;j<vesicle->poly_list->poly[i]->vlist->n;j++){
+    	cellidx=vertex_self_avoidance(vesicle, vesicle->poly_list->poly[i]->vlist->vtx[j]);
+    	cell_add_vertex(vesicle->clist->cell[cellidx],vesicle->poly_list->poly[i]->vlist->vtx[j]);
+	}
+    }
+
+    
+
     //fprintf(stderr, "Bil sem tu\n"); 
-	if(dcell);
-	if(shift);
+	//if(dcell);
+	//if(shift);
     return TS_SUCCESS;
 }
diff --git a/src/general.h b/src/general.h
index 5194460..0372e7a 100644
--- a/src/general.h
+++ b/src/general.h
@@ -230,6 +230,7 @@
 	ts_vertex_list *vlist;
 	ts_bond_list *blist;
 	ts_vertex *grafted_vtx;
+	ts_double k;
 };
 typedef struct ts_poly ts_poly;
 
@@ -247,15 +248,17 @@
 	ts_vertex_list *vlist;
 	ts_bond_list *blist;
 	ts_triangle_list *tlist;
-    ts_cell_list *clist;
+	ts_cell_list *clist;
 	ts_uint nshell;
-    ts_double bending_rigidity;
-    ts_double dmax;
-    ts_double stepsize;
-    ts_double cm[3];
-    ts_double volume;
-    ts_spharm *sphHarmonics;
+	ts_double bending_rigidity;
+	ts_double dmax;
+	ts_double stepsize;
+   	ts_double cm[3];
+	ts_double volume;
+	ts_spharm *sphHarmonics;
+
 	ts_poly_list *poly_list;
+	ts_double spring_constant;
 } ts_vesicle;
 
 
diff --git a/src/io.c b/src/io.c
index 81ab298..8b51793 100644
--- a/src/io.c
+++ b/src/io.c
@@ -341,7 +341,7 @@
     long int brezveze0=1;
     long int brezveze1=1;
     long int brezveze2=1;
-    ts_double xk0=25.0, dmax=1.67,stepsize=0.15;
+    ts_double xk0=25.0, dmax=1.67,stepsize=0.15,kspring=800.0;
 	long int iter=1000, init=1000, mcsw=1000;
 
 
@@ -351,6 +351,7 @@
         CFG_SIMPLE_INT("nmono", &nmono),
         CFG_SIMPLE_FLOAT("dmax", &dmax),
         CFG_SIMPLE_FLOAT("xk0",&xk0),
+        CFG_SIMPLE_FLOAT("k_spring",&kspring),
         CFG_SIMPLE_FLOAT("stepsize",&stepsize),
         CFG_SIMPLE_INT("nxmax", &ncxmax),
         CFG_SIMPLE_INT("nymax", &ncymax),
@@ -381,6 +382,9 @@
 	*mcsweeps=mcsw;
 	vesicle=initial_distribution_dipyramid(nshell,ncxmax,ncymax,nczmax,stepsize);
 	vesicle->poly_list=init_poly_list(npoly,nmono, vesicle->vlist);
+	vesicle->spring_constant=kspring;
+	poly_assign_spring_const(vesicle);
+	
 
     vesicle->nshell=nshell;
     vesicle->dmax=dmax*dmax;
diff --git a/src/poly.c b/src/poly.c
index 05566d0..edab18f 100644
--- a/src/poly.c
+++ b/src/poly.c
@@ -5,6 +5,15 @@
 #include"bond.h"
 #include<math.h>
 
+ts_bool poly_assign_spring_const(ts_vesicle *vesicle){
+	ts_uint i;
+
+	for(i=0;i<vesicle->poly_list->n;i++){
+ 	vesicle->poly_list->poly[i]->k = vesicle->spring_constant;
+    	}
+	
+	return TS_SUCCESS;
+}
 
 ts_poly	*init_poly(ts_uint n, ts_vertex *grafted_vtx){
 	ts_poly	*poly=(ts_poly *)calloc(1,sizeof(ts_poly));
@@ -19,6 +28,10 @@
 		vtx_add_neighbour(poly->vlist->vtx[i+1], poly->vlist->vtx[i]);
 	}
 
+	for(i=0;i<poly->blist->n;i++){
+	poly->blist->bond[i]->bond_length=sqrt(vtx_distance_sq(poly->blist->bond[i]->vtx1,poly->blist->bond[i]->vtx2));
+	}
+
 	return poly;
 }
 
diff --git a/src/poly.h b/src/poly.h
index 89392ba..9bdec52 100644
--- a/src/poly.h
+++ b/src/poly.h
@@ -11,4 +11,6 @@
 
 ts_bool poly_list_free(ts_poly_list *poly_list);
 
+ts_bool poly_assign_spring_const(ts_vesicle *vesicle);
+
 #endif
diff --git a/src/tape b/src/tape
index 55973b6..c8c8cdb 100644
--- a/src/tape
+++ b/src/tape
@@ -11,8 +11,10 @@
 ####### Polymer definitions ###########
 # npoly is a number of polymers attached to npoly distinct vertices on vesicle
 npoly=10
-# nmono is a number of monomers in each polymere
+# nmono is a number of monomers in each polymer
 nmono=15
+# Spring constant between monomers of the polymer
+k_spring=800
 
 #######  Cell definitions ############
 nxmax=60

--
Gitblit v1.9.3