Rosetta 3.4
Public Member Functions | Static Public Member Functions | Protected Member Functions
core::pack::interaction_graph::PDEdge Class Reference

#include <PDInteractionGraph.hh>

Inheritance diagram for core::pack::interaction_graph::PDEdge:
Inheritance graph
[legend]
Collaboration diagram for core::pack::interaction_graph::PDEdge:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 PDEdge (InteractionGraphBase *owner, int first_node_ind, int second_node_ind)
 main constructor - no default nor copy constructors provided
virtual ~PDEdge ()
 destructor
virtual void set_sparse_aa_info (ObjexxFCL::FArray2_bool const &sparse_conn_info)
virtual void force_aa_neighbors (int node1aa, int node2aa)
 re-allocates two-body energy table after forcing a pair of amino acids to become neighbors that were not initially declared to be neighbors
virtual void force_all_aa_neighbors ()
 re-allocates two-body energy table after forcing a pair of amino acids to become neighbors that were not initially declared to be neighbors
virtual bool get_sparse_aa_info (int node1aa, int node2aa) const
 returns whether two amino acid types are represented as neighbors
virtual void add_to_two_body_energy (int const, int const, core::PackerEnergy const)
 adds the input energy to the two body energy for state1 on the node with the smaller index and state2 on the node with the larger index so long as the amion acid types of those states have been previously declared amino acid neighbors. Any energies for non-neighboring states are ignored.
virtual void add_to_two_body_energies (ObjexxFCL::FArray2< core::PackerEnergy > const &res_res_energy_array)
 Adds all the energies stored in the oversized_res_res_energy array to the two body energy table for those states whose amion acid types were previoudsly declared to be amino-acid neighbors. The res-res array should have the dimension (node1->get_num_states() x node2->get_num_states());.
virtual void set_two_body_energy (int const, int const, core::PackerEnergy const)
 Sets the two-body energy for a pair of states. That is, it overwrites whatever two-body energy there was previously for that state pair with a new energy. Ignores non-neighboring state pairs.
virtual void clear_two_body_energy (int const, int const)
 Sets the two-body energy for a pair of states. That is, it overwrites whatever two-body energy there was previously for that state pair with a new energy. Ignores non-neighboring state pairs.
virtual core::PackerEnergy get_two_body_energy (int const, int const ) const
 returns the two body energy for a pair of states: 0 if those states are not neighbors
virtual void declare_energies_final ()
 When all the energies that are going to be stored in an edge have been placed in it, the edge may save some memory by shrinking its AminoAcidNeighborSparseMatrix. This method instructs the edge to do so.
virtual void prepare_for_simulated_annealing ()
 reduces the size of the pair-energy table if any amino-acid-neighbor submatrices hold nothing but 0's
core::PackerEnergy get_current_two_body_energy ()
 returns the two body energy corresponding to the current states assigned to the nodes this edge is incident upon.
void acknowledge_state_change (int node_ind, int new_state, SparseMatrixIndex const &new_state_sparse_info, core::PackerEnergy &new_energy)
 updates bookkeeping information when one of the two nodes changes its state
void acknowledge_state_zeroed (int node_ind)
 updates bookkeeping information when one of the two nodes enters its "unassigned" state.
void acknowledge_substitution (int substituted_node_index, core::PackerEnergy const curr_state_energy, int nodes_new_state, SparseMatrixIndex const &nodes_new_state_sparse_info)
 update bookkeeping information when one of the nodes an edge is incident upon changes state
ObjexxFCL::FArray2D_int const & get_offsets_for_aatypes ()
 Returns the array of offsets into the sparse two-body energy table for amino-acid neighbors. Used in transferring information from edges onto nodes for cache efficiency.
utility::vector1< int > const & get_second_node_num_states_per_aa ()
 returns an FArray of the number of states for each amino acid type for the higher-indexed node
int get_two_body_table_size () const
 returns the memory usage of the two body energy table for this edge
core::PackerEnergyget_edge_table_ptr ()
 Returns a reference to the first element in the sparse two-body energy table. Used to create a proxy array on the nodes for cache efficiency.
virtual unsigned int count_static_memory () const
virtual unsigned int count_dynamic_memory () const
ObjexxFCL::FArray2D
< core::PackerEnergy
get_aa_submatrix_energies (int node1aa, int node2aa) const
virtual void set_edge_weight (Real weight)

Static Public Member Functions

static core::PackerEnergy get_alternate_state_energy_first_node (int first_node_alt_state, int second_node_orig_state, SparseMatrixIndex const &second_node_orig_state_sparse_info, int first_node_state_offset_minus_1, int second_node_curr_num_states_per_aatype, int aa_neighbor_offset, ObjexxFCL::FArray1< core::PackerEnergy > &edge_energy_table)
 static method that looks up the two body energy when the node with the smaller index on an edge is considering an alternate state
static core::PackerEnergy get_alternate_state_energy_second_node (int first_node_orig_state, int second_node_alt_state, SparseMatrixIndex const &first_node_orig_state_sparse_info, SparseMatrixIndex const &second_node_alternate_state_sparse_info, int second_node_alt_state_num_states_per_aatype, int aa_neighbor_offset, ObjexxFCL::FArray1< core::PackerEnergy > &edge_energy_table)
 static method that looks up the two body energy when the node with the larger index on an edge is considering an alternate state

Protected Member Functions

void declare_energies_final_no_deletion ()
 allow derived class to prep this class for simA, but guarantee no call to delete this;
void prepare_for_simulated_annealing_no_deletion ()
 
  • allow derived class to prep this class for simA, but guarantee no call to delete this;

bool pd_edge_table_all_zeros () const
 

Constructor & Destructor Documentation

core::pack::interaction_graph::PDEdge::PDEdge ( InteractionGraphBase owner,
int  first_node_ind,
int  second_node_ind 
)

main constructor - no default nor copy constructors provided

Parameters:
owner- [in] - pointer to the graph that created this node
first_node_ind- [in] - the index of the smaller-indexed node
second_node_ind- [in] - the index of the larger-indexed node
core::pack::interaction_graph::PDEdge::~PDEdge ( ) [virtual]

destructor


Member Function Documentation

void core::pack::interaction_graph::PDEdge::acknowledge_state_change ( int  node_ind,
int  new_state,
SparseMatrixIndex const &  new_state_sparse_info,
core::PackerEnergy new_energy 
)

updates bookkeeping information when one of the two nodes changes its state

Parameters:
node_ind- [in] - the index of the node that changed its state
node_state- [in] - the index of the new state it assumed
new_state_spare_info- [in] - the sparse-matrix information for the state
new_energy- [out] - the two body energy produced by the new state and the current state on the other node

Referenced by core::pack::interaction_graph::PDNode::assign_state().

void core::pack::interaction_graph::PDEdge::acknowledge_state_zeroed ( int  node_ind)

updates bookkeeping information when one of the two nodes enters its "unassigned" state.

Parameters:
node_ind- [in] - the index of the node that has just entered its 0 state

References core::pack::interaction_graph::EdgeBase::get_edges_position_in_nodes_edge_vector(), core::pack::interaction_graph::EdgeBase::get_node_index(), core::pack::interaction_graph::SparseMatrixIndex::set_aa_type(), and core::pack::interaction_graph::SparseMatrixIndex::set_state_ind_for_this_aa_type().

void core::pack::interaction_graph::PDEdge::acknowledge_substitution ( int  substituted_node_index,
core::PackerEnergy const  curr_state_energy,
int  nodes_new_state,
SparseMatrixIndex const &  nodes_new_state_sparse_info 
) [inline]

update bookkeeping information when one of the nodes an edge is incident upon changes state

Parameters:
substituted_node_index- [in] - index of the node that chagned its state
curr_state_energy- [in] - the two body energy given the new state
nodes_new_state- [in] - the state the node just transitioned into
nodes_new_state_sparse_info- [in] - sparse matrix info for the new state

References core::pack::interaction_graph::EdgeBase::get_edges_position_in_nodes_edge_vector(), and core::pack::interaction_graph::EdgeBase::get_node_index().

Referenced by core::pack::interaction_graph::PDNode::commit_considered_substitution().

virtual void core::pack::interaction_graph::PDEdge::add_to_two_body_energies ( ObjexxFCL::FArray2< core::PackerEnergy > const &  res_res_energy_array) [virtual]

Adds all the energies stored in the oversized_res_res_energy array to the two body energy table for those states whose amion acid types were previoudsly declared to be amino-acid neighbors. The res-res array should have the dimension (node1->get_num_states() x node2->get_num_states());.

Parameters:
res_res_energy_array- [in] - an array containing the state pair energies

Implements core::pack::interaction_graph::PrecomputedPairEnergiesEdge.

void core::pack::interaction_graph::PDEdge::add_to_two_body_energy ( int const  state1,
int const  state2,
core::PackerEnergy const  energy 
) [virtual]

adds the input energy to the two body energy for state1 on the node with the smaller index and state2 on the node with the larger index so long as the amion acid types of those states have been previously declared amino acid neighbors. Any energies for non-neighboring states are ignored.

Implements core::pack::interaction_graph::PrecomputedPairEnergiesEdge.

void core::pack::interaction_graph::PDEdge::clear_two_body_energy ( int const  state1,
int const  state2 
) [virtual]

Sets the two-body energy for a pair of states. That is, it overwrites whatever two-body energy there was previously for that state pair with a new energy. Ignores non-neighboring state pairs.

Parameters:
state1- [in] - state index for the node with the smaller index
state2- [in] - state index for the node with the larger index
energy- [in] - the energy which replaces the old two-body energy

Implements core::pack::interaction_graph::PrecomputedPairEnergiesEdge.

unsigned int core::pack::interaction_graph::PDEdge::count_dynamic_memory ( ) const [virtual]
unsigned int core::pack::interaction_graph::PDEdge::count_static_memory ( ) const [virtual]
void core::pack::interaction_graph::PDEdge::declare_energies_final ( ) [virtual]

When all the energies that are going to be stored in an edge have been placed in it, the edge may save some memory by shrinking its AminoAcidNeighborSparseMatrix. This method instructs the edge to do so.

Implements core::pack::interaction_graph::EdgeBase.

References prepare_for_simulated_annealing().

void core::pack::interaction_graph::PDEdge::declare_energies_final_no_deletion ( ) [protected]

allow derived class to prep this class for simA, but guarantee no call to delete this;

References prepare_for_simulated_annealing_no_deletion().

void core::pack::interaction_graph::PDEdge::force_aa_neighbors ( int  node1aa,
int  node2aa 
) [virtual]

re-allocates two-body energy table after forcing a pair of amino acids to become neighbors that were not initially declared to be neighbors

Parameters:
node1aa- [in] - the amino acid type for the node with the smaller index
node2aa- [in] - the amino acid type for the node with the larger index

Implements core::pack::interaction_graph::FixedBBEdge.

References core::pack::interaction_graph::AminoAcidNeighborSparseMatrix< T >::force_aa_neighbors().

void core::pack::interaction_graph::PDEdge::force_all_aa_neighbors ( ) [virtual]

re-allocates two-body energy table after forcing a pair of amino acids to become neighbors that were not initially declared to be neighbors

Parameters:
node1aa- [in] - the amino acid type for the node with the smaller index
node2aa- [in] - the amino acid type for the node with the larger index

Implements core::pack::interaction_graph::FixedBBEdge.

References core::pack::interaction_graph::AminoAcidNeighborSparseMatrix< T >::force_all_aa_neighbors().

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

ObjexxFCL::FArray2D< core::PackerEnergy > core::pack::interaction_graph::PDEdge::get_aa_submatrix_energies ( int  node1aa,
int  node2aa 
) const
float core::pack::interaction_graph::PDEdge::get_alternate_state_energy_first_node ( int  first_node_alt_state,
int  second_node_orig_state,
SparseMatrixIndex const &  second_node_orig_state_sparse_info,
int  first_node_state_offset_minus_1,
int  second_node_curr_num_states_per_aatype,
int  aa_neighbor_offset,
ObjexxFCL::FArray1< core::PackerEnergy > &  edge_energy_table 
) [inline, static]

static method that looks up the two body energy when the node with the smaller index on an edge is considering an alternate state

Parameters:
first_node_alt_state- [in] - the alternate state for the lower-indexed node
second_node_orig_state- [in] - the current state for the higher-indexed node
second_node_orig_state_sparse_info- [in] - the sparse matrix info for the higher-indexed node
first_node_state_offset_minus_1- [in] - part of the sparse matrix info for the lower-indexed node where 1 is subtracted from the state offset.
second_node_num_states_per_aatype- [in] - number of states with current aa type for node 2
aa_neighbor_offset- [in] - offset for the amino-acid neighbor pair for the sparse two-body energy table
edge_energy_table- [in] - the proxy FArray pointing at the edge table connecting the two nodes.
float core::pack::interaction_graph::PDEdge::get_alternate_state_energy_second_node ( int  first_node_orig_state,
int  second_node_alt_state,
SparseMatrixIndex const &  first_node_orig_state_sparse_info,
SparseMatrixIndex const &  second_node_alternate_state_sparse_info,
int  second_node_alt_state_num_states_per_aatype,
int  aa_neighbor_offset,
ObjexxFCL::FArray1< core::PackerEnergy > &  edge_energy_table 
) [inline, static]

static method that looks up the two body energy when the node with the larger index on an edge is considering an alternate state

Parameters:
first_node_orig_state- [in] - the current state for the lower-indexed node
second_node_alt_state- [in] - the alt state for the higher-indexed node
first_node_orig_state_sparse_info- [in] - the sparse matrix info for the lower-indexed node
second_node_alt_state_sparse_info- [in] - the sparse matrix info for the higher-indexed node
first_node_state_offset_minus_1- [in] - part of the sparse matrix info for the lower-indexed node where 1 is subtracted from the state offset.
second_node_alt_state_num_states_per_aatype- [in] - number of states with alternate aa type for node 2
aa_neighbor_offset- [in] - offset for the amino-acid neighbor pair for the sparse two-body energy table
edge_energy_table- [in] - the proxy FArray pointing at the edge table connecting the two nodes.
float core::pack::interaction_graph::PDEdge::get_current_two_body_energy ( )

returns the two body energy corresponding to the current states assigned to the nodes this edge is incident upon.

Referenced by core::pack::interaction_graph::PDNode::update_internal_energy_sums().

float & core::pack::interaction_graph::PDEdge::get_edge_table_ptr ( )

Returns a reference to the first element in the sparse two-body energy table. Used to create a proxy array on the nodes for cache efficiency.

References core::pack::interaction_graph::AminoAcidNeighborSparseMatrix< T >::getMatrixPointer().

Referenced by core::pack::interaction_graph::PDNode::update_internal_vectors().

FArray2D_int const & core::pack::interaction_graph::PDEdge::get_offsets_for_aatypes ( )

Returns the array of offsets into the sparse two-body energy table for amino-acid neighbors. Used in transferring information from edges onto nodes for cache efficiency.

References core::pack::interaction_graph::AminoAcidNeighborSparseMatrix< T >::getAANeighborOffsets().

Referenced by core::pack::interaction_graph::PDNode::update_internal_vectors().

utility::vector1< int > const & core::pack::interaction_graph::PDEdge::get_second_node_num_states_per_aa ( )

returns an FArray of the number of states for each amino acid type for the higher-indexed node

References core::pack::interaction_graph::PDNode::get_num_states_for_aa_types().

Referenced by core::pack::interaction_graph::PDNode::update_internal_vectors().

bool core::pack::interaction_graph::PDEdge::get_sparse_aa_info ( int  node1aa,
int  node2aa 
) const [virtual]

returns whether two amino acid types are represented as neighbors

Implements core::pack::interaction_graph::FixedBBEdge.

References core::pack::interaction_graph::AminoAcidNeighborSparseMatrix< T >::get_sparse_aa_info().

float core::pack::interaction_graph::PDEdge::get_two_body_energy ( int const  state1,
int const  state2 
) const [virtual]

returns the two body energy for a pair of states: 0 if those states are not neighbors

Parameters:
state1- [in] - state index for the node with the smaller index
state2- [in] - state index for the node with the larger index

Implements core::pack::interaction_graph::FixedBBEdge.

References core::pack::interaction_graph::AminoAcidNeighborSparseMatrix< T >::get().

Referenced by protocols::enzdes::EnzdesFlexibleRegion::calculate_rotamer_set_design_targets_partition_sum().

int core::pack::interaction_graph::PDEdge::get_two_body_table_size ( ) const

returns the memory usage of the two body energy table for this edge

References core::pack::interaction_graph::AminoAcidNeighborSparseMatrix< T >::get_table_size().

Referenced by core::pack::interaction_graph::PDNode::update_internal_vectors().

bool core::pack::interaction_graph::PDEdge::pd_edge_table_all_zeros ( ) const [protected]

References core::pack::interaction_graph::AminoAcidNeighborSparseMatrix< T >::get_table_size().

void core::pack::interaction_graph::PDEdge::prepare_for_simulated_annealing ( ) [virtual]

reduces the size of the pair-energy table if any amino-acid-neighbor submatrices hold nothing but 0's

since the drop_zero_submatrices_where_possible() method of the AANSM is somewhat time consuming, and since it can only reduce memory use / simA running time on the first execution following an update to the two-body energies, the PDEdge member variable energies_updated_since_last_prep_ for_simA ensures that the AANSM method is only called once following the update of any RPEs.

Implements core::pack::interaction_graph::EdgeBase.

References core::pack::interaction_graph::AminoAcidNeighborSparseMatrix< T >::get_table_size(), and prepare_for_simulated_annealing_no_deletion().

Referenced by declare_energies_final().

void core::pack::interaction_graph::PDEdge::prepare_for_simulated_annealing_no_deletion ( ) [protected]

  • allow derived class to prep this class for simA, but guarantee no call to delete this;

References core::pack::interaction_graph::AminoAcidNeighborSparseMatrix< T >::drop_zero_submatrices_where_possible().

Referenced by declare_energies_final_no_deletion(), and prepare_for_simulated_annealing().

void core::pack::interaction_graph::PDEdge::set_edge_weight ( Real  weight) [virtual]

DANGER: If for some reason one were to reweight edges during simulated annealing then some of the cached energies in the adjacent nodes would be out-of-date; data integrity would be violated an all hell would break loose. The same thing is true if one were to change the energies on any edge during simulated annealing. One simple solution: call blanket_assign_state0 to wipe all cahced energies stored on nodes and then assign_network_state to the state just before the reweighting. Of course, since the annealer itself is tracking the "best" network state, one would have to worry about its data integrity as well. General advice: don't change energies during simA.

Implements core::pack::interaction_graph::EdgeBase.

References core::pack::interaction_graph::EdgeBase::edge_weight(), and core::pack::interaction_graph::AminoAcidNeighborSparseMatrix< T >::scale().

virtual void core::pack::interaction_graph::PDEdge::set_sparse_aa_info ( ObjexxFCL::FArray2_bool const &  sparse_conn_info) [virtual]
void core::pack::interaction_graph::PDEdge::set_two_body_energy ( int const  state1,
int const  state2,
core::PackerEnergy const  energy 
) [virtual]

Sets the two-body energy for a pair of states. That is, it overwrites whatever two-body energy there was previously for that state pair with a new energy. Ignores non-neighboring state pairs.

Parameters:
state1- [in] - state index for the node with the smaller index
state2- [in] - state index for the node with the larger index
energy- [in] - the energy which replaces the old two-body energy

Implements core::pack::interaction_graph::PrecomputedPairEnergiesEdge.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines