SimSoup: Design

Modules: Chemical Network

Module Purpose

The SimSoup Chemical Network module represents the Molecule Types that can exist, and the Interaction Types (reactions) in which they can be involved. It provides a representation of chemistry as a network in which the nodes are Molecule Types and the connections between the nodes are Interaction Types.

Class Diagrams

The diagrams below shows the classes that form the SimSoup Chemical Network Subsystem. The first diagram shows the class data and relationships (including inheritance) between data items. The second diagram shows the dependencies between classes.

Data And Inheritance View

Chemical Network Subsystem Data
  And Inheritance View

Dependency View

Chemistry Network Subsystem
  Dependency View

Class Descriptions

The classes that are included in the Chemical Network module, and their definitions, are as follows:-
Chemistry
Identifies the Molecule Types and Interaction Types that are known to SimSoup. The Chemistry object provides a point of integration for other objects in the Chemical Network, and also provides a number of module level operations. The Chemistry is a singleton object; only one can exist in SimSoup at any time.
Construction
A Construction is a kind of Interaction Type. It has interaction scheme A + B --> C. In a Construction, two Molecules join together to produce a single product Molecule.
Fission
A Fission is a kind of Interaction Type. It has interaction scheme A --> B+ C. In a Fission, a single Molecule splits to form two product Molecules.
Interaction Type
A base class. Classes derived from Interaction Type represent types of interaction that can take place involving Molecule Types. Interaction Type represents those aspects that are common to all types of interaction. This includes one Reactant and one Product.
Molecule Type
Represents a type (species) of Molecule
Transformation
A Transformation is a kind of Interaction Type. It has interaction scheme A --> B. In a Transformation, a single Molecule transforms into a single product Molecule of a different Molecule_Type.

Explanation of Class Data Relationships

The Chemistry includes Molecule Types and Chemistry includes Interaction Types aggregation relationships indicate that the Chemistry object is the point of aggregation that holds together all of the Molecule Types and Interaction Types in the Chemistry. In the C++ implementation, the Chemistry object hold a List of Molecule Types and a List of Interaction Types.

The inheritance relationships between Chemistry and Construction, Fission and Transformation show that the latter three are different kinds of interaction derived from the Interaction Type base class.

The Molecule Type is reactant for Interaction Type relationship indicates that one Molecule Type can be a reactant for many different Interaction Types. In the C++ implementation, each Molecule Type maintains a List of Interaction Types for which it can be a reactant.

Similarly, the Molecule Type is product of Interaction Type relationship indicates that one Molecule Type can be a product of many different Interaction Types. In the C++ implementation, each Molecule Type object maintains a List of the Interaction Types of which it is a product.

The Molecule Type is reactant 1 for Interaction Type relationship indicates that each Interaction Type has a 'first' Reactant. In the C++ implementation, each Interaction Type object maintains a pointer to its Reactant 1 Molecule Type.

Similarly, the Molecule Type is product 1 of Interaction Type relationship indicates that each Interaction Type has a 'first' Product. In the C++ implementation, each Interaction Type object maintains a pointer to its Product 1 Molecule Type.

Each Construction has two Reactants. The Molecule Type is reactant 2 for Interaction Type relationship indicates that in addition to having a relationship with a 'first' Reactant, each Construction also has a relationship with a second reactant. In the C++ implementation, each Construction maintains a pointer to its Reactant 2 Molecule Type.

Similarly, each Fission has an is product 2 of relationship, and the C++ implementation maintains a pointer to the Product 2 Molecule Type.

Since a Transformation has only one Reactant and one Product, it needs no relationships beyond the ones it inherits from its base class (Interaction Type).

The Realised Molecule Type identifies realised Molecule Type relationship indicates that the Molecule Type has been realised. That is, at least one Molecule of the type currently exists, or has existed in the Reactor at some time during the model run. In the C++ implementation, the objects at both ends of the relationship each maintain a pointer to the other.

The Realisable Interaction Type can currently realise Interaction Type relationship indicates that the Interaction Type is currently realisable. That is, there are sufficient Reactant Molecules of the correct types currently in the Reactor for at least one interaction of the type to take place. In the C++ implementation, the objects at both ends of the relationship each maintain a pointer to the other.

The Realised Interaction Type identifies current or previous realisation of Interaction Type relationship indicates that the particular Interaction Type has been realised in the Reactor, regardless of whether or not it is currently realisable. In the C++ implementation, the the Realised Interaction Type object maintains a pointer to the Interaction Type object.