Permalink
Browse files

Edited reaction procedure. Now it accepts the number of reaction steps

  • Loading branch information...
helvrud committed Oct 11, 2017
1 parent d6456c6 commit 94f46e9bc17cdf9b6bb62c50c65c6bf1b7dad355
@@ -33,9 +33,11 @@ ReactionEnsemble::~ReactionEnsemble(){
/**
* Performs a randomly selected reaction in the reaction ensemble
*/
int ReactionEnsemble::do_reaction(){
int reaction_id=i_random(m_current_reaction_system.nr_single_reactions);
generic_oneway_reaction(reaction_id, reaction_ensemble_mode);
int ReactionEnsemble::do_reaction(int reaction_steps){
for (int i = 0; i< reaction_steps; i++){
int reaction_id=i_random(m_current_reaction_system.nr_single_reactions);
generic_oneway_reaction(reaction_id, reaction_ensemble_mode);
}
return 0;
}
@@ -143,7 +143,7 @@ class ReactionEnsemble {
bool m_system_is_in_1_over_t_regime = false;
void set_cuboid_reaction_ensemble_volume();
int do_reaction();
int do_reaction(int reaction_steps);
int check_reaction_ensemble();
int calculate_nu_bar(int *reactant_coefficients, int len_reactant_types,
int *product_coefficients,
@@ -73,7 +73,7 @@ cdef extern from "reaction_ensemble.hpp" namespace "ReactionEnsemble":
cdef cppclass c_reaction_ensemble "ReactionEnsemble::ReactionEnsemble":
reaction_system m_current_reaction_system
int do_reaction() except +
int do_reaction(int reaction_steps) except +
bool do_global_mc_move_for_particles_of_type(int type, int start_id_polymer, int end_id_polymer, int particle_number_of_type, bool use_wang_landau)
int find_index_of_type(int type) except +
void set_cuboid_reaction_ensemble_volume()
@@ -207,11 +207,11 @@ IF REACTION_ENSEMBLE:
if(isinstance(self._params["dictionary"],dict)==False):
raise ValueError("No dictionary for relation between types and default charges provided.")
def reaction(self):
def reaction(self, reaction_steps = 1):
"""
performs one randomly selected reaction of the provided reaction system
"""
RE.do_reaction()
RE.do_reaction(reaction_steps)
def global_mc_move_for_one_particle_of_type(type_mc):
"""

0 comments on commit 94f46e9

Please sign in to comment.