Hi, sorry to bother you I am using the following function to create a packer:
def build_packer(score_function: Callable) -> PackRotamersMover: task_factory = pack.task.TaskFactory() task_factory.push_back(pack.task.operation.InitializeFromCommandline()) task_factory.push_back(pack.task.operation.RestrictToRepacking()) packer = PackRotamersMover(score_function) packer.task_factory(task_factory) return packer
I was interested in scoring my pose before and after the packer is applied. I used the following function:
def score_pack(path:str) -> float: seed = random.randint(1111111, 9999999) pr.rosetta.basic.random.init_random_generators(seed, "mt19937") pose = pr.pose_from_pdb(path) em_score_function = ScoreFunctionFactory.create_score_function('ref2015.wts') no_pack = em_score_function(pose) packer = build_packer(em_score_function) packer.apply(pose) pack = em_score_function(pose) return no_pack, pack
This all works well and I see a difference, however for some reason the nonzero terms change:
1. After packing
fa_atr: -2328.96 fa_rep: 1094.73 fa_sol: 1396.91 fa_intra_atr: -487.363 fa_intra_rep: 910.014 fa_intra_sol: 307.783 fa_intra_atr_xover4: -133.2 fa_intra_rep_xover4: 143.71 fa_intra_sol_xover4: 82.8076 lk_ball_wtd: -44.8235 fa_elec: -632.838 pro_close: 118.391 hbond_sr_bb: -32.4072 hbond_lr_bb: -178.389 hbond_bb_sc: -51.7056 hbond_sr_bb_sc: -4.11494 hbond_lr_bb_sc: -47.5907 hbond_sc: -36.6903 hbond: -299.192 dslf_fa13: 5.03305 omega: 328.61 fa_dun: 819.941 fa_dun_dev: 55 fa_dun_rot: 251.187 fa_dun_semi: 513.754 p_aa_pp: -127.312 ref: 85.163 rama_prepro: 206.551 total_score: -258.038
2. Before packing
fa_atr: -2362.02 fa_rep: 7226.75 fa_sol: 1431.37 fa_intra_atr: -473.779 fa_intra_rep: 787.174 fa_intra_sol: 292.432 fa_intra_atr_xover4: -122.77 fa_intra_rep_xover4: 79.49 fa_intra_sol_xover4: 72.0629 lk_ball: 879.197 lk_ball_wtd: -35.2312 lk_ball_iso: 2099.04 fa_elec: -531.228 fa_elec_bb_bb: -375.256 fa_elec_bb_sc: -104.049 fa_elec_sc_sc: -51.9238 pro_close: 159.466 hbond_sr_bb: -32.4072 hbond_lr_bb: -178.389 hbond_bb_sc: -42.2032 hbond_sr_bb_sc: -2.70277 hbond_lr_bb_sc: -39.5004 hbond_sc: -14.1873 hbond: -267.186 dslf_fa13: 5.83132 omega: 328.61 fa_dun: 1214.37 fa_dun_dev: 459.646 fa_dun_rot: 234.871 fa_dun_semi: 519.851 p_aa_pp: -127.312 ref: 85.163 rama_prepro: 206.551 total_score: 3576.26
lk_ball: 879.197 lk_ball_iso: 2099.04 fa_elec_bb_bb: -375.256 fa_elec_bb_sc: -104.049 fa_elec_sc_sc: -51.9238
Any idea what can drive this behaviour ?
Thank you for your time
This is the packer doing what the packer is supposed to.
The non-zero energies here are the scoreterms which are evaluating your structure. Different structures, different energies.
The purpose of the packer is to optimize the sidechain placement to improve the overall energy. You would hope that if you put a structure in with a poor energy, the packer should change the structure to one which has a better energy. (Assuming the bad energies are due to sidechain placements.)
That's what you see here. Focusing just on the total_score, you start off with a total score of 3576.26 and end up with one of -258.038 -- Rosetta scores (energies) are more negative is better, so the packer has made the score better (more negative), which is what it's supposed to do.
The other terms are merely stating the details of how this changed happened. The total score is a weighted linear sum of the component terms. The terms from total_energies() are not weighted, which is why the sum of the difference in components doesn't look like it corresponds to the difference in totals. (There's a total_energies_weighted() if you want that.)
Thank you for your help. I understand why total_score, fa_atr, fa_rep chance after packing. What I am saying is that certain terms: lk_ball, lk_ball_iso, fa_elec_bb_bb, fa_elec_bb_sc, fa_elec_sc_sc become zero after I apply the scoring function a second time.
I have done some more tests:
It looks like if you apply the scoring function more than once some terms go to zero.