void OECopyMol(OEMolBase &dst, const OEMolBase &src,
               OEAtomBase **atommap=0, OEBondBase **bondmap=0)
void OECopyMol(OEMCMolBase &dst, const OEMCMolBase &src,
               OEAtomBase **atommap=0, OEBondBase **bondmap=0)

Create a copy of the molecule src into the molecule dst. The mapping of the atoms and bonds between the two copies of the molecule can be retrieved by passing in arrays to the atommap and bondmap arguments. The size of the atommap array should be large enough to store src.GetMaxAtomIdx() atoms. The size of the bondmap array should be large enough to store src.GetMaxBondIdx() atoms. The new atom or bond in dst will be stored at the src atom or bond’s OEAtomBase.GetIdx location in the array.

The following code demonstrates how to access the atom associations output by the OECopyMol function.

package openeye.docexamples.oechem;

import java.util.*;
import openeye.oechem.*;

public class CopyMol {
    public static void main(String argv[]) {
        OEGraphMol src = new OEGraphMol(); 

        oechem.OESmilesToMol(src, "c1ccccc1");

        // make holes in the molecule index space and juggle things around

        OEAtomBasePtrArray atommap = new OEAtomBasePtrArray(src.GetMaxAtomIdx());
        OEGraphMol dst = new OEGraphMol();
        oechem.OECopyMol(dst, src, atommap);

        for (OEAtomBase srcatom : src.GetAtoms()) {
            OEAtomBase dstatom = atommap.getItem(srcatom.GetIdx());
            System.out.println(srcatom.GetIdx() + " -> " + dstatom.GetIdx());