13 #include <protocols/farna/util.hh>
14 #include <core/pose/rna/RNA_IdealCoord.hh>
15 #include <protocols/stepwise/modeler/rna/util.hh>
16 #include <protocols/stepwise/modeler/output_util.hh>
18 #include <core/types.hh>
19 #include <core/chemical/AA.hh>
20 #include <core/chemical/AtomType.hh>
21 #include <core/chemical/ChemicalManager.hh>
22 #include <core/chemical/ResidueTypeSet.hh>
23 #include <core/chemical/util.hh>
24 #include <core/chemical/VariantType.hh>
25 #include <core/conformation/ResidueFactory.hh>
26 #include <core/conformation/Residue.hh>
27 #include <core/conformation/Conformation.hh>
29 #include <core/scoring/ScoringManager.hh>
30 #include <core/scoring/ScoreFunctionFactory.hh>
32 #include <core/sequence/util.hh>
33 #include <core/sequence/Sequence.hh>
35 #include <core/init/init.hh>
37 #include <core/optimization/AtomTreeMinimizer.hh>
38 #include <core/optimization/MinimizerOptions.hh>
45 #include <protocols/viewer/viewers.hh>
47 #include <core/id/AtomID.hh>
48 #include <core/id/NamedAtomID.hh>
49 #include <core/pose/Pose.hh>
50 #include <core/pose/util.hh>
51 #include <core/pose/full_model_info/util.hh>
52 #include <core/pose/full_model_info/FullModelInfo.hh>
53 #include <core/scoring/rms_util.tmpl.hh>
54 #include <core/scoring/ScoreFunction.hh>
55 #include <core/scoring/ScoreType.hh>
56 #include <core/scoring/rna/RNA_TorsionPotential.hh>
57 #include <core/pose/rna/util.hh>
58 #include <core/chemical/rna/util.hh>
59 #include <core/io/silent/SilentFileData.fwd.hh>
60 #include <core/io/silent/SilentFileData.hh>
61 #include <core/io/silent/BinarySilentStruct.hh>
62 #include <core/import_pose/import_pose.hh>
63 #include <core/pose/annotated_sequence.hh>
65 #include <core/scoring/EnergyGraph.hh>
66 #include <core/scoring/Energies.hh>
67 #include <core/scoring/EnergyMap.hh>
68 #include <core/kinematics/FoldTree.hh>
69 #include <core/kinematics/AtomTree.hh>
70 #include <core/kinematics/Jump.hh>
71 #include <core/kinematics/MoveMap.hh>
73 #include <core/pack/rotamer_trials.hh>
74 #include <core/pack/pack_rotamers.hh>
75 #include <core/pack/task/PackerTask.hh>
76 #include <core/pack/task/TaskFactory.hh>
77 #include <core/pack/rotamer_set/RotamerCouplings.hh>
78 #include <core/pack/rotamer_set/WaterAnchorInfo.hh>
79 #include <core/pack/rotamer_set/WaterPackingInfo.hh>
80 #include <core/pack/rotamer_set/WaterPackingInfo.fwd.hh>
82 #include <protocols/moves/Mover.hh>
83 #include <protocols/moves/Mover.fwd.hh>
85 #include <core/scoring/constraints/Constraint.hh>
86 #include <core/scoring/constraints/ConstraintIO.hh>
87 #include <core/scoring/constraints/ConstraintSet.hh>
88 #include <core/scoring/constraints/ConstraintSet.fwd.hh>
89 #include <core/scoring/constraints/CoordinateConstraint.hh>
90 #include <core/scoring/constraints/AtomPairConstraint.hh>
91 #include <core/scoring/constraints/AngleConstraint.hh>
92 #include <core/scoring/func/HarmonicFunc.hh>
93 #include <core/scoring/constraints/util.hh>
96 #include <basic/options/keys/out.OptionKeys.gen.hh>
97 #include <basic/options/keys/in.OptionKeys.gen.hh>
98 #include <basic/options/keys/score.OptionKeys.gen.hh>
99 #include <basic/options/keys/edensity.OptionKeys.gen.hh>
100 #include <basic/options/keys/rna.OptionKeys.gen.hh>
103 #include <core/pose/PDBInfo.hh>
104 #include <core/chemical/rna/RNA_FittedTorsionInfo.hh>
105 #include <core/kinematics/FoldTree.hh>
106 #include <core/types.hh>
122 using namespace core;
124 using namespace basic::options::OptionKeys;
128 OPT_KEY ( Boolean, vary_geometry )
129 OPT_KEY ( Boolean, constrain_P )
130 OPT_KEY ( Boolean, ready_set_only )
131 OPT_KEY ( Boolean, skip_minimize )
132 OPT_KEY ( Boolean, attempt_pyrimidine_flip )
133 OPT_KEY ( IntegerVector, fixed_res )
134 OPT_KEY ( IntegerVector, cutpoint_open )
139 for (
Size i = 1; i <= input_vector.size(); ++i ) {
140 if ( input_num == input_vector[i] )
return true;
147 Vector const & nbr_atom_xyz ) {
148 Vector const translate ( nbr_atom_xyz - rsd.nbr_atom_xyz() );
150 for (
Size i = 1; i <= rsd.natoms(); ++i ) {
151 rsd.set_xyz ( i, rsd.xyz ( i ) + translate );
157 core::id::AtomID
const & atom_id2,
158 utility::vector1< std::pair< core::id::AtomID, core::id::AtomID > > & bonded_atom_list ) {
159 for (
Size n = 1; n <= bonded_atom_list.size(); n++ ) {
160 if ( atom_id1 == bonded_atom_list[ n ].
first && atom_id2 == bonded_atom_list[ n ].second )
return true;
162 if ( atom_id2 == bonded_atom_list[ n ].
first && atom_id1 == bonded_atom_list[ n ].second )
return true;
172 core::id::AtomID
const & atom_id2,
173 core::id::AtomID
const & atom_id3,
174 utility::vector1< std::pair< core::id::AtomID, std::pair< core::id::AtomID, core::id::AtomID > > > & bond_angle_list ) {
175 for (
Size n = 1; n <= bond_angle_list.size(); n++ ) {
176 if ( atom_id1 == bond_angle_list[ n ].
first ) {
177 if ( atom_id2 == bond_angle_list[ n ].second.first && atom_id3 == bond_angle_list[ n ].second.second )
return true;
179 if ( atom_id3 == bond_angle_list[ n ].second.first && atom_id2 == bond_angle_list[ n ].second.second )
return true;
188 using namespace core::pose::rna;
189 using namespace core::chemical::rna;
190 RNA_FittedTorsionInfo
const rna_fitted_torsion_info;
191 Real const DELTA_CUTOFF ( rna_fitted_torsion_info.delta_cutoff() );
192 bool const is_use_phenix_geo =
option[ basic::options::OptionKeys::rna::corrected_geo ];
195 RNA_IdealCoord ideal_coord;
196 for (
Size n = 1; n <= pose.total_residue(); n++ ) {
197 if ( pose.residue ( n ).aa() == core::chemical::aa_vrt )
continue;
199 Real const delta = pose.residue ( n ).mainchain_torsion ( DELTA );
201 if ( delta > DELTA_CUTOFF ) {
202 apply_ideal_c2endo_sugar_coords ( pose_reference, n );
203 pucker_conformation[n] = SOUTH;
205 pucker_conformation[n] = NORTH;
208 if ( is_use_phenix_geo ) {
209 ideal_coord.apply(pose_reference, pucker_conformation,
false );
215 core::id::AtomID
const & atom_id2,
216 utility::vector1< std::pair< core::id::AtomID, core::id::AtomID > > & bonded_atom_list,
219 core::scoring::constraints::ConstraintSetOP & cst_set ) {
220 using namespace core::scoring;
222 std::string
const & atom_name1 = pose.residue ( atom_id1.rsd() ).atom_name ( atom_id1.atomno() );
223 std::string
const & atom_name2 = pose.residue ( atom_id2.rsd() ).atom_name ( atom_id2.atomno() );
225 if ( !pose_reference.residue ( atom_id1.rsd() ).
has ( atom_name1 ) )
return;
227 if ( !pose_reference.residue ( atom_id2.rsd() ).
has ( atom_name2 ) )
return;
230 bonded_atom_list.push_back ( std::make_pair ( atom_id1, atom_id2 ) );
231 Real const bond_length_sd_ ( 0.05 );
232 Real const bond_length = ( pose_reference.residue ( atom_id1.rsd() ).
xyz ( atom_name1 ) -
233 pose_reference.residue ( atom_id2.rsd() ).
xyz ( atom_name2 ) ).
length();
234 core::scoring::func::FuncOP dist_harm_func_(
new core::scoring::func::HarmonicFunc ( bond_length, bond_length_sd_ ) );
238 rna_bond_geometry ) ) ) );
241 std::cout <<
"PUTTING CONSTRAINT ON DISTANCE: " <<
242 atom_id2.rsd() <<
" " << atom_name1 <<
"; " <<
243 atom_id1.rsd() <<
" " << atom_name2 <<
" " <<
252 core::id::AtomID
const & atom_id2,
253 core::id::AtomID
const & atom_id3,
254 utility::vector1< std::pair < core::id::AtomID, std::pair< core::id::AtomID, core::id::AtomID > > > & bond_angle_list,
257 core::scoring::constraints::ConstraintSetOP & cst_set ) {
258 using namespace core::scoring;
260 using namespace numeric::conversions;
262 if ( atom_id2 == atom_id3 )
return;
264 if ( atom_id1 == atom_id3 )
return;
266 if ( atom_id1 == atom_id2 )
return;
268 std::string
const & atom_name1 = pose.residue ( atom_id1.rsd() ).atom_name ( atom_id1.atomno() );
269 std::string
const & atom_name2 = pose.residue ( atom_id2.rsd() ).atom_name ( atom_id2.atomno() );
270 std::string
const & atom_name3 = pose.residue ( atom_id3.rsd() ).atom_name ( atom_id3.atomno() );
272 if ( !pose_reference.residue ( atom_id1.rsd() ).
has ( atom_name1 ) )
return;
274 if ( !pose_reference.residue ( atom_id2.rsd() ).
has ( atom_name2 ) )
return;
276 if ( !pose_reference.residue ( atom_id3.rsd() ).
has ( atom_name3 ) )
return;
279 bond_angle_list.push_back ( std::make_pair ( atom_id1, std::make_pair ( atom_id2, atom_id3 ) ) );
282 pose_reference.residue ( atom_id2.rsd() ).
xyz ( atom_name2 ) ,
283 pose_reference.residue ( atom_id1.rsd() ).
xyz ( atom_name1 ) ,
284 pose_reference.residue ( atom_id3.rsd() ).
xyz ( atom_name3 )
287 if ( bond_angle < 0.001 )
std::cout <<
"WHAT THE HELL????????? " << std::endl;
289 core::scoring::func::FuncOP angle_harm_func_(
new core::scoring::func::HarmonicFunc ( bond_angle, bond_angle_sd_ ) );
291 atom_id2 , atom_id1, atom_id3, angle_harm_func_, rna_bond_geometry ) ) ) );
294 std::cout <<
"PUTTING CONSTRAINT ON ANGLE: " <<
295 atom_id2.rsd() <<
" " << pose_reference.residue ( atom_id2.rsd() ).atom_name ( atom_id2.atomno() ) <<
"; " <<
296 atom_id1.rsd() <<
" " << pose_reference.residue ( atom_id1.rsd() ).atom_name ( atom_id1.atomno() ) <<
"; " <<
297 atom_id3.rsd() <<
" " << pose_reference.residue ( atom_id3.rsd() ).atom_name ( atom_id3.atomno() ) <<
" ==> " <<
degrees ( bond_angle ) <<
" " <<
degrees ( bond_angle_sd_ ) <<
307 core::id::AtomID
const & atom_id1,
308 core::id::AtomID
const & atom_id2 ) {
309 if ( atom_id1.rsd() == atom_id2.rsd() )
return true;
311 core::kinematics::tree::AtomCOP
atom1 ( pose.atom_tree().atom ( atom_id1 ).get_self_ptr() );
312 core::kinematics::tree::AtomCOP
atom2 ( pose.atom_tree().atom ( atom_id2 ).get_self_ptr() );
324 if ( k > residue2.first_sidechain_atom() &&
325 k != chemical::rna::first_base_atom_index ( residue2 ) )
return false;
327 if ( residue2.is_virtual( k ) ) {
343 std::string
const & atom_name = pose.residue ( atom_id.rsd() ).atom_name ( atom_id.atomno() );
345 if ( pose_reference.residue ( atom_id.rsd() ).
has ( atom_name ) ) {
357 using namespace core::chemical;
358 ResidueTypeSetCOP rsd_set;
359 rsd_set = core::chemical::ChemicalManager::get_instance()->residue_type_set ( FA_STANDARD );
360 make_pose_from_sequence ( pose_reference, pose.sequence(), *rsd_set );
368 core::kinematics::MoveMap &
mm,
372 using namespace core::id;
373 using namespace core::scoring;
375 using namespace core::kinematics;
376 using namespace numeric::conversions;
377 ConstraintSetOP cst_set = pose.constraint_set()->clone();
378 pose.constraint_set ( cst_set );
379 Size const nres ( pose.total_residue() );
381 std::cout <<
"Enter the vary_bond_geometry....." << std::endl;
383 for (
Size i = 1; i <=
nres; i++ ) {
384 if ( pose.residue ( i ).aa() == core::chemical::aa_vrt )
continue;
386 if ( !allow_insert_ ( i ) )
continue;
388 conformation::Residue
const & residue ( pose.residue ( i ) );
390 for (
Size j = 1; j <= residue.natoms(); j++ ) {
395 core::kinematics::tree::AtomCOP current_atom ( pose.atom_tree().atom ( AtomID ( j, i ) ).get_self_ptr() );
397 if ( current_atom->is_jump() )
continue;
400 core::kinematics::tree::AtomCOP input_stub_atom1 ( current_atom->input_stub_atom1() );
402 if ( !input_stub_atom1 )
continue;
408 mm.set ( DOF_ID ( AtomID ( j, i ), D ),
true );
410 if ( input_stub_atom1->is_jump() )
continue;
412 core::kinematics::tree::AtomCOP input_stub_atom2 ( current_atom->input_stub_atom2() );
415 if ( !input_stub_atom2 )
continue;
417 if ( input_stub_atom2 == current_atom )
continue;
423 mm.set ( DOF_ID ( AtomID ( j, i ), THETA ),
true );
425 if ( input_stub_atom2->is_jump() )
continue;
428 core::kinematics::tree::AtomCOP input_stub_atom3 ( current_atom->input_stub_atom3() );
430 if ( !input_stub_atom3 )
continue;
436 if ( input_stub_atom3 == current_atom )
continue;
438 mm.set ( DOF_ID ( AtomID ( j, i ),
PHI ),
true );
445 for (
Size i = 1; i <=
nres; i++ ) {
446 if ( pose.residue ( i ).aa() == core::chemical::aa_vrt )
continue;
449 if ( !allow_insert_ ( i ) )
continue;
451 conformation::Residue
const & residue ( pose.residue ( i ) );
453 for (
Size j = 1; j <= residue.natoms(); j++ ) {
456 AtomID atom_id1 ( j, i );
460 for (
Size n = 1; n <= nbrs.size(); n++ ) {
461 AtomID
const & atom_id2 ( nbrs[ n ] );
462 conformation::Residue
const & residue2 ( pose.residue ( atom_id2.rsd() ) ) ;
463 Size const & k ( atom_id2.atomno() ) ;
470 pose, pose_reference, cst_set );
475 for (
Size m = 1; m <= nbrs.size(); m++ ) {
476 AtomID
const & atom_id2 ( nbrs[ m ] );
477 conformation::Residue
const & residue2 ( pose.residue ( atom_id2.rsd() ) ) ;
481 Size const & k ( atom_id2.atomno() ) ;
483 for (
Size n = 1; n <= nbrs.size(); n++ ) {
484 AtomID
const & atom_id3 ( nbrs[ n ] );
485 conformation::Residue
const & residue3 ( pose.residue ( atom_id3.rsd() ) ) ;
489 Size const & q ( atom_id3.atomno() ) ;
494 pose, pose_reference, cst_set );
500 for (
Size n = 1; n <= nbrs2.size(); n++ ) {
501 AtomID
const & atom_id3 ( nbrs2[ n ] );
502 conformation::Residue
const & residue3 ( pose.residue ( atom_id3.rsd() ) ) ;
506 Size const & q ( atom_id3.atomno() ) ;
511 pose, pose_reference, cst_set );
518 pose.constraint_set ( cst_set );
524 int nres = pose.total_residue();
527 if ( pose.residue ( pose.fold_tree().root() ).aa() == core::chemical::aa_vrt ) {
528 std::cout <<
"add_virtual_res() called but pose is already rooted on a VRT residue ... continuing." << std::endl;
529 return pose.fold_tree().root();
533 core::chemical::ResidueTypeSet
const & residue_set = *pose.residue_type ( 1 ).residue_type_set();
534 core::conformation::ResidueOP new_res ( core::conformation::ResidueFactory::create_residue ( *( residue_set.get_representative_type_name3(
"VRT" ) ) ) );
535 pose.append_residue_by_jump ( *new_res , nres );
537 kinematics::FoldTree newF ( pose.fold_tree() );
538 newF.reorder ( nres + 1 );
539 pose.fold_tree ( newF );
541 core::pose::full_model_info::FullModelInfoOP full_model_info(
new core::pose::full_model_info::FullModelInfo( pose ) );
542 set_full_model_info( pose, full_model_info );
549 using namespace chemical;
550 using namespace core::scoring;
551 using namespace core::chemical::rna;
552 using namespace core::conformation;
553 using namespace core::kinematics;
554 using namespace core::id;
555 Size const nres ( pose.total_residue() );
556 Size const num_jumps ( cutpoint_list.size() );
560 for (
Size n = 1; n <= cutpoint_list.size(); n++ ) {
561 jump_points ( 1, n ) = cutpoint_list[n];
562 jump_points ( 2, n ) = cutpoint_list[n] + 1;
563 cuts ( n ) = cutpoint_list[n];
567 f.tree_from_jumps_and_cuts (
nres, num_jumps, jump_points, cuts, 1,
false );
568 pose.fold_tree ( f );
573 for (
Size i = 1; i <= list.size(); ++i ) {
574 if ( elem == list[i] )
return true;
582 using namespace chemical;
583 using namespace core::scoring;
584 using namespace core::conformation;
585 using namespace core::kinematics;
586 using namespace core::id;
587 Size const nres ( pose.total_residue() );
594 if ( is_res_sample_res != is_segment_sample_res ) {
595 is_segment_sample_res = is_res_sample_res;
596 f.new_jump ( i - 1,
nres, i - 1 );
602 pose.fold_tree ( f );
610 using namespace core::id;
611 using namespace core::scoring;
612 using namespace core::chemical::rna;
613 using namespace core::conformation;
615 using namespace core::chemical;
617 Size const total_res = pose.total_residue();
620 orig_score = (*scorefxn) (
pose);
622 std::cout <<
"Start pyrimidine_flip_trial. Filp residue :";
623 for (
Size i = 1; i <= total_res; ++i ) {
625 Residue
const &
res = pose.residue(i);
626 if ( res.is_RNA() && (res.aa() == na_rcy || res.aa() == na_ura) ) {
627 Real const orig_chi = pose.torsion( TorsionID( i, id::CHI, 1 ) );
628 Real const new_chi = orig_chi + 180.0;
629 screen_pose.set_torsion( TorsionID( i, id::CHI, 1 ), new_chi );
632 pose.set_torsion( TorsionID( i, id::CHI, 1 ), new_chi );
636 screen_pose.set_torsion( TorsionID( i, id::CHI, 1 ), orig_chi );
646 using namespace core::conformation;
647 using namespace core::chemical;
648 using namespace core::kinematics;
649 using namespace core::scoring;
650 using namespace core::chemical::rna;
652 using namespace core::optimization;
653 using namespace core::id;
654 using namespace protocols::stepwise::modeler::rna;
656 ResidueTypeSetCOP rsd_set = core::chemical::ChemicalManager::get_instance()->
657 residue_type_set ( FA_STANDARD );
658 bool const vary_bond_geometry_ =
option[ vary_geometry ];
659 bool const constrain_phosphate =
option[ constrain_P ];
660 bool const ready_set_only_ =
option[ ready_set_only ];
661 bool const skip_minimize_ =
option[ skip_minimize ];
662 bool const attempt_pyrimidine_flip_ =
option[ attempt_pyrimidine_flip ];
668 std::string pdb_name;
671 protocols::farna::make_phosphate_nomenclature_matches_mini(
pose);
677 std::string output_pdb_name;
679 output_pdb_name =
option[ out_pdb ] ();
681 output_pdb_name = pdb_name;
682 size_t found = output_pdb_name.find(
".pdb");
683 if ( found != std::string::npos ) {
684 if ( ready_set_only_ ) {
685 output_pdb_name.replace(found, found + 4,
"_ready_set.pdb");
687 output_pdb_name.replace(found, found + 4,
"_minimize.pdb");
690 if ( ready_set_only_ ) {
691 output_pdb_name.append(
"_ready_set.pdb");
693 output_pdb_name.append(
"_minimize.pdb");
698 if ( ready_set_only_ ) {
699 pose.dump_pdb(output_pdb_name);
704 std::string score_weight_file =
"stepwise/rna/rna_hires_elec_dens";
707 std::cout <<
"User passed in score:weight option: " << score_weight_file << std::endl;
709 core::scoring::ScoreFunctionOP
scorefxn =
710 ScoreFunctionFactory::create_score_function ( score_weight_file );
712 core::scoring::ScoreFunctionOP edens_scorefxn(
new ScoreFunction );
713 edens_scorefxn -> set_weight(
714 elec_dens_atomwise,
scorefxn -> get_weight(elec_dens_atomwise) );
717 if ( cutpoint_list.size() == 0 ) {
718 core::pose::rna::figure_out_reasonable_rna_fold_tree (
pose );
727 Size const nres_moving (
nres - fixed_res_list.size() );
730 std::string working_sequence =
pose.sequence();
731 std::cout <<
"Pose sequence = " << working_sequence << std::endl;
735 if ( attempt_pyrimidine_flip_ ) {
738 if ( skip_minimize_ ) {
739 pose.dump_pdb(output_pdb_name);
745 std::cout <<
"Setting up movemap ..." << std::endl;
746 kinematics::MoveMap
mm;
749 mm.set_chi (
false );
750 mm.set_jump (
false );
753 if (
pose.residue (
ii ).aa() != core::chemical::aa_vrt ) {
754 allow_insert (
ii ) =
true;
755 mm.set_bb (
ii,
true );
756 mm.set_chi (
ii,
true );
766 cut_lower.push_back(k);
767 cut_upper.push_back(m);
769 if (
pose.residue ( k ).aa() != core::chemical::aa_vrt &&
770 pose.residue ( m ).aa() != core::chemical::aa_vrt ) {
771 if ( fixed_res_list.size() != 0 &&
774 mm.set_jump ( i,
true );
781 if ( fixed_res_list.size() != 0 ) {
785 for (
Size i = 1; i <= fixed_res_list.size(); ++i ) {
786 Size fixed_res_num ( fixed_res_list[i] );
788 Real const coord_sdev ( 0.1 );
789 Size const my_anchor ( virtual_res_pos );
790 ConstraintSetOP cst_set =
pose.constraint_set()->clone();
791 Residue
const & rsd (
pose.residue ( fixed_res_num ) );
792 Size const atm_indexP = rsd.atom_index (
"P" );
793 Size const atm_indexO3 = rsd.atom_index (
"O3'" );
794 Size const atm_indexOP2 = rsd.atom_index (
"OP2" );
795 Size const atm_indexC6 = rsd.atom_index (
"C6" );
796 Size atm_indexBase = 0;
797 if ( rsd.aa() == core::chemical::na_rgu || rsd.aa() == core::chemical::na_rad ) {
798 atm_indexBase = rsd.atom_index (
"N9" );
799 }
else if ( rsd.aa() == core::chemical::na_ura || rsd.aa() == core::chemical::na_rcy ) {
800 atm_indexBase = rsd.atom_index (
"N1" );
805 cst_set -> add_constraint (
ConstraintCOP(
ConstraintOP(
new CoordinateConstraint ( AtomID ( atm_indexP, fixed_res_num ), AtomID ( 1, my_anchor ), rsd.xyz ( atm_indexP ), core::scoring::func::FuncOP(
new core::scoring::func::HarmonicFunc ( 0.0, coord_sdev ) ) ) ) ) );
806 cst_set -> add_constraint (
ConstraintCOP(
ConstraintOP(
new CoordinateConstraint ( AtomID ( atm_indexO3, fixed_res_num ), AtomID ( 1, my_anchor ), rsd.xyz ( atm_indexO3 ), core::scoring::func::FuncOP(
new core::scoring::func::HarmonicFunc ( 0.0, coord_sdev ) ) ) ) ) );
807 cst_set -> add_constraint (
ConstraintCOP(
ConstraintOP(
new CoordinateConstraint ( AtomID ( atm_indexBase, fixed_res_num ), AtomID ( 1, my_anchor ), rsd.xyz ( atm_indexBase ), core::scoring::func::FuncOP(
new core::scoring::func::HarmonicFunc ( 0.0, coord_sdev ) ) ) ) ) );
808 cst_set -> add_constraint (
ConstraintCOP(
ConstraintOP(
new CoordinateConstraint ( AtomID ( atm_indexC6, fixed_res_num ), AtomID ( 1, my_anchor ), rsd.xyz ( atm_indexC6 ), core::scoring::func::FuncOP(
new core::scoring::func::HarmonicFunc ( 0.0, coord_sdev ) ) ) ) ) );
809 cst_set -> add_constraint (
ConstraintCOP(
ConstraintOP(
new CoordinateConstraint ( AtomID ( atm_indexOP2, fixed_res_num ), AtomID ( 1, my_anchor ), rsd.xyz ( atm_indexOP2 ), core::scoring::func::FuncOP(
new core::scoring::func::HarmonicFunc ( 0.0, coord_sdev ) ) ) ) ) );
810 pose.constraint_set ( cst_set );
811 scorefxn->set_weight ( coordinate_constraint, 10 );
813 mm.set_chi ( fixed_res_num,
false );
814 mm.set_bb ( fixed_res_num,
false );
816 allow_insert(fixed_res_num) =
false;
818 if ( fixed_res_num - 1 > 0 &&
821 allow_insert(fixed_res_num) =
true;
823 if ( fixed_res_num + 1 <=
nres &&
826 allow_insert(fixed_res_num) =
true;
833 if ( constrain_phosphate ) {
834 for (
Size i = 1; i <=
nres; ++i ) {
835 if (
pose.residue ( i ).aa() == core::chemical::aa_vrt )
continue;
837 bool is_fixed_res =
false;
838 for (
Size j = 1; j <= fixed_res_list.size(); ++j ) {
839 if ( i == fixed_res_list[j] ) {
845 if ( is_fixed_res )
continue;
847 Real const coord_sdev ( 0.3 );
848 Size const my_anchor ( virtual_res_pos );
849 ConstraintSetOP cst_set =
pose.constraint_set()->clone();
850 Residue
const & rsd (
pose.residue ( i ) );
851 Size const atm_indexP = rsd.atom_index (
"P" );
852 cst_set -> add_constraint (
ConstraintCOP(
ConstraintOP(
new CoordinateConstraint ( AtomID ( atm_indexP, i ), AtomID ( 1, my_anchor ), rsd.xyz ( atm_indexP ), core::scoring::func::FuncOP(
new core::scoring::func::HarmonicFunc ( 0.0, coord_sdev ) ) ) ) ) );
853 pose.constraint_set ( cst_set );
854 scorefxn->set_weight ( coordinate_constraint, 10 );
859 if ( vary_bond_geometry_ ) {
860 std::cout <<
"Setup vary_bond_geometry" << std::endl;
866 protocols::stepwise::modeler::output_movemap (
mm,
pose );
868 Real const score_before = ( (*scorefxn) (
pose) );
869 Real const edens_score_before = ( (*edens_scorefxn) (
pose) );
871 protocols::viewer::add_conformation_viewer (
pose.conformation(),
"current", 400, 400 );
875 AtomTreeMinimizer minimizer;
876 float const dummy_tol ( 0.00000001 );
878 std::cout <<
"Minimize using dfpmin with use_nb_list=true .." << std::endl;
879 MinimizerOptions min_options_dfpmin (
"dfpmin", dummy_tol,
true,
false,
false );
880 min_options_dfpmin.max_iter (
std::min( 3000,
std::max( 1000,
int(nres_moving * 12) ) ) );
885 Real const edens_score = ( (*edens_scorefxn) (
pose) );
886 if (
score > score_before + 5 || edens_score > edens_score_before * 0.9 ) {
887 std::cout <<
"current_score = " <<
score <<
", start_score = " << score_before << std::endl;
888 std::cout <<
"current_edens_score = " << edens_score <<
", start_edens_score = " << edens_score_before << std::endl;
889 std::cout <<
"The minimization went wild!!! Try alternative minimization using dfpmin with use_nb_list=false .." << std::endl;
893 MinimizerOptions min_options_dfpmin_no_nb (
"dfpmin", dummy_tol,
false,
false,
false );
894 min_options_dfpmin_no_nb.max_iter (
std::min( 3000,
std::max( 1000,
int(nres_moving * 12) ) ) );
898 Real const edens_score = ( (*edens_scorefxn) (
pose) );
899 if ( score > score_before + 5 || edens_score > edens_score_before * 0.9 ) {
900 std::cout <<
"current_score = " << score <<
", start_score = " << score_before << std::endl;
901 std::cout <<
"current_edens_score = " << edens_score <<
", start_edens_score = " << edens_score_before << std::endl;
903 std::cout <<
"The minimization went wild again!!! Skip the minimization!!!!!" << std::endl;
908 pose.dump_pdb ( output_pdb_name );
909 std::cout <<
"Job completed sucessfully." << std::endl;
915 protocols::viewer::clear_conformation_viewers();
920 main (
int argc,
char * argv [] ) {
924 NEW_OPT ( out_pdb,
"name of output pdb file",
"" );
925 NEW_OPT ( vary_geometry,
"vary geometry",
false );
926 NEW_OPT ( constrain_P,
"constrain phosphate",
false );
927 NEW_OPT ( fixed_res,
"optional: residues to be held fixed in minimizer", blank_size_vector );
928 NEW_OPT ( cutpoint_open,
"optional: chainbreak in full sequence", blank_size_vector );
929 NEW_OPT ( ready_set_only,
"load in and output directly for reformatting the pdb",
false );
930 NEW_OPT ( skip_minimize,
"output the pdb without minimization",
false );
931 NEW_OPT ( attempt_pyrimidine_flip,
"try to flip pyrimidine by 180 degree and pick the better energy conformer",
false );
941 protocols::viewer::viewer_main (
my_main );
943 std::cout <<
"caught exception " << e.
msg() << std::endl;
#define utility_exit_with_message(m)
Exit with file + line + message.
void add_bond_constraint(core::id::AtomID const &atom_id1, core::id::AtomID const &atom_id2, utility::vector1< std::pair< core::id::AtomID, core::id::AtomID > > &bonded_atom_list, core::pose::Pose const &pose, core::pose::Pose const &pose_reference, core::scoring::constraints::ConstraintSetOP &cst_set)
utility::pointer::shared_ptr< Constraint > ConstraintOP
utility::keys::lookup::has< KeyType > const has
Lookup functors.
bool i_want_this_atom_to_move(conformation::Residue const &residue2, Size const &k)
virtual std::string const msg() const
void angle_radians(xyzVector< T > const &p1, xyzVector< T > const &p2, xyzVector< T > const &p3, T &angle)
Plane angle in radians: angle value passed.
bool check_in_bond_angle_list(core::id::AtomID const &atom_id1, core::id::AtomID const &atom_id2, core::id::AtomID const &atom_id3, utility::vector1< std::pair< core::id::AtomID, std::pair< core::id::AtomID, core::id::AtomID > > > &bond_angle_list)
bool is_atom_exist_in_reference(pose::Pose const &pose, pose::Pose const &pose_reference, core::id::AtomID const &atom_id)
BooleanOptionKey const user("options:user")
Conversions between degrees and radians.
bool is_elem_in_list(core::Size const elem, utility::vector1< core::Size > const &list)
xyzVector< Real > xyz(Real const &r1, Real const &omega1, Real const &t, Real const &dz1, Real const &delta_omega1, Real const &delta_z1)
Returns the x-, y-, and z-coordinates of a point on a helix given r1, omega1, and t...
common derived classes for thrown exceptions
int main(int argc, char *argv[])
void pyrimidine_flip_trial(pose::Pose &pose, utility::vector1< Size > const &fixed_res_list, scoring::ScoreFunctionOP scorefxn)
void show(utility::vector1< T_ > vector)
bool check_if_really_connected(core::pose::Pose const &pose, core::id::AtomID const &atom_id1, core::id::AtomID const &atom_id2)
void setup_fold_tree_sample_res(pose::Pose &pose, utility::vector1< core::Size > const &sample_res_list)
bool check_in_bonded_list(core::id::AtomID const &atom_id1, core::id::AtomID const &atom_id2, utility::vector1< std::pair< core::id::AtomID, core::id::AtomID > > &bonded_atom_list)
void add_bond_angle_constraint(core::id::AtomID const &atom_id1, core::id::AtomID const &atom_id2, core::id::AtomID const &atom_id3, utility::vector1< std::pair< core::id::AtomID, std::pair< core::id::AtomID, core::id::AtomID > > > &bond_angle_list, core::pose::Pose const &pose, core::pose::Pose const &pose_reference, core::scoring::constraints::ConstraintSetOP &cst_set)
void setup_fold_tree(pose::Pose &pose, utility::vector1< core::Size > const &cutpoint_list)
basic::options::OptionKeys collection
Input file stream wrapper for uncompressed and compressed files.
bool check_num_in_vector(int input_num, utility::vector1< int > const &input_vector)
std::vector with 1-based indexing
T degrees(T const &radians)
Degrees of radians.
rule< Scanner, options_closure::context_t > options
#define OPT_KEY(type, key)
Output file stream wrapper for uncompressed and compressed files.
#define NEW_OPT(akey, help, adef)
int add_virtual_res(core::pose::Pose &pose)
void create_pose_reference(pose::Pose const &pose, pose::Pose &pose_reference)
ocstream cout(std::cout)
Wrapper around std::cout.
void apply_ideal_coordinates(pose::Pose const &pose, pose::Pose &pose_reference)
utility::pointer::shared_ptr< Constraint const > ConstraintCOP
BooleanOptionKey const exit("options:exit")
vector1: std::vector with 1-based indexing
void vary_bond_geometry(core::kinematics::MoveMap &mm, pose::Pose &pose, pose::Pose const &pose_reference, ObjexxFCL::FArray1D< bool > &allow_insert_)
T radians(T const °rees)
Radians of degrees.
xyzVector and xyzMatrix functions
void init()
set global 'init_was_called' to true
Program options global and initialization function.
void translate_residue(conformation::Residue &rsd, Vector const &nbr_atom_xyz)
rule< Scanner, option_closure::context_t > option
FArray2D: Fortran-Compatible 2D Array.
FArray1D: Fortran-Compatible 1D Array.