6.6 Looping over the Conformers of a Molecule

Molecules with multi-conformers are represented by OEMCMolBase s in OEChem. OEMCMolBases derive from OEMolBase s and support atom and bond iterators, but they also support conformer iterators. The following code shows a rudimentary example of looping over conformers.

 1 #include "openeye.h"
 2 #include "oechem.h"
 3 #include <iostream>
 4
 5 using namespace OEChem;
 6 using namespace OESystem;
 7 using namespace std;
 8
 9 int main()
10 {
11   OEIter<OEMCMolBase> mol;
12   OEIter<OEConfBase> conf;
13   oemolistream ims;
14
15   for (mol=ims.GetMCMolBases(); mol; ++mol)
16   {
17     for(conf = mol->GetConfs(); conf; ++conf)
18     {
19       cerr << conf->GetTitle() << ": Energy = " << conf->GetEnergy() << endl;
20     }
21   }
22
23   return 0;
24 }

Listing:6.8 Looping over conformers of molecules