Rosetta 3.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
LazyInteractionGraph.cc
Go to the documentation of this file.
1 // -*- mode:c++;tab-width:2;indent-tabs-mode:t;show-trailing-whitespace:t;rm-trailing-spaces:t -*-
2 // vi: set ts=2 noet:
3 //
4 // (c) Copyright Rosetta Commons Member Institutions.
5 // (c) This file is part of the Rosetta software suite and is made available under license.
6 // (c) The Rosetta software is developed by the contributing members of the Rosetta Commons.
7 // (c) For more information, see http://www.rosettacommons.org. Questions about this can be
8 // (c) addressed to University of Washington UW TechTransfer, email: license@u.washington.edu.
9 
10 /// @file core/pack/interaction_graph/LazyInteractionGraph.cc
11 /// @brief Interaction graph that computes each rotamer pair energy at most once
12 /// @author Andrew Leaver-Fay (aleaverfay@gmail.com)
13 
14 /// Unit headers
16 
17 /// C++ headers
18 #include <iostream>
19 
20 #include <utility/vector1.hh>
21 
22 
23 namespace core {
24 namespace pack {
25 namespace interaction_graph {
26 
27 
28 ////////////////////////////////////////////////////////////////////////////////
29 /// @begin LazyNode::(InteractionGraphBase *, int, int)
30 ///
31 /// @brief
32 /// main constructor, no default or copy constructors
33 ///
34 /// @detailed
35 ///
36 /// @param
37 ///
38 /// @global_read
39 ///
40 /// @global_write
41 ///
42 /// @remarks
43 ///
44 /// @references
45 ///
46 /// @authors apl
47 ///
48 /// @last_modified
49 ////////////////////////////////////////////////////////////////////////////////
51  InteractionGraphBase * owner,
52  int node_id,
53  int num_states
54 ) :
55  OnTheFlyNode( owner, node_id, num_states ),
56  current_state_( 0 ),
57  curr_state_one_body_energy_( 0.0f ),
58  curr_state_total_energy_( 0.0f ),
59  alternate_state_( 0 ),
60  alternate_state_one_body_energy_( 0 ),
61  alternate_state_total_energy_( 0 ),
62  alternate_state_is_being_considered_( false ),
63  procrastinated_( false )
64 {
65 }
66 
67 ////////////////////////////////////////////////////////////////////////////////
68 /// @begin LazyNode::~LazyNode()
69 ///
70 /// @brief
71 ///
72 /// @detailed
73 ///
74 /// @param
75 ///
76 /// @global_read
77 ///
78 /// @global_write
79 ///
80 /// @remarks
81 ///
82 /// @references
83 ///
84 /// @authors apl
85 ///
86 /// @last_modified
87 ////////////////////////////////////////////////////////////////////////////////
89 {}
90 
91 ////////////////////////////////////////////////////////////////////////////////
92 /// @begin LazyNode::prepare_for_simulated_annealing
93 ///
94 /// @brief
95 ///
96 /// @detailed
97 ///
98 /// @param
99 ///
100 /// @global_read
101 ///
102 /// @global_write
103 ///
104 /// @remarks
105 ///
106 /// @references
107 ///
108 /// @authors apl
109 ///
110 /// @last_modified
111 ////////////////////////////////////////////////////////////////////////////////
112 void
114 {
116  /*for (int ii = 1; ii <= get_num_states(); ++ii) {
117  mark_coordinates_current( ii ); /// What did this used to to?
118  }*/
119  return;
120 }
121 
122 ////////////////////////////////////////////////////////////////////////////////
123 /// @begin LazyNode::print
124 ///
125 /// @brief
126 ///
127 /// @detailed
128 ///
129 /// @param
130 ///
131 /// @global_read
132 ///
133 /// @global_write
134 ///
135 /// @remarks
136 ///
137 /// @references
138 ///
139 /// @authors apl
140 ///
141 /// @last_modified
142 ////////////////////////////////////////////////////////////////////////////////
143 void
145 {
146 
147  std::cout << "LazyNode " << get_node_index() << " with " << get_num_states() << " states" << std::endl;
148  std::cout << "curr_state " << current_state_ << " ";
149  std::cout << "curr_state_sparse_mat_info_ ";
150  std::cout << curr_state_sparse_mat_info_.get_aa_type() << " ";
152  std::cout << "Curr One Body Energy: " << curr_state_one_body_energy_ << std::endl;
153  std::cout << "Curr Two Body Energies:";
154  for (int ii = 1; ii <= get_num_incident_edges(); ++ii) {
155  std::cout << " " << get_index_of_adjacent_node(ii) << ":" << curr_state_two_body_energies_[ ii ];
156  }
157  std::cout << std::endl;
158 
159  if ( ! alternate_state_is_being_considered_ ) return;
160  std::cout << "Alt One Body Energy: " << alternate_state_one_body_energy_ << std::endl;
161  std::cout << "Alt Two Body Energies:";
162  for (int ii = 1; ii <= get_num_incident_edges(); ++ii) {
163  std::cout << " " << get_index_of_adjacent_node(ii) << ":" << alternate_state_two_body_energies_[ ii ];
164  }
165  std::cout << std::endl << "-----------------" << std::endl;
166 
167 
168 }
169 
170 ////////////////////////////////////////////////////////////////////////////////
171 /// @begin LazyNode::getMemoryUsageInBytes
172 ///
173 /// @brief
174 ///
175 /// @detailed
176 ///
177 /// @param
178 ///
179 /// @global_read
180 ///
181 /// @global_write
182 ///
183 /// @remarks
184 ///
185 /// @references
186 ///
187 /// @authors apl
188 ///
189 /// @last_modified
190 ////////////////////////////////////////////////////////////////////////////////
191 
192 unsigned int
194 {
195  return sizeof( LazyNode );
196 }
197 
198 unsigned int
200 {
201  unsigned int total_memory = OnTheFlyNode::count_dynamic_memory();
202 
203  total_memory += neighbors_curr_state_.size() * sizeof (int );
204 
205  total_memory += aa_offsets_for_edges_.size() * sizeof( int );
206  total_memory += num_states_for_aa_type_for_higher_indexed_neighbor_.size() * sizeof( int );
207  total_memory += neighbors_curr_state_.size() * sizeof( int );
208  total_memory += neighbors_curr_state_sparse_info_.size() * sizeof( SparseMatrixIndex );
209  total_memory += edge_matrix_ptrs_.size() * sizeof( FArray1A< core::PackerEnergy > );
210 
211  total_memory += curr_state_two_body_energies_.size() * sizeof( core::PackerEnergy );
212  total_memory += alternate_state_two_body_energies_.size() * sizeof( core::PackerEnergy );
213 
214  return total_memory;
215 }
216 
217 int
218 LazyNode::aatype_for_state( int state ) const
219 {
220  return get_sparse_mat_info_for_state( state ).get_aa_type();
221 }
222 
223 ////////////////////////////////////////////////////////////////////////////////
224 /// @begin LazyNode::assign_zero_state
225 ///
226 /// @brief
227 ///
228 /// @detailed
229 ///
230 /// @param
231 ///
232 /// @global_read
233 ///
234 /// @global_write
235 ///
236 /// @remarks
237 ///
238 /// @references
239 ///
240 /// @authors apl
241 ///
242 /// @last_modified
243 ////////////////////////////////////////////////////////////////////////////////
244 void
246 {
247  current_state_ = 0;
248  alternate_state_ = 0;
250 
252  //fills from [1] to end
253  std::vector< core::PackerEnergy >::iterator position1 = curr_state_two_body_energies_.begin();
254  ++position1;
255  std::fill( position1, curr_state_two_body_energies_.end(), core::PackerEnergy( 0.0 ));
257 
258  for (int ii = 1; ii <= get_num_incident_edges(); ++ii ) {
260  }
261 
262  return;
263 }
264 
265 ////////////////////////////////////////////////////////////////////////////////
266 /// @begin LazyNode::assign_state
267 ///
268 /// @brief
269 ///
270 /// @detailed
271 ///
272 /// @param
273 ///
274 /// @global_read
275 ///
276 /// @global_write
277 ///
278 /// @remarks
279 ///
280 /// @references
281 ///
282 /// @authors apl
283 ///
284 /// @last_modified
285 ////////////////////////////////////////////////////////////////////////////////
286 void
288 {
289  assert( new_state >= 0 && new_state <= get_num_states());
290 
291  if (new_state == 0) {
293  } else {
294  //std::cout << "assign_state: node - " << get_node_index() <<
295  // " new state " << new_state << "...";
296  current_state_ = new_state;
301 
302  for (int ii = 1; ii <= get_num_incident_edges(); ++ii ) {
304  get_node_index(),
308 
310  }
311  //std::cout<< "..done" << std::endl;
312  }
313  return;
314 }
315 
316 ////////////////////////////////////////////////////////////////////////////////
317 /// @begin LazyNode::partial_assign_state
318 ///
319 /// @brief
320 ///
321 /// @detailed
322 ///
323 /// @param
324 ///
325 /// @global_read
326 ///
327 /// @global_write
328 ///
329 /// @remarks
330 ///
331 /// @references
332 ///
333 /// @authors apl
334 ///
335 /// @last_modified
336 ////////////////////////////////////////////////////////////////////////////////
337 void
339 {
340  if (new_state == 0 ) {
342  return;
343  }
344 
345  current_state_ = new_state;
348  for (int ii = 1; ii <= get_num_incident_edges(); ++ii ) {
350  get_node_index(),
353  }
355 }
356 
357 
358 ////////////////////////////////////////////////////////////////////////////////
359 /// @begin LazyNode::complete_state_assignment
360 ///
361 /// @brief
362 ///
363 /// @detailed
364 ///
365 /// @param
366 ///
367 /// @global_read
368 ///
369 /// @global_write
370 ///
371 /// @remarks
372 ///
373 /// @references
374 ///
375 /// @authors apl
376 ///
377 /// @last_modified
378 ////////////////////////////////////////////////////////////////////////////////
380 {
381  if ( current_state_ == 0 ) return;
382 
385  for (int ii = 1; ii <= get_num_incident_edges(); ++ii) {
387  get_incident_lazy_edge( ii )->
388  get_energy_following_partial_state_assignment();
390  }
391 }
392 
393 
394 
395 ////////////////////////////////////////////////////////////////////////////////
396 /// @begin LazyNode::commit_considered_substitution
397 ///
398 /// @brief
399 ///
400 /// @detailed
401 ///
402 /// @param
403 ///
404 /// @global_read
405 ///
406 /// @global_write
407 ///
408 /// @remarks
409 ///
410 /// @references
411 ///
412 /// @authors apl
413 ///
414 /// @last_modified
415 ////////////////////////////////////////////////////////////////////////////////
416 void
418 {
420 
425 
426  //copies from [1] to end
427  std::vector< core::PackerEnergy >::iterator alt_position1 = alternate_state_two_body_energies_.begin();
428  ++alt_position1;
429  std::vector< core::PackerEnergy >::iterator curr_position1 = curr_state_two_body_energies_.begin();
430  ++curr_position1;
431 
432  std::copy( alt_position1,
434  curr_position1 );
435 
436  //if ( procrastinated_ )
437  //{
438  // curr_state_total_energy_ = curr_state_one_body_energy_;
439  // for (int ii = 1; ii <= get_num_incident_edges(); ++ii)
440  // {
441  // if ( curr_state_two_body_energies_[ ii ] == LazyEdge::NOT_YET_COMPUTED_ENERGY )
442  // {
443  // curr_state_two_body_energies_[ ii ] = compute_pair_energy_for_current_state( ii );
444  // }
445  // curr_state_total_energy_ += curr_state_two_body_energies_[ ii ];
446  // }
447  // procrastinated_ = false;
448  // ++num_procrastinated_committed;
449  //}
450 
451 
452  for ( int ii = 1; ii <= get_num_incident_edges(); ++ii ) {
454  get_node_index(),
458  );
459  }
460 
462  return;
463 }
464 
465 ////////////////////////////////////////////////////////////////////////////////
466 /// @begin LazyNode::compute_pair_energy_for_current_state
467 ///
468 /// @brief
469 ///
470 /// @detailed
471 ///
472 /// @param
473 ///
474 /// @global_read
475 ///
476 /// @global_write
477 ///
478 /// @remarks
479 ///
480 /// @references
481 ///
482 /// @authors apl
483 ///
484 /// @last_modified
485 ////////////////////////////////////////////////////////////////////////////////
488  int edge_making_energy_request
489 )
490 {
492  edge_making_energy_request,
494  neighbors_curr_state_[ edge_making_energy_request ]
495  );
496 }
497 
498 ////////////////////////////////////////////////////////////////////////////////
499 /// @begin LazyNode::acknowledge_neighbors_partial_state_substitution
500 ///
501 /// @brief
502 ///
503 /// @detailed
504 ///
505 /// @param
506 ///
507 /// @global_read
508 ///
509 /// @global_write
510 ///
511 /// @remarks
512 ///
513 /// @references
514 ///
515 /// @authors apl
516 ///
517 /// @last_modified
518 ////////////////////////////////////////////////////////////////////////////////
519 void
521  int edge_to_altered_neighbor,
522  int other_node_new_state,
523  SparseMatrixIndex const & other_node_new_state_sparse_info
524 )
525 {
527  curr_state_two_body_energies_[ edge_to_altered_neighbor ] = 0;
528  neighbors_curr_state_[ edge_to_altered_neighbor ] = other_node_new_state;
529  neighbors_curr_state_sparse_info_[ edge_to_altered_neighbor ] =
530  other_node_new_state_sparse_info;
531 }
532 
533 
534 ////////////////////////////////////////////////////////////////////////////////
535 /// @begin LazyNode::print_internal_energies
536 ///
537 /// @brief
538 ///
539 /// @detailed
540 ///
541 /// @param
542 ///
543 /// @global_read
544 ///
545 /// @global_write
546 ///
547 /// @remarks
548 ///
549 /// @references
550 ///
551 /// @authors apl
552 ///
553 /// @last_modified
554 ////////////////////////////////////////////////////////////////////////////////
555 void
557 {
558  std::cout << "curr_state " << current_state_ << " ";
559  std::cout << "curr_state_sparse_mat_info_ ";
560  std::cout << curr_state_sparse_mat_info_.get_aa_type() << " ";
562  std::cout << "curr_state_one_body_energy_ ";
563  std::cout << curr_state_one_body_energy_ << " ";
564  std::cout << "curr_state_total_energy_" << curr_state_total_energy_ << " ";
565  for (int ii = 1; ii <= get_num_incident_edges(); ++ii) {
566  std::cout << "(" << curr_state_two_body_energies_[ ii ] << ") ";
567  }
568  std::cout << std::endl;
569 }
570 
571 ////////////////////////////////////////////////////////////////////////////////
572 /// @begin LazyNode::update_internal_energy_sums
573 ///
574 /// @brief
575 ///
576 /// @detailed
577 ///
578 /// @param
579 ///
580 /// @global_read
581 ///
582 /// @global_write
583 ///
584 /// @remarks
585 ///
586 /// @references
587 ///
588 /// @authors apl
589 ///
590 /// @last_modified
591 ////////////////////////////////////////////////////////////////////////////////
592 void
594 {
595  assert( get_edge_vector_up_to_date() );
597  for (int ii = 1; ii <= get_num_incident_edges(); ++ii) {
599  }
601  return;
602 }
603 
604 
605 ////////////////////////////////////////////////////////////////////////////////
606 /// @begin LazyNode::update_internal_vectors
607 ///
608 /// @brief
609 ///
610 /// @detailed
611 ///
612 /// @param
613 ///
614 /// @global_read
615 ///
616 /// @global_write
617 ///
618 /// @remarks
619 ///
620 /// @references
621 ///
622 /// @authors apl
623 ///
624 /// @last_modified
625 ////////////////////////////////////////////////////////////////////////////////
627 {
631 
632  edge_matrix_ptrs_.clear();
634  edge_matrix_ptrs_.push_back( FArray1A< core::PackerEnergy >() ); //occupy the 0th position
635 
636  aa_offsets_for_edges_.dimension(
640 
641  //copy offsets from edges
642  //int neighb_aa_offset =
643  // num_states_for_aa_type_for_higher_indexed_neighbor_.index(1,1);
644  int count_neighbs_with_higher_indices = 0;
645  for ( int ii = 1; ii <= get_num_incident_edges(); ++ii ) {
646  neighbors_curr_state_sparse_info_[ii].set_aa_type( 1 );
647 
648  core::PackerEnergy & edge_table_ref =
650  edge_matrix_ptrs_.push_back( FArray1A< core::PackerEnergy >( edge_table_ref ));
651 
652 
653  int edge_table_size = get_incident_lazy_edge(ii)->get_two_body_table_size();
654  edge_matrix_ptrs_[ii].dimension( edge_table_size );
655 
656  FArray2D_int const & edge_aa_neighb_offsets =
658  utility::vector1< int > const & neighb_num_states_per_aa =
660 
662  ++count_neighbs_with_higher_indices;
663  for ( int jj = 1; jj <= get_num_aa_types(); ++jj ) {
664  for ( int kk = 1; kk <= get_num_aa_types(); ++kk ) {
665  aa_offsets_for_edges_(kk, ii, jj) = edge_aa_neighb_offsets(kk, jj);
666  }
668  jj, count_neighbs_with_higher_indices) =
669  neighb_num_states_per_aa[ jj ];
670  //++neighb_aa_offset;
671  }
672  } else {
673  for ( int jj = 1; jj <= get_num_aa_types(); ++jj ) {
674  for ( int kk = 1; kk <= get_num_aa_types(); ++kk ) {
675  aa_offsets_for_edges_(kk, ii, jj) = edge_aa_neighb_offsets(jj, kk);
676  }
677  }
678  }
679  }
680 
683  return;
684 }
685 
686 // @ brief - allow derived class to "drive" through the deltaE calculation
687 void
688 LazyNode::calc_deltaEpd( int alternate_state )
689 {
690  core::PackerEnergy dummy(0.0f);
691  project_deltaE_for_substitution( alternate_state, dummy );
692 }
693 
694 
695 //-----------------------------------------------------------------//
696 
698 
699 ////////////////////////////////////////////////////////////////////////////////
700 /// @begin LazyEdge::LazyEdge
701 ///
702 /// @brief
703 ///
704 /// @detailed
705 ///
706 /// @param
707 ///
708 /// @global_read
709 ///
710 /// @global_write
711 ///
712 /// @remarks
713 ///
714 /// @references
715 ///
716 /// @authors apl
717 ///
718 /// @last_modified
719 ////////////////////////////////////////////////////////////////////////////////
721  InteractionGraphBase* owner,
722  int first_node_ind,
723  int second_node_ind
724 ):
725  OnTheFlyEdge( owner, first_node_ind, second_node_ind),
726  //energy_table_size_(0)
727  two_body_energies_(
728  get_lazy_node(0)->get_num_states_for_aa_types(),
729  get_lazy_node(1)->get_num_states_for_aa_types()
730  ),
731  curr_state_energy_( 0.0f ),
732  partial_state_assignment_( false ),
733  ran_annealing_since_pair_energy_table_cleared_( false )
734 {
735 }
736 
737 ////////////////////////////////////////////////////////////////////////////////
738 /// @begin LazyEdge::~LazyEdge()
739 ///
740 /// @brief
741 ///
742 /// @detailed
743 ///
744 /// @param
745 ///
746 /// @global_read
747 ///
748 /// @global_write
749 ///
750 /// @remarks
751 ///
752 /// @references
753 ///
754 /// @authors apl
755 ///
756 /// @last_modified
757 ////////////////////////////////////////////////////////////////////////////////
759 {
760 }
761 
762 ////////////////////////////////////////////////////////////////////////////////
763 /// @begin LazyEdge::set_sparse_aa_info
764 ///
765 /// @brief
766 ///
767 /// @detailed
768 ///
769 /// @param
770 ///
771 /// @global_read
772 ///
773 /// @global_write
774 ///
775 /// @remarks
776 ///
777 /// @references
778 ///
779 /// @authors apl
780 ///
781 /// @last_modified
782 ////////////////////////////////////////////////////////////////////////////////
783 void
785  FArray2_bool const & aa_neighbors
786 )
787 {
788  two_body_energies_.set_sparse_aa_info( aa_neighbors );
791 }
792 
793 /// @brief returns whether two amino acid types are represented as neighbors
794 bool LazyEdge::get_sparse_aa_info( int node1aa, int node2aa ) const
795 {
796  return two_body_energies_.get_sparse_aa_info( node1aa, node2aa );
797 }
798 
799 /// @brief re-allocates two-body energy table after forcing a pair of amino acids
800 /// to become neighbors that were not initially declared to be neighbors
801 ///
802 /// @param node1aa - [in] - the amino acid type for the node with the smaller index
803 /// @param node2aa - [in] - the amino acid type for the node with the larger index
804 ///
805 void LazyEdge::force_aa_neighbors(int node1aa, int node2aa)
806 {
807  two_body_energies_.force_aa_neighbors( node1aa, node2aa );
810 }
811 
812 /// @brief re-allocates two-body energy table after forcing a pair of amino acids
813 /// to become neighbors that were not initially declared to be neighbors
814 ///
815 /// @param node1aa - [in] - the amino acid type for the node with the smaller index
816 /// @param node2aa - [in] - the amino acid type for the node with the larger index
817 ///
819 {
823 }
824 
825 
826 
828  int const node1state,
829  int const node2state
830 ) const
831 {
832  SparseMatrixIndex node1info = get_otf_node(0)->get_sparse_mat_info_for_state( node1state );
833  SparseMatrixIndex node2info = get_otf_node(1)->get_sparse_mat_info_for_state( node2state );
834 
835  core::PackerEnergy energy = two_body_energies_.get( node1info, node2info );
836 
837  if ( energy == NOT_YET_COMPUTED_ENERGY ) {
840  node1state, node2state );
841  two_body_energies_.set( node1info, node2info, energy );
842  }
843  return energy;
844 }
845 
846 ////////////////////////////////////////////////////////////////////////////////
847 /// @begin LazyEdge::declare_energies_final
848 ///
849 /// @brief
850 ///
851 /// @detailed
852 ///
853 /// @param
854 ///
855 /// @global_read
856 ///
857 /// @global_write
858 ///
859 /// @remarks
860 ///
861 /// @references
862 ///
863 /// @authors apl
864 ///
865 /// @last_modified
866 ////////////////////////////////////////////////////////////////////////////////
867 void
869 {}
870 
871 ////////////////////////////////////////////////////////////////////////////////
872 /// @begin LazyEdge::prepare_for_simulated_annealing
873 ///
874 /// @brief
875 ///
876 /// @detailed
877 ///
878 /// @param
879 ///
880 /// @global_read
881 ///
882 /// @global_write
883 ///
884 /// @remarks
885 ///
886 /// @references
887 ///
888 /// @authors apl
889 ///
890 /// @last_modified
891 ////////////////////////////////////////////////////////////////////////////////
892 void
894 {
897  if ( two_body_energies_.size() == 0 ) {
898  delete this;
899  return;
900  }
901  return;
902  } else {
903  /*for (int ii = 0; ii < 2; ++ii) {
904  if ( get_lazy_node( ii )->get_any_coordinates_not_current() ) {
905  for (int jj = 1; jj <= get_lazy_node( ii )->get_num_states(); ++jj ) {
906  if ( ! get_lazy_node( ii )->get_coordinates_current( jj ) ) {
907  wipe_two_body_energies_for_node_state( ii, jj );
908  }
909  }
910  }
911  }*/
912  }
913 }
914 
915 ////////////////////////////////////////////////////////////////////////////////
916 /// @begin LazyEdge::getMemoryUsageInBytes
917 ///
918 /// @brief
919 ///
920 /// @detailed
921 ///
922 /// @param
923 ///
924 /// @global_read
925 ///
926 /// @global_write
927 ///
928 /// @remarks
929 ///
930 /// @references
931 ///
932 /// @authors apl
933 ///
934 /// @last_modified
935 ////////////////////////////////////////////////////////////////////////////////
936 
937 unsigned int
939 {
940  return sizeof( LazyEdge );
941 }
942 
943 
944 unsigned int
946 {
947  unsigned int total_memory = OnTheFlyEdge::count_dynamic_memory();
948  total_memory += two_body_energies_.get_table_size() * sizeof( core::PackerEnergy );
950 
951  return total_memory;
952 }
953 
954 
955 void
957 {
958  Real const scale_factor = weight / edge_weight();
959  for ( int ii = 1; ii <= two_body_energies_.size(); ++ii ) {
961  two_body_energies_[ ii ] *= scale_factor;
962  }
963  }
964  edge_weight( weight );
965 }
966 
967 
968 
969 ////////////////////////////////////////////////////////////////////////////////
970 /// @begin LazyEdge::get_current_two_body_energy
971 ///
972 /// @brief
973 ///
974 /// @detailed
975 ///
976 /// @param
977 ///
978 /// @global_read
979 ///
980 /// @global_write
981 ///
982 /// @remarks
983 ///
984 /// @references
985 ///
986 /// @authors apl
987 ///
988 /// @last_modified
989 ////////////////////////////////////////////////////////////////////////////////
992 {
993  return curr_state_energy_;
994 }
995 
996 ////////////////////////////////////////////////////////////////////////////////
997 /// @begin LazyEdge::acknowledge_state_change
998 ///
999 /// @brief
1000 ///
1001 /// @detailed
1002 ///
1003 /// @param
1004 ///
1005 /// @global_read
1006 ///
1007 /// @global_write
1008 ///
1009 /// @remarks
1010 ///
1011 /// @references
1012 ///
1013 /// @authors apl
1014 ///
1015 /// @last_modified
1016 ////////////////////////////////////////////////////////////////////////////////
1017 void
1019  int node_ind,
1020  int new_state,
1021  SparseMatrixIndex const & new_state_sparse_info,
1022  core::PackerEnergy & new_energy
1023 )
1024 {
1025  int node_substituted = ( node_ind == get_node_index(0) ? 0 : 1);
1026  int node_not_substituted = ! node_substituted;
1027 
1028  int nodes_curr_states[2];
1029  SparseMatrixIndex nodes_curr_states_sparse_info[2];
1030 
1031  nodes_curr_states[ node_substituted ] = new_state;
1032  nodes_curr_states_sparse_info[ node_substituted ] = new_state_sparse_info;
1033 
1034  nodes_curr_states[ node_not_substituted ] =
1035  get_lazy_node( node_not_substituted )->get_current_state();
1036  nodes_curr_states_sparse_info[ node_not_substituted ] =
1037  get_lazy_node( node_not_substituted )->
1038  get_sparse_mat_info_for_curr_state();
1039 
1040  get_energy_for_state_pair( nodes_curr_states, nodes_curr_states_sparse_info );
1041  new_energy = curr_state_energy_;
1042 
1044  get_edges_position_in_nodes_edge_vector( node_not_substituted ),
1046  new_state,
1047  new_state_sparse_info
1048  );
1049 
1050  return;
1051 }
1052 
1053 ////////////////////////////////////////////////////////////////////////////////
1054 /// @begin LazyEdge::acknowledge_state_zeroed
1055 ///
1056 /// @brief
1057 ///
1058 /// @detailed
1059 ///
1060 /// @param
1061 ///
1062 /// @global_read
1063 ///
1064 /// @global_write
1065 ///
1066 /// @remarks
1067 ///
1068 /// @references
1069 ///
1070 /// @authors apl
1071 ///
1072 /// @last_modified
1073 ////////////////////////////////////////////////////////////////////////////////
1074 void
1076 {
1077  int node_substituted = ( node_ind == get_node_index(0) ? 0 : 1);
1078  int node_not_substituted = ! node_substituted;
1079 
1080  curr_state_energy_ = 0;
1081  SparseMatrixIndex dummy_sparse_info;
1082  dummy_sparse_info.set_aa_type( 1 );
1083  dummy_sparse_info.set_state_ind_for_this_aa_type(1);
1084 
1086  get_edges_position_in_nodes_edge_vector( node_not_substituted ),
1088  0,
1089  dummy_sparse_info
1090  );
1091  return;
1092 }
1093 
1094 ////////////////////////////////////////////////////////////////////////////////
1095 /// @begin LazyEdge::acknowledge_partial_state_change
1096 ///
1097 /// @brief
1098 ///
1099 /// @detailed
1100 ///
1101 /// @param
1102 ///
1103 /// @global_read
1104 ///
1105 /// @global_write
1106 ///
1107 /// @remarks
1108 ///
1109 /// @references
1110 ///
1111 /// @authors apl
1112 ///
1113 /// @last_modified
1114 ////////////////////////////////////////////////////////////////////////////////
1116  int node_ind,
1117  int new_state,
1118  SparseMatrixIndex const & new_state_sparse_info
1119 )
1120 {
1121  int node_substituted = ( node_ind == get_node_index(0) ? 0 : 1);
1122  int node_not_substituted = ! node_substituted;
1123 
1124  curr_state_energy_ = 0;
1125 
1127  get_edges_position_in_nodes_edge_vector( node_not_substituted ),
1128  new_state,
1129  new_state_sparse_info
1130  );
1132  return;
1133 }
1134 
1135 ////////////////////////////////////////////////////////////////////////////////
1136 /// @begin LazyEdge::get_energy_following_partial_state_assignment
1137 ///
1138 /// @brief
1139 ///
1140 /// @detailed
1141 ///
1142 /// @param
1143 ///
1144 /// @global_read
1145 ///
1146 /// @global_write
1147 ///
1148 /// @remarks
1149 ///
1150 /// @references
1151 ///
1152 /// @authors apl
1153 ///
1154 /// @last_modified
1155 ////////////////////////////////////////////////////////////////////////////////
1158 {
1160  int nodes_curr_states[2];
1161  SparseMatrixIndex nodes_curr_states_sparse_info[2];
1162 
1163  for (int ii = 0; ii < 2; ++ii) {
1164  nodes_curr_states[ ii ] =
1166  nodes_curr_states_sparse_info[ ii ] =
1168  }
1169  get_energy_for_state_pair( nodes_curr_states, nodes_curr_states_sparse_info );
1170  partial_state_assignment_ = false;
1171  }
1172  return curr_state_energy_;
1173 }
1174 
1175 
1176 
1177 ////////////////////////////////////////////////////////////////////////////////
1178 /// @begin LazyEdge::get_edge_table_ptr
1179 ///
1180 /// @brief
1181 ///
1182 /// @detailed
1183 ///
1184 /// @param
1185 ///
1186 /// @global_read
1187 ///
1188 /// @global_write
1189 ///
1190 /// @remarks
1191 ///
1192 /// @references
1193 ///
1194 /// @authors apl
1195 ///
1196 /// @last_modified
1197 ////////////////////////////////////////////////////////////////////////////////
1199 {
1201 }
1202 
1203 ////////////////////////////////////////////////////////////////////////////////
1204 /// @begin LazyEdge::get_two_body_table_size
1205 ///
1206 /// @brief
1207 ///
1208 /// @detailed
1209 ///
1210 /// @param
1211 ///
1212 /// @global_read
1213 ///
1214 /// @global_write
1215 ///
1216 /// @remarks
1217 ///
1218 /// @references
1219 ///
1220 /// @authors apl
1221 ///
1222 /// @last_modified
1223 ////////////////////////////////////////////////////////////////////////////////
1225 {
1227 }
1228 
1229 
1230 ////////////////////////////////////////////////////////////////////////////////
1231 /// @begin LazyEdge::get_offsets_for_aatypes
1232 ///
1233 /// @brief
1234 ///
1235 /// @detailed
1236 ///
1237 /// @param
1238 ///
1239 /// @global_read
1240 ///
1241 /// @global_write
1242 ///
1243 /// @remarks
1244 ///
1245 /// @references
1246 ///
1247 /// @authors apl
1248 ///
1249 /// @last_modified
1250 ////////////////////////////////////////////////////////////////////////////////
1251 FArray2D_int const &
1253 {
1255 }
1256 
1257 ////////////////////////////////////////////////////////////////////////////////
1258 /// @begin LazyEdge::get_second_node_num_states_per_aa
1259 ///
1260 /// @brief
1261 ///
1262 /// @detailed
1263 ///
1264 /// @param
1265 ///
1266 /// @global_read
1267 ///
1268 /// @global_write
1269 ///
1270 /// @remarks
1271 ///
1272 /// @references
1273 ///
1274 /// @authors apl
1275 ///
1276 /// @last_modified
1277 ////////////////////////////////////////////////////////////////////////////////
1280 {
1282 }
1283 
1284 ////////////////////////////////////////////////////////////////////////////////
1285 /// @begin LazyEdge::get_energy_for_state_pair
1286 ///
1287 /// @brief
1288 ///
1289 /// @detailed
1290 ///
1291 /// @param
1292 ///
1293 /// @global_read
1294 ///
1295 /// @global_write
1296 ///
1297 /// @remarks
1298 ///
1299 /// @references
1300 ///
1301 /// @authors apl
1302 ///
1303 /// @last_modified
1304 ////////////////////////////////////////////////////////////////////////////////
1305 void
1307  int nodes_states[ 2 ],
1308  SparseMatrixIndex sparse_matrix_indices_[ 2 ]
1309 )
1310 {
1311  bool one_node_in_zero_state = ( nodes_states[0] == 0 || nodes_states[1] == 0 );
1312 
1313  if ( one_node_in_zero_state ) {
1314  curr_state_energy_ = 0;
1315  } else {
1317  sparse_matrix_indices_[0],
1318  sparse_matrix_indices_[1]);
1321  compute_pair_energy_for_current_state(
1324  sparse_matrix_indices_[0],
1325  sparse_matrix_indices_[1],
1327  }
1328  }
1329 }
1330 
1331 ObjexxFCL::FArray2D< core::PackerEnergy >
1333  int node1aa,
1334  int node2aa
1335 ) const
1336 {
1337  ObjexxFCL::FArray2D< core::PackerEnergy > submat = two_body_energies_.get_aa_submatrix_energies( node1aa, node2aa );
1338  int const iioffset = get_lazy_node(0)->get_state_offset_for_aatype( node1aa );
1339  int const jjoffset = get_lazy_node(1)->get_state_offset_for_aatype( node2aa );
1340 
1341  for ( Size ii = 1; ii <= submat.size2(); ++ii ) {
1342  for ( Size jj = 1; jj <= submat.size1(); ++jj ) {
1343  if ( submat(jj,ii) == NOT_YET_COMPUTED_ENERGY ) {
1344  int const ii_state = ii + iioffset;
1345  int const jj_state = jj + jjoffset;
1348  ii_state, jj_state );
1350  get_otf_node(0)->get_sparse_mat_info_for_state( ii_state ),
1351  get_otf_node(1)->get_sparse_mat_info_for_state( jj_state ),
1352  iijjenergy );
1353  submat(jj,ii) = iijjenergy;
1354  }
1355  }
1356  }
1357  return submat;
1358 }
1359 
1360 
1361 void
1363  int node,
1364  int state
1365 )
1366 {
1367  int other_node = node == 0 ? 1 : 0;
1368 
1369  SparseMatrixIndex states[ 2 ];
1370  states[ node ] = get_lazy_node( node )
1371  ->get_sparse_mat_info_for_state( state );
1372  int const other_node_num_states =
1373  get_lazy_node( other_node )->get_num_states();
1374 
1375  for (int ii = 1; ii <= other_node_num_states; ++ii) {
1376  states[ other_node ] = get_lazy_node( other_node )
1378  two_body_energies_.set( states[ 0 ], states[ 1 ], NOT_YET_COMPUTED_ENERGY );
1379 
1380  }
1381 
1382 }
1383 
1384 void
1386 {
1387  std::cout << "LazyEdge: " << get_node_index( 0 ) << "/" << get_node_index( 1 );
1388  std::cout << " energy= " << curr_state_energy_ << std::endl;
1389 }
1390 
1391 
1392 //-------------------------------------------------------------------//
1393 
1394 ////////////////////////////////////////////////////////////////////////////////
1395 /// @begin LazyInteractionGraph::LazyInteractionGraph
1396 ///
1397 /// @brief
1398 ///
1399 /// @detailed
1400 ///
1401 /// @param
1402 ///
1403 /// @global_read
1404 ///
1405 /// @global_write
1406 ///
1407 /// @remarks
1408 ///
1409 /// @references
1410 ///
1411 /// @authors apl
1412 ///
1413 /// @last_modified
1414 ////////////////////////////////////////////////////////////////////////////////
1416  int numNodes
1417 ) : OnTheFlyInteractionGraph( numNodes )
1418 {
1419 }
1420 
1421 ////////////////////////////////////////////////////////////////////////////////
1422 /// @begin LazyInteractionGraph::LazyInteractionGraph
1423 ///
1424 /// @brief
1425 ///
1426 /// @detailed
1427 ///
1428 /// @param
1429 ///
1430 /// @global_read
1431 ///
1432 /// @global_write
1433 ///
1434 /// @remarks
1435 ///
1436 /// @references
1437 ///
1438 /// @authors apl
1439 ///
1440 /// @last_modified
1441 ////////////////////////////////////////////////////////////////////////////////
1443 {
1444 }
1445 
1446 
1447 ////////////////////////////////////////////////////////////////////////////////
1448 /// @begin LazyInteractionGraph::blanket_assign_state_0
1449 ///
1450 /// @brief
1451 ///
1452 /// @detailed
1453 ///
1454 /// @param
1455 ///
1456 /// @global_read
1457 ///
1458 /// @global_write
1459 ///
1460 /// @remarks
1461 ///
1462 /// @references
1463 ///
1464 /// @authors apl
1465 ///
1466 /// @last_modified
1467 ////////////////////////////////////////////////////////////////////////////////
1468 void
1470 {
1471  for ( int ii = 1; ii <= get_num_nodes(); ++ii ) {
1473  }
1475 }
1476 
1477 ////////////////////////////////////////////////////////////////////////////////
1478 /// @begin LazyInteractionGraph::set_state_for_node
1479 ///
1480 /// @brief
1481 ///
1482 /// @detailed
1483 ///
1484 /// @param
1485 ///
1486 /// @global_read
1487 ///
1488 /// @global_write
1489 ///
1490 /// @remarks
1491 ///
1492 /// @references
1493 ///
1494 /// @authors apl
1495 ///
1496 /// @last_modified
1497 ////////////////////////////////////////////////////////////////////////////////
1499 LazyInteractionGraph::set_state_for_node(int node_ind, int new_state)
1500 {
1501  get_lazy_node( node_ind )->assign_state( new_state );
1504 }
1505 
1506 ////////////////////////////////////////////////////////////////////////////////
1507 /// @begin LazyInteractionGraph::set_network_state
1508 ///
1509 /// @brief
1510 ///
1511 /// @detailed
1512 ///
1513 /// @param
1514 ///
1515 /// @global_read
1516 ///
1517 /// @global_write
1518 ///
1519 /// @remarks
1520 ///
1521 /// @references
1522 ///
1523 /// @authors apl
1524 ///
1525 /// @last_modified
1526 ////////////////////////////////////////////////////////////////////////////////
1528 LazyInteractionGraph::set_network_state( FArray1_int & node_states)
1529 {
1530  for ( int ii = 1; ii <= get_num_nodes(); ++ii ) {
1531  get_lazy_node( ii )->partial_assign_state( node_states( ii ) );
1532  }
1533  for ( int ii = 1; ii <= get_num_nodes(); ++ii ) {
1535  }
1537  //std::cout << "Set Network State Finished" << std::endl;
1538  //print_current_state_assignment();
1540 }
1541 
1542 ////////////////////////////////////////////////////////////////////////////////
1543 /// @begin LazyInteractionGraph::consider_substitution
1544 ///
1545 /// @brief
1546 ///
1547 /// @detailed
1548 ///
1549 /// @param
1550 ///
1551 /// @global_read
1552 ///
1553 /// @global_write
1554 ///
1555 /// @remarks
1556 ///
1557 /// @references
1558 ///
1559 /// @authors apl
1560 ///
1561 /// @last_modified
1562 ////////////////////////////////////////////////////////////////////////////////
1563 void
1565  int node_ind,
1566  int new_state,
1567  core::PackerEnergy & delta_energy,
1568  core::PackerEnergy & prev_energy_for_node
1569 )
1570 {
1571  node_considering_alt_state_ = node_ind;
1572 
1573  delta_energy = get_lazy_node( node_ind )->
1574  project_deltaE_for_substitution( new_state, prev_energy_for_node );
1575 
1578 }
1579 
1580 ////////////////////////////////////////////////////////////////////////////////
1581 /// @begin LazyInteractionGraph::commit_considered_substitution
1582 ///
1583 /// @brief
1584 ///
1585 /// @detailed
1586 ///
1587 /// @param
1588 ///
1589 /// @global_read
1590 ///
1591 /// @global_write
1592 ///
1593 /// @remarks
1594 ///
1595 /// @references
1596 ///
1597 /// @authors apl
1598 ///
1599 /// @last_modified
1600 ////////////////////////////////////////////////////////////////////////////////
1603 {
1605 
1608 
1612  }
1613 
1615 }
1616 
1617 ////////////////////////////////////////////////////////////////////////////////
1618 /// @begin LazyInteractionGraph::get_energy_current_state_assignment
1619 ///
1620 /// @brief
1621 ///
1622 /// @detailed
1623 ///
1624 /// @param
1625 ///
1626 /// @global_read
1627 ///
1628 /// @global_write
1629 ///
1630 /// @remarks
1631 ///
1632 /// @references
1633 ///
1634 /// @authors apl
1635 ///
1636 /// @last_modified
1637 ////////////////////////////////////////////////////////////////////////////////
1640 {
1641  //std::cout << "Num rotamer pair energy calculations performed: " << LazyNode::num_rpe_calcs << std::endl;
1642  //std::cout << "Num procrastinated comps committed: " << LazyNode::num_procrastinated_committed << std::endl;
1645 }
1646 
1647 
1648 ////////////////////////////////////////////////////////////////////////////////
1649 /// @begin LazyInteractionGraph::get_edge_memory_usage
1650 ///
1651 /// @brief
1652 ///
1653 /// @detailed
1654 ///
1655 /// @param
1656 ///
1657 /// @global_read
1658 ///
1659 /// @global_write
1660 ///
1661 /// @remarks
1662 ///
1663 /// @references
1664 ///
1665 /// @authors apl
1666 ///
1667 /// @last_modified
1668 ////////////////////////////////////////////////////////////////////////////////
1669 int
1671 {
1672  int sum = 0;
1673  for (std::list< EdgeBase* >::const_iterator iter = get_edge_list_begin();
1674  iter != get_edge_list_end(); ++iter) {
1675  sum += ((LazyEdge*) *iter)->get_two_body_table_size();
1676  }
1677  return sum;
1678 }
1679 
1680 ////////////////////////////////////////////////////////////////////////////////
1681 /// @begin LazyInteractionGraph::print_current_state_assignment
1682 ///
1683 /// @brief
1684 ///
1685 /// @detailed
1686 ///
1687 /// @param
1688 ///
1689 /// @global_read
1690 ///
1691 /// @global_write
1692 ///
1693 /// @remarks
1694 ///
1695 /// @references
1696 ///
1697 /// @authors apl
1698 ///
1699 /// @last_modified
1700 ////////////////////////////////////////////////////////////////////////////////
1701 void
1703 {
1704  std::cout << "State Assignment: " << std::endl;
1705  for ( int ii = 1; ii <= get_num_nodes(); ++ii ) {
1706  std::cout << "Node " << ii << " state " << get_lazy_node(ii)->get_current_state() << std::endl;
1707  get_lazy_node(ii)->print();
1708  }
1709 
1710  for (std::list< EdgeBase* >::const_iterator iter = get_edge_list_begin();
1711  iter != get_edge_list_end(); ++iter) {
1712  ((LazyEdge*) (*iter))->print_current_energy();
1713  }
1714  std::cout << "Energy: " << total_energy_current_state_assignment_ << std::endl;
1715 }
1716 
1717 // @ brief O(1) total energy report. Protected read access for derived classes.
1719 {
1721 }
1722 
1723 
1724 ////////////////////////////////////////////////////////////////////////////////
1725 /// @begin LazyInteractionGraph::set_errorfull_deltaE_threshold
1726 ///
1727 /// @brief
1728 ///
1729 /// @detailed
1730 ///
1731 /// @param
1732 ///
1733 /// @global_read
1734 ///
1735 /// @global_write
1736 ///
1737 /// @remarks
1738 ///
1739 /// @references
1740 ///
1741 /// @authors apl
1742 ///
1743 /// @last_modified
1744 ////////////////////////////////////////////////////////////////////////////////
1745 void
1747 {}
1748 
1749 ////////////////////////////////////////////////////////////////////////////////
1750 /// @begin LazyInteractionGraph::get_energy_sum_for_vertex_group
1751 ///
1752 /// @brief
1753 ///
1754 /// @detailed
1755 ///
1756 /// @param
1757 ///
1758 /// @global_read
1759 ///
1760 /// @global_write
1761 ///
1762 /// @remarks
1763 ///
1764 /// @references
1765 ///
1766 /// @authors apl
1767 ///
1768 /// @last_modified
1769 ////////////////////////////////////////////////////////////////////////////////
1772 {
1773  core::PackerEnergy esum = 0;
1774  for ( int ii = 1; ii <= get_num_nodes(); ++ii ) {
1775  if ( get_vertex_member_of_energy_sum_group( ii, group_id ) ) {
1777  }
1778  }
1779 
1780  for ( std::list< EdgeBase* >::iterator edge_iter = get_edge_list_begin();
1781  edge_iter != get_edge_list_end(); ++edge_iter ) {
1782  int first_node_ind = (*edge_iter)->get_first_node_ind();
1783  int second_node_ind = (*edge_iter)->get_second_node_ind();
1784 
1785  if ( get_vertex_member_of_energy_sum_group( first_node_ind, group_id )
1786  && get_vertex_member_of_energy_sum_group( second_node_ind, group_id )) {
1787  esum += ((LazyEdge*) (*edge_iter))->get_current_two_body_energy();
1788  }
1789  }
1790 
1791  return esum;
1792 }
1793 
1794 /// @details LazyInteractionGraph will return aa submatrices as requested.
1795 bool
1797 {
1798  return true;
1799 }
1800 
1802  int node_ind,
1803  int node_state
1804 ) const
1805 {
1806  return get_lazy_node(node_ind )->aatype_for_state( node_state );
1807 }
1808 
1809 ObjexxFCL::FArray2D< core::PackerEnergy >
1811  int node1,
1812  int node2,
1813  int node1aa,
1814  int node2aa
1815 ) const
1816 {
1817  return get_lazy_edge( node1, node2 )->get_aa_submatrix_energies( node1aa, node2aa );
1818 }
1819 
1820 
1821 ////////////////////////////////////////////////////////////////////////////////
1822 /// @begin LazyInteractionGraph::getMemoryUsageInBytes()
1823 ///
1824 /// @brief
1825 ///
1826 /// @detailed
1827 ///
1828 /// @param
1829 ///
1830 /// @global_read
1831 ///
1832 /// @global_write
1833 ///
1834 /// @remarks
1835 ///
1836 /// @references
1837 ///
1838 /// @authors apl
1839 ///
1840 /// @last_modified
1841 ////////////////////////////////////////////////////////////////////////////////
1842 
1843 unsigned int
1845 {
1846  return sizeof( LazyInteractionGraph );
1847 }
1848 
1849 unsigned int
1851 {
1852  unsigned int total_memory = OnTheFlyInteractionGraph::count_dynamic_memory();
1853  return total_memory;
1854 }
1855 
1856 ////////////////////////////////////////////////////////////////////////////////
1857 /// @begin LazyInteractionGraph::create_new_node( int node_index, int num_states)
1858 ///
1859 /// @brief
1860 ///
1861 /// @detailed
1862 ///
1863 /// @param
1864 ///
1865 /// @global_read
1866 ///
1867 /// @global_write
1868 ///
1869 /// @remarks
1870 ///
1871 /// @references
1872 ///
1873 /// @authors apl
1874 ///
1875 /// @last_modified
1876 ////////////////////////////////////////////////////////////////////////////////
1877 NodeBase*
1878 LazyInteractionGraph::create_new_node( int node_index, int num_states)
1879 {
1880  return new LazyNode( this, node_index, num_states );
1881 }
1882 
1883 ////////////////////////////////////////////////////////////////////////////////
1884 /// @begin LazyInteractionGraph::create_new_edge( int index1, int index2)
1885 ///
1886 /// @brief
1887 ///
1888 /// @detailed
1889 ///
1890 /// @param
1891 ///
1892 /// @global_read
1893 ///
1894 /// @global_write
1895 ///
1896 /// @remarks
1897 ///
1898 /// @references
1899 ///
1900 /// @authors apl
1901 ///
1902 /// @last_modified
1903 ////////////////////////////////////////////////////////////////////////////////
1904 EdgeBase*
1906 {
1907  return new LazyEdge( this, index1, index2 );
1908 }
1909 
1910 ////////////////////////////////////////////////////////////////////////////////
1911 /// @begin LazyInteractionGraph::update_internal_energy_totals
1912 ///
1913 /// @brief
1914 ///
1915 /// @detailed
1916 ///
1917 /// @param
1918 ///
1919 /// @global_read
1920 ///
1921 /// @global_write
1922 ///
1923 /// @remarks
1924 ///
1925 /// @references
1926 ///
1927 /// @authors apl
1928 ///
1929 /// @last_modified
1930 ////////////////////////////////////////////////////////////////////////////////
1931 void
1933 {
1935 
1936  for ( int ii = 1; ii <= get_num_nodes(); ++ii ) {
1938  get_one_body_energy_current_state();
1939  }
1940 
1941  for (std::list<EdgeBase*>::iterator iter = get_edge_list_begin();
1942  iter != get_edge_list_end(); ++iter ) {
1944  ((LazyEdge*) *iter)->get_current_two_body_energy();
1945  }
1946 
1948  return;
1949 }
1950 
1951 } //end namespace pack
1952 }
1953 }