OMEGA Examples¶
The following table lists the currently available Omega TK examples:
Program |
Description |
---|---|
generating conformers |
|
generating a single conformer |
|
generating densely sampled conformers |
|
generating stereoisomers |
|
torsion driving to generating conformer ensemble |
|
making fragment library |
|
generating macrocycle conformers |
|
generating single macrocycle conformer |
Note
If the input molecule has SD tag data, the data will be copied to every conformer in the results molecule.
Classic OEOmega Examples¶
Generating Conformers¶
The following code example is a simple example of how to generate conformers using the OEOmega object.
See also
OEOmegaOptions class
OEOmega class
OESimpleAppOptions class
Listing 1: Generating Conformers
/*
(C) 2022 Cadence Design Systems, Inc. (Cadence)
All rights reserved.
TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of Cadence products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. Cadence claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable Cadence offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall Cadence be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
#include <openeye.h>
#include <oeplatform.h>
#include <oesystem.h>
#include <oechem.h>
#include <oeomega2.h>
int main(int argc, char *argv[])
{
OEConfGen::OEOmegaOptions omegaOpts;
omegaOpts.SetParameterVisibility(OESystem::OEParamVisibility::Hidden);
omegaOpts.SetParameterVisibility("-rms", OESystem::OEParamVisibility::Simple);
omegaOpts.SetParameterVisibility("-ewindow", OESystem::OEParamVisibility::Simple);
omegaOpts.SetParameterVisibility("-maxconfs", OESystem::OEParamVisibility::Simple);
omegaOpts.SetParameterVisibility("-useGPU", OESystem::OEParamVisibility::Simple);
OEChem::OESimpleAppOptions opts(omegaOpts, "simple_omega", OEChem::OEFileStringType::Mol, OEChem::OEFileStringType::Mol3D);
if (OESystem::OEConfigureOpts(opts, argc, argv, false) == OESystem::OEOptsConfigureStatus::Help)
return 0;
omegaOpts.UpdateValues(opts);
OEConfGen::OEOmega omega(omegaOpts);
OEChem::oemolistream ifs;
if (!ifs.open(opts.GetInFile()))
OESystem::OEThrow.Fatal("Unable to open %s for reading", opts.GetInFile().c_str());
OEChem::oemolostream ofs;
if (!ofs.open(opts.GetOutFile()))
OESystem::OEThrow.Fatal("Unable to open %s for writing", opts.GetOutFile().c_str());
OEChem::OEMol mol;
while (OEChem::OEReadMolecule(ifs, mol))
{
OESystem::OEThrow.Info("Title: %s", mol.GetTitle());
unsigned retCode = omega.Build(mol);
if (retCode == OEConfGen::OEOmegaReturnCode::Success)
OEChem::OEWriteMolecule(ofs, mol);
else
OESystem::OEThrow.Warning("%s: %s", mol.GetTitle(), OEConfGen::OEGetOmegaError(retCode).c_str());
}
return 0;
}
Download code
Generating a Single Conformer¶
The following code example is a simple example of how to generate a single conformer.
See also
OEConformerBuilder class
Listing 2: Generating a Single Conformer
/*
(C) 2022 Cadence Design Systems, Inc. (Cadence)
All rights reserved.
TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of Cadence products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. Cadence claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable Cadence offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall Cadence be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
#include <openeye.h>
#include <oeplatform.h>
#include <oesystem.h>
#include <oechem.h>
#include <oeomega2.h>
int main(int argc, char *argv[])
{
if (argc != 3)
OESystem::OEThrow.Usage("%s <infile> <outfile>", argv[0]);
OEChem::oemolistream ifs;
if (!ifs.open(argv[1]))
OESystem::OEThrow.Fatal("Unable to open %s for reading", argv[1]);
OEChem::oemolostream ofs;
if (!ofs.open(argv[2]))
OESystem::OEThrow.Fatal("Unable to open %s for writing", argv[2]);
if (!OEChem::OEIs3DFormat(ofs.GetFormat()))
OESystem::OEThrow.Fatal("Invalid output file format for 3D coordinates!");
OEConfGen::OEConformerBuilder builder;
OEChem::OEMol mol;
while (OEChem::OEReadMolecule(ifs, mol))
{
OESystem::OEThrow.Info("Title: %s", mol.GetTitle());
unsigned retCode = builder.Build(mol);
if (retCode == OEConfGen::OEOmegaReturnCode::Success)
OEChem::OEWriteMolecule(ofs, mol);
else
OESystem::OEThrow.Warning("%s: %s", mol.GetTitle(), OEConfGen::OEGetOmegaError(retCode).c_str());
}
return 0;
}
Download code
Generating Densely Sampled Conformers¶
The following code example is a simple example of how to generate densely sampled conformers, as used in OEFreeFormConf calculations, using the OEOmega object.
See also
OEOmegaOptions class
OEOmega class
OEOmegaSampling
namespaceOESimpleAppOptions class
Listing 3: Generating Densely Sampled Conformers
/*
(C) 2022 Cadence Design Systems, Inc. (Cadence)
All rights reserved.
TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of Cadence products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. Cadence claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable Cadence offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall Cadence be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
#include <openeye.h>
#include <oeplatform.h>
#include <oesystem.h>
#include <oechem.h>
#include <oeomega2.h>
int main(int argc, char *argv[])
{
OEConfGen::OEOmegaOptions omegaOpts(OEConfGen::OEOmegaSampling::Dense);
omegaOpts.SetParameterVisibility(OESystem::OEParamVisibility::Hidden);
omegaOpts.SetParameterVisibility("-rms", OESystem::OEParamVisibility::Simple);
omegaOpts.SetParameterVisibility("-ewindow", OESystem::OEParamVisibility::Simple);
omegaOpts.SetParameterVisibility("-maxconfs", OESystem::OEParamVisibility::Simple);
omegaOpts.SetParameterVisibility("-useGPU", OESystem::OEParamVisibility::Simple);
omegaOpts.SetParameterVisibility("-searchFF", OESystem::OEParamVisibility::Simple);
OEChem::OESimpleAppOptions opts(omegaOpts, "dense_omega", OEChem::OEFileStringType::Mol, OEChem::OEFileStringType::Mol3D);
if (OESystem::OEConfigureOpts(opts, argc, argv, false) == OESystem::OEOptsConfigureStatus::Help)
return 0;
omegaOpts.UpdateValues(opts);
OEConfGen::OEOmega omega(omegaOpts);
OEChem::oemolistream ifs;
if (!ifs.open(opts.GetInFile()))
OESystem::OEThrow.Fatal("Unable to open %s for reading", opts.GetInFile().c_str());
OEChem::oemolostream ofs;
if (!ofs.open(opts.GetOutFile()))
OESystem::OEThrow.Fatal("Unable to open %s for writing", opts.GetOutFile().c_str());
OEChem::OEMol mol;
while (OEChem::OEReadMolecule(ifs, mol))
{
OESystem::OEThrow.Info("Title: %s", mol.GetTitle());
unsigned retCode = omega.Build(mol);
if (retCode == OEConfGen::OEOmegaReturnCode::Success)
OEChem::OEWriteMolecule(ofs, mol);
else
OESystem::OEThrow.Warning("%s: %s", mol.GetTitle(), OEConfGen::OEGetOmegaError(retCode).c_str());
}
return 0;
}
Download code
Flipper Examples¶
Generating Stereoisomers¶
The following code example is a simple example of how to use the OEFlipper function to generate stereoisomers. The code example also demonstrates that stereoisomers should be generated before generating conformers.
See also
OEOmegaOptions class
OEOmega class
OEFlipper function
OESimpleAppOptions class
Listing 4: Generating Stereoisomers
/*
(C) 2022 Cadence Design Systems, Inc. (Cadence)
All rights reserved.
TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of Cadence products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. Cadence claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable Cadence offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall Cadence be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
#include <openeye.h>
#include <oeplatform.h>
#include <oesystem.h>
#include <oechem.h>
#include <oeomega2.h>
int main(int argc, char *argv[])
{
OEConfGen::OEFlipperOptions flipperOpts;
OEChem::OESimpleAppOptions opts(flipperOpts, "setereo_and_torsion", OEChem::OEFileStringType::Mol, OEChem::OEFileStringType::Mol);
if (OESystem::OEConfigureOpts(opts, argc, argv, false) == OESystem::OEOptsConfigureStatus::Help)
return 0;
flipperOpts.UpdateValues(opts);
OEConfGen::OEOmega omega;
OEChem::oemolistream ifs;
if (!ifs.open(opts.GetInFile()))
OESystem::OEThrow.Fatal("Unable to open %s for reading", opts.GetInFile().c_str());
OEChem::oemolostream ofs;
if (!ofs.open(opts.GetOutFile()))
OESystem::OEThrow.Fatal("Unable to open %s for writing", opts.GetOutFile().c_str());
OEChem::OEMol mol;
while (OEChem::OEReadMolecule(ifs, mol))
{
OESystem::OEThrow.Info("Title: %s", mol.GetTitle());
OESystem::OEIter<OEChem::OEMolBase> stereo = OEConfGen::OEFlipper(*mol.GetActive(), flipperOpts);
for ( ; stereo; ++stereo)
{
OEChem::OEMol fmol = *stereo;
unsigned retCode = omega.Build(fmol);
if (retCode == OEConfGen::OEOmegaReturnCode::Success)
OEChem::OEWriteMolecule(ofs, fmol);
else
OESystem::OEThrow.Warning("%s: %s", fmol.GetTitle(), OEConfGen::OEGetOmegaError(retCode).c_str());
}
}
return 0;
}
Download code
Generating Torsion Driven Conformation Examples¶
Torsion Driving to Generating Conformer Ensemble¶
The following code example is a simple example of how to torsion drive from given 3D structure, to generate a conformer ensemble.
See also
OETorDriveOptions class
OETorDriver class
OESimpleAppOptions class
Listing 5: Torsion Driving to Generating Conformer Ensemble
/*
(C) 2022 Cadence Design Systems, Inc. (Cadence)
All rights reserved.
TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of Cadence products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. Cadence claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable Cadence offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall Cadence be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
#include <openeye.h>
#include <oeplatform.h>
#include <oesystem.h>
#include <oechem.h>
#include <oeomega2.h>
int main(int argc, char *argv[])
{
OEConfGen::OETorDriveOptions torOpts;
torOpts.SetParameterVisibility(OESystem::OEParamVisibility::Hidden);
torOpts.SetParameterVisibility("-rms", OESystem::OEParamVisibility::Simple);
torOpts.SetParameterVisibility("-ewindow", OESystem::OEParamVisibility::Simple);
torOpts.SetParameterVisibility("-maxconfs", OESystem::OEParamVisibility::Simple);
OEChem::OESimpleAppOptions opts(torOpts, "torsion_drive", OEChem::OEFileStringType::Mol, OEChem::OEFileStringType::Mol3D);
if (OESystem::OEConfigureOpts(opts, argc, argv, false) == OESystem::OEOptsConfigureStatus::Help)
return 0;
torOpts.UpdateValues(opts);
OEConfGen::OETorDriver tordriver(torOpts);
OEChem::oemolistream ifs;
if (!ifs.open(opts.GetInFile()))
OESystem::OEThrow.Fatal("Unable to open %s for reading", opts.GetInFile().c_str());
OEChem::oemolostream ofs;
if (!ofs.open(opts.GetOutFile()))
OESystem::OEThrow.Fatal("Unable to open %s for writing", opts.GetOutFile().c_str());
OEChem::OEMol mol;
while (OEChem::OEReadMolecule(ifs, mol))
{
OESystem::OEThrow.Info("Title: %s", mol.GetTitle());
unsigned retCode = tordriver.GenerateConfs(mol);
if (retCode == OEConfGen::OEOmegaReturnCode::Success)
OEChem::OEWriteMolecule(ofs, mol);
else
OESystem::OEThrow.Warning("%s: %s", mol.GetTitle(), OEConfGen::OEGetOmegaError(retCode).c_str());
}
return 0;
}
Download code
Fragment Library generation Examples¶
Making Fragment Library¶
The following code example is a simple example of how to generate a fragment library.
See also
OEFragBuilderOptions class
OEMakeFragLib class
OESimpleAppOptions class
Listing 6: Making Fragment Library
/*
(C) 2022 Cadence Design Systems, Inc. (Cadence)
All rights reserved.
TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of Cadence products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. Cadence claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable Cadence offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall Cadence be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
#include <openeye.h>
#include <oeplatform.h>
#include <oesystem.h>
#include <oechem.h>
#include <oeomega2.h>
int main(int argc, char *argv[])
{
OEConfGen::OEFragBuilderOptions libOpts;
libOpts.SetParameterVisibility(OESystem::OEParamVisibility::Hidden);
libOpts.SetParameterVisibility("-buildFF", OESystem::OEParamVisibility::Simple);
OEChem::OESimpleAppOptions opts(libOpts, "make_fraglib", OEChem::OEFileStringType::Mol, OEChem::OEFileStringType::Mol3D);
if (OESystem::OEConfigureOpts(opts, argc, argv, false) == OESystem::OEOptsConfigureStatus::Help)
return 0;
libOpts.UpdateValues(opts);
OEConfGen::OEMakeFragLib makefraglib(libOpts);
OEChem::oemolistream ifs;
if (!ifs.open(opts.GetInFile()))
OESystem::OEThrow.Fatal("Unable to open %s for reading", opts.GetInFile().c_str());
OEChem::oemolostream ofs;
if (!ofs.open(opts.GetOutFile()))
OESystem::OEThrow.Fatal("Unable to open %s for writing", opts.GetOutFile().c_str());
if (ofs.GetFormat() != OEChem::OEFormat::OEB)
OESystem::OEThrow.Fatal("Output file has to have OEB format!");
makefraglib.ClearFragLibs();
makefraglib.GenerateMissingFrags(ifs, ofs);
return 0;
}
Download code
Macrocycle Examples¶
Generating Macrocycle Conformers¶
The following code example is a simple example of how to generate conformers using the OEMacrocycleOmega object.
See also
OEMacrocycleOmegaOptions class
OEMacrocycleOmega class
OESimpleAppOptions class
Listing 7: Generating Macrocycle Conformers
/*
(C) 2022 Cadence Design Systems, Inc. (Cadence)
All rights reserved.
TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of Cadence products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. Cadence claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable Cadence offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall Cadence be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
#include <openeye.h>
#include <oeplatform.h>
#include <oesystem.h>
#include <oechem.h>
#include <oeomega2.h>
int main(int argc, char *argv[])
{
OEConfGen::OEMacrocycleOmegaOptions omegaOpts;
omegaOpts.SetParameterVisibility(OESystem::OEParamVisibility::Hidden);
omegaOpts.SetParameterVisibility("-rms", OESystem::OEParamVisibility::Simple);
omegaOpts.SetParameterVisibility("-ewindow", OESystem::OEParamVisibility::Simple);
omegaOpts.SetParameterVisibility("-maxconfs", OESystem::OEParamVisibility::Simple);
OEChem::OESimpleAppOptions opts(omegaOpts, "macrocycle", OEChem::OEFileStringType::Mol, OEChem::OEFileStringType::Mol3D);
if (OESystem::OEConfigureOpts(opts, argc, argv, false) == OESystem::OEOptsConfigureStatus::Help)
return 0;
omegaOpts.UpdateValues(opts);
OEConfGen::OEMacrocycleOmega mcomega(omegaOpts);
OEChem::oemolistream ifs;
if (!ifs.open(opts.GetInFile()))
OESystem::OEThrow.Fatal("Unable to open %s for reading", opts.GetInFile().c_str());
OEChem::oemolostream ofs;
if (!ofs.open(opts.GetOutFile()))
OESystem::OEThrow.Fatal("Unable to open %s for writing", opts.GetOutFile().c_str());
OEChem::OEMol mol;
while (OEChem::OEReadMolecule(ifs, mol))
{
OESystem::OEThrow.Info("Title: %s", mol.GetTitle());
unsigned retCode = mcomega.Build(mol);
if (retCode == OEConfGen::OEOmegaReturnCode::Success)
OEChem::OEWriteMolecule(ofs, mol);
else
OESystem::OEThrow.Warning("%s: %s", mol.GetTitle(), OEConfGen::OEGetOmegaError(retCode).c_str());
}
return 0;
}
Download code
Generating a Single Macrocycle Conformer¶
The following code example is a simple example of how to generate a single macrocycle conformer using the OEMacrocycleBuilder object.
See also
OEMacrocycleBuilder class
OESimpleAppOptions class
Listing 8: Generating a Single Macrocycle Conformer
/*
(C) 2022 Cadence Design Systems, Inc. (Cadence)
All rights reserved.
TERMS FOR USE OF SAMPLE CODE The software below ("Sample Code") is
provided to current licensees or subscribers of Cadence products or
SaaS offerings (each a "Customer").
Customer is hereby permitted to use, copy, and modify the Sample Code,
subject to these terms. Cadence claims no rights to Customer's
modifications. Modification of Sample Code is at Customer's sole and
exclusive risk. Sample Code may require Customer to have a then
current license or subscription to the applicable Cadence offering.
THE SAMPLE CODE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED. OPENEYE DISCLAIMS ALL WARRANTIES, INCLUDING, BUT
NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. In no event shall Cadence be
liable for any damages or liability in connection with the Sample Code
or its use.
*/
#include <openeye.h>
#include <oeplatform.h>
#include <oesystem.h>
#include <oechem.h>
#include <oeomega2.h>
int main(int argc, char *argv[])
{
OEConfGen::OEMacrocycleBuilderOptions buildOpts;
buildOpts.SetParameterVisibility(OESystem::OEParamVisibility::Hidden);
buildOpts.SetParameterVisibility("-seed", OESystem::OEParamVisibility::Simple);
buildOpts.SetParameterVisibility("-dielectric_constant", OESystem::OEParamVisibility::Simple);
OEChem::OESimpleAppOptions opts(buildOpts, "MacrocycleBuilder", OEChem::OEFileStringType::Mol, OEChem::OEFileStringType::Mol3D);
if (OESystem::OEConfigureOpts(opts, argc, argv, false) == OESystem::OEOptsConfigureStatus::Help)
return 0;
buildOpts.UpdateValues(opts);
OEChem::oemolistream ifs;
if (!ifs.open(opts.GetInFile()))
OESystem::OEThrow.Fatal("Unable to open %s for reading", opts.GetInFile().c_str());
OEChem::oemolostream ofs;
if (!ofs.open(opts.GetOutFile()))
OESystem::OEThrow.Fatal("Unable to open %s for writing", opts.GetOutFile().c_str());
OEChem::OEMol mol;
while (OEChem::OEReadMolecule(ifs, mol))
{
OESystem::OEThrow.Info("Title: %s", mol.GetTitle());
unsigned retCode = OEConfGen::OEOmegaReturnCode::Failed;
unsigned int itlimit = 1000, itnum = 0;
while(itnum <= itlimit)
{
OEConfGen::OEMacrocycleBuilder builder(buildOpts);
retCode = builder.Build(mol);
if(retCode == OEConfGen::OEOmegaReturnCode::Success)
{
OEChem::OEWriteMolecule(ofs, mol);
break;
}
else
{
buildOpts.SetRandomSeed(buildOpts.GetRandomSeed()+1);
}
++itnum;
}
if(retCode != OEConfGen::OEOmegaReturnCode::Success)
OESystem::OEThrow.Warning("%s: %s", mol.GetTitle(), OEConfGen::OEGetOmegaError(retCode).c_str());
}
return 0;
}
Download code