![]() |
Rosetta
2021.16
|
Defines a FirstClass node which will keep track of changes in the SASA and hpatch score. FirstClassNode is defined and implemented in AdditionalBackgroundNodesInteractionGraph. More...
#include <HPatchInteractionGraph.hh>

Public Types | |
| typedef FirstClassNode< V, E, G > | parent |
| typedef V | grandparent |
Public Types inherited from core::pack::interaction_graph::FirstClassNode< V, E, G > | |
| typedef std::list < BackgroundToFirstClassEdge < V, E, G > * > | BackgroundEdgeList |
| typedef std::list < BackgroundToFirstClassEdge < V, E, G > * >::iterator | BackgroundEdgeListIter |
| typedef std::vector < BackgroundNode< V, E, G > * > | BackgroundNodeVector |
| typedef std::vector < BackgroundToFirstClassEdge < V, E, G > * > | BackgroundEdgeVector |
| typedef std::vector < BackgroundToFirstClassEdge < V, E, G > * >::iterator | BackgroundEdgeVectorIter |
Public Member Functions | |
| HPatchNode (G *owner, int node_index, int num_states) | |
| HPatchNode constructor. More... | |
| ~HPatchNode () override | |
| destructor – no dynamically allocated data, does nothing More... | |
| void | set_rotamers (rotamer_set::RotamerSetCOP rotamers) |
| conformation::ResidueCOP | get_rotamer (int state) const |
| Returns a constant OP to the rotamer/residue object for the given state. More... | |
| conformation::ResidueCOP | curr_state_rotamer () const |
| conformation::ResidueCOP | alt_state_rotamer () const |
| virtual void | set_rotamer_dots_for_state (Size state, RotamerDots const &rd) |
| stores the coordinates for a state. More... | |
| bool | overlaps (HPatchNode< V, E, G > *neighbor) |
| returns true if any sphere for any atom of any state on this vertex overlaps with any atom on any sphere on a neighboring vertex. More... | |
| bool | detect_any_overlap_with_rotamer (RotamerDots const &rotamer) const |
| determines if any atom for any rotamer of this vertex overlaps with any atom from some background residue. called by BGNodes for the detect_background_residue_and_first_class_residue_overlap phase of the prep for simA call in the HPatchIG. More... | |
| void | prepare_for_simulated_annealing () override |
| invokes V's prep_for_simA method. Also computes the "self-overlap" that each of its rotamers has. More... | |
| void | initialize_overlap_with_background (RotamerDots const &bg_rotamer, std::vector< RotamerDotsCache > &overlap, std::vector< utility::vector1< utility::vector1< bool > > > &states_atom_atom_overlap_on_bg_res) |
| This method computes and caches each set of overlaps this node's states have with a background residue. More... | |
| void | assign_zero_state () override |
| Assign the node to state 0 – the "unassigned" state. More... | |
| void | acknowledge_neighbors_substitution () |
| bookkeeping to follow a neighbors state substitution. this method gets called when a HPatchNode commits a sub and then broadcasts that change to all its neighboring fc nodes via the incident HPatchEdges. basically we need to set current state equal to alt state here. (Hopefully alt state is still correct!!) Since there's no way for a HPatchNode to know what other HPatchNodes are connected to it except via HPatchEdges, the calls seem a bit complicated. A HPatchNode has to call acknowledge_state on each Edge. The Edges have to figure out which Node is changing/not changing and then they call an inform_non_changing node of change method. That method then makes the call to this method on the correct HPatchNode. The inform_non_changing method can not be removed, because it's used during the substitution evaluations as well. More... | |
| core::PackerEnergy | calculate_PD_deltaE_for_substitution (int alternate_state, core::PackerEnergy &prev_PDenergies_for_node) |
| Returns the change in energy induced by changing a node from its current state into some alternate state for the PD energy terms only. More... | |
| core::PackerEnergy | get_pd_energy_delta () |
| Returns the deltaE for just the PD terms. Separate method from the one above because this one can be called from within a commit_sub call that didn't go through consider_sub(). More... | |
| Real | consider_alternate_state () |
| Instructs the Node to update the alt state information held by it and its neighbors in response to switching from the current state to an alternate state. More... | |
| Real | get_current_state_sasa () const |
| returns the amount of sasa this node has in its current state assignment More... | |
| Real | get_current_state_sasa (Size atom_index) const |
| Returns the current state SASA for the passed in atom index. More... | |
| Real | get_alternate_state_sasa (Size atom_index) const |
| Returns the alternate state SASA for the passed in atom index. More... | |
| utility::vector1 < utility::vector1< bool > > const & | get_atom_atom_self_overlaps_for_state (Size state) const |
| Returns a const reference to the atom-x-atom-pair vector-of-vectors of bools that specifies which atoms are overlapping, in the given state. More... | |
| Size | get_current_state_num_atoms () const |
| Size | get_alt_state_num_atoms () const |
| int | wt_seqpos_for_node () const |
| conformation::Residue const & | wt_residue_for_node () const |
| Real | update_state_for_neighbors_substitution (HPatchNode< V, E, G > *node_considering_substitution, RotamerDots &neighbors_alternate_state, RotamerDotsCache const &neighbors_curr_state_overlap_with_this, RotamerDotsCache &this_overlap_with_neighbors_alternate, RotamerDotsCache &neighbors_alternate_overlap_with_this, utility::vector1< utility::vector1< bool > > &alt_state_atom_atom_overlaps_cache) |
| returns the change in sasa for this node induced by a state substitution at a neighboring node. The node increments the dot coverage count for the RotamerDots object representing the alternate state dots for that neighbor. More... | |
| void | reset_alt_state_dots () |
| Sets the alt state rotamer dots to the current state rotamer dots. See comments in SIG and commit_considered_substitution for more information about why this method exists. More... | |
| void | commit_considered_substitution () |
| Sets the current state to the alternate state this node was asked to consider. Copies appropriate score information. Notifies all of its neighbors that it is going through with the state substitution it had been considering. More... | |
| virtual unsigned int | getMemoryUsageInBytes () const |
| Not implemented, but needs to be! More... | |
| unsigned int | count_static_memory () const override |
| Returns the amount of static memory used by this Node object. More... | |
| unsigned int | count_dynamic_memory () const override |
| Returns the amount of dynamic memory used by this Node object. More... | |
| void | print () const override |
| useful for debugging More... | |
| RotamerDots const & | get_current_state_rotamer_dots () |
| Returns current state. Only used by the unit tests. More... | |
| RotamerDots const & | get_alt_state_rotamer_dots () |
| Returns current state. Only used by the unit tests. More... | |
| InvRotamerDots const & | curr_state_inv_dots () const |
| InvRotamerDots const & | alt_state_inv_dots () const |
| Size | max_hphobe_atoms_any_restype () const |
| utility::vector1< Size > const & | curr_state_hphobes () const |
| utility::vector1< Size > const & | alt_state_hphobes () const |
| Size | n_curr_state_hphobes () const |
| Size | n_alt_state_hphobes () const |
| utility::vector1< Size > const & | curr_state_exp_hphobes () const |
| utility::vector1< Size > const & | alt_state_exp_hphobes () const |
| Size | n_curr_state_exp_hphobes () const |
| Size | n_alt_state_exp_hphobes () const |
Public Member Functions inherited from core::pack::interaction_graph::FirstClassNode< V, E, G > | |
| ~FirstClassNode () override | |
| FirstClassNode destructor. More... | |
| FirstClassNode (G *owner, int node_id, int num_states) | |
| FirstClassNode constructor. More... | |
| BackgroundEdgeListIter | add_background_edge (BackgroundToFirstClassEdge< V, E, G > *edge) |
| Adds a BackgroundToFirstClassEdge to the node's list of such edges and returns an iterator to that list position. More... | |
| void | drop_background_edge (BackgroundEdgeListIter edge) |
| Removes an edge from the node's BackgroundToFirstClassEdge list. More... | |
| unsigned int | count_dynamic_memory () const override |
| Returns an int representing the amount of memory in bytes used by this node. More... | |
Private Member Functions | |
| void | update_alt_state_exphphobes () |
| Updates the vector alt_state_exp_hphobes_ by checking the sasa of every atom in the residue currently on this Node. More... | |
| void | initialize_self_overlap () |
| Initializes rotamer self overlap; called by HPatchInteractionGraph;:prepare_for_sim_annealing right before simulated annealing begins. More... | |
| void | initialize_atom_atom_overlap_cache () |
| Initializes the atom_atom_overlaps vector. More... | |
| HPatchNode () | |
| HPatchNode (HPatchNode< V, E, G > const &) | |
| HPatchNode< V, E, G > & | operator= (HPatchNode< V, E, G > const &) |
Private Attributes | |
| utility::vector1 < conformation::ResidueCOP > | rotamers_vector_ |
| utility::vector1< Size > | restype_group_for_rotamers_ |
| utility::vector1 < utility::vector1< Size > > | hphobe_ats_for_restype_group_ |
| Size | max_hphobes_ |
| utility::vector1 < utility::vector1 < utility::vector1< bool > > > | self_atom_atom_overlaps_ |
| utility::vector1< RotamerDots > | self_and_bg_dots_for_states_ |
| RotamerDots | current_state_rotamer_dots_ |
| RotamerDots | alt_state_rotamer_dots_ |
| InvRotamerDots | curr_state_inv_dots_ |
| InvRotamerDots | alt_state_inv_dots_ |
| utility::vector1< Size > | curr_state_exp_hphobes_ |
| utility::vector1< Size > | alt_state_exp_hphobes_ |
| bool | alt_state_dots_matches_current_state_dots_ |
Defines a FirstClass node which will keep track of changes in the SASA and hpatch score. FirstClassNode is defined and implemented in AdditionalBackgroundNodesInteractionGraph.
| typedef V core::pack::interaction_graph::HPatchNode< V, E, G >::grandparent |
| typedef FirstClassNode< V, E, G > core::pack::interaction_graph::HPatchNode< V, E, G >::parent |
| core::pack::interaction_graph::HPatchNode< V, E, G >::HPatchNode | ( | G * | owner, |
| int | node_index, | ||
| int | num_states | ||
| ) |
|
override |
destructor – no dynamically allocated data, does nothing
|
private |
|
private |
| void core::pack::interaction_graph::HPatchNode< V, E, G >::acknowledge_neighbors_substitution | ( | ) |
bookkeeping to follow a neighbors state substitution. this method gets called when a HPatchNode commits a sub and then broadcasts that change to all its neighboring fc nodes via the incident HPatchEdges. basically we need to set current state equal to alt state here. (Hopefully alt state is still correct!!) Since there's no way for a HPatchNode to know what other HPatchNodes are connected to it except via HPatchEdges, the calls seem a bit complicated. A HPatchNode has to call acknowledge_state on each Edge. The Edges have to figure out which Node is changing/not changing and then they call an inform_non_changing node of change method. That method then makes the call to this method on the correct HPatchNode. The inform_non_changing method can not be removed, because it's used during the substitution evaluations as well.
|
inline |
|
inline |
|
inline |
|
inline |
|
override |
Assign the node to state 0 – the "unassigned" state.
A node in state 0 produces no hpatch score. Its neighbors have to adjust their scores appropriately. This method iterates over all the edges emanating from this node and tells them to acknowledge that they've been zeroed out.
References core::pack::interaction_graph::TR_NODE().
| core::PackerEnergy core::pack::interaction_graph::HPatchNode< V, E, G >::calculate_PD_deltaE_for_substitution | ( | int | alternate_state, |
| core::PackerEnergy & | prev_PDenergies_for_node | ||
| ) |
Returns the change in energy induced by changing a node from its current state into some alternate state for the PD energy terms only.
This function always gets called for every substitution. Only the consider_alt_state() call can get procrastinated.
| void core::pack::interaction_graph::HPatchNode< V, E, G >::commit_considered_substitution | ( | ) |
Sets the current state to the alternate state this node was asked to consider. Copies appropriate score information. Notifies all of its neighbors that it is going through with the state substitution it had been considering.
There's a potential situation with considers() and commits() that needs to be checked for here. It's possible that a consider() call is made which causes a set of Nodes to update their alt states correspondingly. Since the consider() only gets processed by (or actually the call only goes out to) Nodes which are neighbor graph neighbors, only those Nodes will have their counts updated. Assume that the first consider() is really bad and no commit goes out. If we then consider() another sub, the alt state counts at the previous consider()'s set of nodes are incorrect. If get_deltaE is called by this consider() on some of those nodes, some of them will have their alt states reset. But when the commit goes out to ALL Nodes that are neighbors (NOT just the neighbor graph neighbors) it's possible that some of the Nodes will save the wrong alt state count. One way I think this can be avoided to is check at this node, if the alt state count is different from current, whether the node that originally changed is a neighbor graph neighbor of this node. If it is, that means the counts changed because of that node. If it's not, then this Node must have been one of the ones that fell out of sync.
Oooooh, I just thought of another way. When the SIG consider() method is called, I could have a reset alt state counts method that will deal with Nodes that are out of sync. That's more elegant than yet another if statement here!
I'm not sure the above is really a problem in the case of this IG. It seems like even if a non-committed consider() call occurs that alters the alt state counts/dots at some set of nodes, when a following sub does get commit'd(), then the nodes that will get the commit message should have all been updated. Some nodes will still have alt_state counts that are weird, but when a consider() call comes back around to them, it should reset the alt_state before doing anything.
References core::pack::interaction_graph::TR_NODE().
| Real core::pack::interaction_graph::HPatchNode< V, E, G >::consider_alternate_state | ( | ) |
Instructs the Node to update the alt state information held by it and its neighbors in response to switching from the current state to an alternate state.
References core::pack::interaction_graph::TR_NODE().
|
override |
Returns the amount of dynamic memory used by this Node object.
|
override |
Returns the amount of static memory used by this Node object.
|
inline |
|
inline |
|
inline |
|
inline |
| bool core::pack::interaction_graph::HPatchNode< V, E, G >::detect_any_overlap_with_rotamer | ( | RotamerDots const & | rotamer | ) | const |
determines if any atom for any rotamer of this vertex overlaps with any atom from some background residue. called by BGNodes for the detect_background_residue_and_first_class_residue_overlap phase of the prep for simA call in the HPatchIG.
Referenced by core::pack::interaction_graph::HPatchBackgroundNode< V, E, G >::detect_overlap().
|
inline |
| RotamerDots const & core::pack::interaction_graph::HPatchNode< V, E, G >::get_alt_state_rotamer_dots | ( | ) |
Returns current state. Only used by the unit tests.
| Real core::pack::interaction_graph::HPatchNode< V, E, G >::get_alternate_state_sasa | ( | Size | atom_index | ) | const |
Returns the alternate state SASA for the passed in atom index.
| utility::vector1< utility::vector1< bool > > const & core::pack::interaction_graph::HPatchNode< V, E, G >::get_atom_atom_self_overlaps_for_state | ( | Size | state | ) | const |
Returns a const reference to the atom-x-atom-pair vector-of-vectors of bools that specifies which atoms are overlapping, in the given state.
|
inline |
| RotamerDots const & core::pack::interaction_graph::HPatchNode< V, E, G >::get_current_state_rotamer_dots | ( | ) |
Returns current state. Only used by the unit tests.
| Real core::pack::interaction_graph::HPatchNode< V, E, G >::get_current_state_sasa | ( | ) | const |
returns the amount of sasa this node has in its current state assignment
RotamerDots objects know when they are in the unassigned state, so nothing special needs to be done to handle the 0 state. But, we could also query parent using get_current_state() to check if it's nonzero as an alternative.
| Real core::pack::interaction_graph::HPatchNode< V, E, G >::get_current_state_sasa | ( | Size | atom_index | ) | const |
Returns the current state SASA for the passed in atom index.
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
| core::PackerEnergy core::pack::interaction_graph::HPatchNode< V, E, G >::get_pd_energy_delta | ( | ) |
Returns the deltaE for just the PD terms. Separate method from the one above because this one can be called from within a commit_sub call that didn't go through consider_sub().
| conformation::ResidueCOP core::pack::interaction_graph::HPatchNode< V, E, G >::get_rotamer | ( | int | state | ) | const |
Returns a constant OP to the rotamer/residue object for the given state.
Need to save a reference to the rotamer_set so that we can determine what a particular state change will do to the score
|
protected |
Returns alt_state_rotamer_dots_.get_sasa() - curr_state_dots.get_sasa() except when either the current state or the alternate state is the unassigned state; state 0.
This method requires that the variables current_state_ and alternate_state_ correspond to the rotamers held in current_state_rotamer_dots_ and alt_state_rotamer_dots_. Usually, alternate_state_ holds meaningful data only if a vertex is considering a state substitution. This method will be invoked by a vertex as it considers a state substitition; it will also be invoked by each of its neighbors. That means the statement alternate_state_ = current_state_; must be present in HPatchNode::update_state_for_neighbors_substitution().
|
virtual |
Not implemented, but needs to be!
|
private |
Initializes the atom_atom_overlaps vector.
The atom_atom_overlaps vector stores a boolean for the intra-residue atom-atom overlap for every state possible at this Node. During simulated annealing, the IG has to determine the connected components after every sub. To do this, it has to know which atoms are exposed as well as overlapping. Instead of recomputing atom-atom overlaps after every sub, do it once and cache the values on the Node.
References core::kinematics::tree::distance_squared(), core::pack::interaction_graph::RotamerDots::get_atom_radius(), and core::scoring::sasa::get_legrand_atomic_overlap().
| void core::pack::interaction_graph::HPatchNode< V, E, G >::initialize_overlap_with_background | ( | RotamerDots const & | bg_rotamer_dots, |
| std::vector< RotamerDotsCache > & | node_states_coverage_of_bg_res_, | ||
| std::vector< utility::vector1< utility::vector1< bool > > > & | states_atom_atom_overlap_on_bg_res | ||
| ) |
This method computes and caches each set of overlaps this node's states have with a background residue.
The node stores these overlaps in two places: 1) in the input vector from the HPatchBackgroundEdge object, and 2) in its own array of dot coverage counts for the self-and-background sphere overlaps.
| bg_rotamer | - [in] - the RotamerDots object for the background residue node_states_coverage_of_bg_res_ -[out] - the array of RotamerDotsCache objects that the HPatchBackgroundEdge stores for the overlap of each state in this residue on the background residue. states_atom_atom_overlap_on_bg_res -[out] - an array that holds the atom-atom overlap each state on this Node has on the background residue |
References core::pack::interaction_graph::RotamerDots::get_num_atoms().
|
private |
Initializes rotamer self overlap; called by HPatchInteractionGraph;:prepare_for_sim_annealing right before simulated annealing begins.
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
private |
| bool core::pack::interaction_graph::HPatchNode< V, E, G >::overlaps | ( | HPatchNode< V, E, G > * | neighbor | ) |
returns true if any sphere for any atom of any state on this vertex overlaps with any atom on any sphere on a neighboring vertex.
neighbor - [in] - the vertex that neighbors this vertex
References core::pack::interaction_graph::HPatchNode< V, E, G >::self_and_bg_dots_for_states_.
|
override |
invokes V's prep_for_simA method. Also computes the "self-overlap" that each of its rotamers has.
References core::pack::interaction_graph::TR_NODE().
|
override |
useful for debugging
useful for debugging - writes information about a node to the tracer
References core::pack::interaction_graph::TR_NODE().
| void core::pack::interaction_graph::HPatchNode< V, E, G >::reset_alt_state_dots | ( | ) |
Sets the alt state rotamer dots to the current state rotamer dots. See comments in SIG and commit_considered_substitution for more information about why this method exists.
References core::pack::interaction_graph::TR_NODE().
|
virtual |
stores the coordinates for a state.
Currently RotamerCoords stores the atoms in the order they are created for the pose. In the future, this might be changes to store the atoms in special trie order to reduce the number of sphere calculations necessary.
self_and_bg_dots_for_states_ is a vector1 of RotamerDots objects. the size of the vector is set during Node construction to parent::get_num_states().
| void core::pack::interaction_graph::HPatchNode< V, E, G >::set_rotamers | ( | rotamer_set::RotamerSetCOP | rotamers | ) |
Need to save a reference to the rotamer_set so that we can determine what a particular state change will do to the score
References core::chemical::ResidueType::atom_type(), core::chemical::AtomType::element(), core::chemical::ResidueType::nheavyatoms(), and core::pack::interaction_graph::TR_NODE().
|
private |
Updates the vector alt_state_exp_hphobes_ by checking the sasa of every atom in the residue currently on this Node.
| Real core::pack::interaction_graph::HPatchNode< V, E, G >::update_state_for_neighbors_substitution | ( | HPatchNode< V, E, G > * | node_considering_substitution, |
| RotamerDots & | neighbors_alternate_state, | ||
| RotamerDotsCache const & | neighbors_curr_state_overlap_with_this, | ||
| RotamerDotsCache & | this_overlap_with_neighbors_alternate, | ||
| RotamerDotsCache & | neighbors_alternate_overlap_with_this, | ||
| utility::vector1< utility::vector1< bool > > & | atom_atom_overlaps_cache | ||
| ) |
returns the change in sasa for this node induced by a state substitution at a neighboring node. The node increments the dot coverage count for the RotamerDots object representing the alternate state dots for that neighbor.
The procedure is simple at heart – the caching makes it complex.
alt_state_rotamer_dots_ = current_state_rotamer_dots_; //copy dot coverage counts alt_state_rotamer_dots_.decrement( neighbors_curr_state_overlap_with_this ); alt_state_rotamer_dots_.increment_both( neighbors_alternate_state ); return ( alt_state_rotamer_dots_.get_score() - current_state_rotamer_dots_.get_score() );
Extensive caching techniques save time. Each HPatchEdge stores the dot coverage for each pair of HPatchNodes in their current state. These are stored in the RotamerDotsCache objects. Let's name the vertices: this vertex is vertex B. Vertex B is projecting its hpatch deltaE while vertex A is considering a substitution from one state to another. The edge connecting A and B provides node B with the set of masks for the overlap by the atoms of A's alternate state on all atoms of vertex B.
| neighbors_alternate_state | - [in/out] - the RotamerDots object representing the alternate state vertex A (the neighbor) is considering. neighbors_curr_state_overlap_with_this - [in] - the RotamerDotsCache object held by the HPatchEdge connecting A and B that represents the coverage of A's current state of B's atoms. this_overlap_with_neighbors_alternate - [out] - the dot cache to store the results of computing the overlap of B's current state on A's alt state neighbors_alternate_overlap_with_this - [out] - the dot cache to store the results of computing the overlap of A's alt state on B's current state mask_this_covered_by_other - [in/out] - starting set of overlaps mask_other_covered_by_this - [in/out] - starting set of overlaps num_atoms_same - [in] - the number of atoms shared between A's current and alternate states. |
What do we do when the current state is unassigned. Then that results in the alt_state starting from being unassigned and we get problems because the RotamerDots object doesn't have any memory assigned to it if it's in the unassigned state.
it's probable that a sub that was considered before wasn't committed, so the alt state count at this node needs to go back to what the current state count is. the problem that may crop up with the reset here is that on a previous consider call, a set of nodes will update their counts. if commit is not called, and a second consider is called, then this node will have its alt state count reset but what about all the other nodes in the previous set. how will their counts get reset to the current state count? perhaps a check in the commit method can be added. nope, a new method has been added to Nodes and BGNodes to handle this case. alt_state_total_hASA_ = curr_state_total_hASA_;
References core::pack::interaction_graph::TR_NODE().
|
inline |
|
inline |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
1.8.7