22 #include <basic/Tracer.hh>
23 #include <basic/options/option.hh>
24 #include <basic/options/keys/in.OptionKeys.gen.hh>
26 #include <numeric/numeric.functions.hh>
27 #include <numeric/random/random.hh>
28 #include <numeric/xyz.functions.hh>
63 static numeric::random::RandomGenerator
RG(21141980);
72 static basic::Tracer
TR(
"protocols.antibody2.H3PerturbCCD");
85 H3PerturbCCD::H3PerturbCCD() : Mover() {
181 using namespace fragment;
182 using namespace protocols;
183 using namespace protocols::simple_moves;
184 using namespace protocols::loops;
190 TR <<
"Fragments based centroid CDR H3 loop building" << std::endl;
192 if( trimmed_cdr_h3.
size() <= 2){
193 utility_exit_with_message(
"Loop too small for modeling");
202 Real current_h3_prob =
RG.uniform();
203 TR<<
"current_h3_prob="<<current_h3_prob<<std::endl;
221 TR<<
"frag_size="<<frag_size<<std::endl;
228 TR<<trimmed_cdr_h3<<std::endl;
229 TR<<pose_in<<std::endl;
234 if( !pose_in.
residue( trimmed_cdr_h3.
cut() ).is_upper_terminus() ) {
248 cdrh3_map->set_chi(
true );
249 cdrh3_map->set_bb (
false);
250 for(
Size ii=trimmed_cdr_h3.
start(); ii<=trimmed_cdr_h3.
stop(); ii++ ){
251 cdrh3_map->set_bb( ii,
true );
253 cdrh3_map->set_jump( 1,
false );
257 Size num_cycles2(25 * trimmed_cdr_h3.
size() );
258 bool H3_found_ever(
false);
259 Size total_cycles(0);
261 bool loop_found(
false);
263 while( !loop_found && ( total_cycles++ <
num_cycles1_) ) {
268 for(
Size ii = trimmed_cdr_h3.
start(); ii<=trimmed_cdr_h3.
stop() - ( buffer + (frag_size - 1 ) ); ii++ ) {
270 cfm->set_check_ss(
false );
271 cfm->enable_end_bias_check(
false );
272 cfm->define_start_window( ii );
273 cfm->apply( pose_in );
277 if( total_cycles == 1 ) {
278 mc_->reset( pose_in );
280 Size local_h3_attempts(0);
284 for (
Size c2 = 1; c2 <= num_cycles2; ++c2 ) {
285 TR<<
"c1="<<total_cycles<<
" "<<
"c2="<<c2<<std::endl;
288 cfm->set_check_ss(
false );
289 cfm->enable_end_bias_check(
false );
290 cfm->apply( pose_in );
294 bool H3_found_current(
false);
297 if( !H3_found_ever && !H3_found_current) {
299 mc_->boltzmann( pose_in );
303 else if( !H3_found_ever && H3_found_current ) {
304 H3_found_ever =
true;
305 mc_->reset( pose_in );
309 else if( H3_found_ever && !H3_found_current ) {
314 else if( H3_found_ever && H3_found_current ){
315 mc_->boltzmann( pose_in );
320 mc_->boltzmann( pose_in );
325 if ( (c2 > num_cycles2/2 &&
RG.uniform() * num_cycles2 < c2) || ( trimmed_cdr_h3.
size() <= 5) ) {
329 if( trimmed_cdr_h3.
size() <= 5 ) {
331 ccd_cycle->apply( pose_in );
335 ccd_cycle->apply( pose_in );
337 mc_->boltzmann( pose_in );
343 mc_->recover_low( pose_in );
350 ccd_closure->apply( pose_in );
354 if( total_cycles == 1 ){
380 TR <<
"Finished Fragments based centroid CDR H3 loop building" << std::endl;
391 using namespace chemical;
393 using namespace fragment;
394 using namespace core::scoring;
404 TR<<frag_size<<std::endl;
411 offset_3mer_frags = frag_libs[2]->empty_clone();
412 FrameList loop_3mer_frames;
414 frag_libs[2]->region_simple( 1, frag_size, loop_3mer_frames );
415 for ( FrameList::const_iterator it = loop_3mer_frames.begin(),
416 eit = loop_3mer_frames.end(); it!=eit; ++it ) {
417 FrameOP short_frame = (*it)->clone_with_frags();
419 short_frame->shift_to( (
ab_info_->get_CDR_loop(
h3).start() - 2 ) + offset );
420 offset_3mer_frags->add( short_frame );
425 offset_9mer_frags = frag_libs[1]->empty_clone();
426 FrameList loop_9mer_frames;
428 frag_libs[1]->region_simple( 1, frag_size, loop_9mer_frames );
429 for ( FrameList::const_iterator it = loop_9mer_frames.begin(),
430 eit = loop_9mer_frames.end(); it!=eit; ++it ) {
431 FrameOP short_frame = (*it)->clone_with_frags();
433 short_frame->shift_to( (
ab_info_->get_CDR_loop(
h3).start() - 2 ) + offset );
434 offset_9mer_frags->add( short_frame );
442 TR<<
"Finished reading fragments files!!!"<<std::endl;