\(\(\( (*\ 
      One - conformation\ Model\ *) \)\(
\)\(
\)\(\(SeedRandom[];\)

    \(step = 0.01;\)
 (*\ 
      parameter\ step\ determines\ the\ time\ resolution\ and\ is\ regarded\ as\ the\ unit\ time\ in\ the\ simulation . \ step\  = \ 
        0.01\ means\ the\ program\ generates\ data\ every\ 0.01\ \(\(second\)\(.\)\)\ *) 


    \(Prob = {0.03, 0.03};\)
 (*\ 
      parameter\ Prob[1]\  = \ 
        1 - exp \((\(-k1\)*
                step)\)\ is\ the\ probability\ of\ the\ molecule\ leaving\ the\ off - state, \ 
      where\ k1\ is\ the\ backward\ rate\ constant\ \((from\ off - 
            state\ to\ on - state)\); \ 
      parameter\ Prob[2]\  = \ 
        1 - exp \((\(-k2\)*
                step)\)\ is\ the\ probability\ for\ leaving\ the\ on - 
          state, \ where\ k2\ is\ the\ forward\ reaction\ rate\ \((from\ on - 
              state\ to\ off - state)\) . \ 
          When\ the\ step\ size\ is\ small\ so\ k*step\ is\ small, \ 
      Prob[1] = \ \(\(k1*step\  &\)\ Prob[2] = \ 
          k1*step . \ For\ example\), \ 
      if\ k1 = \(\(2\  &\)\ k2 = \ \(3\ per\ second\ and\ step = \ 
            0.01\ second\)\), \ 
      Prob[1] = \ \(\(0.02\  &\)\ Prob[
              2] = \ \(\(0.03\)\(.\)\)\)\ *) 


    \(Time = 10000;\)
 (*\ 
      parameter\ Time\ defines\ the\ total\ number\ of\ data\ points . \ 
            If\ Time = \ 10000, \ 
      the\ total\ length\ of\ the\ single\ molecule\ trace\ is\ 100\ seconds\ \((Time\ *\ step)\)\ *) 


    \(Turnover = \ 300;\)
 (*\ 
      parameter\ Turnover\ is\ a\ rough\ estimation\ of\ the\ total\ number\ of\ turnover\ from\ the\ forward\ and\ backward\ reaction\ rates . \ 
            The\ number\ of\ turnovers\ is\ also\ the\ number\ of\ on - 
        times\ and\ off - 
        times\ generated\ from\ the\ \(\(program\)\(.\)\)\ *) 


    \(signal = 1;\)

    \(t = 1;\)

    \(j = 1;\)

    \(k = 1;\)

    \(trace = Table[0, {i, Time}];\)

    \(on = Table[0, {i, Turnover}];\)

    \(off = Table[0, {i, Turnover}];\)


    \(Do[
{If[
            Random[]\  > 
              Prob[\([signal + 1]\)], 
{t = 
                t + 1}, 
{If[
                signal == 1, 
{on[\([j]\)] = t*step; 
                  j = j + 1}, 
{off[\([k]\)] = t*step; 
                  k = k + 1}
]; 
signal = 
                Mod[signal + 1, 2]; 
t = 
                1}
]; 
trace[\([i]\)] = 
            signal;}, 
{i, \ 
          Time}
];\)


    \(v = 
        Table[{on[\([i]\)], off[\([i]\)]}, {i, 
            Turnover}];\)


    \(Export["C:\simulation\data\one-conform.dat", 
        trace, "Table"];\)
 (*\ 
      the\ simulated\ single - 
        molecule\ trace\ is\ output\ to\ a\ file\ at\ the\ above\ address\ *) 


    \(Export["C:\simulation\data\on-conform-on-off.dat", 
        v, "Table"];\)
 (*\ 
      the\ simulated\ on - times\ and\ off - 
        times\ are\ output\ to\ a\ file\ at\ the\ above\ address\ *) 

    \)\)\)