-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInitdip.f90
More file actions
26 lines (24 loc) · 1.11 KB
/
Copy pathInitdip.f90
File metadata and controls
26 lines (24 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
SUBROUTINE Initdip(trel,kon,koff,tswitch,dip,N,Nc)
IMPLICIT NONE
INTEGER*8 :: i, j, N, Nc, dip(N,Nc)
REAL*8 :: con, trel(N,Nc), tswitch(N,Nc),kon,koff
REAL*4 :: rand
! Loop over chains
DO i = 1,Nc
! Loop over links
DO j = 1,N
! Assign initial state randomly according to on/off rates
! Calculate time till next switch (Poisson process)
con = kon/(kon+koff)
IF(rand(0) .LT. con)THEN
dip(j,i) = 1
trel(j,i) = 0.d0
tswitch(j,i) = -log(rand(0))/koff
ELSE
dip(j,i) = 0
trel(j,i) = 0.d0
tswitch(j,i) = -log(rand(0))/kon
ENDIF
ENDDO
ENDDO
END SUBROUTINE Initdip