# Individual Residue Energy

3 posts / 0 new
Individual Residue Energy
#1

Hi everyone,

I'm trying to get the energies of individual residues in a pose and am encountering an error that I can't seem to find much information on. Here is a sample of my script:

from pyrosetta import *
from pyrosetta.rosetta import *
from pyrosetta.rosetta.core.scoring import *

pyrosetta.init('-ignore_zero_occupancy false')

pose = pose_from_pdb(pdb_file)

sfxn = create_score_function('ref2015.wts')

score = pose.energies().residue_total_energy(1)

And here is the error I encounter:

ERROR: Energies::residue_total_energy( int const seqpos ): variable seqpos is out of range!

This error is confusing to me because it seems to say that the residue number I entered (in this example 1) is not in the pose, however when I try something like:

aa = pose.aa(1)

which also requires the seqpose input I don't get an error, and there doesn't seem to be anything strange with the PDB file. I've tried this with multiple PDB files and gotten the same error. Does any know what I am doing wrong, or if there is an alternate way to get individual residue energies?

Thanks

-Peik

Category:
Post Situation:
Fri, 2021-02-19 10:13
Peik

The energies object is only populated after scoring. You create the scorefunction, but never apply it to the pose.

Try adding the line sfxn.score( pose ) on the line before you access the energies object. That should fill out the energies object.

Fri, 2021-02-19 10:18
rmoretti

Thanks for the quick response! I figured that out literally right after posting.

Fri, 2021-02-19 10:29
Peik