Designing the FragmentedChemicalSystem Class

Note

At present the ChemicalSystem class is somewhat of a stub. When the design of the ChemicalSystem class evolves the design of the FragmentedChemicalSystem class will evolve too.

This page describes the design of the FragmentedChemicalSystem class.

Why Do We Need the FragmentedChemicalSystem Class?

Like the FragmentedNuclei and FragmentedMolecule classes, the need for the FragmentedChemicalSystem class was motivated by the chemical system hierarchy consideration raised in Designing the Fragmenting Component. In short, fragmenting a ChemicalSystem class requires us to fragment each layer of the hierarchy. The FragmentedChemicalSystem class is responsible for fragmenting the ChemicalSystem part.

FragmentedChemicalSystem Considerations

chemical system state

The FragmentedChemicalSystem class must act like it contains a series of ChemicalSystem objects. This requires it to hold a FragmentedMolecule and eventually a set of fields (fields are currently an experimental feature and this will need modified).

chemical system compatible

The fragments in a FragmentedChemicalSystem are expected to be usable wherever ChemicalSystem objects can be used.

FragmentedChemcialSystem APIs

To construct a FragmentedChemicalSystem:

// It's assumed that the user already has a ChemicalSystem object
ChemicalSystem chem_sys = make_a_chemical_system();

FragmentedChemicalSystem empty; // See FragmentedBase for more details
FragmentedChemicalSystem empty(chem_sys);

//If you already have a FragmentedMolecule
FragmentedMolecule frags = make_fragments();
FragmentedChemicalSystem has_frags(frags);

Some notes on the above:

  • make_a_chemical_system and make_fragments are opaque functions which respectively encapsulate the details of creating ChemicalSystem and FragmentedMolecule objects respectively. The details of these functions are irrelevant for the purposes of this discussion.

FragmentedChemicalSystem Design

../../../_images/fragmented_chemical_system.png

Fig. 14 State of the FragmentedChemicalSystem class and its relationship to related classes.

Fig. 14 shows the design of the FragmentedChemicalSystem class. At present the class is just a thin wrapper around a FragmentedMolecule object. Eventually we foresee the state expanding in accordance with the chemical system state consideration. To address the chemical system compatible consideration the fragments will be returned as ChemicalSystemView objects.

Summary

chemical system state

Right now FragmentedChemicalSystem is a thin wrapper around a FragmentedMolecule object. In the future it will need to be extended to fields.

chemical system compatible

Fragments in the FragmentedChemicalSystem class are returned as