Merge pull request #5926 from RosettaCommons/roccomoretti/scratch_space_reorg_master
Reduce dependency on RotamerLibraryScratchSpace
The SingleResidueRotamerLibrary functions had dunbrack::RotamerLibraryScratchSpace as a parameter dependency. This was a little bit of an annoyance for non-Dunbrack rotamer libraries, particularly as there's fixed numbers of torsions within the scratch space. (Which results in some jiggery-pokery on the derivatives for non-canonicals.)
It turns out that we don't actually make much use of the ScratchSpace for the general SingleResidueRotamerLibrary member interface. (In particular, we don't really re-use the scratch space at all.) We can re-write the interface to exclude it (letting the Dunbrack library create a new one), using a new TorsionEnergy class for the return-by-reference of the score components. For derivatives, we can push the torsion selection into the interface, avoiding having to return all the torsion derivatives.
I cleaned up/condensed the usage of Scratch Space for the Dunbrack libraries. Not knowing the full complexities which have been layered on here, I stopped at a certain point. In particular, there's probably some room for efficiency improvements by skipping derivative calculations for unneeded torsions, though I leave that to a future PR by someone else.