Hi!

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!

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!.

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.

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:

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).

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!!