faunus
Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Friends | List of all members
Faunus::ReactionData Class Reference

General properties of reactionsEnd of class. More...

#include <molecule.h>

Public Types

enum  Direction : char { LEFT = 0, RIGHT = 1 }
 
using StoichiometryMap = std::map< int, int >
 key = id; value = stoichiometic coeff.
 
using AtomicAndMolecularPair = std::pair< const StoichiometryMap &, const StoichiometryMap & >
 
using StoichiometryPair = StoichiometryMap::value_type
 first = id; second = stoichiometic coeff.
 
using MapFilter = std::function< bool(const ReactionData::StoichiometryPair &)>
 

Public Member Functions

void setDirection (Direction)
 Set directions of the process.
 
void setRandomDirection (Random &random)
 Set random direction (left or right)
 
Direction getDirection () const
 Get direction of the process.
 
void reverseDirection ()
 Reverse direction of reaction.
 
AtomicAndMolecularPair getProducts () const
 Pair with atomic and molecular products.
 
AtomicAndMolecularPair getReactants () const
 Pair with atomic and molecular reactants.
 
double freeEnergy () const
 Free energy of reaction in current direction (kT) More...
 
bool containsAtomicSwap () const
 True if a swap move is detected, i.e. atom_a <-> atom_b.
 
const std::string & getReactionString () const
 Reaction string.
 
std::pair< std::set< int >, std::set< int > > participatingAtomsAndMolecules () const
 Atom and molecule id's affected. More...
 

Public Attributes

bool only_neutral_molecules = false
 Only neutral molecules are involved in the reaction.
 

Static Public Attributes

static const MapFilter is_implicit_group
 
static const MapFilter not_implicit_group
 
static const MapFilter not_implicit_atom
 
static const MapFilter is_atomic_group
 
static const MapFilter is_molecular_group
 

Friends

void from_json (const json &, ReactionData &)
 
void to_json (json &, const ReactionData &)
 

Detailed Description

General properties of reactionsEnd of class.

Placeholder for chemical reactions used in the RCMC move. A reaction has two sides, left and right, each contained one or more atomic / molecular reactants and products. The reaction is associated with an equilibrium constant, lnK or pK. If the direction is RIGHT, the right-hand side species are products and the left-hand side are reactants. Vice versa if the direction is LEFT. The direction can be changed with setDirection() which also handles sign changes of lnK and pK. The functions getProducts() and getReactants() returns a pair with atomic and molecular reactants/products, always reflecting the current direction.

Todo:
  • [x] Enable canonic and reservoir_size
  • [ ] Enable reservoir size to be given as molarity and number
  • [ ] Merge products and reactant structures using signed stoichiometric numbers
  • [x] reservoir_size should ideally be associated with an implicit molecule
  • [ ] direction should be a member of ReactionData due to possible data races

Member Function Documentation

◆ freeEnergy()

double Faunus::ReactionData::freeEnergy ( ) const

Free energy of reaction in current direction (kT)

Returns
Reaction free energy in the current direction, i.e. products minus reactants (kT)

◆ participatingAtomsAndMolecules()

std::pair< std::set< int >, std::set< int > > Faunus::ReactionData::participatingAtomsAndMolecules ( ) const

Atom and molecule id's affected.

Returns
Pair of sets with id's for atoms and molecules participating in the reaction (i.e. reactants & products)

Member Data Documentation

◆ is_atomic_group

const ReactionData::MapFilter Faunus::ReactionData::is_atomic_group
static
Initial value:
= [](const auto& pair) {
return Faunus::molecules.at(pair.first).isAtomic();
}

◆ is_implicit_group

const ReactionData::MapFilter Faunus::ReactionData::is_implicit_group
static
Initial value:
= [](const auto& pair) {
return Faunus::molecules.at(pair.first).isImplicit();
}

◆ is_molecular_group

const ReactionData::MapFilter Faunus::ReactionData::is_molecular_group
static
Initial value:
= [](const auto& pair) {
return Faunus::molecules.at(pair.first).isMolecular();
}

◆ not_implicit_atom

const ReactionData::MapFilter Faunus::ReactionData::not_implicit_atom
static
Initial value:
= [](const auto& pair) {
return !Faunus::atoms.at(pair.first).implicit;
}

◆ not_implicit_group

const ReactionData::MapFilter Faunus::ReactionData::not_implicit_group
static
Initial value:
= [](const auto& pair) {
return !Faunus::molecules.at(pair.first).isImplicit();
}

The documentation for this class was generated from the following files: