![]() |
Rosetta
2021.16
|
Defines the interaction graph that will keep track of changes to the hpatch score. More...
#include <NPDHBondInteractionGraph.hh>

Public Types | |
| typedef AdditionalBackgroundNodesInteractionGraph < V, E, G > | parent |
Public Types inherited from core::pack::interaction_graph::AdditionalBackgroundNodesInteractionGraph< V, E, G > | |
| typedef std::vector < BackgroundNode< V, E, G > * > | BackgroundNodeVector |
| typedef std::list < BackgroundToFirstClassEdge < V, E, G > * > | BackgroundEdgeList |
| typedef std::list < BackgroundToFirstClassEdge < V, E, G > * >::iterator | BackgroundEdgeListIter |
| typedef std::list < BackgroundToFirstClassEdge < V, E, G > * >::const_iterator | BackgroundEdgeListConstIter |
Public Member Functions | |
| NPDHBondInteractionGraph (int num_nodes) | |
| ~NPDHBondInteractionGraph () override | |
| pose::Pose const & | pose () const |
| void | set_pose (pose::Pose const &pose) |
| scoring::ScoreFunction const & | scorefxn () const |
| void | set_score_function (scoring::ScoreFunction const &scorefxn) |
| utility::graph::Graph const & | packer_neighbor_graph () const |
| void | set_packer_neighbor_graph (utility::graph::Graph const &neighbor_graph) |
| task::PackerTask const & | packer_task () const |
| void | set_packer_task (task::PackerTask const &task) |
| We need a copy of the packer task to figure out which residues are being packed and/or designed. We have to figure the packing options because it determines whether a residue becomes a FirstClass (NPDHBondNode) node or a background node. This method gets called in IGSupport.cc. More... | |
| rotamer_set::RotamerSets const & | rotamer_sets () const |
| void | set_rotamer_sets (rotamer_set::RotamerSets const &rotsets) |
| void | initialize (pack_basic::RotamerSetsBase const &rot_sets) override |
| void | set_num_residues_in_protein (Size num_res) |
| tells the graph how many residues there are total in the protein More... | |
| void | set_num_background_residues (Size num_background_residues) |
| tells the graph how many residues there are as part of the protein that are not part of the combinatorial optimization process – they are part of the background More... | |
| void | set_residue_as_background_residue (int residue) |
| informs the graph that a particular residue is part of the background More... | |
| void | prepare_graph_for_simulated_annealing () override |
| Prepares the graph to begin simulated annealing. More... | |
| void | blanket_assign_state_0 () override |
| assigns state 0 – the unassigned state – to all (first class) vertices in the graph More... | |
| Real | get_npd_hbond_score () |
| void | set_errorfull_deltaE_threshold (core::PackerEnergy deltaE) override |
| Allows the sim-annealer to specify a deltaE threshold above which, it is no longer necessary to be very accurate. More... | |
| void | consider_substitution (int node_ind, int new_state, core::PackerEnergy &delta_energy, core::PackerEnergy &prev_energy_for_node) override |
| Returns the (possibly approximate) change in energy induced by switching a particular node from its currently assigned state to some alternate state. More... | |
| core::PackerEnergy | calculate_npd_hbond_deltaE () |
| Real | calculate_alt_state_npd_hbond_score () |
| core::PackerEnergy | commit_considered_substitution () override |
| Commits the substitution that the sim annealer had previously asked the graph to consider. Returns the accurate total energy for the graph. More... | |
| core::PackerEnergy | set_network_state (ObjexxFCL::FArray1_int &node_states) override |
| Switch the state assignment of every first class node in the graph. Useful, for instance, if you want to switch to the best network state that you've found so far. More... | |
| core::PackerEnergy | get_energy_current_state_assignment () override |
| returns the energy of the entire graph under the current network state assignment. Also sends a bunch of information to standard error. Only seems to be called by the MultiCoolAnnealer. More... | |
| int | get_edge_memory_usage () const override |
| Should return a measurement of the memory used by the interaction graph to store the rotamer pair energies. Unimplemented. More... | |
| unsigned int | count_static_memory () const override |
| unsigned int | count_dynamic_memory () const override |
| virtual Real | get_energy_sum_for_vertex_group (Size group_id) |
| returns the sum of the PD energy and the hpatch energy for all members first class members of a user-defined vertex subset. Unimplemented. More... | |
| void | print_internal_energies_for_current_state_assignment () |
| void | print () const override |
| useful for debugging More... | |
| int | bg_node_2_resid (Size node_index) |
| Provides read access to the bg to resid array. Returns -1 if the index is not in bounds. More... | |
| std::vector< int > | get_network_state () const |
| Returns the state on each FCNode, but not necessarily in pose resid order. Only used by the unit tests. More... | |
| void | set_observed_sufficient_boolean_true () |
| Sets the observed_sufficient_npd_hbond_E_to_predict_min_ to true. Only used by the unit tests. More... | |
| scoring::hbonds::HBondDatabase const & | hbond_database () const |
| scoring::hbonds::HBondOptions const & | hbond_options () const |
| scoring::hbonds::NPDHBondSet const & | npd_hbond_set () const |
| utility::vector1< char > & | hbonding_to_res_vector () |
| NPDHBondOP | unused_hbond () |
| void | return_hbond_to_queue (NPDHBondOP const &hbond) |
| Real | npd_hb_weight (scoring::hbonds::HBEvalType eval_type, bool intra_res) |
| NPDHBondNode< V, E, G > const * | get_npd_hbond_node (int index) const |
| NPDHBondNode< V, E, G > * | get_npd_hbond_node (int index) |
| NPDHBondBackgroundNode< V, E, G > const * | get_npd_hbond_bg_node (int index) const |
| NPDHBondBackgroundNode< V, E, G > * | get_npd_hbond_bg_node (int index) |
Public Member Functions inherited from core::pack::interaction_graph::AdditionalBackgroundNodesInteractionGraph< V, E, G > | |
| AdditionalBackgroundNodesInteractionGraph (int num_nodes) | |
| AdditionalBackgroundNodesInteractionGraph constructor; no default or copy constructors; no operator =. More... | |
| ~AdditionalBackgroundNodesInteractionGraph () override | |
| AdditionalBackgroundNodesInteractionGraph destructor. More... | |
| unsigned int | getTotalMemoryUsage () const override |
| Returns an int representing the total amount of memory in bytes used by this graph. More... | |
| unsigned int | count_dynamic_memory () const override |
| Returns an int representing the amount of dynamic memory in bytes used by this graph. More... | |
| int | get_num_background_nodes () const |
Static Public Member Functions | |
| static void | print_npd_hbond_avoidance_stats () |
| reports on the level of success for hpatch score calculation procrastination More... | |
| static void | reset_npd_hbond_avoidance_stats () |
| resets static member variables of NPDHBondIG that measure how worthwhile hpatch calculation procrastination is. More... | |
Protected Member Functions | |
| NodeBase * | create_new_node (int node_index, int num_states) override |
| factory method pattern for instantiation of NPDHBondNode objects, used by InteractionGraphBase class. More... | |
| EdgeBase * | create_new_edge (int index1, int index2) override |
| factory method pattern for instantiation of NPDHBondEdge objects, used by InteractionGraphBase class. More... | |
| BackgroundNode< V, E, G > * | create_background_node (int node_index) override |
| factory method pattern for instantiation of NPDHBondBackgroundNode objects, used by AdditionalBackgroundNodesInteractionGraph class. More... | |
| BackgroundToFirstClassEdge< V, E, G > * | create_background_edge (int fc_node_index, int bg_node_index) override |
| factory method pattern for instantiation of NPDHBondBackgroundEdge objects, used by AdditionalBackgroundNodesInteractionGraph class. More... | |
| void | track_npd_hbond_E_min () |
| Keeps track of the minimum hpatch score seen. Every 100 substitutions, updates the variable npd_hbond_score_min_last_100. More... | |
| void | update_internal_energy_totals_npd_hbond () |
| After every 2^10 commits, the graph traverses its nodes and edges and re-tallies the total energy of the current state assignment. This update prevents the accumulation of numerical drift, increasing accuracy. More... | |
Protected Member Functions inherited from core::pack::interaction_graph::AdditionalBackgroundNodesInteractionGraph< V, E, G > | |
| void | clean_up_bgtfc_edges_marked_for_deletion () |
| Remove those BackgroundToFirstClassEdges that have marked themselves for deletion. More... | |
| void | drop_background_edge (BackgroundEdgeListIter iter) |
| Constant time edge removal. More... | |
| void | set_num_background_nodes (int num_bg_nodes) |
| sets the number of background nodes in the graph. Should be called no more than once. Some problem instances do not require background nodes. More... | |
| void | add_background_edge (int first_class_node_index, int bg_node_index) |
| adds a BackgroundToFirstClassEdge to the graph and performs the requisite bookkeepking. More... | |
| BackgroundToFirstClassEdge< V, E, G > * | find_background_edge (int first_class_node_index, int bg_node_index) const |
| returns a pointer to the background edge, identified by the indices of the first and second class nodes it connects. Returns the null pointer if the edge does not exist. Possibly linear time operation (in the number of BackgroundToFirstClassEdges). More... | |
| int | get_num_bg_edges () const |
| BackgroundNode< V, E, G > * | get_background_node (int index) const |
| void | prepare_graph_for_simulated_annealing () override |
| invokes prepare_for_simulated_annealing on each of the BackgroundToFirstClassEdges and then invokes prepare_for_simulated_annealing on each of the BackgroundNodes. More... | |
| BackgroundEdgeListConstIter | get_bg_edge_list_begin () const |
| BackgroundEdgeListConstIter | get_bg_edge_list_end () const |
Private Member Functions | |
| void | reset_from_previous_delta_npd_hbond_comp () |
| bool | decide_procrastinate_npd_hbond_computations (Real const pd_deltaE, Real const threshold) const |
| NPDHBondInteractionGraph ()=delete | |
| NPDHBondInteractionGraph (NPDHBondInteractionGraph< V, E, G > const &)=delete | |
| NPDHBondInteractionGraph< V, E, G > & | operator= (NPDHBondInteractionGraph< V, E, G > const &)=delete |
Static Private Attributes | |
| static Size | num_state_substitutions_considered_ = 0 |
| static Size | num_npd_hbond_comps_procrastinated_ = 0 |
| static Size | num_npd_hbond_comps_later_made_ = 0 |
| static const int | COMMIT_LIMIT_BETWEEN_UPDATES = 4096 |
Defines the interaction graph that will keep track of changes to the hpatch score.
In addition to implementing the virtual base class methods, this class additionally defines methods relating to keeping track of data relating to hpatch.
| typedef AdditionalBackgroundNodesInteractionGraph< V, E, G > core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::parent |
| core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::NPDHBondInteractionGraph | ( | int | num_nodes | ) |
Main constructor. Initializes all member variables to 0 and false.
|
override |
|
privatedelete |
|
privatedelete |
| int core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::bg_node_2_resid | ( | Size | node_index | ) |
Provides read access to the bg to resid array. Returns -1 if the index is not in bounds.
|
override |
assigns state 0 – the unassigned state – to all (first class) vertices in the graph
This is the 3rd entry point into the NPDHBIG. It is called by the Annealer just before simulated annealing and rotamer substitutions begin to init the graph to unassigned values everywhere.
| Real core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::calculate_alt_state_npd_hbond_score | ( | ) |
| core::PackerEnergy core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::calculate_npd_hbond_deltaE | ( | ) |
Goes through the entire process of calculating the hpatch deltaE for a substitution.
|
override |
Commits the substitution that the sim annealer had previously asked the graph to consider. Returns the accurate total energy for the graph.
|
override |
Returns the (possibly approximate) change in energy induced by switching a particular node from its currently assigned state to some alternate state.
First, queries the NPDHBondNode for the pairwise-decomposable (PD) energy. If the PD difference implies a collision, then the NPDHBondIG pretends as if the state substitution causes the best improvement possible in hpatch score, and returns the PD difference + pretend hpatch difference. It will procrastinate computing the actual hpatch score difference until the guiding SimAnnealer decides to commit the substitution. If the SimAnnealer rejects the substitution, then the work to compute the hpatch score is never done. If it is unclear that the SimAnnealer will reject the substitution based on the PD difference, then the Graph goes ahead and computes the change in hpatch score accurately.
This function is the 4th major entry point from the Annealer into the NPDHBIG.
Also returns the sum of the two body energies for the node in its current state; the sim-annealer accepts state substitutions at higher chance if the original state was also at a poor energy.
| node_ind | - [in] - the index of the (first class) node new_state - [in] - the alternate state that the node should consider delta_energy - [out] - the change in energy induced on the entire graph by substituting a node's current state with the alternate. This energy may be inaccurate if it exceeds a threshold set by the sim-annealer. prev_energy_for_node - [out] - the sum of the pair-wise decomposable portion of the energy function for the node's currently assigned state |
|
override |
|
override |
|
overrideprotectedvirtual |
factory method pattern for instantiation of NPDHBondBackgroundEdge objects, used by AdditionalBackgroundNodesInteractionGraph class.
Implements core::pack::interaction_graph::AdditionalBackgroundNodesInteractionGraph< V, E, G >.
|
overrideprotectedvirtual |
factory method pattern for instantiation of NPDHBondBackgroundNode objects, used by AdditionalBackgroundNodesInteractionGraph class.
Implements core::pack::interaction_graph::AdditionalBackgroundNodesInteractionGraph< V, E, G >.
|
overrideprotected |
factory method pattern for instantiation of NPDHBondEdge objects, used by InteractionGraphBase class.
|
overrideprotected |
factory method pattern for instantiation of NPDHBondNode objects, used by InteractionGraphBase class.
|
private |
Makes the decision whether or not to procrastinate calculating the NPD-hbond score. Basically, if the PD energy got better (dE < 0) then return false so we don't procrastinate the calculation (because the alternate state probably will be accepted?). If the best guess for the hpatch deltaE also comes back better (dE < 0), then return false. Finally, if the difference between the deltaE for the PD terms and the (guessed) npd-hbond deltaE is greater than the threshold, return true so we do procrastinate. So basically if the PD energy gets much worse, procrastinate. Otherwise, don't.
|
override |
Should return a measurement of the memory used by the interaction graph to store the rotamer pair energies. Unimplemented.
|
override |
returns the energy of the entire graph under the current network state assignment. Also sends a bunch of information to standard error. Only seems to be called by the MultiCoolAnnealer.
|
virtual |
returns the sum of the PD energy and the hpatch energy for all members first class members of a user-defined vertex subset. Unimplemented.
| std::vector< int > core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::get_network_state | ( | ) | const |
Returns the state on each FCNode, but not necessarily in pose resid order. Only used by the unit tests.
|
inline |
|
inline |
|
inline |
|
inline |
| Real core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::get_npd_hbond_score | ( | ) |
| scoring::hbonds::HBondDatabase const & core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::hbond_database | ( | ) | const |
| scoring::hbonds::HBondOptions const & core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::hbond_options | ( | ) | const |
| utility::vector1< char > & core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::hbonding_to_res_vector | ( | ) |
|
override |
This function is the 1st major entry point (well, after the constructor) into the NPDHBIG. It needs to set residues that are not changing as background residues
Oldest comments: In ++, there's a file InteractionGraphSupport.cc which is an analog of the InteractionGraphFactory in mini. In ++, the InteractionGraphSupport file instantiates and initializes, depending on the command line switches, the right interaction graph. For the NPDHBondInteractionGraph, it first initializes the PDInteractionGraph (which is the base) and then calls the NPDHBondIG initialize method.
The thing is that this initialize method can't be called when the graph is constructed in the InteractionGraphFactory. The reason is that the PDInteractionGraph base initialize() method is NOT called until later in the pack rotamers process. (Actually it's called from within rotsets->compute_energies().) Only after the rotsets->compute energies returns can I stick in an initialize() method call for the NPDHBondInteractionGraph (NPDHBIG). But then that's too late because the rotsets object has already computed some energies. Perhaps that's ok though. The rotsets object only calculates the PD energy terms - it doesn't do anything with non-PD terms.
If a NPDHBIG init method is called during construction of the NPDHBIG, then the init method that's called by the rotsets object causes all the node info that was set in the NPDHBIG init method to be lost because the rotsets init method recreates all the nodes in the interaction graph when it runs. (That was a fun behaviour to figure out.)
So the solution I'm going for is to call this init method in the prepare for simulated annealing method of this class. That gets called just before SA starts, so it will do the task above then. It doesn't really matter when the task gets done as long as it happens before SA starts. This also means that the NPDHBIG will now have to keep a reference to the Pose, the Task, and the RotamerSets objects since it needs all of these things to do tasks 1) and 2). (For the port of this NPDHBondIG, we might not need the task and rotamer sets objects.)
prepare_graph_for_simulated_annealing gets called by the FixbbSA::run() method. Before this method, the rotamersets object has called compute_energies() (the whole process being started in pack_rotamers) which calls initialize() on the IG. I need to place the NPDHBIG init method directly after the IG init method that the RS object calls.
References core::pack::rotamer_set::RotamerSets::nmoltenres().
| Real core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::npd_hb_weight | ( | scoring::hbonds::HBEvalType | eval_type, |
| bool | intra_res | ||
| ) |
References core::scoring::hbonds::npd_hb_eval_type_weight().
Referenced by core::pack::interaction_graph::create_hbonds_one_way().
| scoring::hbonds::NPDHBondSet const & core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::npd_hbond_set | ( | ) | const |
|
privatedelete |
|
inline |
|
inline |
|
inline |
|
override |
Prepares the graph to begin simulated annealing.
Invokes both base-class prepare_graph_for_simulated_annealing subroutines: InteractionGraphBase first, to prepare the NPDHBondNodes and NPDHBondEdges. Then the AdditionalBackgroundNodesInteractionGraph, to prepare the NPDHBondBackgroundNodes, the NPDHBondBackgroundEdges, and to do a little more preparing of the NPDHBondNodes. Also computes background/background overlap. This is the 2nd major entry point into the NPDHBIG.
|
override |
useful for debugging
| void core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::print_internal_energies_for_current_state_assignment | ( | ) |
References core::pack::interaction_graph::TR().
|
static |
reports on the level of success for hpatch score calculation procrastination
References core::pack::interaction_graph::TR().
|
private |
|
static |
resets static member variables of NPDHBondIG that measure how worthwhile hpatch calculation procrastination is.
Referenced by core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::set_errorfull_deltaE_threshold().
| void core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::return_hbond_to_queue | ( | NPDHBondOP const & | hbond | ) |
|
inline |
|
inline |
|
override |
Allows the sim-annealer to specify a deltaE threshold above which, it is no longer necessary to be very accurate.
When the annealer asks the graph to consider a state substitution that produces a large collision, the graph may approximate the hpatch deltaE instead of performing expensive sphere overlap computations. The deltaE returned by consider_substitution() will be inaccurate, but if the annealer is unlikely to accept the substitution, then time can be saved. The graph guarantees that if the annealer does commit that substitution that it will go back and perform the hpatch computations and return an accurate total energy for the graph.
References core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::reset_npd_hbond_avoidance_stats().
|
override |
Switch the state assignment of every first class node in the graph. Useful, for instance, if you want to switch to the best network state that you've found so far.
This function is the last major entry point from the Annealer into the NPDHBIG.
| void core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::set_num_background_residues | ( | Size | num_background_residues | ) |
tells the graph how many residues there are as part of the protein that are not part of the combinatorial optimization process – they are part of the background
The other half of switching between enumeration schemes for the background residues is knowing how many background residues there are.
| void core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::set_num_residues_in_protein | ( | Size | num_res | ) |
tells the graph how many residues there are total in the protein
The graph maintains its own enumeration for the background residues; but asks that anyone wanting to refer to them use their original resid. The graph has to switch back and forth between enumeration schemes and must know how many residues there are total to do that efficiently.
| void core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::set_observed_sufficient_boolean_true | ( | ) |
Sets the observed_sufficient_npd_hbond_E_to_predict_min_ to true. Only used by the unit tests.
| void core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::set_packer_neighbor_graph | ( | utility::graph::Graph const & | neighbor_graph | ) |
| void core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::set_packer_task | ( | task::PackerTask const & | task | ) |
We need a copy of the packer task to figure out which residues are being packed and/or designed. We have to figure the packing options because it determines whether a residue becomes a FirstClass (NPDHBondNode) node or a background node. This method gets called in IGSupport.cc.
References core::pack::task::PackerTask::clone().
| void core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::set_pose | ( | pose::Pose const & | pose | ) |
All throughout this class, I refer back to the original pose sequence. To be able to do that, I need to have a handle to the pose in this class. That's what this method provides. In IGFactory.cc, this method gets called with the pose object that's being packed/designed.
| void core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::set_residue_as_background_residue | ( | int | residue | ) |
informs the graph that a particular residue is part of the background
| void core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::set_rotamer_sets | ( | rotamer_set::RotamerSets const & | rotsets | ) |
| void core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::set_score_function | ( | scoring::ScoreFunction const & | sfxn | ) |
All throughout this class, I refer back to the original pose sequence. To be able to do that, I need to have a handle to the pose in this class. That's what this method provides. In IGFactory.cc, this method gets called with the pose object that's being packed/designed.
References core::scoring::ScoreFunction::clone(), and core::scoring::EnergiesCacheableDataType::NPD_HBOND_SET.
|
protected |
Keeps track of the minimum hpatch score seen. Every 100 substitutions, updates the variable npd_hbond_score_min_last_100.
| NPDHBondOP core::pack::interaction_graph::NPDHBondInteractionGraph< V, E, G >::unused_hbond | ( | ) |
Referenced by core::pack::interaction_graph::create_hbonds_one_way().
|
protected |
After every 2^10 commits, the graph traverses its nodes and edges and re-tallies the total energy of the current state assignment. This update prevents the accumulation of numerical drift, increasing accuracy.
|
private |
|
private |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
staticprivate |
|
staticprivate |
|
private |
|
staticprivate |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
1.8.7