Hi,

I would like to know how to compute each single-residue and pairwise energy gradients for side chain minimization. Moreover I would like to have gradients with respect to dihedral angles (e.g. not in terms of atom placement). By looking at MinPackMover I believe this is do-able but I need a little guidance on the data structures involved. Another comlication is that I would like to evaluate these gradients for a set of side chain angles at each residue (e.g. for pairwise terms I need the gradient at each combination of side chain angles in the sets for the pair of residues).

I currently have code which computes all single-residue and pairwise energies (not gradients) via interaction graphs. In particular I construct a PrecomputedPairEnergiesInteractionGraph object, then for each node/edge in the graph I call get_one_body_.energy_.. or get_two_body_energy_... functions. There does not seem to be a similar interface for getting the gradient terms.

Looking at MinPackMover it seems like I may need to go through a MinimizationGraph. If so is there a simple way to convert an InteractionGraph to a MinimizationGraph so my energy and gradient evaluations don't become disjoint? Or would I need to rewrite the energy evaluation code to utilyze a MinimizationGraph? The most direct solution (I think) is to use ScoreFunction directly, iterate through the energy terms, and call their respective gradient functions, but I'm hoping there is a higher-level interface I can utilize instead.

Thanks,

Jason

The formalism that Rosetta uses for the energy function gradients is laid out in Abe, Braun, Noguti and Go (1984) "Rapid Calculation of First and Second Derivatives of Conformational Energy with Respect to Dihedral Angles for Proteins. General Recurrent Equations" Computers & Chemistry 8(4) pp. 239-247. The F1 and F2 vectors that the EnergyMethod derivitive functions return by reference correspond roughly to Fa and Ga, respectively, of equations 7a & 7b in that paper. For speed purposes, things are a bit more complex than just dx/dy/dz or d(theta) values, so there isn't necessarily an "easy" way of getting derivitive values, as opposed to getting point energies.

The InteractionGraph (packing) and MinimizationGraph (minimization) don't really share anything aside from very broad brushstrokes conceptual things, so there really isn't any reason to convert one to the other - if you need a MinimizationGraph, you should create one from scratch from the Pose, ScoreFunction and MoveMap, rather than attempting to convert an InteractionGraph.

Another thing to keep in mind is that the pariwise-decomposability formalism that's used to speed up packing doesn't really apply to minimization. Minimization is intrinsically a whole-structure process, though there are controls to limit the degrees of freedom that minimization touches. (Although you can still have leaver-arm effects if you do things like minimizing backbones.)

I'm not *quite* sure I understand what you're aiming for, so I can only be of limited help, but if you're looking for derivatives for individual torsional angles, I might start by looking at the core::optimization::AtomTreeMultifunc, which is what does much of the heavy lifting for Torsion-space minimization. I think (but am not 100% sure) that the dfunc() method of that should give you the partial derivatives for each torsional degree of freedom in the protein. This works with a "Multivec" object, which you should be able to use with the MinimizerMap to get the torsion/entry correspondence.

I'd recommend taking a look at main/source/test/util/deriv_funcs.hh (particularly simple_deriv_check()) for an example of how to extract this sort of derivative data from the minimization framework. This is code that's used in the Rosetta unit testing framework to make sure that the analytical derivatives that are actually used in the minimization match the numeric derivatives calculated from point energy estimates.

Whoa.

You're digging deep.

So, yeah, you can get f1/f2 derivative vectors out of the scoring terms on a residue-pair basis so that you can run minimization alongside side-chain optimization, and this is exactly what the min packer does. It sounds like perhaps you want to minimize more than a single sidechain at a time, which is beyond what the min packer does, but you could probably hack the min packer to, e.g., optimize the neighbors of the residue undergoing a rotamer substitution. The SCMinMultifunc is designed to let you optimize more than one residue at a time. Is that what you're aiming to do?

What kind of protocol are you developing here?

Thanks for the quick replies!

As rmoretti suggests I will look into the details of the AtomTreeMultiFunc to try and reverse engineer some of the torsion-space optimization.

Andrew, you are correct that I'm interested in gradients of more than one (all) side chains at each time. Basically, if you write the energy model as a sum of unary and pairwise energies I would like to know the gradient of each term at a set of values (e.g. over the rotamer configurations for each residue) and pairs of values (pairs of rotamers). In fact I am not planning on using the built-in minimizer, I just need the gradients, so limitations of the optimization is not an issue. If you are interested in further details this is related to extensions on the following paper ( http://people.csail.mit.edu/pachecoj/pubs/loopyDPMP_icml15.pdf ).

Jason

A comment from Frank DiMaio:

I've done something similar for cartesian-space gradients:

Replacing CartesianMinimizerMap->MinimizerMap and CartesianMultifunc->AtomTreeMultifunc should work.

MinimizerMap should contain the mapping from torsions -> dof indices.

-Frank

Thanks for these helpful and quick replies! I think Frank's code, along with the suggested modifications, should do the trick.

Jason