From 6487a03362d35589c286d0660eba123a7ab00535 Mon Sep 17 00:00:00 2001
From: Samo Penic <samo.penic@gmail.com>
Date: Mon, 10 May 2021 11:14:04 +0000
Subject: [PATCH] Raj and Yoav session in making multiple protein species

---
 src/io.c                   |   24 ++++++++++++++++++++++++
 src/tape                   |    8 ++++----
 src/energy.c               |    2 +-
 src/initial_distribution.c |    1 +
 src/general.h              |    1 +
 src/restore.c              |   23 +++++++++++++++++++++++
 6 files changed, 54 insertions(+), 5 deletions(-)

diff --git a/src/energy.c b/src/energy.c
index 1dae415..b182a87 100644
--- a/src/energy.c
+++ b/src/energy.c
@@ -213,7 +213,7 @@
 }
 
 ts_double direct_force_energy(ts_vesicle *vesicle, ts_vertex *vtx, ts_vertex *vtx_old){
-	if(fabs(vtx->c)<1e-15) return 0.0;
+	if(fabs(vtx->direct_interaction_force)<1e-15) return 0.0;
 //	printf("was here");
 	if(fabs(vesicle->tape->F)<1e-15) return 0.0;
 
diff --git a/src/general.h b/src/general.h
index 2dd63d8..d131ca6 100644
--- a/src/general.h
+++ b/src/general.h
@@ -158,6 +158,7 @@
         ts_double solAngle;
 		struct ts_poly *grafted_poly;
 		struct ts_cluster *cluster;
+	ts_double direct_interaction_force;
 };
 typedef struct ts_vertex ts_vertex;
 
diff --git a/src/initial_distribution.c b/src/initial_distribution.c
index 21eda68..756fdae 100644
--- a/src/initial_distribution.c
+++ b/src/initial_distribution.c
@@ -137,6 +137,7 @@
 				continue;
 			}
 			vesicle->vlist->vtx[rndvtx]->c=tape->c0;
+			vesicle->vlist->vtx[rndvtx]->direct_interaction_force=tape->F;
 		}
 		mean_curvature_and_energy(vesicle);
 		if(fabs(tape->w)>1e-16){ //if nonzero energy
diff --git a/src/io.c b/src/io.c
index 8fa652c..034207b 100644
--- a/src/io.c
+++ b/src/io.c
@@ -935,6 +935,30 @@
 			}
 		}
     fprintf(fh,"</DataArray>\n");
+	fprintf(fh,"<DataArray type=\"Float64\" Name=\"direct_interaction_force\" format=\"ascii\">");
+	for(i=0;i<vlist->n;i++){
+		fprintf(fh,"%.17e ",vtx[i]->direct_interaction_force);
+	}
+		//polymeres
+		if(poly){
+			poly_idx=vlist->n;
+			for(i=0;i<vesicle->poly_list->n;i++){
+				for(j=0;j<vesicle->poly_list->poly[i]->vlist->n;j++,poly_idx++){
+					fprintf(fh,"%.17e ", vesicle->poly_list->poly[i]->vlist->vtx[j]->direct_interaction_force);
+				}
+			}
+		}
+		//filaments
+		if(fil){
+			poly_idx=vlist->n+monono*polyno;
+			for(i=0;i<vesicle->filament_list->n;i++){
+				for(j=0;j<vesicle->filament_list->poly[i]->vlist->n;j++,poly_idx++){
+		//	fprintf(stderr,"was here\n");
+					fprintf(fh,"%.17e ",  vesicle->filament_list->poly[i]->vlist->vtx[j]->direct_interaction_force);
+				}
+			}
+		}
+    fprintf(fh,"</DataArray>\n");
 
 	//here comes additional data. Energy!
 	fprintf(fh,"<DataArray type=\"Float64\" Name=\"bending_energy\" format=\"ascii\">");
diff --git a/src/restore.c b/src/restore.c
index 6e12c1e..9ee9c45 100644
--- a/src/restore.c
+++ b/src/restore.c
@@ -362,6 +362,29 @@
 				}
 				xmlFree(values);		
 			}
+			if(!xmlStrcmp(property_name,(const xmlChar *)"direct_interaction_force")){
+				values=xmlNodeListGetString(doc,child->xmlChildrenNode,1);
+				vals=(char *)values;
+				token=strtok(vals," ");
+				idx=0;
+				while(token!=NULL){
+					if(idx<vesicle->vlist->n){
+						vesicle->vlist->vtx[idx]->direct_interaction_force=atof(token);
+					} else if(vesicle->tape->nmono && vesicle->tape->npoly && idx<vesicle->vlist->n+vesicle->tape->nmono*vesicle->tape->npoly) {
+						polyidx=(idx-vesicle->vlist->n)/vesicle->tape->nmono;
+						monoidx=(idx-vesicle->vlist->n)%vesicle->tape->nmono;
+						vesicle->poly_list->poly[polyidx]->vlist->vtx[monoidx]->direct_interaction_force=atof(token);
+					} else {
+						filidx=(idx-vesicle->vlist->n-vesicle->tape->nmono*vesicle->tape->npoly)/vesicle->tape->nfono;
+						fonoidx=(idx-vesicle->vlist->n-vesicle->tape->nmono*vesicle->tape->npoly)%vesicle->tape->nfono;
+						//fprintf(stderr,"filidx=%d, fonoidx=%d, coord=%s,%s,%s\n",filidx,fonoidx,token[0],token[1],token[2]);
+						vesicle->filament_list->poly[filidx]->vlist->vtx[fonoidx]->direct_interaction_force=atof(token);
+					}
+					idx++;
+					token=strtok(NULL," ");
+				}
+				xmlFree(values);		
+			}
 			xmlFree(property_name);
 		}
 		
diff --git a/src/tape b/src/tape
index d2965a6..f30ddaa 100644
--- a/src/tape
+++ b/src/tape
@@ -30,9 +30,9 @@
 
 ####### Polymer (brush) definitions ###########
 # npoly is a number of polymers attached to npoly distinct vertices on vesicle
-npoly=10
+npoly=0
 # nmono is a number of monomers in each polymer
-nmono=20
+nmono=0
 # Spring constant between monomers of the polymer
 k_spring=800
 #set to 1 if half of the polymeres are inside the vesicle
@@ -92,9 +92,9 @@
 
 
 #number of vertices with spontaneous curvature (integer)
-number_of_vertices_with_c0=0
+number_of_vertices_with_c0=200
 #c0/2 is spontaneous curvature. c0 is used as (c1+c1-c0)^2 in energy term (float)
-c0=0.5
+c0=1.0
 #energy of attraction of vertices with spontaneous curvature (float, positive value for attraction)
 w=10.0
 #direct force on vesicles with spontaneous curvature (float)

--
Gitblit v1.9.3