v1. I try to implement a different algorithm in which I do not follow the evolution of the polymer but pick the ageing block T, perform N(T) cuts and follow relaxation with Rouse dynamics.
NOTE: even though the recording is 10 minutes, the MSD is ~30 sec so only 15 times the relaxation dynamics.
NOTE: I have defined the relaxation time as L^2/D0 but int reality it is L^2/(\pi^2 D0) so the survival probability plotted in units of Trep should decay as exp(-x/(1/pi^2)) and it does.
*/
#include<iostream>
#include<stdlib.h>
#include<cmath>
#include<sstream>
#include<fstream>
#include<string>
#include<iomanip>
#include<vector>
#include<algorithm> // std::shuffle/swap/sort
#include<array> // std::array
usingnamespacestd;
/* screen output */
intspeak=1;
/* CONSTANTS */
constintREPMAX=100;
constintNPARTICLES=1000;
constdoubledL=0.01;//
constdoubledt=0.001;//integration time
constdoubleD0=0.01;//monomer diffusion. In units of L0^2/tau
constdoubleL0=1;//L0 sets the units of length = lambda-dna = 48 kb
constintTrep=int(pow(L0,2.0)/D0);//Rouse time units [tau]
intqdump=int(1.0/dt);
intTblock=int(300*Trep);//time per survival block (300x2sec=10min) units [tau]
intTmsd=int(15*Trep);//time of MSD is actually only 15x relaxation time
// #of dt steps in each Tblock (= 300Trep/dt=300/dt/D0 or larger)
constintTblockmax=10000000;
constintNblocksmax=10;
/* VARIABLES */
intt;
doubleL;
/*RESTRICTION SITES */
/* cumulative positions */
doubler0=L0*0.1135;
doubler1=L0*0.4607;
doubler2=L0*0.5766;
doubler3=L0*0.7113;
doubler4=L0*0.8604;
doubleREsites[5]={r0,r1,r2,r3,r4};
doubleREsite_iscut[5]={0,0,0,0,0};//is_cut
doublefragment[6][2];// up to 6 fragments -- contains 0=b1,1=b2
intnREsitesmax=5;
constintncutmax=6;// fragments = sites + 1
doublecut[ncutmax];
//start from (see below)
//fragment[0][0]=0;
//fragment[0][1]=L;
intnfrags=1;
/* ARRAYS */
doublepos[Tblockmax];//this is updated every dt
intSurvival[Tblockmax];//[Tblock] => 10 blocks of 30Trep
//double g3ave[Nblocksmax][Tblockmax]; //[Tblock] => blocks of Tblock
doubleb1;//boundary of particle
doubleb2;//boundary of particle
intalive;
doubleNcuts;
doubleMeanLength;
/* FUNCTIONS */
doubleDiff(doubleL);
/* MAIN */
intmain(intargc,char*argv[]){
cout<<"Type in 1. xi=tau_b/tau_r (around 360-720) 2. Ageing block [0:20]"<<endl;
srand(time(NULL));
doublexi=atof(argv[1]);
doublec1=(1.0/Trep)*(1/xi);// [1/tau]
doubleTbreak=1/c1;// [tau]
intageblock=atoi(argv[2]);
//each block is 10 minutes = 300 relaxation times and about 1 breakage time
//but I am following the particle only for the first 15 relaxation times (30 seconds)