27 #include <basic/Tracer.hh>
31 #include <numeric/random/random.hh>
33 static numeric::random::RandomGenerator
RG(239111);
40 namespace monte_carlo {
50 if ( i == nres || fold_tree.is_cutpoint( i ) ){
51 if ( i == 1 || fold_tree.is_cutpoint( i-1 ) ){
56 }
else if ( i == 1 || fold_tree.is_cutpoint( i-1 ) ){
62 return moving_residue_case;
81 for (
Size n = 1; n <= moving_res_list.size(); n++ ){
83 Size const i = moving_res_list[ n ];
85 if ( i == nres || fold_tree.is_cutpoint( i ) ){
87 possible_res.push_back( i );
89 add_or_delete_choices.push_back(
DELETE );
91 }
else if ( i == 1 || fold_tree.is_cutpoint( i-1 ) ) {
93 possible_res.push_back( i );
95 add_or_delete_choices.push_back(
DELETE );
115 std::map< Size, Size > sub_to_full = sub_to_full_info.sub_to_full();
117 Size nres_full = sub_to_full_info.full_sequence().size();
120 for (
Size i = 1; i <= nres_full; i++ ) is_cutpoint_in_full_pose.push_back(
false );
121 for (
Size n = 1; n <= cutpoints_in_full_pose.size(); n++ ) is_cutpoint_in_full_pose[ cutpoints_in_full_pose[n] ] =
true;
123 for (
Size i = 1; i <= nres; i++ ){
125 if ( ( i == nres ) ||
126 ( fold_tree.is_cutpoint( i ) && (sub_to_full[ i ]+1 < sub_to_full[ i+1 ]) ) ) {
128 Size const i_full = sub_to_full[ i ] ;
129 if ( !is_cutpoint_in_full_pose[ i_full ] && i_full < nres_full ){
131 possible_res.push_back( i );
133 add_or_delete_choices.push_back(
ADD );
139 for (
Size i = 1; i <= nres; i++ ){
142 ( fold_tree.is_cutpoint( i-1 ) && (sub_to_full[ i ]-1 > sub_to_full[ i-1 ]) ) ) {
144 Size const i_full = sub_to_full[ i ];
145 if ( i_full > 1 && !is_cutpoint_in_full_pose[ i_full-1 ] ) {
147 possible_res.push_back( i );
149 add_or_delete_choices.push_back(
ADD );
159 Size & residue_at_chain_terminus,
162 bool const disallow_delete ) {
169 if ( !disallow_delete ){
175 Size const res_idx =
int(
RG.uniform() * possible_res.size() ) + 1;
177 residue_at_chain_terminus = possible_res[ res_idx ];
178 moving_residue_case = moving_residue_cases[ res_idx ];
179 add_or_delete_choice = add_or_delete_choices[ res_idx ];