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 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 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 trosions to randomize.