Rosetta  2021.16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
core::pack::interaction_graph::PDNode Class Reference

#include <PDInteractionGraph.hh>

Inheritance diagram for core::pack::interaction_graph::PDNode:
Inheritance graph
[legend]

Public Member Functions

 PDNode (InteractionGraphBase *owner, int node_id, int num_states)
 Constructor. More...
 
 ~PDNode () override
 Destructor. More...
 
void print () const override
 prints a description of the node and all of it's one-body energies More...
 
virtual void set_amino_acid_types (std::vector< int > const &)
 sets the amino acid type for each state More...
 
virtual int aatype_for_state (int state) const
 return the amino acid type for a particular state – this indexing is of course completely arbitrary More...
 
utility::vector1< int > const & get_num_states_for_aa_types () const
 returns an FArray & with the number of states for each amino acid type More...
 
void update_one_body_energy (int state, core::PackerEnergy energy) override
 update energy to the one-body energy for state More...
 
virtual void update_one_body_energies (ObjexxFCL::FArray1< core::PackerEnergy > &energies)
 set all the one-body energies for this node More...
 
void add_to_one_body_energy (int state, core::PackerEnergy energy) override
 adds energy to the one-body energy for state state More...
 
void add_to_one_body_energies (ObjexxFCL::FArray1< core::PackerEnergy > &energies) override
 adds all the energies in energies to the one-body energies for this node More...
 
void zero_one_body_energies () override
 Set all onebody energies to zero. More...
 
core::PackerEnergy get_one_body_energy (int state) const override
 returns the one body energy for a state More...
 
void prepare_for_simulated_annealing () override
 prepares node for simulated annealing More...
 
void assign_zero_state () override
 assigns node's state to it's zero, or "unassigned" state. More...
 
bool state_unassigned () const override
 Is the current state unassigned (set to the zero or null state)? More...
 
void assign_state (int new_state)
 assigns node a new_state More...
 
int get_current_state () const
 returns the state the node is currently assigned More...
 
core::PackerEnergy get_one_body_energy_current_state () const
 returns the one body energy for the state the node is currently assigned More...
 
core::PackerEnergy project_deltaE_for_substitution (int alternate_state, core::PackerEnergy &prev_node_energy)
 returns the change in energy that would be induced by switching this node from its current state into another state More...
 
void commit_considered_substitution ()
 tells the node that it should change its state to the last state it was asked to consider (from a call to project_deltaE_for_substitution) More...
 
void project_deltaE_for_substitution (int alternate_state, core::PackerEnergy &deltaE_unweighted, core::PackerEnergy &prevE_unweighted, core::PackerEnergy &deltaE_weighted, core::PackerEnergy &prevE_weighted, ObjexxFCL::FArray2D< core::PackerEnergy > const &weights)
 returns the change in weighted energy that would be induced by switching this node from its current state into another state More...
 
core::PackerEnergy get_weighted_energy_with_higher_indexed_nodes (ObjexxFCL::FArray2D< core::PackerEnergy > const &weights) const
 Paul's code. More...
 
void acknowledge_neighbors_state_substitution (int edge_to_altered_neighbor, core::PackerEnergy new_edge_energy, int other_node_new_state, SparseMatrixIndex const &other_node_new_state_sparse_info)
 updates bookkeeping arrays for when a neighbor has changed its state More...
 
SparseMatrixIndex const & get_sparse_mat_info_for_state (int state) const
 returns the sparse matrix information for a paricular state More...
 
SparseMatrixIndex const & get_sparse_mat_info_for_curr_state () const
 returns the sparse matrix information for the current state More...
 
int get_num_states_for_aa_type (int aa_type) const
 returns the number of states that are of a particular amino acid type More...
 
void print_internal_energies () const
 outputs to standard error the bookkeeping energies for the node in its current state assignment More...
 
void update_internal_energy_sums ()
 removes numerical drift long stretches of efficient bookkeeping produces More...
 
unsigned int count_static_memory () const override
 
unsigned int count_dynamic_memory () const override
 memory accounting scheme More...
 
- Public Member Functions inherited from core::pack::interaction_graph::PrecomputedPairEnergiesNode
 ~PrecomputedPairEnergiesNode () override
 
 PrecomputedPairEnergiesNode (InteractionGraphBase *owner, int node_id, int num_states)
 
- Public Member Functions inherited from core::pack::interaction_graph::FixedBBNode
 ~FixedBBNode () override
 
 FixedBBNode (InteractionGraphBase *owner, int node_id, int num_states)
 
- Public Member Functions inherited from core::pack::interaction_graph::NodeBase
virtual ~NodeBase ()
 virtual destructor More...
 
 NodeBase (InteractionGraphBase *, int node_id, int num_states)
 Main constructor, no default constructor nor copy constructor. More...
 
int get_num_states () const
 returns the number of states for this node More...
 
std::list< EdgeBase * >::iterator add_edge (EdgeBase *edge_ptr)
 adds edge pointer to edge list; returns an iterator to the new list element More...
 
void drop_edge (std::list< EdgeBase * >::iterator edge_iterator)
 removes an edge iterator from the node's edge list More...
 
void drop_all_edges ()
 deletes all edges incident upon this node More...
 
EdgeBasefind_edge (int other_node_index) const
 a slow (linear) search for an edge. The edge is identified by the index of the node to which the edge connects this node. Returns NULL when there is no such connecting edge. More...
 
void depth_first_connected_component_counting ()
 performs a depth first traversal of the graph. Each node informs the graph that the traversal resulted in arriving at the node. More...
 
std::list< EdgeBase * >
::const_iterator 
edge_list_begin ()
 
std::list< EdgeBase * >
::const_iterator 
edge_list_end ()
 
int get_node_index () const
 
int get_num_incident_edges () const
 
int get_num_edges_to_smaller_indexed_nodes () const
 
int get_num_edges_to_larger_indexed_nodes () const
 
EdgeBase const * get_incident_edge (int index) const
 These functions are public for the sake of writing good unit tests. More...
 
EdgeBaseget_incident_edge (int index)
 
int get_index_of_adjacent_node (int index) const
 
NodeBase const * get_adjacent_node (int index) const
 
NodeBaseget_adjacent_node (int index)
 

Protected Member Functions

void update_internal_vectors ()
 updates bookkeeping arrays that correspond to edge-list. More...
 
core::PackerEnergy get_curr_pd_energy_total () const
 
core::PackerEnergy get_alt_pd_energy_total () const
 
void set_alternate_state (int alt)
 
int get_alternate_state () const
 
void calc_deltaEpd (int alternate_state)
 
  • allow derived class to "drive" through the deltaE calculation
More...
 
bool considering_alternate_state () const
 
- Protected Member Functions inherited from core::pack::interaction_graph::NodeBase
void update_edge_vector ()
 converts edge-list to edge-vector representation More...
 
bool get_edge_vector_up_to_date () const
 
InteractionGraphBase const * get_owner () const
 
InteractionGraphBaseget_owner ()
 

Private Member Functions

void set_alt_aa_offsets_from_edge (int edge_index, ObjexxFCL::FArray2D_int const &offsets)
 
PDEdge const * get_incident_pd_edge (int index) const
 
PDEdgeget_incident_pd_edge (int index)
 
PDInteractionGraph const * get_pdig_owner () const
 
PDInteractionGraphget_pdig_owner ()
 
 PDNode ()
 
 PDNode (PDNode const &)
 
PDNodeoperator= (PDNode const &)
 

Private Attributes

int num_aa_types_
 
utility::vector1< int > num_states_for_aatype_
 
std::vector< SparseMatrixIndexsparse_mat_info_for_state_
 
std::vector< core::PackerEnergyone_body_energies_
 
ObjexxFCL::FArray3D_int aa_offsets_for_edges_
 
ObjexxFCL::FArray2D_int num_states_for_aa_type_for_higher_indexed_neighbor_
 
std::vector< int > neighbors_curr_state_
 
std::vector< SparseMatrixIndexneighbors_curr_state_sparse_info_
 
std::vector
< ObjexxFCL::FArray1A
< core::PackerEnergy > > 
edge_matrix_ptrs_
 
int current_state_
 
SparseMatrixIndex curr_state_sparse_mat_info_
 
core::PackerEnergy curr_state_one_body_energy_
 
core::PackerEnergy curr_state_total_energy_
 
std::vector< core::PackerEnergycurr_state_two_body_energies_
 
int alternate_state_
 
SparseMatrixIndex alt_state_sparse_mat_info_
 
core::PackerEnergy alternate_state_one_body_energy_
 
core::PackerEnergy alternate_state_total_energy_
 
std::vector< core::PackerEnergyalternate_state_two_body_energies_
 
bool alternate_state_is_being_considered_
 

Constructor & Destructor Documentation

core::pack::interaction_graph::PDNode::PDNode ( InteractionGraphBase owner,
int  node_id,
int  num_states 
)

Constructor.

main constructor, no default or copy constructors

allocates one-body energy array and initializes it to zero. allocates space for sparse-matrix information.

core::pack::interaction_graph::PDNode::~PDNode ( )
overridedefault

Destructor.

destructor

not responsible for any dynamically allocated memory, so node does nothing it's member variables, of course, are implicitly destructed

core::pack::interaction_graph::PDNode::PDNode ( )
private

Referenced by count_static_memory().

core::pack::interaction_graph::PDNode::PDNode ( PDNode const &  )
private

Member Function Documentation

int core::pack::interaction_graph::PDNode::aatype_for_state ( int  state) const
virtual

return the amino acid type for a particular state – this indexing is of course completely arbitrary

References sparse_mat_info_for_state_.

Referenced by core::pack::interaction_graph::PDInteractionGraph::aatype_for_node_state().

void core::pack::interaction_graph::PDNode::acknowledge_neighbors_state_substitution ( int  edge_to_altered_neighbor,
core::PackerEnergy  new_edge_energy,
int  other_node_new_state,
SparseMatrixIndex const &  other_node_new_state_sparse_info 
)
inline

updates bookkeeping arrays for when a neighbor has changed its state

Parameters
edge_to_altered_neighbor- [in] - the index for the edge that connects this node to the node that just changed its state
new_edge_energ- [in] - the pair energy between this node in its current state and the new state of the node that just changed its state
other_node_new_state- [in] - the state the neighbor just adopted
other_node_new_state_sparse_info- [in] - the sparse-matrix info corresponding to the neighbor's new state

References curr_state_total_energy_, curr_state_two_body_energies_, neighbors_curr_state_, and neighbors_curr_state_sparse_info_.

void core::pack::interaction_graph::PDNode::add_to_one_body_energies ( ObjexxFCL::FArray1< core::PackerEnergy > &  energies)
overridevirtual

adds all the energies in energies to the one-body energies for this node

Parameters
energies- [in] - the array of energies. Must hold num_states_ entries

Implements core::pack::interaction_graph::NodeBase.

References core::pack::interaction_graph::NodeBase::get_num_states(), and one_body_energies_.

void core::pack::interaction_graph::PDNode::add_to_one_body_energy ( int  state,
core::PackerEnergy  energy 
)
overridevirtual

adds energy to the one-body energy for state state

Parameters
state- [in] - one-based index of the state
energy- [in] - the energy that should be added.

Implements core::pack::interaction_graph::NodeBase.

References protocols::buns::energy, and one_body_energies_.

void core::pack::interaction_graph::PDNode::assign_state ( int  new_state)
void core::pack::interaction_graph::PDNode::assign_zero_state ( )
overridevirtual
void core::pack::interaction_graph::PDNode::calc_deltaEpd ( int  alternate_state)
protected

  • allow derived class to "drive" through the deltaE calculation

References project_deltaE_for_substitution().

void core::pack::interaction_graph::PDNode::commit_considered_substitution ( )

tells the node that it should change its state to the last state it was asked to consider (from a call to project_deltaE_for_substitution)

updates edge energy vector, iterates across neighbors having them update their edge energies. Bookkeeping recaptures performance lost by leaving energy2b structure

References core::pack::interaction_graph::PDEdge::acknowledge_substitution(), alt_state_sparse_mat_info_, alternate_state_, alternate_state_is_being_considered_, alternate_state_one_body_energy_, alternate_state_total_energy_, alternate_state_two_body_energies_, curr_state_one_body_energy_, curr_state_sparse_mat_info_, curr_state_total_energy_, curr_state_two_body_energies_, current_state_, get_incident_pd_edge(), core::pack::interaction_graph::NodeBase::get_node_index(), and core::pack::interaction_graph::NodeBase::get_num_incident_edges().

bool core::pack::interaction_graph::PDNode::considering_alternate_state ( ) const
inlineprotected
unsigned int core::pack::interaction_graph::PDNode::count_dynamic_memory ( ) const
overridevirtual
unsigned int core::pack::interaction_graph::PDNode::count_static_memory ( ) const
overridevirtual
core::PackerEnergy core::pack::interaction_graph::PDNode::get_alt_pd_energy_total ( ) const
inlineprotected
int core::pack::interaction_graph::PDNode::get_alternate_state ( ) const
inlineprotected

References alternate_state_.

core::PackerEnergy core::pack::interaction_graph::PDNode::get_curr_pd_energy_total ( ) const
inlineprotected
int core::pack::interaction_graph::PDNode::get_current_state ( ) const

returns the state the node is currently assigned

References current_state_.

Referenced by core::pack::interaction_graph::PDInteractionGraph::print_current_state_assignment().

PDEdge const * core::pack::interaction_graph::PDNode::get_incident_pd_edge ( int  index) const
inlineprivate
PDEdge * core::pack::interaction_graph::PDNode::get_incident_pd_edge ( int  index)
inlineprivate
int core::pack::interaction_graph::PDNode::get_num_states_for_aa_type ( int  aa_type) const

returns the number of states that are of a particular amino acid type

Parameters
aa_type- [in] - the amino acid type in question

References num_states_for_aatype_.

utility::vector1< int > const & core::pack::interaction_graph::PDNode::get_num_states_for_aa_types ( ) const

returns an FArray & with the number of states for each amino acid type

Used by AminoAcidNeighborSparseMatrix. The FArray must persist for as long as any AminoAcidNeighborSparseMatrix points to it.

References num_states_for_aatype_.

Referenced by core::pack::interaction_graph::PDEdge::get_second_node_num_states_per_aa().

core::PackerEnergy core::pack::interaction_graph::PDNode::get_one_body_energy ( int  state) const
overridevirtual
float core::pack::interaction_graph::PDNode::get_one_body_energy_current_state ( ) const

returns the one body energy for the state the node is currently assigned

References curr_state_one_body_energy_.

Referenced by core::pack::interaction_graph::PDInteractionGraph::get_energy_sum_for_vertex_group().

PDInteractionGraph const * core::pack::interaction_graph::PDNode::get_pdig_owner ( ) const
inlineprivate
PDInteractionGraph * core::pack::interaction_graph::PDNode::get_pdig_owner ( )
inlineprivate
SparseMatrixIndex const & core::pack::interaction_graph::PDNode::get_sparse_mat_info_for_curr_state ( ) const

returns the sparse matrix information for the current state

References curr_state_sparse_mat_info_.

SparseMatrixIndex const & core::pack::interaction_graph::PDNode::get_sparse_mat_info_for_state ( int  state) const

returns the sparse matrix information for a paricular state

Parameters
state- [in] - the state whose information is requested

References core::pack::interaction_graph::NodeBase::get_num_states(), and sparse_mat_info_for_state_.

float core::pack::interaction_graph::PDNode::get_weighted_energy_with_higher_indexed_nodes ( ObjexxFCL::FArray2D< core::PackerEnergy > const &  weights) const
PDNode& core::pack::interaction_graph::PDNode::operator= ( PDNode const &  )
private
void core::pack::interaction_graph::PDNode::prepare_for_simulated_annealing ( )
overridevirtual

prepares node for simulated annealing

updates internal edge vector + other vectorized edge information

Implements core::pack::interaction_graph::NodeBase.

References core::pack::interaction_graph::NodeBase::get_edge_vector_up_to_date(), and update_internal_vectors().

void core::pack::interaction_graph::PDNode::print ( ) const
overridevirtual
void core::pack::interaction_graph::PDNode::print_internal_energies ( ) const
float core::pack::interaction_graph::PDNode::project_deltaE_for_substitution ( int  alternate_state,
core::PackerEnergy prev_node_energy 
)
inline

returns the change in energy that would be induced by switching this node from its current state into another state

iterates across the incident edges for a node in two phases: in the first phase, it examines edges leading to higher-indexed nodes in the second phase, it examines edges leading to smaller-indexed nodes. for cache efficiency, all of the amino-acid-neighbor-offset information that each edge calculates is stored on the nodes themselves. The edges are never touched; rather, their private information is stored on the nodes and handed to static member functions of the PDEdge class. This "store edge information on the nodes" strategy gives me performance equivalent to the previous energy2b lookup tables.

Parameters
alternate_state- [in] - the alternate state to consider
previous_energy_for_node- [out] - the old energy1b/energy2b sum for this node; used by simulate annealing.

References aa_offsets_for_edges_, alt_state_sparse_mat_info_, alternate_state_, alternate_state_is_being_considered_, alternate_state_one_body_energy_, alternate_state_total_energy_, alternate_state_two_body_energies_, curr_state_total_energy_, edge_matrix_ptrs_, core::pack::interaction_graph::SparseMatrixIndex::get_aa_type(), get_incident_pd_edge(), core::pack::interaction_graph::NodeBase::get_num_edges_to_smaller_indexed_nodes(), core::pack::interaction_graph::NodeBase::get_num_incident_edges(), core::pack::interaction_graph::SparseMatrixIndex::get_state_ind_for_this_aa_type(), neighbors_curr_state_, neighbors_curr_state_sparse_info_, num_aa_types_, num_states_for_aa_type_for_higher_indexed_neighbor_, num_states_for_aatype_, one_body_energies_, and sparse_mat_info_for_state_.

Referenced by calc_deltaEpd().

void core::pack::interaction_graph::PDNode::project_deltaE_for_substitution ( int  alternate_state,
core::PackerEnergy deltaE_unweighted,
core::PackerEnergy prevE_unweighted,
core::PackerEnergy deltaE_weighted,
core::PackerEnergy prevE_weighted,
ObjexxFCL::FArray2D< core::PackerEnergy > const &  weights 
)

returns the change in weighted energy that would be induced by switching this node from its current state into another state

calls project_deltaE_for_substitution ( the weighted version )

void core::pack::interaction_graph::PDNode::set_alt_aa_offsets_from_edge ( int  edge_index,
ObjexxFCL::FArray2D_int const &  offsets 
)
private
void core::pack::interaction_graph::PDNode::set_alternate_state ( int  alt)
inlineprotected

References alternate_state_.

void core::pack::interaction_graph::PDNode::set_amino_acid_types ( std::vector< int > const &  aatypes_for_state)
virtual

sets the amino acid type for each state

The graph doesn't know anything specific about amino acid types, for instance, nothing specially distinguishes glycine and threonine. The sparse-matrix representation for the PDEdge two-body energy tables requires knowing when two states are of the same amino acid type and when they are different amino acid types.

Parameters
aatypes_for_state- [in] - amino acid type for each state in the node

References core::pack::interaction_graph::NodeBase::get_num_states(), num_states_for_aatype_, and sparse_mat_info_for_state_.

Referenced by core::pack::interaction_graph::PDInteractionGraph::initialize().

bool core::pack::interaction_graph::PDNode::state_unassigned ( ) const
inlineoverridevirtual

Is the current state unassigned (set to the zero or null state)?

Implements core::pack::interaction_graph::NodeBase.

References current_state_.

void core::pack::interaction_graph::PDNode::update_internal_energy_sums ( )
void core::pack::interaction_graph::PDNode::update_internal_vectors ( )
protected

updates bookkeeping arrays that correspond to edge-list.

calls base class update_edge_vector function, and then proceeds to create appropriate bookkeeping arrays used in simulated annealing

It's possible that a derived class created an Edge, but that Edge doesn't have any two body energies. For example, in the HPatchIG, two residues (Nodes) may have SASA overlap, but be outside of the 5.5A energy function cutoff. To handle this case, check the size of the two-body energy table before trying to dereference it. (ronj)

References aa_offsets_for_edges_, alternate_state_two_body_energies_, curr_state_two_body_energies_, edge_matrix_ptrs_, core::pack::interaction_graph::PDEdge::get_edge_table_ptr(), get_incident_pd_edge(), core::pack::interaction_graph::NodeBase::get_index_of_adjacent_node(), core::pack::interaction_graph::NodeBase::get_node_index(), core::pack::interaction_graph::NodeBase::get_num_edges_to_larger_indexed_nodes(), core::pack::interaction_graph::NodeBase::get_num_incident_edges(), core::pack::interaction_graph::PDEdge::get_offsets_for_aatypes(), core::pack::interaction_graph::PDEdge::get_second_node_num_states_per_aa(), core::pack::interaction_graph::PDEdge::get_two_body_table_size(), neighbors_curr_state_, neighbors_curr_state_sparse_info_, num_aa_types_, num_states_for_aa_type_for_higher_indexed_neighbor_, and core::pack::interaction_graph::NodeBase::update_edge_vector().

Referenced by prepare_for_simulated_annealing().

void core::pack::interaction_graph::PDNode::update_one_body_energies ( ObjexxFCL::FArray1< core::PackerEnergy > &  energies)
virtual

set all the one-body energies for this node

Parameters
energies- [in] - the array of energies. Must hold num_states_ entries

References core::pack::interaction_graph::NodeBase::get_num_states(), and one_body_energies_.

void core::pack::interaction_graph::PDNode::update_one_body_energy ( int  state,
core::PackerEnergy  energy 
)
overridevirtual

update energy to the one-body energy for state

Parameters
state- [in] - one-based index of the state
energy- [in] - the energy that should be set.

Implements core::pack::interaction_graph::NodeBase.

References protocols::buns::energy, and one_body_energies_.

void core::pack::interaction_graph::PDNode::zero_one_body_energies ( )
overridevirtual

Member Data Documentation

ObjexxFCL::FArray3D_int core::pack::interaction_graph::PDNode::aa_offsets_for_edges_
private
SparseMatrixIndex core::pack::interaction_graph::PDNode::alt_state_sparse_mat_info_
private
int core::pack::interaction_graph::PDNode::alternate_state_
private
bool core::pack::interaction_graph::PDNode::alternate_state_is_being_considered_
private
core::PackerEnergy core::pack::interaction_graph::PDNode::alternate_state_one_body_energy_
private
core::PackerEnergy core::pack::interaction_graph::PDNode::alternate_state_total_energy_
private
std::vector< core::PackerEnergy > core::pack::interaction_graph::PDNode::alternate_state_two_body_energies_
private
core::PackerEnergy core::pack::interaction_graph::PDNode::curr_state_one_body_energy_
private
SparseMatrixIndex core::pack::interaction_graph::PDNode::curr_state_sparse_mat_info_
private
core::PackerEnergy core::pack::interaction_graph::PDNode::curr_state_total_energy_
private
std::vector< core::PackerEnergy > core::pack::interaction_graph::PDNode::curr_state_two_body_energies_
private
int core::pack::interaction_graph::PDNode::current_state_
private
std::vector< ObjexxFCL::FArray1A< core::PackerEnergy > > core::pack::interaction_graph::PDNode::edge_matrix_ptrs_
private
std::vector< int > core::pack::interaction_graph::PDNode::neighbors_curr_state_
private
std::vector< SparseMatrixIndex > core::pack::interaction_graph::PDNode::neighbors_curr_state_sparse_info_
private
int core::pack::interaction_graph::PDNode::num_aa_types_
private
ObjexxFCL::FArray2D_int core::pack::interaction_graph::PDNode::num_states_for_aa_type_for_higher_indexed_neighbor_
private
utility::vector1< int > core::pack::interaction_graph::PDNode::num_states_for_aatype_
private
std::vector< core::PackerEnergy > core::pack::interaction_graph::PDNode::one_body_energies_
private
std::vector< SparseMatrixIndex > core::pack::interaction_graph::PDNode::sparse_mat_info_for_state_
private

The documentation for this class was generated from the following files: