# Path: stochpy/implementations/StochPyTools.py
# class Species():
# class StochPySSA_Shared(): 
#     def __init__(self):
#     def Parse(self,model_file,model_dir,IsTauleaping=False,IsNRM=False,IsDelayed = False,IsSMM = False,IsQuiet=False):
#     def SpeciesSelection(self):
#     def RateSelection(self):
#     def SetEvents(self):
#     def Propensities(self,IsTauleaping=False):
#     def BuildPropensityCodes(self, propensities = None): # 21-11-2013 
#     def HandleEvents(self,IsTauleapingStep=False):    
#     def AssignmentRules(self):
#     def rateFunc(self,rate_eval_code,r_vec):
#     def Initial_Conditions(self,IsTauleaping = False):              
#     def GenerateOutput(self,IsTauleaping = False,completion_delayed = False):


import sys,copy,time,os,operator
from .StochPyTools import __species__,StochPySSA_Shared,np
#! /usr/bin/env python
"""
Delayed Direct Method
=====================

This module performs the Delayed Direct Stochastic Simulation Algorithm adapted from Cai (2007) [1].

This algorithm is used to generate exact realizations of the Markov jump process with delays. Of course, the algorithm is stochastic, so these realizations are different for each run.

Only molecule populations are specified. Positions and velocities, such as in Molecular Dynamics (MD) are ignored. This makes the algorithm much faster, because non-reactive molecular collisions can be ignored.different
Still, this exact SSA is quite slow, because it insists on simulating every individual reaction event, which takes a lot of time if the reactant population is large. Furthermore, even larger problems arise if the model contains distinct processes operating on different time scales [2].

[1] Xiaodong Cai (2007), "Exact stochastic simulation of coupled chemical reactions with delays", J.Phys. Chem. 126:124108

Written by M Moinat, T.R. Maarleveld
Adapted from 'DirectMethod' by T.R. Maarleveld, Amsterdam, The Netherlands
E-mail: tmd200@users.sourceforge.net
Last Change: June 01, 2015
"""

from __future__ import division, print_function, absolute_import

__doc__ = """
          Delayed Direct Method
          =====================
          This module performs the Delayed Direct Stochastic Simulation Algorithm adapted from Cai (2007) [1]. This algorithm is used to generate exact realizations of the Markov jump process with delays. Of course, the algorithm is stochastic, so these realizations are different for each run.
          Only molecule populations are specified. Positions and velocities, such as in Molecular Dynamics (MD) are ignored. This makes the algorithm much faster, because non-reactive molecular collisions can be ignored.
          Still, this exact SSA is quite slow, because it insists on simulating every individual reaction event, which takes a lot of time if the reactant population is large. Furthermore, even larger problems arise if the model contains distinct processes operating on different time-scales [2].
          

# Path: stochpy/implementations/StochPyTools.py
# class Species():
# class StochPySSA_Shared(): 
#     def __init__(self):
#     def Parse(self,model_file,model_dir,IsTauleaping=False,IsNRM=False,IsDelayed = False,IsSMM = False,IsQuiet=False):
#     def SpeciesSelection(self):
#     def RateSelection(self):
#     def SetEvents(self):
#     def Propensities(self,IsTauleaping=False):
#     def BuildPropensityCodes(self, propensities = None): # 21-11-2013 
#     def HandleEvents(self,IsTauleapingStep=False):    
#     def AssignmentRules(self):
#     def rateFunc(self,rate_eval_code,r_vec):
#     def Initial_Conditions(self,IsTauleaping = False):              
#     def GenerateOutput(self,IsTauleaping = False,completion_delayed = False):


# Path: stochpy/implementations/DelayedDirectMethod.py
import sys,copy,time,os,operator
from .StochPyTools import __species__,StochPySSA_Shared,np

#! /usr/bin/env python
"""
Delayed Direct Method
=====================

This module performs the Delayed Direct Stochastic Simulation Algorithm adapted from Cai (2007) [1].

This algorithm is used to generate exact realizations of the Markov jump process with delays. Of course, the algorithm is stochastic, so these realizations are different for each run.

Only molecule populations are specified. Positions and velocities, such as in Molecular Dynamics (MD) are ignored. This makes the algorithm much faster, because non-reactive molecular collisions can be ignored.different
Still, this exact SSA is quite slow, because it insists on simulating every individual reaction event, which takes a lot of time if the reactant population is large. Furthermore, even larger problems arise if the model contains distinct processes operating on different time scales [2].

[1] Xiaodong Cai (2007), "Exact stochastic simulation of coupled chemical reactions with delays", J.Phys. Chem. 126:124108

Written by M Moinat, T.R. Maarleveld
Adapted from 'DirectMethod' by T.R. Maarleveld, Amsterdam, The Netherlands
E-mail: tmd200@users.sourceforge.net
Last Change: June 01, 2015
"""

from __future__ import division, print_function, absolute_import

__doc__ = """
          Delayed Direct Method
          =====================
          This module performs the Delayed Direct Stochastic Simulation Algorithm adapted from Cai (2007) [1]. This algorithm is used to generate exact realizations of the Markov jump process with delays. Of course, the algorithm is stochastic, so these realizations are different for each run.
          Only molecule populations are specified. Positions and velocities, such as in Molecular Dynamics (MD) are ignored. This makes the algorithm much faster, because non-reactive molecular collisions can be ignored.
          Still, this exact SSA is quite slow, because it insists on simulating every individual reaction event, which takes a lot of time if the reactant population is large. Furthermore, even larger problems arise if the model contains distinct processes operating on different time-scales [2].
          

          [1] Xiaodong Cai (2007), "Exact stochastic simulation of coupled chemical reactions with delays", J.Phys. Chem. 126:124108