14 #ifndef INCLUDED_core_scoring_trie_trie_vs_path_hh
15 #define INCLUDED_core_scoring_trie_trie_vs_path_hh
29 #include <ObjexxFCL/FArray2D.hh>
36 #include <utility/vector1_bool.hh>
56 template <
class AT,
class CPDAT1,
class CPDAT2,
class CPFXN,
class SFXN >
62 SFXN & score_function,
67 using namespace ObjexxFCL;
71 Size trie2_num_atoms = trie2.
atoms().size();
74 Size const trie1_num_atoms = trie1.
atoms().size();
88 FArray2D_int parent_heavy_wi_hydrogen_cutoff( trie2_num_heavyatoms, trie1.
max_heavyatom_depth(),
true);
89 FArray2D_int r_heavy_skip_s_subtree(trie2_num_heavyatoms, trie1.
max_heavyatom_depth(),
false);
93 r_heavy_depth_stack[1] = 0;
95 Size r_num_rotamers_seen = 0;
96 Size r_curr_stack_top = 2;
99 for (
Size ii = 1; ii <= trie1_num_atoms; ++ii ) {
105 energy_sum[ r_curr_stack_top ] = energy_sum[ r_curr_stack_top - 1];
106 r_heavy_depth_stack[ r_curr_stack_top ] = r_heavy_depth_stack[ r_curr_stack_top-1 ];
110 if (! r.
is_hydrogen() ) ++r_heavy_depth_stack[ r_curr_stack_top ];
124 for (
Size jj = 1; jj <= trie2_num_atoms; ++jj )
131 if ( parent_heavy_wi_hydrogen_cutoff( s_heavy_depth, r_heavy_depth_stack[ r_curr_stack_top ] ) &&
133 e = score_function.hydrogenatom_hydrogenatom_energy( r.
atom(), s.
atom(), path_dist );
134 energy_sum[ r_curr_stack_top ] += weight * e;
139 if (r_heavy_skip_s_subtree(s_heavy_depth,r_heavy_depth_stack[ r_curr_stack_top ]))
break;
141 if ( parent_heavy_wi_hydrogen_cutoff(s_heavy_depth, r_heavy_depth_stack[ r_curr_stack_top ] ) &&
143 e = score_function.hydrogenatom_heavyatom_energy( r.
atom(), s.
atom(), path_dist );
144 energy_sum[ r_curr_stack_top ] += e * weight;
150 for (
Size jj = 1; jj <= trie2_num_heavyatoms; ++jj ) {
151 r_heavy_skip_s_subtree( jj, r_heavy_depth_stack[ r_curr_stack_top ] ) =
false;
153 for (
Size jj = 1; jj <= trie2_num_atoms; ++jj ) {
157 if (parent_heavy_wi_hydrogen_cutoff( s_heavy_depth, r_heavy_depth_stack[ r_curr_stack_top ] ) &&
159 e = score_function.heavyatom_hydrogenatom_energy( r.
atom(), s.
atom(), path_dist );
160 energy_sum[ r_curr_stack_top ] += weight * e;
166 if ( count_pair( r.
cp_data(), s.
cp_data(), weight, path_dist ) ) {
167 e = score_function.heavyatom_heavyatom_energy(r.
atom(), s.
atom(), d2, path_dist);
169 energy_sum[ r_curr_stack_top ] += weight * e;
172 d2 = r.
atom().xyz().distance_squared( s.
atom().xyz() );
177 r_heavy_skip_s_subtree(s_heavy_depth, r_heavy_depth_stack[ r_curr_stack_top ]) =
true;
186 ++r_num_rotamers_seen;
187 temp_vector[r_num_rotamers_seen] = energy_sum[ r_curr_stack_top ];
285 d2 = r.atom().xyz().distance_squared( s.atom().xyz() );
288 parent_wi_h_dist[s_heavy_depth] = (d2 < hydrogen_interaction_cutoff);
289 if (d2 > s.subtree_interaction_sphere_square_radius())
291 r_heavy_skip_s_subtree_depth = s_heavy_depth;