2.3 Getting Started with OEChem Molecules

For those of you who just picked up the OEChem manual for the first time and are looking for somewhere to get started, let us consider the the OEGraphMol. This is the molecule used in most example programs you will find in OEChem's example directories, or in the listings of this manual. An OEGraphMol is a concrete class which can be declared and used for most molecular functions in OEChem. An OEGraphMol contains atoms and bonds which can be accessed through iterators via the molecule API. Much of the OEGraphMol's API is defined by the OEMolBase abstract base-class. An OEGraphMol can be passed to any function which takes an OEMolBase argument. For efficiency, the OEGraphMol does not inherit from OEMolBase. This pattern will be discussed in more detail later in this manual. This is an over-simplistic view of the OEChem molecular hierarchy, but it provides a useful starting point for understanding and using OEChem.

Simplistic OEChem inheritance scheme:
                OEBase
                  |
                  |
                OEMolBase ---------------- OEGraphMol
<- indicates inheritance
-- indicates API correspondence without inheritance

While this distinction is more exposed in C++, since Python-OEChem is a wrapper around the C++ OEChem, library it is important to have some understanding of the underlying details.