<commit_before>#pragma once 

#include "Move.h"
#include "../Utils/Helpers.h"
#include "../Utils/Rand.h"
#include "../Worlds/WorldManager.h"
#include "../ForceFields/ForceFieldManager.h"
#include "../DensityOfStates/DOSOrderParameter.h"

/* Currently move only works with acid where the following is the reaction:
forward HA -> A- + H+
Reverse A- + H+ -> HA
*/

namespace SAPHRON
{
	class AcidReactionMove : public Move
	{
	private:
		std::vector<int> _reactants;
		std::vector<int> _products;
		Rand _rand;

		int _performed;
		int _rejected;
		bool _prefac;
		int _scount;
		double _pKo;
		double _protoncharge;
		int _Ndeprotonated;
		int _seed;

		void InitStashParticles(const WorldManager& wm)
		{
			// Get particle map, find one of the appropriate species 
			// and clone.
			auto& plist = Particle::GetParticleMap();

			for(auto& id : _reactants)
			{
				// Since the species exists, we assume there must be at least 
				// one find. 
				auto pcand = std::find_if(plist.begin(), plist.end(), 
					[=](const std::pair<int, Particle*>& p)
					{
						return p.second->GetSpeciesID() == id;
					}
				);

				// Stash a characteristic amount of the particles in world.
				for(auto& world : wm)
					world->StashParticle(pcand->second, _scount);
			}
		}<commit_msg>Bug fix in Acid Reaction Move.<commit_after>#pragma once 

#include "Move.h"
#include "../Utils/Helpers.h"
#include "../Utils/Rand.h"
#include "../Worlds/WorldManager.h"
#include "../ForceFields/ForceFieldManager.h"
#include "../DensityOfStates/DOSOrderParameter.h"

/* Currently move only works with acid where the following is the reaction:
forward HA -> A- + H+
Reverse A- + H+ -> HA
*/

namespace SAPHRON
{
	class AcidReactionMove : public Move
	{
	private:
		std::vector<int> _reactants;
		std::vector<int> _products;
		Rand _rand;

		int _performed;
		int _rejected;
		bool _prefac;
		int _scount;
		double _pKo;
		double _protoncharge;
		int _Ndeprotonated;
		int _seed;

		void InitStashParticles(const WorldManager& wm)
		{
			// Get particle map, find one of the appropriate species 
			// and clone.
			auto& plist = Particle::GetParticleMap();

			for(auto& id : _products)
			{
				// Since the species exists, we assume there must be at least 
				// one find. 
				auto pcand = std::find_if(plist.begin(), plist.end(), 
					[=](const std::pair<int, Particle*>& p)
					{
						return p.second->GetSpeciesID() == id;
					}
				);

				// Stash a characteristic amount of the particles in world.
				for(auto& world : wm)
					world->StashParticle(pcand->second, _scount);
			}
		}
{'fraction_non_alphanumeric': 0.13004658385093168, 'fraction_numerical': 0.0, 'mean_word_length': 3.1232, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '898440', 'n_tokens_mistral': 1034, 'n_tokens_neox': 877, 'n_words': 249}