Molecule Builder Functions

The functions detailed in this section provide the ability to create new molecules from basic inputs and to modify existing ones.

AtomAddHydrogens

void AtomAddHydrogens(const OEPropDB::OEKey &k, bool polaronly=false)

Adds explicit hydrogens to the specified atom. If polaronly is set to True, this will only add polar hydrogens to the specified atom.

AtomAddHydrogensScoped

void AtomAddHydrogensScoped(bool polaronly=false,
                            unsigned int scope = SelectedScope)

Scoped version of .

AtomAtomicNumDefaultGet

unsigned int AtomAtomicNumDefaultGet()

Returns the default value of the atomic number to be used when setting the atomic number of an atom via a mouse action.

AtomAtomicNumDefaultSet

void AtomAtomicNumDefaultSet(unsigned int)

Sets the default value of the atomic number to be used when setting the atomic number of an atom via a mouse action.

AtomAtomicNumGet

unsigned int AtomAtomicNumGet(const OEPropDB::OEKey &k)

Returns the atomic number of the specified atom.

AtomAtomicNumSet

void AtomAtomicNumSet(const OEPropDB::OEKey &k, unsigned int an)

Sets the atomic number of the specific atom.

AtomAtomicNumSetScoped

void AtomAtomicNumSetScoped(unsigned int an,
                            unsigned int scope = SelectedScope)

Scoped version of .

AtomAttach

void AtomAttach(const OEPropDB::OEKey &k, const std::string &oeb)
void AtomAttach(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2)
void AtomAttach(const OEPropDB::OEKey &k, const std::string &smiles, int attach)

Attaches the specified molecule fragment to the specified atom. There are three different implementations of this function which allow for different specifications of the fragment. The atom being attached to, is always the first parameter. The attachment is performed by the creation of a single bond.

The first implementation takes a hexadecimal encoding of a molecule specified in OEB format. This implementation is primarily intended for internal use.

The second implementation takes an OEKey parameter specifying an atom on an already loaded fragment to which the attachment will occur.

The third implementation takes a SMILES string representing the fragment to be attached as well as an index specifying which atom in that fragment will be the attachment point.

AtomDelete

void AtomDelete(const OEPropDB::OEKey &k)

Deletes the specified atom as well as any attached hydrogens.

AtomDeleteHydrogens

void AtomDeleteHydrogens(const OEPropDB::OEKey &k)

Deletes all of the hydrogens attached to the specified atom.

AtomDeleteHydrogensScoped

void AtomDeleteHydrogensScoped(bool nonpolar=false,
                               unsigned int scope = SelectedScope)

Scoped version of .

AtomDeleteScoped

void AtomDeleteScoped(unsigned int scope = SelectedScope)

Scoped version of .

AtomFormalChargeDefaultGet

int AtomFormalChargeDefaultGet()

Returns the default value of the formal to be used when setting the formal of an atom via a mouse action.

AtomFormalChargeDefaultSet

void AtomFormalChargeDefaultSet(int)

Sets the default value of the formal to be used when setting the formal of an atom via a mouse action.

AtomFormalChargeGet

int AtomFormalChargeGet(const OEPropDB::OEKey &k)

Returns the formal charge for the specified atom.

AtomFormalChargeModify

void AtomFormalChargeModify(const OEPropDB::OEKey &k, int delta)

Modifies the formal charge on the specified atom by the specified delta value. The delta value can be either positive or negative.

AtomFormalChargeModifyScoped

void AtomFormalChargeModifyScoped(int delta,
                                  unsigned int scope = SelectedScope)

Scoped version of .

AtomFormalChargeSet

void AtomFormalChargeSet(const OEPropDB::OEKey &k, int chg)

Sets the formal charge on the specified atom.

AtomFormalChargeSetScoped

void AtomFormalChargeSetScoped(int chg,
                               unsigned int scope = SelectedScope)

Scoped version of .

AtomFuse

void AtomFuse(const OEPropDB::OEKey &k, const std::string &oeb)
void AtomFuse(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2)
void AtomFuse(const OEPropDB::OEKey &k, const std::string &smiles, int attach)

Fuses the specified molecule fragment to the specified atom. There are three different implementations of this function which allow for different specifications of the fragment. The atom being fused to is always the first parameter.

The first implementation takes a hexadecimal encoding of a molecule specified in OEB format. This implementation is primarily intended for internal use.

The second implementation takes an OEKey parameter specifying an atom on an already loaded fragment where the fusion will occur.

The third implementation takes a SMILES string representing the fragment to be fused as well as an index specifying which atom in that fragment will be the site of the fusion.

AtomHybridizationGet

unsigned int AtomHybridizationGet(const OEPropDB::OEKey &k)

Returns the hybridization state of the specified atom.

AtomHybridizationSet

void AtomHybridizationSet(const OEPropDB::OEKey &k, unsigned int hyb)

Sets the hybridization state of the specified atom.

AtomHybridizationSetScoped

void AtomHybridizationSetScoped(unsigned int hyb,
                                unsigned int scope = SelectedScope)

Scoped version of .

AtomIsotopeGet

unsigned int AtomIsotopeGet(const OEPropDB::OEKey &k)

Returns the isotope of the specified atom.

AtomIsotopeSet

void AtomIsotopeSet(const OEPropDB::OEKey &k, unsigned int iso)

Sets the isotope for the specified atom.

AtomIsotopeSetScoped

void AtomIsotopeSetScoped(unsigned int iso,
                          unsigned int scope = SelectedScope)

Scoped version of .

AtomSprout

void AtomSprout(const OEPropDB::OEKey &k, unsigned int elem=6,
                unsigned int order=1)

Sprouts a new atom off of the specified atom. The atomic number of the new atom is specified by elem and the order of the bond to the new atom is specified by the order parameter.

AtomSproutScoped

void AtomSproutScoped(unsigned int elem=6, unsigned int order=1,
                      unsigned int scope = SelectedScope)

Scoped version of .

AtomStereoDefaultGet

std::string AtomStereoDefaultGet()

Returns the default value for the stereochemistry setting to be used when setting the stereochemistry via a mouse action. Allowed values include:

  • “R”
  • “S”
  • “Invert”

AtomStereoDefaultSet

void AtomStereoDefaultSet(const std::string &s)

Sets the default value for the stereochemistry setting to be used when setting the stereochemistry via a mouse action. Allowed values include:

  • “R”
  • “S”
  • “Invert”

AtomStereoSet

void AtomStereoSet(const OEPropDB::OEKey &k, const std::string &s)

Sets the CIP stereochemistry of the specified atom. Allowed values are “R” and “S”.

AtomStereoSetScoped

void AtomStereoSetScoped(const std::string &s,
                         unsigned int scope = SelectedScope)

Scoped version of .

AtomStereoToggle

void AtomStereoToggle(const OEPropDB::OEKey &k)

Toggles the stereochemistry of the specified atom.

AtomStereoToggleScoped

void AtomStereoToggleScoped(unsigned int scope = SelectedScope)

Scoped version of: .

BondAngleGet

double BondAngleGet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2)
double BondAngleGet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                    const OEPropDB::OEKey &k3)

Returns the angle between the two specified bonds or the three specified atoms.

BondAngleModify

void BondAngleModify(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                     double angle, unsigned int rmode)
void BondAngleModify(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                     const OEPropDB::OEKey &k3, double ang, unsigned int rmode)

Modifies the angle between the two specified bonds or the three specified atoms. The amount by which the angle is adjusted is specified by the angle parameter. The portion of the molecule which is actually moved in this process is specified by the rmode parameter:

  • 0 - the smaller portion of the molecule will be moved
  • 1 - the larger portion of the molecule will be moved

BondAngleSet

void BondAngleSet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                  double angle, unsigned int rmode)
void BondAngleSet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                  const OEPropDB::OEKey &k3, double ang, unsigned int rmode)

Sets the angle between the two specified bonds or the three specified atoms. The desired angle is specified by the angle parameter. The portion of the molecule which is actually moved in this process is specified by the rmode parameter:

  • 0 - the smaller portion of the molecule will be moved
  • 1 - the larger portion of the molecule will be moved

BondCreate

void BondCreate(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                unsigned int order=1, double length=0.0)

Creates a new bond between the two specified atoms with an order and length specified by the two eponymous parameters.

BondDelete

void BondDelete(const OEPropDB::OEKey &k)

Deletes the specified bond.

BondDeleteScoped

void BondDeleteScoped(unsigned int scope = SelectedScope)

Scoped version of .

BondFuse

void BondFuse(const OEPropDB::OEKey &b, const std::string &oeb)
void BondFuse(const OEPropDB::OEKey &b1, const OEPropDB::OEKey &b2)
void BondFuse(const OEPropDB::OEKey &b, const OEPropDB::OEKey &e,
              const std::string &oeb)
void BondFuse(const OEPropDB::OEKey &b, const std::string &smiles, int battach,
              int eattach)
void BondFuse(const OEPropDB::OEKey &b1, const OEPropDB::OEKey &e1,
              const OEPropDB::OEKey &b2, const OEPropDB::OEKey &e2)
void BondFuse(const OEPropDB::OEKey &beg, const OEPropDB::OEKey &end,
              const std::string &smiles, int battach, int eattach)

Fuses two bonds together. There are multiple implementations of this function which allow for different mechanisms of specifying the source bond as well as the target bond (and associated fragment). The source bond can be specified using a distinct bond key or by specifying the keys of the beginning and end atoms of that bond. The target bond can also be specified using a distinct bond key or by two keys representing the beginning and end atoms of the bond. However, the target bond can also be set as part of a specified fragment.

One implementation allows for specification of a hexadecimal encoded OEB string representing the molecule fragment and selected target bond. This method is primarily intended for internal use.

The other mechanism allows for specification of the fragment as a SMILES string associated with an index for the beginning and end atoms defining the bond.

BondLengthGet

double BondLengthGet(const OEPropDB::OEKey &k)
double BondLengthGet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2)

Returns the length of the specified bond. The bond can be specified using either a bond key or two atom keys corresponding to the endpoints of the bond.

BondLengthModify

void BondLengthModify(const OEPropDB::OEKey &k, double len, unsigned int rmode)
void BondLengthModify(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                      double length, unsigned int rmode)

Modifies the length of the specified bond by the amount specified in the len parameter. The bond can be specified using either a bond key or two atom keys corresponding to the endpoints of the bond. The portion of the molecule which is actually moved is determined by the rmode parameter. Available values include:

  • 0 - the smaller portion of the molecule is moved
  • 1 - the larger portion of the molecule is moved

BondLengthSet

void BondLengthSet(const OEPropDB::OEKey &k, double len, unsigned int rmode)
void BondLengthSet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                   double length, unsigned int rmode)

Sets the length of the specified bond to the value specified in the len parameter. The bond can be specified using either a bond key or two atom keys corresponding to the endpoints of the bond. The portion of the molecule which is actually moved is determined by the rmode parameter. Available values include:

  • 0 - the smaller portion of the molecule is moved
  • 1 - the larger portion of the molecule is moved

BondLengthSetScoped

void BondLengthSetScoped(double length,
                         unsigned int rmode=OEForge::RotateMode::Smaller,
                         unsigned int scope = SelectedScope)

Scoped version of .

BondOrderDefaultGet

unsigned int BondOrderDefaultGet()

Returns the default value of the bond order used when setting the order of a bond through a mouse action.

BondOrderDefaultSet

void BondOrderDefaultSet(unsigned int)

Sets the default value of the bond order used when setting the order of a bond through a mouse action.

BondOrderGet

unsigned int BondOrderGet(const OEPropDB::OEKey &k)
unsigned int BondOrderGet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2)

Returns the order of the specified bond. The bond can be specified as a distinct bond key or two keys corresponding to the endpoint atoms.

BondOrderSet

void BondOrderSet(const OEPropDB::OEKey &k, unsigned int order)
void BondOrderSet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                  unsigned int order)

Sets the order of the specified bond. The bond can be specified as a distinct bond key or two keys corresponding to the endpoint atoms.

BondOrderSetScoped

void BondOrderSetScoped(unsigned int order, unsigned int scope)

Scoped version of .

BondStereoDefaultGet

std::string BondStereoDefaultGet()

Returns the default value for bond stereochemistry setting to be used when setting the stereochemistry via a mouse action. Allowed values include:

  • “E”
  • “Z”
  • “Invert”

BondStereoDefaultSet

void BondStereoDefaultSet(const std::string &)

Sets the default value for bond stereochemistry setting to be used when setting the stereochemistry via a mouse action. Allowed values include:

  • “E”
  • “Z”
  • “Invert”

BondStereoSet

void BondStereoSet(const OEPropDB::OEKey &k, const std::string &s)
void BondStereoSet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                   const std::string &s)

Sets the CIP stereochemistry for the specified bond. The bond can be specified as a distinct bond key or by two atom keys corresponding to the endpoint atoms. Allowed values for stereochemistry include:

  • “E”
  • “Z”

BondStereoSetScoped

void BondStereoSetScoped(const std::string &s,
                         unsigned int scope = SelectedScope)

Scoped version of .

BondStereoToggle

void BondStereoToggle(const OEPropDB::OEKey &k)
void BondStereoToggle(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2)

Toggles the stereochemistry for the specified bond. The bond can be specified as a distinct bond key or by two atom keys corresponding to the endpoint atoms.

BondStereoToggleScoped

void BondStereoToggleScoped(unsigned int scope = SelectedScope)

Scoped version of .

BondTorsionGet

double BondTorsionGet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                      const OEPropDB::OEKey &k3)
double BondTorsionGet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                      const OEPropDB::OEKey &k3, const OEPropDB::OEKey &k4)

Returns the torsion (dihedral) angle specified by either three bonds or four atoms. The order of specification is important in the determination of the angle.

BondTorsionModify

void BondTorsionModify(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                       const OEPropDB::OEKey &k3, double t, unsigned int rmode)
void BondTorsionModify(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                       const OEPropDB::OEKey &k3, const OEPropDB::OEKey &k4,
                       double torsion, unsigned int rmode)

Modifies the torsion (dihedral) angle specified by either three bonds or four atoms. The amount the angle is modified by is specified by the torsion parameter. The portion of the molecule which is moved by this function is specified by the rmode parameter. Available values include:

  • 0 - the smaller portion of the molecule moves
  • 1 - the larger portion of the molecule moves

BondTorsionSet

void BondTorsionSet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                    const OEPropDB::OEKey &k3, double t, unsigned int rmode)
void BondTorsionSet(const OEPropDB::OEKey &k1, const OEPropDB::OEKey &k2,
                    const OEPropDB::OEKey &k3, const OEPropDB::OEKey &k4,
                    double torsion, unsigned int rmode)

Sets the torsion (dihedral) angle specified by either three bonds or four atoms. The desired angle is specified by the torsion parameter. The portion of the molecule which is moved by this function is specified by the rmode parameter. Available values include:

  • 0 - the smaller portion of the molecule moves
  • 1 - the larger portion of the molecule moves

BuilderActiveGet

bool BuilderActiveGet()

Returns whether or not VIDA is in molecule editing mode.

BuilderActiveSet

void BuilderActiveSet(bool)

Sets whether or not VIDA is in molecule editing mode.

BuilderAlternateConfModeGet

bool BuilderAlternateConfModeGet()

Returns whether or not VIDA is in ring alternate conformation exploration mode.

BuilderAlternateConfModeSet

void BuilderAlternateConfModeSet(bool)

Sets whether or not VIDA is in ring alternate conformation exploration mode.

BuilderAlternateConfSet

void BuilderAlternateConfSet(unsigned int)

Applies the specified alternate ring conformation to the molecule currently being edited. This is intended for internal use only.

BuilderCancel

void BuilderCancel()

Cancels all modifications made to the molecule currently being edited and exits editing mode.

BuilderEdit

void BuilderEdit(const OEPropDB::OEKey &, bool force3D)

Puts VIDA into editing mode for the specified molecule. If the molecule is a 2D molecule, setting the force3D parameter to True will ensure that 3D coordinates will be generated, even if the user cancels out of editing mode.

BuilderFinish

void BuilderFinish()

Commits all modifications made to the molecule currently being edited and exits editing mode.

BuilderFragmentGet

std::string BuilderFragmentGet()

Returns a hexadecimal encoded OEB string representation of the current fragment being used in the builder component.

BuilderFragmentSet

void BuilderFragmentSet(const std::string &oeb)
void BuilderFragmentSet(const std::string &smiles, int)

Sets the default fragment to be used in mouse actions in the builder. The first implementation takes a hexadecimal encoded OEB string representation of the molecule fragment (this is primarily intended for internal use). The second implementation takes a SMILES string with an additional index parameter which specifies the index of the atom to be used as the attachment point.

BuilderMinimize

void BuilderMinimize()

Minimizes the molecule currently being edited using the MMFF forcefield.

BuilderMinimizeScoped

void BuilderMinimizeScoped(unsigned int scope = SelectedScope)

Minimizes a portion of the molecule currently being edited as determined by the atoms in the specified scope. Valid values for the scope parameter are:

  • MarkedScope
  • SelectedScope
  • ScratchScope

BuilderPropertiesGet

std::vector<string> BuilderPropertiesGet()

Returns a list of the properties displayed in the Property table of the Builder window.

BuilderPropertyAdd

void BuilderPropertyAdd(const std::string &name, const std::string &command, unsigned int flags = CalculateForSmallMols)

Adds a user-defined property calculator to the Properties table of the Builder window. The name parameter is the name of the property to be calculated. The command parameter is a string containing a Python command to be executed to calculate the property. The return value of the command is displayed in the property table. The flags parameter specifies what types of molecules the property will be calculated for, and whether a change to a molecule’s coordinates requires the property to be recalculated. Valid values for this parameter are:

  • UpdateOnCoordChange
  • CalculateForSmallMols
  • CalculateForProteins

These values can be OR’ed together to be used in combinations. The property is always recalculated when the chemical graph of the active molecule changes.

To add one of VIDA’s default properties (e.g., ‘LogP’) to the property table, use its name and leave the command string empty.

BuilderPropertyRemove

void BuilderPropertyRemove(const std::string &propertyToRemove)

Removes a property from the Property table of the Builder window.

BuilderPropertySetValue

void BuilderPropertySetValue(const std::string &propertyName, const std::string &value)

Directly sets a value in the Property table of the Builder window. The value will be overwritten when the property is updated.

BuilderTorsionActivate

void BuilderTorsionActivate(const OEPropDB::OEKey &key)

Activates an existing torsion monitor, specified by key, so that it can be rotated interactively while in Editing mode. Activating a torsion will temporarily display two torsion measurements, one for each end of the bond. When one of these measurements is selected, the corresponding end of the molecule will be moved when the mouse wheel or up/down arrows are used. If this command is used outside of Editing mode, the double measurements will be displayed but will not be activated.

BuilderTorsionsDeactivate

void BuilderTorsionsDeactivate()

Returns all active torsion monitors to their inactive state.

BuilderUseMMFF94sSet

void BuilderUseMMFF94sSet(bool useMMFF94s)

Causes the builder geometry optimizations to use the MMFF94s force field, which provides more nearly planar geometries for delocalized trigonal nitrogens than the MMFF94 force field. Calling this function with useMMFF94s = False will cause the builder to revert to using MMFF94.

BuilderUseMMFF94sGet

bool BuilderUseMMFF94sGet()

Returns True if the builder is currently set to use the MMFF94s force field, or False if the builder is using the MMFF94 force field.

MoleculeAddExplicitHydrogens

void MoleculeAddExplicitHydrogens(const OEPropDB::OEKey &k,
                                  bool polarOnly=false)

Adds explicit hydrogens to the specified molecule. If the polarOnly parameter is specified, only polar hydrogens will be added.

MoleculeAddHydrogens

void MoleculeAddHydrogens(const OEPropDB::OEKey &k, bool polarOnly=false)

This function adds hydrogens to the molecule associated with the specified key. If the polarOnly parameter is set, only polar hydrogens will be added.

MoleculeAddHydrogensScoped

void MoleculeAddHydrogensScoped(bool polarOnly=false,
                                unsigned int scope = BestScope)

This function adds hydrogens to the molecules int the specified scope. If the polarOnly parameter is set, only polar hydrogens will be added.

MoleculeDeleteHydrogens

void MoleculeDeleteHydrogens(const OEPropDB::OEKey &k, bool nonpolar=false)

Deletes hydrogens off of the specified molecule. If the nonpolar parameter is True, it will only delete non-polar hydrogens, leaving the molecule with only polar hydrogens still attached.

MoleculeGenerateCoords

void MoleculeGenerateCoords(const OEPropDB::OEKey &k,
                            unsigned int maxconfs=1,
                            bool strict=false)

Generates new coordinates for the specified molecule. The maximum number of conformations can be specified using the maxconfs parameter. Strict stereo can be turn on using the strict parameter.

MoleculeGenerateCoordsFixed

void MoleculeGenerateCoordsFixed(const OEPropDB::OEKey &k,
                                 const std::vector<OEPropDB::OEKey> &fixed,
                                 bool match=true, unsigned int maxconfs=1,
                                 bool strict=false)

Generates new coordinates for the specified molecule while holding fixed either the specified atoms (if the match parameter is True) or all the unspecified atoms (if the match parameter is False). The maximum number of conformations can be specified use the maxconfs parameter. Strict stereo can be turn on using the strict parameter.

MoleculeGenerateCoordsFixedScoped

void MoleculeGenerateCoordsFixedScoped(const OEPropDB::OEKey &k,
                                       bool match=true, unsigned int maxconfs=1,
                                       unsigned int scope = SelectedScope,
                                       bool strict)

Generates new coordinates for the specified molecule while holding fixed either all the atoms in the specified scope (if the match parameter is True) or all the atoms not in specified scope (if the match parameter is False). The maximum number of conformations can be specified use the maxconfs parameter. Strict stereo can be turn on using the strict parameter.

MoleculeNew

OEPropDB::OEKey MoleculeNew(const std::string &text, unsigned int listid=0)

Creates a new molecule from the specified text representation. Allowed text representations include SMILES as well as IUPAC and common names. A FASTA sequence can also be specified if preceded by an angle bracket character (‘>’).

Assuming that the molecule can be created from the specified text, it will be added to the specified list (listid). If the list ID is zero, a new list will be created.

Returns the key corresponding to this molecule.

MoleculeRotate

void MoleculeRotate(const OEPropDB::OEKey &key,
                    int oldx, oldy, int newx, int newy)

Rotates a molecule’s coordinates corresponding to a mouse move in the 3D display window.

SketcherInputSet

void SketcherInputSet(const std::string &smilesString)
void SketcherInputSet(OEMol &molecule)

Sets the molecule in the Sketcher from the provided SMILES string or molecule. If an existing 3D molecule is already in build mode, this method will throw an exception.

SketcherLookupFunctionSet

void SketcherLookupFunctionSet(const std::string &functionString)

Sets a Python function to be called for compound name lookups. The lookup function should accept a string, convert that to either SMILES or a molecule, and call to put the resulting molecule into the Sketcher. The functionString argument should include only the name of the lookup function, without parentheses or arguments, e.g., ‘MyLookupFunction’.

Table Of Contents

Previous topic

Object Functions

Next topic

Data Analysis Functions