OERandomizeTorsions¶
bool OERandomizeTorsions(OEMolBase &mol, double maxRadians)
bool OERandomizeTorsions(OEMolBase &mol, double maxRadians,
const OESystem::OEUnaryPredicate<OEBondBase> &isRotor)
Modifies each of the torsions in a molecule by a random value between
+maxRadians
and -maxRadians
. While most people think about
this sort of function in degrees, all angles in OEChem TK are measures
in radians. The following simple constants may be used
OEMath_Pi
, OEMath_Rad2Deg
and
OEMath_Deg2Rad
to generate the appropriate value.
There are two API points, the one with two arguments applies the
random torsion adjustment to every bond for which the OEChem TK bond
predicate ‘IsRotor` returns true
. The second API point has an
additional argument in which the user can specify a functor which
defines which bonds are rotatable. If the user’s functor causes the
function to attempt to apply a random rotation on a ring bond, no
change in the internal coordinates will occur, however, the frame of
reference of the molecule may change.
The functions return true
if completes successfully. The functions
return false
if there are no torsions to randomize.
- mol
The molecule to randomize torsions of.
- maxRadians
Maximum value of torsions angle to be modified, in radians.
- isRotor
Predicate to define which torsions should be randomized.