Skip to content

Commit

Permalink
progress on filament simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
ssandrews authored and dilawar committed Jul 22, 2024
1 parent f2ecca3 commit f01a77d
Show file tree
Hide file tree
Showing 11 changed files with 902 additions and 1,003 deletions.
Binary file modified docs/Smoldyn/SmoldynCodeDoc.pdf
Binary file not shown.
390 changes: 207 additions & 183 deletions docs/Smoldyn/SmoldynCodeDoc.tex

Large diffs are not rendered by default.

Binary file modified docs/Smoldyn/SmoldynManual.pdf
Binary file not shown.
28 changes: 14 additions & 14 deletions docs/Smoldyn/SmoldynManual.tex
Original file line number Diff line number Diff line change
Expand Up @@ -3530,9 +3530,13 @@ \section{Statements about filaments}

Start of filament type definition block. The filament type name may be given with $name$, or it may be given afterward with the \ttt{name} statement. If the name has not been used yet for a filament type, then a new filament type is started. Between this instruction and \ttt{end\_filament\_type}, all lines need to pertain to filament types. Parameters of one filament type can be listed in multiple blocks, or parameters for many filament types can be listed in one block.

\item{\ttt{name} $name$}

From within a filament type definition block, this switches to a new filament type and creates it if needed.

\item{\ttt{dynamics} $dynamics$}

Sets the dynamics for the filament type. Options are: ``RigidBeads'', ``RigidSegments'', ``Rouse'', ``Alberts'', ``Nedelec''. These are case-insensitive.
Sets the dynamics for the filament type. Current options are: ``none'', ``Newton''. These are case-insensitive.

\item{\ttt{biology} $biology$}

Expand Down Expand Up @@ -3570,17 +3574,13 @@ \section{Statements about filaments}

Viscosity of the surrounding medium.

\item{\ttt{bead\_radius} $value$}

Radius of the beads in these filaments. Used for hydrodynamic calculations.

\item{\ttt{standard\_length} $length$}

Relaxed length of a filament segment. It can change through stretching or compression.

\item{\ttt{standard\_angle} $yaw$ $pitch$ $roll$}

Relaxed angles between adjacent filament segments. When facing toward the filament's front end, yaw represents left-right bending, pitch represents up-down bending, and roll represents rotation about the filament axis.
Relaxed angles between adjacent filament segments. When facing toward the filament's front end, yaw represents left-right bending, pitch represents up-down bending, and roll represents rotation about the filament axis. For 2D simulations, only enter a single bending angle.

\item{\ttt{force\_length} $value$}

Expand All @@ -3600,21 +3600,21 @@ \section{Statements about filaments}

\begin{description}

\item{\ttt{random\_filament} $name$ $type$ $segments$ $[x$ $y$ $z]$}
\item{\ttt{random\_filament} $name$ $type$ $segments$ $[x$ $y$ $z$ $\theta$ $\phi$ $\chi]$ $thickness$}

Create a new filament with random segments. It is named $name$, is of type $type$, has $segments$ number of segments, and, optionally, has its starting location at $(x,y,z)$.
Create a new filament with random segments. It is named $name$, is of type $type$, has $segments$ number of segments, and, optionally, has its starting location at $(x,y,z)$ and initial yaw-pitch-roll angle $(\theta, \phi, \chi)$. It also has optional thickness $thickness.$.

\item{\ttt{start\_filament} $name$}
\item{\ttt{start\_filament} $type$ $name$}

Start of filament definition block. The filament name may be given with $name$, or it may be given afterward with the \ttt{name} statement. If the name has not been used yet for a filament, then a new filament is started. Between this instruction and \ttt{end\_filament}, all lines need to pertain to filaments. Parameters of one filament can be listed in multiple blocks, or parameters for many filaments can be listed in one block.
Start of filament definition block, for a filament of type $type$ and named $name$. If the name has not been used yet for a filament of this type, then a new filament is started. Between this instruction and \ttt{end\_filament}, all lines need to pertain to filaments. Parameters of one filament can be listed in multiple blocks, or parameters for many filaments can be listed in one block.

\item{\ttt{* name} $name$}
\item{\ttt{new\_filament} $type$ $name$}

Name of the filament for editing. This statement is not required because the filament name can also be given with \ttt{start\_filament}. This statement gives the name of the current filament for editing, and creates a new filament if needed.
Defines a new filament of type $type$ that is called $name$, but does not start a filament block. This statement is largely redundant with \ttt{start\_filament}.

\item{\ttt{type} $type$}
\item{\ttt{* name} $type$ $name$}

Filament type, which should already be defined in a filament type block.
Name of the filament for editing. This statement is not required because the filament name can also be given with \ttt{start\_filament}. This statement gives the name of the current filament for editing, and creates a new filament if needed.

\item{\ttt{first\_segment} $x$ $y$ $z$ $length$ $angle_0$ $angle_1$ $angle_2$ $[thickness]$}

Expand Down
22 changes: 13 additions & 9 deletions examples/S13_filaments/filament.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Filaments

#graphics opengl
random_seed 2
graphics opengl_better
graphics opengl
#random_seed 2
#graphics opengl_better

dim 3
boundaries x 0 100 r
Expand All @@ -13,15 +13,15 @@ species red

difc red 3

color red white
color red red

time_start 0
time_stop 10000
time_step 0.01

frame_thickness 0

mol 1 red u u u
mol 2 red u u u


start_filament_type black
Expand All @@ -32,18 +32,22 @@ kT 1
#treadmill_rate 1
standard_length 5
standard_angle 0 0 0
force_length 0
force_length 1
force_angle 100 0 0
end_filament_type


start_filament template
type black
start_filament black template
random_segments 5 10 50 1 u u u
#copy fil2
#name black fil2
#translate + 15 15 0
end_filament


#filament template copy fil2
filament template copy fil2
filament fil2 translate + 15 15 0


/*
filament template copy fil3
Expand Down
14 changes: 9 additions & 5 deletions examples/S13_filaments/filament1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,18 @@ color black
thickness 2
polygon edge
kT 1
#treadmill_rate 1
standard_length 5
treadmill_rate 2
standard_length 2
standard_angle 0 0 0
force_length 0
force_angle 100 0 0
force_length 10
force_angle 5 -1 -1
end_filament_type

random_filament fil1 tread 5 10 50 1 u u u
random_filament fil1 tread 10 10 50 1 0 0 0
random_filament fil2 tread 10 20 50 1 1 0 0
random_filament fil3 tread 10 10 40 1 -1 0 0
random_filament fil4 tread 10 30 50 1 2 0 0
random_filament fil5 tread 10 30 30 1 -1 0 0


start_surface bounds
Expand Down
108 changes: 31 additions & 77 deletions source/Smoldyn/smoldyn.h
Original file line number Diff line number Diff line change
Expand Up @@ -756,15 +756,6 @@ typedef struct latticesuperstruct

/********************************* Filaments ********************************/

enum FilamentDynamics
{
FDnone,
FDrigidbeads,
FDrigidsegments,
FDrouse,
FDalberts,
FDnedelec
};
enum FilamentBiology
{
FBactin,
Expand All @@ -776,37 +767,38 @@ enum FilamentBiology
FBnone
};

typedef struct beadstruct
enum FilamentDynamics
{
double xyz[3]; // bead coordinates
double xyzold[3]; // bead coordinates for prior time
} * beadptr;
FDnone,
FDnewton
};

typedef struct segmentstruct
{
double xyzfront[3]; // Coords. for segment front
double xyzback[3]; // Coords. for segment back
double len; // segment length
double ypr[3]; // relative ypr angles
double dcm[9]; // relative dcm
double adcm[9]; // absolute segment orientation
double thk; // thickness of segment
struct filamentstruct* fil; // owning filament
int index; // self index along filament
double xyzfront[3]; // Coords. for segment front
double xyzback[3]; // Coords. for segment back
double len; // segment length
double thk; // thickness of segment
double ypr[3]; // relative ypr angles
double dcm[9]; // relative dcm
double adcm[9]; // absolute segment orientation
} * segmentptr;

typedef struct filamentstruct
{
struct filamenttypestruct* filtype; // filament type structure
char* filname; // filament name (reference, not owned)
int maxbs; // number of beads or segments allocated
int nbs; // number of beads or segments
int frontbs; // index of front bead or segment
beadptr* beads; // array of beads if any
struct filamenttypestruct* filtype; // owning filament type
char* filname; // filament name (ref, not owned)
int maxseg; // number of segments allocated
int nseg; // number of segments
int frontseg; // index of front segment
segmentptr* segments; // array of segments if any
struct filamentstruct* frontend; // what front attaches to if anything
struct filamentstruct* backend; // what back attaches to if anything
int maxbranch; // max number of branches off this filament
int nbranch; // number of branches off this filament
int* branchspots; // list of bead or segments where branches are
struct filamentstruct* frontend; // what front attaches to
struct filamentstruct* backend; // what back attaches to
int maxbranch; // max branches off this filament
int nbranch; // num branches off this filament
int* branchspots; // segments where branches are
struct filamentstruct** branches; // list of branching filaments
int maxmonomer; // number of monomers allocated
int nmonomer; // number of monomers
Expand All @@ -817,11 +809,10 @@ typedef struct filamentstruct
typedef struct filamenttypestruct
{
struct filamentsuperstruct* filss; // filament superstructure
char* ftname; // filament type name (reference, not owned)
char* ftname; // fil type name (ref, not owned)
enum FilamentBiology biology; // biological name for filaments
enum FilamentDynamics dynamics; // dynamics for the filament
int isbead; // 1 for bead model, 0 for segments
enum FilamentBiology biology; // Biological name for filament type
double bundlevalue; // number of microfilaments in bundle
double bundlevalue; // microfilaments in bundle
double color[4]; // filament color
double edgepts; // thickness of edge for drawing
unsigned int edgestipple[2]; // edge stippling [factor, pattern]
Expand All @@ -831,16 +822,17 @@ typedef struct filamenttypestruct
double stdypr[3]; // minimum energy bend angle
double klen; // force constant for length
double kypr[3]; // force constant for angle
double kT; // thermodynamic temperature, [0,inf)
double kT; // thermodynamic temp, [0,inf)
double treadrate; // treadmilling rate constant
double viscosity; // viscosity
double filradius; // bead or segment radius
int maxface; // number of filament faces allocated
double filradius; // segment radius
int maxface; // filament faces allocated
int nface; // number of filament faces
char** facename; // list of face names
double facetwist; // twisting rate of faces along filament
double facetwist; // twisting rate of faces
int maxfil; // maximum number of filaments
int nfil; // actual number of filaments
int autonamenum; // next number for autoname
filamentptr* fillist; // list of filaments
char** filnames; // names of filaments
} * filamenttypeptr;
Expand All @@ -855,44 +847,6 @@ typedef struct filamentsuperstruct
filamenttypeptr* filtypes; // list of filament types
} * filamentssptr;

/* OLD FILAMENTS
typedef struct filamentstruct
{
struct filamentsuperstruct* filss; // filament superstructure
char* fname; // filament name
double color[4]; // filament color
double edgepts; // thickness of edge for drawing
unsigned int edgestipple[2]; // edge stippling [factor, pattern]
enum DrawMode drawmode; // polygon drawing mode
double shiny; // shininess
int maxseg; // number of segments allocated
int nseg; // number of segments
int front; // front index
int back; // back index
double** sxyz; // Coords. for segment ends [seg][3]
double* slen; // segment length [seg]
double** sypr; // relative ypr angles [seg][3]
double** sdcm; // relative dcm [seg][9]
double** sadcm; // absolute segment orientation [seg][9]
double* sthk; // thickness of segment [nmax], [0,inf)
double stdlen; // minimum energy segment length
double stdypr[3]; // minimum energy bend angle
double klen; // force constant for length
double kypr[3]; // force constant for angle
double kT; // thermodynamic temperature, [0,inf)
double treadrate; // treadmilling rate constant
} * filamentptr;
typedef struct filamentsuperstruct
{
enum StructCond condition; // structure condition
struct simstruct* sim; // simulation structure
int maxfil; // maximum number of filaments
int nfil; // actual number of filaments
char** fnames; // filament names
filamentptr* fillist; // list of filaments
} * filamentssptr;
*/

/******************************** BioNetGen *********************************/

Expand Down
10 changes: 5 additions & 5 deletions source/Smoldyn/smoldynfuncs.h
Original file line number Diff line number Diff line change
Expand Up @@ -410,17 +410,17 @@ void filssoutput(simptr sim);
int filcheckparams(simptr sim,int *warnptr);

// filament manipulation
int filAddRandomSegments(filamentptr fil,int number,const char *xstr,const char *ystr,const char *zstr,const char *thtstr,const char *phistr,const char *chistr,double thickness);
int filAddRandomBeads(filamentptr fil,int number,const char *xstr,const char *ystr,const char *zstr);
int filGetFilIndex(simptr sim,const char *name,int *ftptr);
filamentptr filAddFilament(filamenttypeptr filtype,const char *filname);
int filAddRandomSegments(filamentptr fil,int number,const char *xstr,const char *ystr,const char *zstr,const char *thtstr, const char* phistr,const char* chistr,double thickness);

// structure set up
int filenablefilaments(simptr sim);
filamentptr filAddFilament(filamenttypeptr filtype,filamentptr fil,const char *filname);
filamenttypeptr filtypereadstring(simptr sim,ParseFilePtr pfp,filamenttypeptr filtype,const char *word,char *line2);
filamentptr filreadstring(simptr sim,ParseFilePtr pfp,filamentptr fil,filamenttypeptr filtype,const char *word,char *line2);
int filloadtype(simptr sim,ParseFilePtr *pfpptr,char *line2);
int filloadfil(simptr sim,ParseFilePtr *pfpptr,char *line2,filamenttypeptr filtype);
int filsupdate(simptr sim);
int filloadfil(simptr sim,ParseFilePtr *pfpptr,char *line2);
int filupdate(simptr sim);

// core simulation functions
int filDynamics(simptr sim);
Expand Down
Loading

0 comments on commit f01a77d

Please sign in to comment.