diff --git a/src/core/reaction_ensemble.cpp b/src/core/reaction_ensemble.cpp index 282a85b3084..c3e8fe9b2be 100644 --- a/src/core/reaction_ensemble.cpp +++ b/src/core/reaction_ensemble.cpp @@ -423,11 +423,10 @@ void WangLandauReactionEnsemble::on_end_reaction(int &accepted_state) { * randomly in the box. Matching particles simply change the types. If there * are more reactants than products, old reactant particles are deleted. */ -bool ReactionAlgorithm::generic_oneway_reaction(int reaction_id) { +void ReactionAlgorithm::generic_oneway_reaction(int reaction_id) { SingleReaction ¤t_reaction = reactions[reaction_id]; current_reaction.tried_moves += 1; - bool reaction_is_accepted = false; particle_inside_exclusion_radius_touched = false; int old_state_index = -1; // for Wang-Landau algorithm on_reaction_entry(old_state_index); @@ -435,7 +434,7 @@ bool ReactionAlgorithm::generic_oneway_reaction(int reaction_id) { // makes sure, no incomplete reaction is performed -> only need to consider // rollback of complete reactions on_reaction_rejection_directly_after_entry(old_state_index); - return reaction_is_accepted; + return; } // calculate potential energy @@ -510,7 +509,6 @@ bool ReactionAlgorithm::generic_oneway_reaction(int reaction_id) { delete_particle(to_be_deleted_hidden_ids[i]); // delete particle } current_reaction.accepted_moves += 1; - reaction_is_accepted = true; } else { // reject accepted_state = old_state_index; @@ -524,10 +522,8 @@ bool ReactionAlgorithm::generic_oneway_reaction(int reaction_id) { // 3) restore previously changed reactant particles restore_properties(changed_particles_properties, number_of_saved_properties); - reaction_is_accepted = false; } on_end_reaction(accepted_state); - return reaction_is_accepted; } /** @@ -759,7 +755,6 @@ int WangLandauReactionEnsemble::on_mc_use_WL_get_new_state() { bool ReactionAlgorithm::do_global_mc_move_for_particles_of_type( int type, int particle_number_of_type_to_be_changed, bool use_wang_landau) { m_tried_configurational_MC_moves += 1; - bool got_accepted = false; particle_inside_exclusion_radius_touched = false; int old_state_index = -1; @@ -774,7 +769,7 @@ bool ReactionAlgorithm::do_global_mc_move_for_particles_of_type( if (use_wang_landau) { on_mc_rejection_directly_after_entry(old_state_index); } - return got_accepted; + return false; } const double E_pot_old = calculate_current_potential_energy_of_system(); @@ -866,21 +861,20 @@ bool ReactionAlgorithm::do_global_mc_move_for_particles_of_type( if (m_uniform_real_distribution(m_generator) < bf) { // accept m_accepted_configurational_MC_moves += 1; - got_accepted = true; if (use_wang_landau) { on_mc_accept(new_state_index); } - } else { - // reject - // modify wang_landau histogram and potential - if (use_wang_landau) { - on_mc_reject(old_state_index); - } - // create particles again at the positions they were - for (int i = 0; i < particle_number_of_type_to_be_changed; i++) - place_particle(p_id_s_changed_particles[i], &particle_positions[3 * i]); + return true; } - return got_accepted; + // reject + // modify wang_landau histogram and potential + if (use_wang_landau) { + on_mc_reject(old_state_index); + } + // create particles again at the positions they were + for (int i = 0; i < particle_number_of_type_to_be_changed; i++) + place_particle(p_id_s_changed_particles[i], &particle_positions[3 * i]); + return false; } ///////////////////////////////////////////// Wang-Landau algorithm @@ -1246,13 +1240,9 @@ double WangLandauReactionEnsemble::calculate_acceptance_probability( */ int WangLandauReactionEnsemble::do_reaction(int reaction_steps) { m_WL_tries += reaction_steps; - bool got_accepted = false; for (int step = 0; step < reaction_steps; step++) { int reaction_id = i_random(reactions.size()); - got_accepted = generic_oneway_reaction(reaction_id); - if (got_accepted) { - m_WL_accepted_moves += 1; - } + generic_oneway_reaction(reaction_id); if (can_refine_wang_landau_one_over_t() && m_WL_tries % 10000 == 0) { // check for convergence if (achieved_desired_number_of_refinements_one_over_t()) { diff --git a/src/core/reaction_ensemble.hpp b/src/core/reaction_ensemble.hpp index a6a97ab7453..112f069dd30 100644 --- a/src/core/reaction_ensemble.hpp +++ b/src/core/reaction_ensemble.hpp @@ -166,7 +166,7 @@ class ReactionAlgorithm { protected: std::vector m_empty_p_ids_smaller_than_max_seen_particle; - bool generic_oneway_reaction(int reaction_id); + void generic_oneway_reaction(int reaction_id); virtual void on_reaction_entry(int &old_state_index) {} virtual void on_reaction_rejection_directly_after_entry(int &old_state_index) {} @@ -209,10 +209,6 @@ class ReactionAlgorithm { std::vector &reactant_coefficients, std::vector &product_coefficients); // should only be used when // defining a new reaction - int m_invalid_charge = - -10000; // this is the default charge which is assigned to a type which - // occurs in a reaction. this charge has to be overwritten. if it - // is not overwritten the reaction ensemble will complain. void replace_particle(int p_id, int desired_type); int create_particle(int desired_type); void hide_particle(int p_id, int previous_type); @@ -319,7 +315,6 @@ class WangLandauReactionEnsemble : public ReactionAlgorithm { double wang_landau_parameter = 1.0; // equals the logarithm to basis e of the // modification factor of the degeneracy of // states when the state is visited - double initial_wang_landau_parameter = 1.0; int int_fill_value = -10; double double_fill_value = -10.0; @@ -341,7 +336,6 @@ class WangLandauReactionEnsemble : public ReactionAlgorithm { void update_wang_landau_potential_and_histogram( int index_of_state_after_acceptance_or_rejection); - int m_WL_accepted_moves = 0; int m_WL_tries = 0; bool can_refine_wang_landau_one_over_t(); bool m_system_is_in_1_over_t_regime = false; diff --git a/src/python/espressomd/cellsystem.pyx b/src/python/espressomd/cellsystem.pyx index 4f08f618b6b..a4192b72e75 100644 --- a/src/python/espressomd/cellsystem.pyx +++ b/src/python/espressomd/cellsystem.pyx @@ -18,7 +18,7 @@ # from .grid cimport node_grid from . cimport integrate -from .globals cimport FIELD_SKIN, FIELD_NODEGRID, FIELD_MAXNUMCELLS, FIELD_MINNUMCELLS +from .globals cimport FIELD_SKIN, FIELD_NODEGRID from .globals cimport verlet_reuse, skin from .globals cimport mpi_bcast_parameter from .cellsystem cimport dd, cell_structure diff --git a/src/python/espressomd/globals.pxd b/src/python/espressomd/globals.pxd index 67574af317e..210b08819b5 100644 --- a/src/python/espressomd/globals.pxd +++ b/src/python/espressomd/globals.pxd @@ -23,8 +23,6 @@ cdef extern from "global.hpp": int FIELD_BOXL int FIELD_SKIN int FIELD_NODEGRID - int FIELD_MAXNUMCELLS - int FIELD_MINNUMCELLS int FIELD_NPTISO_PISTON int FIELD_NPTISO_PDIFF int FIELD_PERIODIC diff --git a/src/python/espressomd/reaction_ensemble.pxd b/src/python/espressomd/reaction_ensemble.pxd index 180f6cb4dff..0cd60388615 100644 --- a/src/python/espressomd/reaction_ensemble.pxd +++ b/src/python/espressomd/reaction_ensemble.pxd @@ -45,7 +45,6 @@ cdef extern from "reaction_ensemble.hpp" namespace "ReactionEnsemble": void delete_reaction(int reaction_id) vector[SingleReaction] reactions - int nr_different_types map[int, double] charges_of_types double temperature double exclusion_radius @@ -65,8 +64,6 @@ cdef extern from "reaction_ensemble.hpp" namespace "ReactionEnsemble": cdef cppclass CWangLandauReactionEnsemble "ReactionEnsemble::WangLandauReactionEnsemble"(CReactionAlgorithm): CWangLandauReactionEnsemble(int seed) double wang_landau_parameter - double initial_wang_landau_parameter - int number_of_monte_carlo_moves_between_check_of_convergence double final_wang_landau_parameter string output_filename vector[double] minimum_energies_at_flat_index