You are here

Differentiable Energy Function w/ Centroid Representation

5 posts / 0 new
Last post
Differentiable Energy Function w/ Centroid Representation


I have a protein complex that's represented in terms of the sequence, the pairwise distances between the CA atoms, and the phi and psi dihedral angles. These distances and dihedral angles should be reasonably correct. I do not have access to the coordinates (N,CA,C,O, etc.) of this protein complex. 

I would like to use an energy function where I can differentiate the energy with respect to the dihedral angles and distances to get a gradient. From perusing this forum, it seems like I should use "score4_smooth"?However, it seems like I would have to reimplement this to take in distances/angles as input instead of coordinates. I can't find where this is implemented, so I'm not sure how to begin this. 

Any advice would be appreciated!

Post Situation: 
Sun, 2022-03-20 09:39

If you have the phi and psi dihedrals, you can build a Pose and then call `set_phi` and `set_psi` repeatedly to set up the backbone dihedrals -- that's an easy way to start. (Now you have coordinates!) Of course, these dihedrals are partially but not entirely redundant with the CA-CA distances. So you would then want to add `AtomPairConstraint`s to represent those distances (and be sure to have `atom_pair_constraint` turned on in your scorefunction) as well as -- probably -- `DihedralConstraint`s to make sure you retain those good phi/psi values while you optimize the CA-CA distances. Oh, be sure to set the omega angle to 180, as it's 0 by default and that's of course quite rare.

Now, you probably want other scorefunction terms, centroid or otherwise, but it'll be way easier if you build a Pose first and then consider what scoring you want to do!.

Sun, 2022-03-20 15:32

Thanks so much, that was very helpful!! 

I actually don't know the residue at each position; I only have a probability distribution over amino acids, and I would like to know the weighted energy. For a pairwise energy term, for example, I would like to weight the energy of a pair of amino acids by the probability of each pair. I would also like to get derivatives of the energy with respect to the weights.

Do you potentially know how I could do this? It seems like I might have to reimplement a score function in an autodiff package, and I'm not sure where I can find an explicit form of the score function in order to do this.

Mon, 2022-03-21 11:09

Sorry to jump in with textbook stuff... but just to make sure the premise is valid, I'd like to add a note to this conversation that the forcefield terms for dihedrals are not pure physics ones (energy energy), but are statistically corrected already.
In most Rosetta scorefunctions the psi/phi play a role in the terms:

  • 'rama': 'Ramachandran preferences.'
  • 'p_aa_pp': 'Probability of amino acid at Phi/Psi.'
  • 'rama_prepro': 'Backbone torsion preference term that takes into account of whether preceding amono acid is Proline or not.'

Which are statistical terms to correct the potential —not actual energy terms from physical forces. Phi and Psi are dihedral angles and the potential energy of dihedrals is classically calculated as weight * (1+ cosine(multiplicity * dihedral-angle + phase-shift)) —there's also improper angles, which are calculated with a harmonic, like bonds and angles, but that's not important. In CHARMM dihedrals both proper and improper are indeed calculated from physical forces, but there's a statistical correction CMAP, which acts similarly to the p_aa_pp term in Rosetta scorefunctions. The CMAP correction is neccessary and highly discussed in the litterature (because folk like the idea of energy terms being purely physics based).

Tue, 2022-03-22 00:53

To follow up, my project has changed and I now need to differentiate the energy function with respect to the one hot vector for an amino acid (it's for a machine learning application). I know the coordinates of the protein (N,CA,C,O) Is there any way I could get access to the Rosetta energy function so that I could implement it in pytorch? If this isn't possible, I'd appreciate recommendations for other energy functions that I could use. Thanks so much!!

Fri, 2022-04-15 17:41