4.5 OEAddMols

bool OEAddMols(OEMolBase &lhs, const OEMolBase &rhs,
      	       OEAtomBase **aa = 0, OEBondBase *bb = 0)

bool OEAddMols(OEMolBase &lhs, const OEMolBase &rhs,
               const char *titleDelimiter,
	             OEAtomBase **aa = 0, OEBondBase *bb = 0)

OEAddMols is a function used to add the data from the rhs molecule to the lhs molecule. For historical reasons, there are two API points, the function call without a titleDelimiter argument uses "_" as the title delimiter. The function with a titleDelemiter concatenated the title of the rhs molecule onto the lhs molecules using the delimiter passed. The empty string (eg "") is a valid argument, and causes a direct concatenation of the two titles. If (char *)0 is passed as the arguement, no concatenation of titles occurs.

In both functions, there are two arguments with defaults of 0. These arguments can be used to obtain mappings between the atoms and bonds in the original rhs molecule and the newly created atoms and bonds in the lhs molecule. It is assumed that arguments passed to aa are arrays of atom pointers of at least rhs.GetMaxAtomIdx() in size and that arguments passed to bb are arrays of bond pointers of at leasts rhs.GetMaxBondIdx() in size. After the function has been called, for any atom rhsAtom from the rhs molecule, the corresponding new atom in the lhs molecule can be obtained by an atom index lookup into the array.

  OEAtomBase *rhsAtom, *lhsAtom;
  lhsAtom = atomMap[rhsAtom->GetIdx()];

where atomMap was passed as the aa argument to the OEAddMols function. Bond maps work in a similar manner.