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

#include <FASTERInteractionGraph.hh>

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

Public Types

typedef PrecomputedPairEnergiesNode parent
 

Public Member Functions

 FASTERNode (InteractionGraphBase *owner, int node_id, int num_states)
 main constructor, no default or copy constructors More...
 
 ~FASTERNode () override
 destructor More...
 
void print () const override
 prints a description of the node and all of it's one-body energies 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
 sets all of the one-body energies for this node 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 prepare_for_FASTER ()
 
void assign_zero_state () override
 assigns node's state to it's zero, or "unassigned" state. More...
 
bool state_unassigned () const override
 
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 acknowledge_neighbors_state_substitution (int edge_to_altered_neighbor, core::PackerEnergy new_edge_energy, int other_node_new_state)
 updates bookkeeping arrays for when a neighbor has changed its state 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
 If FASTERNode is the most-derived class being used, then this function will be called and will return the amount of memory statically allocated by a single FASTERNode. More...
 
unsigned int count_dynamic_memory () const override
 Called either by the IGBase if the FASTERNode is the most-derived class, or called recursively by a derived class. Called to account for the dynamically allocated memory that this node uses. More...
 
void get_total_energy_in_curr_state_assignment_for_all_states ()
 
void partial_assign_state_with_lowest_one_body_energy ()
 
void partial_assign_relaxed_state (Real probability)
 
void partial_assign_state (int state)
 
void acknowledge_neighbors_partial_state_assignment (int which_neighbor, int neighbors_new_state)
 
void complete_partial_state_assignment ()
 
void acknowledge_neighbors_perturbed_state (int which_neighbor, int const neighbors_perturbed_state)
 
void prepare_for_perturbation ()
 
void set_no_longer_perturbed ()
 
void set_perturbed_state (int perturbed_state)
 
void relax_neighbors ()
 
void relax ()
 
void reset_relaxed_for_neighbors ()
 
void reset_relaxed ()
 
void tell_neighbors_to_prep_for_relaxation ()
 
void prep_for_neighbors_perturbation ()
 
void relax_after_neighbors_perturbation ()
 
core::PackerEnergy get_deltaE_for_relaxed_state_following_perturbation ()
 
core::PackerEnergy get_one_body_energy_for_relaxed_state () const
 
int get_relaxed_state () const
 
int get_random_neighbor ()
 
- 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...
 
FASTEREdge const * get_incident_faster_edge (int index) const
 
FASTEREdgeget_incident_faster_edge (int index)
 
FASTERNode const * get_adjacent_faster_node (int index) const
 
FASTERNodeget_adjacent_faster_node (int index)
 
FASTERInteractionGraph const * get_fasterig_owner () const
 
FASTERInteractionGraphget_fasterig_owner ()
 
- 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

 FASTERNode ()
 
 FASTERNode (FASTERNode const &)
 
FASTERNodeoperator= (FASTERNode const &)
 

Private Attributes

std::vector< core::PackerEnergyone_body_energies_
 
std::vector< int > neighbors_curr_state_
 
std::vector
< ObjexxFCL::FArray2A
< core::PackerEnergy > > 
edge_matrix_ptrs_
 
int current_state_
 
core::PackerEnergy curr_state_one_body_energy_
 
core::PackerEnergy curr_state_total_energy_
 
std::vector< core::PackerEnergycurr_state_two_body_energies_
 
int alternate_state_
 
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_
 
bool have_prepared_once_for_FASTER_
 
bool in_FASTER_mode_
 
bool perturbed_
 
bool have_relaxed_since_neighbors_perturbation_
 
bool have_contributed_deltaE_following_perturbation_
 
int relaxed_state_
 
std::vector< core::PackerEnergystate_energies_in_current_state_assignment_
 
std::vector< core::PackerEnergystate_energies_in_current_context_
 
std::vector< boolneighbor_relaxed_in_sBR_
 
std::vector< core::PackerEnergyperturbed_two_body_energies_
 

Friends

class ::FASTERInteractionGraphTests
 

Member Typedef Documentation

Constructor & Destructor Documentation

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

main constructor, no default or copy constructors

allocates one-body energy array and initializes it to zero.

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

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::FASTERNode::FASTERNode ( )
private

Referenced by count_static_memory().

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

Member Function Documentation

void core::pack::interaction_graph::FASTERNode::acknowledge_neighbors_partial_state_assignment ( int  which_neighbor,
int  neighbors_new_state 
)
void core::pack::interaction_graph::FASTERNode::acknowledge_neighbors_perturbed_state ( int  which_neighbor,
int const  neighbors_perturbed_state 
)
void core::pack::interaction_graph::FASTERNode::acknowledge_neighbors_state_substitution ( int  edge_to_altered_neighbor,
core::PackerEnergy  new_edge_energy,
int  other_node_new_state 
)
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

References curr_state_total_energy_, curr_state_two_body_energies_, and neighbors_curr_state_.

Referenced by core::pack::interaction_graph::FASTEREdge::acknowledge_state_zeroed(), and core::pack::interaction_graph::FASTEREdge::acknowledge_substitution().

void core::pack::interaction_graph::FASTERNode::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::FASTERNode::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::FASTERNode::assign_state ( int  new_state)
void core::pack::interaction_graph::FASTERNode::assign_zero_state ( )
overridevirtual
void core::pack::interaction_graph::FASTERNode::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::FASTEREdge::acknowledge_substitution(), 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_total_energy_, curr_state_two_body_energies_, current_state_, get_incident_faster_edge(), core::pack::interaction_graph::NodeBase::get_node_index(), core::pack::interaction_graph::NodeBase::get_num_incident_edges(), and relaxed_state_.

void core::pack::interaction_graph::FASTERNode::complete_partial_state_assignment ( )
unsigned int core::pack::interaction_graph::FASTERNode::count_dynamic_memory ( ) const
overridevirtual
unsigned int core::pack::interaction_graph::FASTERNode::count_static_memory ( ) const
overridevirtual

If FASTERNode is the most-derived class being used, then this function will be called and will return the amount of memory statically allocated by a single FASTERNode.

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

References FASTERNode().

FASTERNode const * core::pack::interaction_graph::FASTERNode::get_adjacent_faster_node ( int  index) const
inlineprotected
FASTERNode * core::pack::interaction_graph::FASTERNode::get_adjacent_faster_node ( int  index)
inlineprotected
int core::pack::interaction_graph::FASTERNode::get_current_state ( ) const
core::PackerEnergy core::pack::interaction_graph::FASTERNode::get_deltaE_for_relaxed_state_following_perturbation ( )
FASTERInteractionGraph const * core::pack::interaction_graph::FASTERNode::get_fasterig_owner ( ) const
inlineprotected
FASTERInteractionGraph * core::pack::interaction_graph::FASTERNode::get_fasterig_owner ( )
inlineprotected
FASTEREdge const * core::pack::interaction_graph::FASTERNode::get_incident_faster_edge ( int  index) const
inlineprotected
FASTEREdge * core::pack::interaction_graph::FASTERNode::get_incident_faster_edge ( int  index)
inlineprotected
core::PackerEnergy core::pack::interaction_graph::FASTERNode::get_one_body_energy ( int  state) const
overridevirtual
core::PackerEnergy core::pack::interaction_graph::FASTERNode::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::FASTERInteractionGraph::get_energy_sum_for_vertex_group().

core::PackerEnergy core::pack::interaction_graph::FASTERNode::get_one_body_energy_for_relaxed_state ( ) const
int core::pack::interaction_graph::FASTERNode::get_random_neighbor ( )
int core::pack::interaction_graph::FASTERNode::get_relaxed_state ( ) const

References relaxed_state_.

void core::pack::interaction_graph::FASTERNode::get_total_energy_in_curr_state_assignment_for_all_states ( )
FASTERNode& core::pack::interaction_graph::FASTERNode::operator= ( FASTERNode const &  )
private
void core::pack::interaction_graph::FASTERNode::partial_assign_relaxed_state ( Real  probability)
void core::pack::interaction_graph::FASTERNode::partial_assign_state ( int  state)
void core::pack::interaction_graph::FASTERNode::partial_assign_state_with_lowest_one_body_energy ( )
void core::pack::interaction_graph::FASTERNode::prep_for_neighbors_perturbation ( )
void core::pack::interaction_graph::FASTERNode::prepare_for_FASTER ( )
void core::pack::interaction_graph::FASTERNode::prepare_for_perturbation ( )
void core::pack::interaction_graph::FASTERNode::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(), in_FASTER_mode_, and update_internal_vectors().

void core::pack::interaction_graph::FASTERNode::print ( ) const
overridevirtual
void core::pack::interaction_graph::FASTERNode::print_internal_energies ( ) const
core::PackerEnergy core::pack::interaction_graph::FASTERNode::project_deltaE_for_substitution ( int  alternate_state,
core::PackerEnergy prev_energy_for_node 
)
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 DensePDEdge 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 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::FASTEREdge::get_alternate_state_energy(), core::pack::interaction_graph::NodeBase::get_num_edges_to_smaller_indexed_nodes(), core::pack::interaction_graph::NodeBase::get_num_incident_edges(), neighbors_curr_state_, and one_body_energies_.

void core::pack::interaction_graph::FASTERNode::relax ( )
void core::pack::interaction_graph::FASTERNode::relax_after_neighbors_perturbation ( )
void core::pack::interaction_graph::FASTERNode::relax_neighbors ( )
void core::pack::interaction_graph::FASTERNode::reset_relaxed ( )
void core::pack::interaction_graph::FASTERNode::reset_relaxed_for_neighbors ( )
void core::pack::interaction_graph::FASTERNode::set_no_longer_perturbed ( )
void core::pack::interaction_graph::FASTERNode::set_perturbed_state ( int  perturbed_state)
bool core::pack::interaction_graph::FASTERNode::state_unassigned ( ) const
inlineoverridevirtual
void core::pack::interaction_graph::FASTERNode::tell_neighbors_to_prep_for_relaxation ( )
void core::pack::interaction_graph::FASTERNode::update_internal_energy_sums ( )
void core::pack::interaction_graph::FASTERNode::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

References alternate_state_two_body_energies_, curr_state_two_body_energies_, edge_matrix_ptrs_, get_incident_faster_edge(), core::pack::interaction_graph::NodeBase::get_num_incident_edges(), neighbors_curr_state_, and core::pack::interaction_graph::NodeBase::update_edge_vector().

Referenced by prepare_for_FASTER(), and prepare_for_simulated_annealing().

void core::pack::interaction_graph::FASTERNode::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::FASTERNode::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::FASTERNode::zero_one_body_energies ( )
overridevirtual

sets all of the one-body energies for this node to zero

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

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

Friends And Related Function Documentation

friend class ::FASTERInteractionGraphTests
friend

Member Data Documentation

int core::pack::interaction_graph::FASTERNode::alternate_state_
private
bool core::pack::interaction_graph::FASTERNode::alternate_state_is_being_considered_
private
core::PackerEnergy core::pack::interaction_graph::FASTERNode::alternate_state_one_body_energy_
private
core::PackerEnergy core::pack::interaction_graph::FASTERNode::alternate_state_total_energy_
private
std::vector< core::PackerEnergy > core::pack::interaction_graph::FASTERNode::alternate_state_two_body_energies_
private
core::PackerEnergy core::pack::interaction_graph::FASTERNode::curr_state_one_body_energy_
private
core::PackerEnergy core::pack::interaction_graph::FASTERNode::curr_state_total_energy_
private
std::vector< core::PackerEnergy > core::pack::interaction_graph::FASTERNode::curr_state_two_body_energies_
private
int core::pack::interaction_graph::FASTERNode::current_state_
private
std::vector< ObjexxFCL::FArray2A< core::PackerEnergy > > core::pack::interaction_graph::FASTERNode::edge_matrix_ptrs_
private
bool core::pack::interaction_graph::FASTERNode::have_contributed_deltaE_following_perturbation_
private
bool core::pack::interaction_graph::FASTERNode::have_prepared_once_for_FASTER_
private

Referenced by prepare_for_FASTER().

bool core::pack::interaction_graph::FASTERNode::have_relaxed_since_neighbors_perturbation_
private
bool core::pack::interaction_graph::FASTERNode::in_FASTER_mode_
private
std::vector< bool > core::pack::interaction_graph::FASTERNode::neighbor_relaxed_in_sBR_
private
std::vector< int > core::pack::interaction_graph::FASTERNode::neighbors_curr_state_
private
std::vector< core::PackerEnergy > core::pack::interaction_graph::FASTERNode::one_body_energies_
private
bool core::pack::interaction_graph::FASTERNode::perturbed_
private
std::vector< core::PackerEnergy > core::pack::interaction_graph::FASTERNode::perturbed_two_body_energies_
private
int core::pack::interaction_graph::FASTERNode::relaxed_state_
private
std::vector< core::PackerEnergy > core::pack::interaction_graph::FASTERNode::state_energies_in_current_context_
private
std::vector< core::PackerEnergy > core::pack::interaction_graph::FASTERNode::state_energies_in_current_state_assignment_
private

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