def generate_manipulations(<EOL>molecule, bond_stretch_factor=<NUM_LIT>, torsion_amplitude=np.pi,<EOL>bending_amplitude=<NUM_LIT><EOL>):
do_stretch = (bond_stretch_factor > <NUM_LIT:0>)<EOL>do_double_stretch = (bond_stretch_factor > <NUM_LIT:0>)<EOL>do_bend = (bending_amplitude > <NUM_LIT:0>)<EOL>do_double_bend = (bending_amplitude > <NUM_LIT:0>)<EOL>do_torsion = (torsion_amplitude > <NUM_LIT:0>)<EOL>results = []<EOL>if do_stretch or do_torsion:<EOL><INDENT>for affected_atoms1, affected_atoms2, hinge_atoms in iter_halfs_bond(molecule.graph):<EOL><INDENT>if do_stretch:<EOL><INDENT>length = np.linalg.norm(<EOL>molecule.coordinates[hinge_atoms[<NUM_LIT:0>]] -<EOL>molecule.coordinates[hinge_atoms[<NUM_LIT:1>]]<EOL>)<EOL>results.append(RandomStretch(<EOL>affected_atoms1, length*bond_stretch_factor, hinge_atoms<EOL>))<EOL><DEDENT>if do_torsion and len(affected_atoms1) > <NUM_LIT:1> and len(affected_atoms2) > <NUM_LIT:1>:<EOL><INDENT>results.append(RandomTorsion(<EOL>affected_atoms1, torsion_amplitude, hinge_atoms<EOL>))<EOL><DEDENT><DEDENT><DEDENT>if do_bend:<EOL><INDENT>for affected_atoms, hinge_atoms in iter_halfs_bend(molecule.graph):<EOL><INDENT>results.append(RandomBend(<EOL>affected_atoms, bending_amplitude, hinge_atoms<EOL>))<EOL><DEDENT><DEDENT>if do_double_stretch or do_double_bend:<EOL><INDENT>for affected_atoms1, affected_atoms2, hinge_atoms in iter_halfs_double(molecule.graph):<EOL><INDENT>if do_double_stretch:<EOL><INDENT>length1 = np.linalg.norm(<EOL>molecule.coordinates[hinge_atoms[<NUM_LIT:0>]] -<EOL>molecule.coordinates[hinge_atoms[<NUM_LIT:1>]]<EOL>)<EOL>length2 = np.linalg.norm(<EOL>molecule.coordinates[hinge_atoms[<NUM_LIT:2>]] -<EOL>molecule.coordinates[hinge_atoms[<NUM_LIT:3>]]<EOL>)<EOL>results.append(RandomDoubleStretch(<EOL>affected_atoms1, <NUM_LIT:0.5>*(length1+length2)*bond_stretch_factor, hinge_atoms<EOL>))<EOL><DEDENT>if do_double_bend and len(affected_atoms1) > <NUM_LIT:2> and len(affected_atoms2) > <NUM_LIT:2>:<EOL><INDENT>if hinge_atoms[<NUM_LIT:0>] != hinge_atoms[<NUM_LIT:2>]:<EOL><INDENT>results.append(RandomTorsion(<EOL>affected_atoms1, bending_amplitude, (hinge_atoms[<NUM_LIT:0>], hinge_atoms[<NUM_LIT:2>])<EOL>))<EOL><DEDENT>if hinge_atoms[<NUM_LIT:1>] != hinge_atoms[<NUM_LIT:3>]:<EOL><INDENT>results.append(RandomTorsion(<EOL>affected_atoms2, bending_amplitude, (hinge_atoms[<NUM_LIT:1>], hinge_atoms[<NUM_LIT:3>])<EOL>))<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return results<EOL>
Generate a (complete) set of manipulations

       The result can be used as input for the functions 'randomize_molecule'
       and 'single_random_manipulation'

       Arguments:
         molecule  --  a reference geometry of the molecule, with graph
                       attribute
         bond_stretch_factor  --  the maximum relative change in bond length by
                                  one bond stretch manipulatio
         torsion_amplitude  --  the maximum change a dihdral angle
         bending_amplitude  --  the maximum change in a bending angle

       The return value is a list of RandomManipulation objects. They can be
       used to generate different random distortions of the original molecule.